-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
gh-101476: Add _PyType_GetModuleState #101477
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
Changes from 2 commits
795763c
813fd94
959367e
62d9dad
6ce3ab0
52be3ef
c76260a
cc628d9
fc2a473
52bb5ee
049ace5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
extern "C" { | ||
#endif | ||
|
||
#include "pycore_moduleobject.h" | ||
|
||
#ifndef Py_BUILD_CORE | ||
# error "this header requires Py_BUILD_CORE define" | ||
#endif | ||
|
@@ -62,6 +64,18 @@ _PyStaticType_GET_WEAKREFS_LISTPTR(static_builtin_state *state) | |
return &state->tp_weaklist; | ||
} | ||
|
||
static inline void * | ||
_PyType_GetModuleState(PyTypeObject *type) | ||
{ | ||
assert(PyType_Check(type)); | ||
assert(type->tp_flags & Py_TPFLAGS_HEAPTYPE); | ||
PyHeapTypeObject* et = (PyHeapTypeObject*)type; | ||
assert(et->ht_module); | ||
PyModuleObject *mod = (PyModuleObject *)(et->ht_module); | ||
erlend-aasland marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assert(mod != NULL); | ||
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. This assertion is the same than 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. ... or the first assert could be changed to |
||
return mod->md_state; | ||
} | ||
|
||
struct types_state { | ||
struct type_cache type_cache; | ||
size_t num_builtins_initialized; | ||
|
Uh oh!
There was an error while loading. Please reload this page.