Skip to content

Conversation

@jorisvandenbossche
Copy link
Member

@jorisvandenbossche jorisvandenbossche commented Nov 24, 2025

This reverts #62070, which didn't yet work for freethreaded python, and also turned out to be problematic for downstream projects with subclassing pandas (geopandas/geopandas#3676)

Using the approach discussed in #61368, thanks to @mpage!
This is using the C implementation (will still compare with the python version)

The large part of the diff comes from the first commit reverting the previous change. To better see what actually changed compared to before #62070, see https://github.com/pandas-dev/pandas/pull/63186/files/32b14c7ce707734a74e3cdc5a159eda6bc3aa8c1..18cbadc2b28e2463738797d8a1a2439078b10297

Closes #61368

jorisvandenbossche and others added 7 commits November 24, 2025 09:56
`PyFrame_GetLocals()` returns a proxy object in CPython 3.13+. Calling
`PyDict_Next()` on the resulting object will not work because it is not
a dictionary. Use `PyMapping_Values()` instead.
@jorisvandenbossche jorisvandenbossche added this to the 3.0 milestone Nov 24, 2025
@jorisvandenbossche
Copy link
Member Author

This is using the C implementation (will still compare with the python version)

Quick timing gives something around 120 ns vs 160-170ns on my laptop for C vs python. In the context of a setitem operation that itself easily takes multiple microseconds (a simple df["a"] adding/overwriting a full column is around 8us), this difference is rather small

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.

BUG: Python 3.14 may not increment refcount

2 participants