summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/c-api/import.rst2
-rw-r--r--Misc/NEWS3
-rw-r--r--Python/import.c2
3 files changed, 5 insertions, 2 deletions
diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst
index c4816f5..bed6089 100644
--- a/Doc/c-api/import.rst
+++ b/Doc/c-api/import.rst
@@ -232,7 +232,7 @@ Importing Modules
tricks with this to provide a dynamically created collection of frozen modules.
-.. cfunction:: int PyImport_AppendInittab(char *name, void (*initfunc)(void))
+.. cfunction:: int PyImport_AppendInittab(const char *name, void (*initfunc)(void))
Add a single module to the existing table of built-in modules. This is a
convenience wrapper around :cfunc:`PyImport_ExtendInittab`, returning ``-1`` if
diff --git a/Misc/NEWS b/Misc/NEWS
index 6bf6dcd..036a061 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -692,6 +692,9 @@ Build
C-API
-----
+- Issue #1419652: Change the first argument to PyImport_AppendInittab() to
+ ``const char *`` as the string is stored beyond the call.
+
- Some PyBytes_* aliases have been removed because they don't exist in 3.x.
- Issue #5175: PyLong_AsUnsignedLongLong now raises OverflowError
diff --git a/Python/import.c b/Python/import.c
index 98b8dce..b39cb18 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -3376,7 +3376,7 @@ PyImport_ExtendInittab(struct _inittab *newtab)
/* Shorthand to add a single entry given a name and a function */
int
-PyImport_AppendInittab(char *name, void (*initfunc)(void))
+PyImport_AppendInittab(const char *name, void (*initfunc)(void))
{
struct _inittab newtab[2];