[Python-checkins] r71031 - in python/trunk: Doc/c-api/import.rst Misc/NEWS Python/import.c

brett.cannon python-checkins at python.org
Thu Apr 2 05:17:39 CEST 2009


Author: brett.cannon
Date: Thu Apr  2 05:17:39 2009
New Revision: 71031

Log:
PyImport_AppendInittab() took a char * as a first argument even though that
string was stored beyond the life of the call. Changed the signature to be
const char * to help make this point.

Closes issue #1419652.


Modified:
   python/trunk/Doc/c-api/import.rst
   python/trunk/Misc/NEWS
   python/trunk/Python/import.c

Modified: python/trunk/Doc/c-api/import.rst
==============================================================================
--- python/trunk/Doc/c-api/import.rst	(original)
+++ python/trunk/Doc/c-api/import.rst	Thu Apr  2 05:17:39 2009
@@ -232,7 +232,7 @@
    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

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Thu Apr  2 05:17:39 2009
@@ -692,6 +692,9 @@
 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

Modified: python/trunk/Python/import.c
==============================================================================
--- python/trunk/Python/import.c	(original)
+++ python/trunk/Python/import.c	Thu Apr  2 05:17:39 2009
@@ -3376,7 +3376,7 @@
 /* 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];
 


More information about the Python-checkins mailing list