GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing github.com — gh-127119: Remove check on accidental deallocation of immortal objects for free-threaded build by eendebakpt · Pull Request #127120 · python/cpython Conversation
|
|
Apparently, assertion is broken in tests. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yes, my mistake. Should be fixed now |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…e-127119.p9Yv4U.rst Co-authored-by: Peter Bierma <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🤖 New build scheduled with the buildbot fleet by @ZeroIntensity for commit 4dc97c9 🤖 If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
CI is failing, because apparently you can build with assertions but not with debug enabled (that's what I get for prematurely approving, ha).
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM (again)!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
this changes from silently re-immortalizing the small ints to actually letting them be deallocated in non-debug builds. in theory this is supposed to be fine, but how confident are we of (buggy) reference counting code not relying in the former behavior?
(I'm not blocking this PR, I think the change is acceptable, just want that pondered...)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I thought about that too, but I think issues around immortal objects being buggy was fixed by GH-125251 (at least, I thought that was implied by the removal of |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The possibility of de-allocating immortal objects is described in [PEP 683, section Accidental De-Immortalizing](https://peps.python.org/pep-0683/#accidental-de-immortalizing). Also see But if I understand the correctly the accidental-de-immortalizing cannot happen on: 64-bit systems, or with the free-threading build, or when And yes, this should be double checked! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Results on a microbenchmark: I expect no overall improvement on the pyperformance benchmark. Benchmark script |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is now incorrect :(
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| #ifdef Py_LIMITED_API | ||
| #ifndef Py_GIL_DISABLED |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's possible for us to know when we're using the limited API. Py_LIMITED_API is something that affects Python.h at the compile-time of an extension module, but this happens during the compilation of CPython, so it will never be true.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
As an alternative to removing the check altogether we could make it cheaper by using the reserved bit https://github.com/python/cpython/blob/main/Include/cpython/longintrepr.h#L79 as a marker for immortal/small ints. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@markshannon Thanks for the idea! I think it works and would not be hard to implement, but I am a bit hesitant to use a reserved bit for a small optimization like this. I created an alternative PR with a faster check based on your idea though |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
That bit is reserved for exactly this use case, so it is fine to use it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing in favor of #127620 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.