[Python-checkins] r71034 - in python/branches/py3k: Doc/c-api/import.rst Include/import.h Python/import.c

brett.cannon python-checkins at python.org
Thu Apr 2 05:41:47 CEST 2009


Author: brett.cannon
Date: Thu Apr  2 05:41:46 2009
New Revision: 71034

Log:
Merged revisions 71031 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71031 | brett.cannon | 2009-04-01 20:17:39 -0700 (Wed, 01 Apr 2009) | 6 lines
  
  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/branches/py3k/   (props changed)
   python/branches/py3k/Doc/c-api/import.rst
   python/branches/py3k/Include/import.h
   python/branches/py3k/Python/import.c

Modified: python/branches/py3k/Doc/c-api/import.rst
==============================================================================
--- python/branches/py3k/Doc/c-api/import.rst	(original)
+++ python/branches/py3k/Doc/c-api/import.rst	Thu Apr  2 05:41:46 2009
@@ -200,7 +200,7 @@
    tricks with this to provide a dynamically created collection of frozen modules.
 
 
-.. cfunction:: int PyImport_AppendInittab(char *name, PyObject* (*initfunc)(void))
+.. cfunction:: int PyImport_AppendInittab(const char *name, PyObject* (*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/branches/py3k/Include/import.h
==============================================================================
--- python/branches/py3k/Include/import.h	(original)
+++ python/branches/py3k/Include/import.h	Thu Apr  2 05:41:46 2009
@@ -43,7 +43,7 @@
 PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
 PyAPI_DATA(struct _inittab *) PyImport_Inittab;
 
-PyAPI_FUNC(int) PyImport_AppendInittab(char *name, PyObject* (*initfunc)(void));
+PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, PyObject* (*initfunc)(void));
 PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
 
 struct _frozen {

Modified: python/branches/py3k/Python/import.c
==============================================================================
--- python/branches/py3k/Python/import.c	(original)
+++ python/branches/py3k/Python/import.c	Thu Apr  2 05:41:46 2009
@@ -3488,13 +3488,13 @@
 /* Shorthand to add a single entry given a name and a function */
 
 int
-PyImport_AppendInittab(char *name, PyObject* (*initfunc)(void))
+PyImport_AppendInittab(const char *name, PyObject* (*initfunc)(void))
 {
 	struct _inittab newtab[2];
 
 	memset(newtab, '\0', sizeof newtab);
 
-	newtab[0].name = name;
+	newtab[0].name = (char *)name;
 	newtab[0].initfunc = initfunc;
 
 	return PyImport_ExtendInittab(newtab);


More information about the Python-checkins mailing list