diff options
author | Victor Stinner <vstinner@python.org> | 2023-07-03 23:02:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-03 23:02:07 (GMT) |
commit | 2e92edbf6de9578b30cca8e48c4bfb2ba71ae97a (patch) | |
tree | 7cb29fc57a2a2ddc93393005fc592346d3e03d6a /Modules/_testcapimodule.c | |
parent | f6d2bb18aba844f6bb5836797c72eb791b7f3644 (diff) | |
download | cpython-2e92edbf6de9578b30cca8e48c4bfb2ba71ae97a.zip cpython-2e92edbf6de9578b30cca8e48c4bfb2ba71ae97a.tar.gz cpython-2e92edbf6de9578b30cca8e48c4bfb2ba71ae97a.tar.bz2 |
gh-106320: Remove private _PyImport C API functions (#106383)
* Remove private _PyImport C API functions: move them to the internal
C API (pycore_import.h).
* No longer export most of these private functions.
* _testcapi avoids private _PyImport_GetModuleAttrString().
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index ce11317..d1044b5 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1267,9 +1267,15 @@ test_pep3118_obsolete_write_locks(PyObject* self, PyObject *Py_UNUSED(ignored)) if (ret != -1 || match == 0) goto error; + PyObject *mod_io = PyImport_ImportModule("_io"); + if (mod_io == NULL) { + return NULL; + } + /* bytesiobuf_getbuffer() */ - PyTypeObject *type = (PyTypeObject *)_PyImport_GetModuleAttrString( - "_io", "_BytesIOBuffer"); + PyTypeObject *type = (PyTypeObject *)PyObject_GetAttrString( + mod_io, "_BytesIOBuffer"); + Py_DECREF(mod_io); if (type == NULL) { return NULL; } |