summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-21 08:25:54 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-21 08:25:54 (GMT)
commitb57d9eac41125bc4a53a1ba9987ba776b4cc6680 (patch)
tree7dbacd56c88ba46115dbe2865c4657d9ee3702eb
parent1fb1c998b2c5e0b97aa909688793e405dfea08f0 (diff)
downloadcpython-b57d9eac41125bc4a53a1ba9987ba776b4cc6680.zip
cpython-b57d9eac41125bc4a53a1ba9987ba776b4cc6680.tar.gz
cpython-b57d9eac41125bc4a53a1ba9987ba776b4cc6680.tar.bz2
Issue #28748: Private variable _Py_PackageContext is now of type "const char *"
rather of "char *".
-rw-r--r--Include/modsupport.h2
-rw-r--r--Misc/NEWS3
-rw-r--r--Objects/moduleobject.c2
-rw-r--r--Python/importdl.c2
-rw-r--r--Python/modsupport.c2
5 files changed, 7 insertions, 4 deletions
diff --git a/Include/modsupport.h b/Include/modsupport.h
index 833e33d..39be128 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -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
diff --git a/Misc/NEWS b/Misc/NEWS
index b9448dd..5bf35ef 100644
--- 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.
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 701bcb1..350f3bf 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -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;
diff --git a/Python/importdl.c b/Python/importdl.c
index f56fa94..d8656b9 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -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);
diff --git a/Python/modsupport.c b/Python/modsupport.c
index 35b529b..06bdcab 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -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 */