summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2022-02-11 16:22:11 (GMT)
committerGitHub <noreply@github.com>2022-02-11 16:22:11 (GMT)
commit204946986feee7bc80b233350377d24d20fcb1b8 (patch)
treee66ab16090f97845e0f95f981c720954e244d102 /Modules
parente0bcfd0e4db193743d4bafc48d10f15ae9ed7b2b (diff)
downloadcpython-204946986feee7bc80b233350377d24d20fcb1b8.zip
cpython-204946986feee7bc80b233350377d24d20fcb1b8.tar.gz
cpython-204946986feee7bc80b233350377d24d20fcb1b8.tar.bz2
bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)
* Make PyType_GetModuleByDef public (remove underscore) Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_csv.c2
-rw-r--r--Modules/_functoolsmodule.c2
-rw-r--r--Modules/_queuemodule.c2
-rw-r--r--Modules/_randommodule.c2
-rw-r--r--Modules/_sqlite/module.h2
-rw-r--r--Modules/_ssl.c4
-rw-r--r--Modules/_ssl.h2
-rw-r--r--Modules/_struct.c2
-rw-r--r--Modules/_testmultiphase.c12
-rw-r--r--Modules/_threadmodule.c6
-rw-r--r--Modules/arraymodule.c2
-rw-r--r--Modules/cjkcodecs/multibytecodec.c2
-rw-r--r--Modules/clinic/_testmultiphase.c.h6
13 files changed, 23 insertions, 23 deletions
diff --git a/Modules/_csv.c b/Modules/_csv.c
index d2cb77f..f59d42a 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -374,7 +374,7 @@ static char *dialect_kws[] = {
static _csvstate *
_csv_state_from_type(PyTypeObject *type, const char *name)
{
- PyObject *module = _PyType_GetModuleByDef(type, &_csvmodule);
+ PyObject *module = PyType_GetModuleByDef(type, &_csvmodule);
if (module == NULL) {
return NULL;
}
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 1f6b852..0974fc7 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -51,7 +51,7 @@ partial_call(partialobject *pto, PyObject *args, PyObject *kwargs);
static inline _functools_state *
get_functools_state_by_type(PyTypeObject *type)
{
- PyObject *module = _PyType_GetModuleByDef(type, &_functools_module);
+ PyObject *module = PyType_GetModuleByDef(type, &_functools_module);
if (module == NULL) {
return NULL;
}
diff --git a/Modules/_queuemodule.c b/Modules/_queuemodule.c
index 413387f..af19dd6 100644
--- a/Modules/_queuemodule.c
+++ b/Modules/_queuemodule.c
@@ -21,7 +21,7 @@ simplequeue_get_state(PyObject *module)
}
static struct PyModuleDef queuemodule;
#define simplequeue_get_state_by_type(type) \
- (simplequeue_get_state(_PyType_GetModuleByDef(type, &queuemodule)))
+ (simplequeue_get_state(PyType_GetModuleByDef(type, &queuemodule)))
typedef struct {
PyObject_HEAD
diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c
index 45860e3..d96c037 100644
--- a/Modules/_randommodule.c
+++ b/Modules/_randommodule.c
@@ -99,7 +99,7 @@ get_random_state(PyObject *module)
static struct PyModuleDef _randommodule;
#define _randomstate_type(type) \
- (get_random_state(_PyType_GetModuleByDef(type, &_randommodule)))
+ (get_random_state(PyType_GetModuleByDef(type, &_randommodule)))
typedef struct {
PyObject_HEAD
diff --git a/Modules/_sqlite/module.h b/Modules/_sqlite/module.h
index 1d319f1..a248d04 100644
--- a/Modules/_sqlite/module.h
+++ b/Modules/_sqlite/module.h
@@ -74,7 +74,7 @@ extern struct PyModuleDef _sqlite3module;
static inline pysqlite_state *
pysqlite_get_state_by_type(PyTypeObject *tp)
{
- PyObject *module = _PyType_GetModuleByDef(tp, &_sqlite3module);
+ PyObject *module = PyType_GetModuleByDef(tp, &_sqlite3module);
assert(module != NULL);
return pysqlite_get_state(module);
}
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 07f0580..d7e041f 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2988,8 +2988,8 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
int result;
/* slower approach, walk MRO and get borrowed reference to module.
- * _PyType_GetModuleByDef is required for SSLContext subclasses */
- PyObject *module = _PyType_GetModuleByDef(type, &_sslmodule_def);
+ * PyType_GetModuleByDef is required for SSLContext subclasses */
+ PyObject *module = PyType_GetModuleByDef(type, &_sslmodule_def);
if (module == NULL) {
PyErr_SetString(PyExc_RuntimeError,
"Cannot find internal module state");
diff --git a/Modules/_ssl.h b/Modules/_ssl.h
index 5fe6504..5593a45 100644
--- a/Modules/_ssl.h
+++ b/Modules/_ssl.h
@@ -42,7 +42,7 @@ get_ssl_state(PyObject *module)
}
#define get_state_type(type) \
- (get_ssl_state(_PyType_GetModuleByDef(type, &_sslmodule_def)))
+ (get_ssl_state(PyType_GetModuleByDef(type, &_sslmodule_def)))
#define get_state_ctx(c) (((PySSLContext *)(c))->state)
#define get_state_sock(s) (((PySSLSocket *)(s))->ctx->state)
#define get_state_obj(o) ((_sslmodulestate *)PyType_GetModuleState(Py_TYPE(o)))
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 7d05ec5..a2e14e8 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -38,7 +38,7 @@ get_struct_state(PyObject *module)
static struct PyModuleDef _structmodule;
#define get_struct_state_structinst(self) \
- (get_struct_state(_PyType_GetModuleByDef(Py_TYPE(self), &_structmodule)))
+ (get_struct_state(PyType_GetModuleByDef(Py_TYPE(self), &_structmodule)))
#define get_struct_state_iterinst(self) \
(get_struct_state(PyType_GetModule(Py_TYPE(self))))
diff --git a/Modules/_testmultiphase.c b/Modules/_testmultiphase.c
index f7bde98..4905269 100644
--- a/Modules/_testmultiphase.c
+++ b/Modules/_testmultiphase.c
@@ -136,21 +136,21 @@ _testmultiphase.StateAccessType.get_defining_module
Return the module of the defining class.
-Also tests that result of _PyType_GetModuleByDef matches defining_class's
+Also tests that result of PyType_GetModuleByDef matches defining_class's
module.
[clinic start generated code]*/
static PyObject *
_testmultiphase_StateAccessType_get_defining_module_impl(StateAccessTypeObject *self,
PyTypeObject *cls)
-/*[clinic end generated code: output=ba2a14284a5d0921 input=356f999fc16e0933]*/
+/*[clinic end generated code: output=ba2a14284a5d0921 input=d2c7245c8a9d06f8]*/
{
PyObject *retval;
retval = PyType_GetModule(cls);
if (retval == NULL) {
return NULL;
}
- assert(_PyType_GetModuleByDef(Py_TYPE(self), &def_meth_state_access) == retval);
+ assert(PyType_GetModuleByDef(Py_TYPE(self), &def_meth_state_access) == retval);
Py_INCREF(retval);
return retval;
}
@@ -160,15 +160,15 @@ _testmultiphase.StateAccessType.getmodulebydef_bad_def
cls: defining_class
-Test that result of _PyType_GetModuleByDef with a bad def is NULL.
+Test that result of PyType_GetModuleByDef with a bad def is NULL.
[clinic start generated code]*/
static PyObject *
_testmultiphase_StateAccessType_getmodulebydef_bad_def_impl(StateAccessTypeObject *self,
PyTypeObject *cls)
-/*[clinic end generated code: output=64509074dfcdbd31 input=906047715ee293cd]*/
+/*[clinic end generated code: output=64509074dfcdbd31 input=edaff09aa4788204]*/
{
- _PyType_GetModuleByDef(Py_TYPE(self), &def_nonmodule); // should raise
+ PyType_GetModuleByDef(Py_TYPE(self), &def_nonmodule); // should raise
assert(PyErr_Occurred());
return NULL;
}
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 072b79a..ca74f9d 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -786,7 +786,7 @@ local_new(PyTypeObject *type, PyObject *args, PyObject *kw)
}
}
- PyObject *module = _PyType_GetModuleByDef(type, &thread_module);
+ PyObject *module = PyType_GetModuleByDef(type, &thread_module);
thread_module_state *state = get_thread_state(module);
localobject *self = (localobject *)type->tp_alloc(type, 0);
@@ -925,7 +925,7 @@ _ldict(localobject *self, thread_module_state *state)
static int
local_setattro(localobject *self, PyObject *name, PyObject *v)
{
- PyObject *module = _PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
+ PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
thread_module_state *state = get_thread_state(module);
PyObject *ldict = _ldict(self, state);
@@ -977,7 +977,7 @@ static PyType_Spec local_type_spec = {
static PyObject *
local_getattro(localobject *self, PyObject *name)
{
- PyObject *module = _PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
+ PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
thread_module_state *state = get_thread_state(module);
PyObject *ldict = _ldict(self, state);
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 4aaab0c..e516f54 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -67,7 +67,7 @@ get_array_state(PyObject *module)
}
#define find_array_state_by_type(tp) \
- (get_array_state(_PyType_GetModuleByDef(tp, &arraymodule)))
+ (get_array_state(PyType_GetModuleByDef(tp, &arraymodule)))
#define get_array_state_by_class(cls) \
(get_array_state(PyType_GetModule(cls)))
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index df48a0d..acfe966 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -33,7 +33,7 @@ static struct PyModuleDef _multibytecodecmodule;
static _multibytecodec_state *
_multibyte_codec_find_state_by_type(PyTypeObject *type)
{
- PyObject *module = _PyType_GetModuleByDef(type, &_multibytecodecmodule);
+ PyObject *module = PyType_GetModuleByDef(type, &_multibytecodecmodule);
assert(module != NULL);
return _multibytecodec_get_state(module);
}
diff --git a/Modules/clinic/_testmultiphase.c.h b/Modules/clinic/_testmultiphase.c.h
index 17c28d5..b8ee93c 100644
--- a/Modules/clinic/_testmultiphase.c.h
+++ b/Modules/clinic/_testmultiphase.c.h
@@ -8,7 +8,7 @@ PyDoc_STRVAR(_testmultiphase_StateAccessType_get_defining_module__doc__,
"\n"
"Return the module of the defining class.\n"
"\n"
-"Also tests that result of _PyType_GetModuleByDef matches defining_class\'s\n"
+"Also tests that result of PyType_GetModuleByDef matches defining_class\'s\n"
"module.");
#define _TESTMULTIPHASE_STATEACCESSTYPE_GET_DEFINING_MODULE_METHODDEF \
@@ -39,7 +39,7 @@ PyDoc_STRVAR(_testmultiphase_StateAccessType_getmodulebydef_bad_def__doc__,
"getmodulebydef_bad_def($self, /)\n"
"--\n"
"\n"
-"Test that result of _PyType_GetModuleByDef with a bad def is NULL.");
+"Test that result of PyType_GetModuleByDef with a bad def is NULL.");
#define _TESTMULTIPHASE_STATEACCESSTYPE_GETMODULEBYDEF_BAD_DEF_METHODDEF \
{"getmodulebydef_bad_def", (PyCFunction)(void(*)(void))_testmultiphase_StateAccessType_getmodulebydef_bad_def, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _testmultiphase_StateAccessType_getmodulebydef_bad_def__doc__},
@@ -131,4 +131,4 @@ _testmultiphase_StateAccessType_get_count(StateAccessTypeObject *self, PyTypeObj
exit:
return return_value;
}
-/*[clinic end generated code: output=eb1b8c2ee6290be3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e8d074b4e6437438 input=a9049054013a1b77]*/