Issue #28748: Private variable _Py_PackageContext is now of type "const char *"
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 21 Nov 2016 08:25:54 +0000 (10:25 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 21 Nov 2016 08:25:54 +0000 (10:25 +0200)
rather of "char *".

Include/modsupport.h
Misc/NEWS
Objects/moduleobject.c
Python/importdl.c
Python/modsupport.c

index 833e33d574d271174eb04ee6761c4c8aa58c45cf..39be12864a3b2e3954838b586197039af327cf9a 100644 (file)
@@ -176,7 +176,7 @@ PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
 #endif /* New in 3.5 */
 
 #ifndef Py_LIMITED_API
-PyAPI_DATA(char *) _Py_PackageContext;
+PyAPI_DATA(const char *) _Py_PackageContext;
 #endif
 
 #ifdef __cplusplus
index b9448dd377984ad907f4cb5d792df915e84d0975..5bf35ef8f63db28a64463923e7d5a07226f4dd0a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -416,6 +416,9 @@ Windows
 C API
 -----
 
+- Issue #28748: Private variable _Py_PackageContext is now of type "const char *"
+  rather of "char *".
+
 - Issue #19569: Compiler warnings are now emitted if use most of deprecated
   functions.
 
index 701bcb1df3516c7eca79c3e2b9810a983120de1c..350f3bfe3aa22e6683f6bb59c5748483837e4df1 100644 (file)
@@ -188,7 +188,7 @@ PyModule_Create2(struct PyModuleDef* module, int module_api_version)
        (if the name actually matches).
     */
     if (_Py_PackageContext != NULL) {
-        char *p = strrchr(_Py_PackageContext, '.');
+        const char *p = strrchr(_Py_PackageContext, '.');
         if (p != NULL && strcmp(module->m_name, p+1) == 0) {
             name = _Py_PackageContext;
             _Py_PackageContext = NULL;
index f56fa94cc427f72077697ef8e479d57f0b8dbe2f..d8656b943336ec17907f501337f39b124fd4c847 100644 (file)
@@ -94,7 +94,7 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp)
 #endif
     PyObject *name_unicode = NULL, *name = NULL, *path = NULL, *m = NULL;
     const char *name_buf, *hook_prefix;
-    char *oldcontext;
+    const char *oldcontext;
     dl_funcptr exportfunc;
     PyModuleDef *def;
     PyObject *(*p0)(void);
index 35b529b07b38b35eef4edf1620acb74ce77bc084..06bdcab3c6c803e93cc2934f0bd0f96fb8c55592 100644 (file)
@@ -9,7 +9,7 @@ typedef double va_double;
 static PyObject *va_build_value(const char *, va_list, int);
 
 /* Package context -- the full module name for package imports */
-char *_Py_PackageContext = NULL;
+const char *_Py_PackageContext = NULL;
 
 /* Helper for mkvalue() to scan the length of a format */