Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PyWeakref_GetRef and critical section in BlockValuesRefs #60540

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

lysnikolaou
Copy link
Contributor

@lysnikolaou lysnikolaou requested a review from WillAyd as a code owner December 11, 2024 15:08
@lysnikolaou lysnikolaou force-pushed the lock-block-values-refs branch from 4e28feb to e21c3c9 Compare December 11, 2024 15:10
pandas/_libs/internals.pyx Outdated Show resolved Hide resolved
@rhshadrach rhshadrach added Enhancement Build Library building on various platforms Python 3.13 labels Dec 27, 2024
@jbrockmendel
Copy link
Member

Perf impact?

@mroeschke
Copy link
Member

IIUC we'll need to wait for the next cython release based on your PR cython/cython#6538?

@lysnikolaou
Copy link
Contributor Author

I've updated this PR so that it's not blocked on a Cython release. A review would be very helpful. The failing CI jobs seem to be unrelated: The pyodide one fails on main as well, and the manylinux one seems to be related to a docker fail, will probably be okay if rerun.

@@ -45,8 +45,12 @@ else
endif

cy = meson.get_compiler('cython')
cdata = configuration_data()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move the configuration_data next to the configure_file call? I assume here you did it to avoid repeating the cy.version() check, but I think it reads easier to keep this all together

new_referenced_blocks = []
for ref in self.referenced_blocks:
status = PyWeakref_GetRef(ref, &pobj)
if status == 1:
Copy link
Member

@WillAyd WillAyd Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if the reference is dead we are intentionally doing nothing here right? We don't need to handle that at all?

(I'm not very familiar with the referencing here)

IF CYTHON_COMPATIBLE_WITH_FREE_THREADING:
new_referenced_blocks = []
for ref in self.referenced_blocks:
status = PyWeakref_GetRef(ref, &pobj)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
status = PyWeakref_GetRef(ref, &pobj)
cdef PyObject *status = PyWeakref_GetRef(ref, &pobj)

Can you just declare / define all in one go? I don't think we need separate blocks for those (same comment for the status variable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Library building on various platforms Enhancement Python 3.13
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants