Skip to content

Commit c65ef77

Browse files
authored
rename _imp initialization function to follow conventions (#5432)
When the C imp module became _imp in 6f44d66, the initialization function should have been renamed from PyInit_imp to PyInit__imp.
1 parent 2a2270d commit c65ef77

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

Include/import.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ extern "C" {
1010
#ifndef Py_LIMITED_API
1111
PyAPI_FUNC(_PyInitError) _PyImportZip_Init(void);
1212

13-
PyMODINIT_FUNC PyInit_imp(void);
13+
PyMODINIT_FUNC PyInit__imp(void);
1414
#endif /* !Py_LIMITED_API */
1515
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
1616
PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);

Modules/config.c.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern "C" {
2525
/* -- ADDMODULE MARKER 1 -- */
2626

2727
extern PyObject* PyMarshal_Init(void);
28-
extern PyObject* PyInit_imp(void);
28+
extern PyObject* PyInit__imp(void);
2929
extern PyObject* PyInit_gc(void);
3030
extern PyObject* PyInit__ast(void);
3131
extern PyObject* _PyWarnings_Init(void);
@@ -39,7 +39,7 @@ struct _inittab _PyImport_Inittab[] = {
3939
{"marshal", PyMarshal_Init},
4040

4141
/* This lives in import.c */
42-
{"_imp", PyInit_imp},
42+
{"_imp", PyInit__imp},
4343

4444
/* This lives in Python/Python-ast.c */
4545
{"_ast", PyInit__ast},

PC/config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extern PyObject* PyInit__opcode(void);
7474
/* -- ADDMODULE MARKER 1 -- */
7575

7676
extern PyObject* PyMarshal_Init(void);
77-
extern PyObject* PyInit_imp(void);
77+
extern PyObject* PyInit__imp(void);
7878

7979
struct _inittab _PyImport_Inittab[] = {
8080

@@ -147,7 +147,7 @@ struct _inittab _PyImport_Inittab[] = {
147147
{"marshal", PyMarshal_Init},
148148

149149
/* This lives it with import.c */
150-
{"_imp", PyInit_imp},
150+
{"_imp", PyInit__imp},
151151

152152
/* These entries are here for sys.builtin_module_names */
153153
{"builtins", NULL},

Python/import.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/* Module definition and import implementation */
32

43
#include "Python.h"
@@ -2253,7 +2252,7 @@ static struct PyModuleDef impmodule = {
22532252
const char *_Py_CheckHashBasedPycsMode = "default";
22542253

22552254
PyMODINIT_FUNC
2256-
PyInit_imp(void)
2255+
PyInit__imp(void)
22572256
{
22582257
PyObject *m, *d;
22592258

Python/pylifecycle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ initimport(PyInterpreterState *interp, PyObject *sysmod)
312312
Py_INCREF(interp->import_func);
313313

314314
/* Import the _imp module */
315-
impmod = PyInit_imp();
315+
impmod = PyInit__imp();
316316
if (impmod == NULL) {
317317
return _Py_INIT_ERR("can't import _imp");
318318
}

0 commit comments

Comments
 (0)