-
-
Notifications
You must be signed in to change notification settings - Fork 35k
[PEP 573] bpo-38787: Module State Access from C Extension Methods #17145
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
Closed
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6026bc1
add ht_module to heap types
f2d45a4
Implement PyCMethod
e85b726
static exception prototype
e593a86
METH_METHOD clinic support
9f9f81f
slot method per-module state access
625a961
port io module
6ad36fb
port _csv module
a526fc5
clinic support for METH_METHOD and heaptype state access
085cab7
port _elementtree
b95d6a4
consoleio
1f6c04d
Helper for getting per-module state from type
41fe314
Correct MRO walking algorithm
40275e2
Limited APIs - rewrite from 3.7 to 3.8
a84e9a2
EuroPython Sprint Changes
7f78843
recover clinic after rebase
387267a
Sanitize the implementation
f284861
Update method_enter_call() call
4422099
Revert Objects/typeslots.py changes.
06c13dd
Remove MRO walker.
a54f720
Reflect PR comments
a6cd004
Add news entry
f77edf4
Reflect also hidden comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -197,6 +197,9 @@ PyAPI_FUNC(PyObject*) PyType_FromSpecWithBases(PyType_Spec*, PyObject*); | |
| #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 | ||
| PyAPI_FUNC(void*) PyType_GetSlot(struct _typeobject*, int); | ||
| #endif | ||
| #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03080000 | ||
| PyAPI_FUNC(PyObject*) PyType_FromModuleAndSpec(PyObject *, PyType_Spec *, PyObject *); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, this is missing from the PEP's summary. |
||
| #endif | ||
|
|
||
| /* Generic type check */ | ||
| PyAPI_FUNC(int) PyType_IsSubtype(struct _typeobject *, struct _typeobject *); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/C API/2020-01-22-12-38-59.bpo-38787.HUH6hd.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Module C state is now accessible from C-defined heap type methods. (PEP-573) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we use the existing
PyCFunction_Typefor methods?The
METH_METHODflag should signal that the underlying struct isPyCMethodObject; you'll also want to settp_itemsizeand the usePyObject_GC_NewVar.