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-124153: Add Py_tp_token support to xxlimited module by gpshead · Pull Request #141644 · python/cpython Conversation
|
|
I guess my question about this is... should we recommend people always do this? is there a downside worth mentioning? cc @neonene as well as the original author of the 3.14 feature PR. |
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.
Thanks for adding this!
should we recommend people always do this
IMO, no -- they should only do it if they need the token (e.g. for XxoObject_Check). Ideally, this should be a tool that's there if you need it, not “best practice” to be cargo-culted in every definition.
But, on the other hand, it's not easy to document it that way. So, maybe suggesting that people should do it, and putting it in the copy-pastable example is the right way.
But then people might wonder why Python doesn't do this automatically...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| #include "pyconfig.h" // Py_GIL_DISABLED | ||
| #ifndef Py_GIL_DISABLED | ||
| # define Py_LIMITED_API 0x030d0000 | ||
| # define Py_LIMITED_API 0x030e0000 |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
What do you think about copying the original to xxlimited_3_13.c, so we have an example for older stable ABI?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
#142827 adds a After/if that's merged, I plan to adapt the HOWTO addition from this PR after that. And ideally add an actual example of type-checking :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 90 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Implement the TODO at line 99-100 to add Py_tp_token slot support, demonstrating Python 3.14 type checking best practices for Limited C API extension modules. Changes to Modules/xxlimited.c: - Update Limited API version from 3.13 (0x030d0000) to 3.14 (0x030e0000) - Add Py_tp_token slot with Py_TP_USE_SPEC to Xxo_Type_slots Changes to Doc/howto/isolating-extensions.rst: - Add new "Type Checking with Heap Types" section documenting Py_tp_token - Reference xxlimited.c as example and link to pythongh-124153 This addresses the type-checking problem for heap types described in PEP 630 and aligns with the documentation modernization effort (pythongh-134160). The xxlimited module now serves as a complete example of modern isolated extension module development. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
93b525f to
70d23e1
Compare
Documentation build overview
|
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.