[Python-checkins] cpython: Issue #28748: Private variable _Py_PackageContext is now of type "const char *"
serhiy.storchaka
python-checkins at python.org
Mon Nov 21 03:26:09 EST 2016
https://hg.python.org/cpython/rev/d2dd6578aa16
changeset: 105265:d2dd6578aa16
user: Serhiy Storchaka <storchaka at gmail.com>
date: Mon Nov 21 10:25:54 2016 +0200
summary:
Issue #28748: Private variable _Py_PackageContext is now of type "const char *"
rather of "char *".
files:
Include/modsupport.h | 2 +-
Misc/NEWS | 3 +++
Objects/moduleobject.c | 2 +-
Python/importdl.c | 2 +-
Python/modsupport.c | 2 +-
5 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/Include/modsupport.h b/Include/modsupport.h
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -176,7 +176,7 @@
#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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -416,6 +416,9 @@
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
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -188,7 +188,7 @@
(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
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -94,7 +94,7 @@
#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
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -9,7 +9,7 @@
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 */
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list