diff -r 021f3b32e11f Doc/whatsnew/3.7.rst --- a/Doc/whatsnew/3.7.rst Sun Nov 20 20:37:08 2016 +0200 +++ b/Doc/whatsnew/3.7.rst Sun Nov 20 21:47:39 2016 +0200 @@ -99,6 +99,9 @@ Build and C API Changes of libffi is now required when building ``_ctypes`` on such platforms. Contributed by Zachary Ware in :issue:`27979`. +* Private variable :c:data:`_Py_PackageContext` is now of type ``const char *`` + rather of ``char *``. (Contributed by Serhiy Storchaka in :issue:`28748`.) + Deprecated ========== diff -r 021f3b32e11f Include/modsupport.h --- a/Include/modsupport.h Sun Nov 20 20:37:08 2016 +0200 +++ b/Include/modsupport.h Sun Nov 20 21:47:39 2016 +0200 @@ -176,7 +176,7 @@ PyAPI_FUNC(PyObject *) PyModule_FromDefA #endif /* New in 3.5 */ #ifndef Py_LIMITED_API -PyAPI_DATA(char *) _Py_PackageContext; +PyAPI_DATA(const char *) _Py_PackageContext; #endif #ifdef __cplusplus diff -r 021f3b32e11f Objects/moduleobject.c --- a/Objects/moduleobject.c Sun Nov 20 20:37:08 2016 +0200 +++ b/Objects/moduleobject.c Sun Nov 20 21:47:39 2016 +0200 @@ -188,7 +188,7 @@ PyModule_Create2(struct PyModuleDef* mod (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; diff -r 021f3b32e11f Python/importdl.c --- a/Python/importdl.c Sun Nov 20 20:37:08 2016 +0200 +++ b/Python/importdl.c Sun Nov 20 21:47:39 2016 +0200 @@ -94,7 +94,7 @@ PyObject * #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); diff -r 021f3b32e11f Python/modsupport.c --- a/Python/modsupport.c Sun Nov 20 20:37:08 2016 +0200 +++ b/Python/modsupport.c Sun Nov 20 21:47:39 2016 +0200 @@ -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 */