Skip to content

Move chained assignment detection to cython for Python 3.14 compat #62070

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jorisvandenbossche
Copy link
Member

Draft exploring a solution for #61368

# @cython.auto_pickle(False)
cdef class SetitemMixin:

def __setitem__(self, key, value):
Copy link
Member

Choose a reason for hiding this comment

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

can this be made cdef? small perf improvement i think. downside is i think it becomes harder for subclassers who want to override it. But after this PR, they should be overriding _setitem instead

Copy link
Member Author

Choose a reason for hiding this comment

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

No, special (dunder) methods need to be specified as def (That's also what I would have expected since this method should be callable from python, but even cpdef gives a cython compilation error "Special methods must be declared with 'def', not 'cdef'")

@jbrockmendel
Copy link
Member

Some commented-out code needs to be removed, otherwise looks nice

@jorisvandenbossche jorisvandenbossche force-pushed the cow-chained-detection-py314 branch from 66cd359 to efea93f Compare August 15, 2025 16:48
@jorisvandenbossche jorisvandenbossche changed the title Test chained assignment detection for Python 3.14 Move chained assignment detection to cython for Python 3.14 compat Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants