Skip to content

Commit 9248f11

Browse files
committed
Remove use of a helper API removed in Python 3.13.
1 parent 188b55d commit 9248f11

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

src/_apachemodule.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -852,13 +852,6 @@ PyObject *_apache_module_init()
852852
m = Py_InitModule("_apache", _apache_module_methods);
853853
#else
854854
m = PyModule_Create(&_apache_moduledef);
855-
PyObject *name = PyUnicode_FromString("_apache");
856-
857-
_PyImport_FixupExtensionObject(m, name, name
858-
#if PY_MINOR_VERSION >= 7
859-
,PyImport_GetModuleDict()
860-
#endif
861-
);
862855
#endif
863856
d = PyModule_GetDict(m);
864857
Mp_ServerReturn = PyErr_NewException("_apache.SERVER_RETURN", NULL, NULL);

src/include/_apachemodule.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@
2929
*/
3030

3131
PyObject *get_ServerReturn(void);
32-
PyMODINIT_FUNC init_apache(void);
3332

3433
#endif /* !Mp_APACHEMODULE_H */

src/mod_python.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ static PyObject * make_obcallback(const char *name)
6969
PyObject *m = NULL;
7070
PyObject *obCallBack = NULL;
7171

72-
/* This makes _apache appear imported, and subsequent
73-
* >>> import _apache
74-
* will not give an error.
75-
*/
76-
_apache_module_init();
77-
7872
/* Now execute the equivalent of
7973
* >>> import <module>
8074
* >>> <initstring>
@@ -787,6 +781,14 @@ static int python_init(apr_pool_t *p, apr_pool_t *ptemp,
787781
Py_NoSiteFlag = 1;
788782
#endif
789783

784+
#if PY_MAJOR_VERSION == 2
785+
PyMODINIT_FUNC init_apache(void);
786+
PyImport_AppendInittab("_apache", &init_apache);
787+
#else
788+
PyMODINIT_FUNC PyInit_apache(void);
789+
PyImport_AppendInittab("_apache", &PyInit_apache);
790+
#endif
791+
790792
Py_Initialize();
791793

792794
#if PY_MAJOR_VERSION == 2 && \

0 commit comments

Comments
 (0)