summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_elementtree.c5
-rw-r--r--Modules/_sqlite/connection.c1
-rw-r--r--Modules/_sqlite/module.c6
-rw-r--r--Modules/_testcapimodule.c10
-rw-r--r--Modules/cjkcodecs/cjkcodecs.h1
-rw-r--r--Modules/pyexpat.c5
6 files changed, 26 insertions, 2 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 4828069..3e742e0 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -11,7 +11,12 @@
*--------------------------------------------------------------------
*/
+#ifndef Py_BUILD_CORE_BUILTIN
+# define Py_BUILD_CORE_MODULE 1
+#endif
+
#include "Python.h"
+#include "pycore_import.h" // _PyImport_GetModuleAttrString()
#include "structmember.h" // PyMemberDef
#include "expat.h"
#include "pyexpat.h"
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 967ba28..d71cef1 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -33,6 +33,7 @@
#include "blob.h"
#include "prepare_protocol.h"
#include "util.h"
+#include "pycore_import.h" // _PyImport_GetModuleAttrString()
#include "pycore_weakref.h" // _PyWeakref_IS_DEAD()
#include <stdbool.h>
diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c
index ea4d8c5..368e581 100644
--- a/Modules/_sqlite/module.c
+++ b/Modules/_sqlite/module.c
@@ -21,6 +21,10 @@
* 3. This notice may not be removed or altered from any source distribution.
*/
+#ifndef Py_BUILD_CORE_BUILTIN
+# define Py_BUILD_CORE_MODULE 1
+#endif
+
#include "connection.h"
#include "statement.h"
#include "cursor.h"
@@ -29,6 +33,8 @@
#include "row.h"
#include "blob.h"
+#include "pycore_import.h" // _PyImport_GetModuleAttrString()
+
#if SQLITE_VERSION_NUMBER < 3015002
#error "SQLite 3.15.2 or higher required"
#endif
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;
}
diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h
index 97290aa..ee58878 100644
--- a/Modules/cjkcodecs/cjkcodecs.h
+++ b/Modules/cjkcodecs/cjkcodecs.h
@@ -13,6 +13,7 @@
#include "Python.h"
#include "multibytecodec.h"
+#include "pycore_import.h" // _PyImport_GetModuleAttrString()
/* a unicode "undefined" code point */
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index e3333ff..2891535 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -1,4 +1,9 @@
+#ifndef Py_BUILD_CORE_BUILTIN
+# define Py_BUILD_CORE_MODULE 1
+#endif
+
#include "Python.h"
+#include "pycore_import.h" // _PyImport_SetModule()
#include <ctype.h>
#include "structmember.h" // PyMemberDef