-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
gh-103743: Add PyUnstable_Object_GC_NewWithExtraData #103744
gh-103743: Add PyUnstable_Object_GC_NewWithExtraData #103744
Conversation
jbradaric
commented
Apr 24, 2023
•
edited by bedevere-bot
Loading
edited by bedevere-bot
- Issue: Allocating extra data after an object instance #103743
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
d045f45
to
d300004
Compare
aa3716f
to
cc46476
Compare
cc46476
to
d644206
Compare
That way it doesn't need the Py_LIMITED_API guard
This is a further workaround: this time for the fact that we can't rely on tp_alloc, which zeroes the memory (including memory for subclasses, like slots in the test) for normal classes. For the test type, this means the instances aren't initialized twice (once in PyUnstable_Object_GC_NewWithExtraData, once again with PyObject_Init after zeroing). Initializing twice throws off the global refcount total in debug builds.
Hi, One more thing to do will be moving GC- or allocation-related tests from |
@encukou, commits look good, thanks for the review and fixes. Sorry for the amount of required changes :) |
Would it be OK if I create a PR to move these tests to a separate file? Or is someone already working on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Minor nits regarding docs.
Misc/NEWS.d/next/C API/2023-04-24-10-31-59.gh-issue-103743.2xYA1K.rst
Outdated
Show resolved
Hide resolved
Fix indentation and reword some parts to sound more natural. Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Thank you for your first contribution to CPython! (It is first, right?)
No problem!
Go ahead! The issue is #93649 and it has a bunch of example PRs. |
Yes, it's the first one. Thanks for all the help :) |
* main: pythongh-103822: [Calendar] change return value to enum for day and month APIs (pythonGH-103827) pythongh-65022: Fix description of tuple return value in copyreg (python#103892) pythonGH-103525: Improve exception message from `pathlib.PurePath()` (pythonGH-103526) pythongh-84436: Add integration C API tests for immortal objects (pythongh-103962) pythongh-103743: Add PyUnstable_Object_GC_NewWithExtraData (pythonGH-103744) pythongh-102997: Update Windows installer to SQLite 3.41.2. (python#102999) pythonGH-103484: Fix redirected permanently URLs (python#104001) Improve assert_type phrasing (python#104081) pythongh-102997: Update macOS installer to SQLite 3.41.2. (pythonGH-102998) pythonGH-103472: close response in HTTPConnection._tunnel (python#103473) pythongh-88496: IDLE - fix another test on macOS (python#104075) pythongh-94673: Hide Objects in PyTypeObject Behind Accessors (pythongh-104074) pythongh-94673: Properly Initialize and Finalize Static Builtin Types for Each Interpreter (pythongh-104072) pythongh-104016: Skip test for deeply neste f-strings on wasi (python#104071)
* main: (760 commits) pythonGH-104102: Optimize `pathlib.Path.glob()` handling of `../` pattern segments (pythonGH-104103) pythonGH-104104: Optimize `pathlib.Path.glob()` by avoiding repeated calls to `os.path.normcase()` (pythonGH-104105) pythongh-103822: [Calendar] change return value to enum for day and month APIs (pythonGH-103827) pythongh-65022: Fix description of tuple return value in copyreg (python#103892) pythonGH-103525: Improve exception message from `pathlib.PurePath()` (pythonGH-103526) pythongh-84436: Add integration C API tests for immortal objects (pythongh-103962) pythongh-103743: Add PyUnstable_Object_GC_NewWithExtraData (pythonGH-103744) pythongh-102997: Update Windows installer to SQLite 3.41.2. (python#102999) pythonGH-103484: Fix redirected permanently URLs (python#104001) Improve assert_type phrasing (python#104081) pythongh-102997: Update macOS installer to SQLite 3.41.2. (pythonGH-102998) pythonGH-103472: close response in HTTPConnection._tunnel (python#103473) pythongh-88496: IDLE - fix another test on macOS (python#104075) pythongh-94673: Hide Objects in PyTypeObject Behind Accessors (pythongh-104074) pythongh-94673: Properly Initialize and Finalize Static Builtin Types for Each Interpreter (pythongh-104072) pythongh-104016: Skip test for deeply neste f-strings on wasi (python#104071) pythongh-104057: Fix direct invocation of test_super (python#104064) pythongh-87092: Expose assembler to unit tests (python#103988) pythongh-97696: asyncio eager tasks factory (python#102853) pythongh-84436: Immortalize in _PyStructSequence_InitBuiltinWithFlags() (pythongh-104054) ...
FYI, it looks like this USan buildbot started failing on this commit: https://buildbot.python.org/all/#/builders/719 Not sure if it's a false positive or not, but is probably worth looking into (especially since the 3.12 release is coming up). |
Fixed in #104191. |