Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b57d9ea

Browse files
Issue #28748: Private variable _Py_PackageContext is now of type "const char *"
rather of "char *".
1 parent 1fb1c99 commit b57d9ea

5 files changed

Lines changed: 7 additions & 4 deletions

File tree

Include/modsupport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
176176
#endif /* New in 3.5 */
177177

178178
#ifndef Py_LIMITED_API
179-
PyAPI_DATA(char *) _Py_PackageContext;
179+
PyAPI_DATA(const char *) _Py_PackageContext;
180180
#endif
181181

182182
#ifdef __cplusplus

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ Windows
416416
C API
417417
-----
418418

419+
- Issue #28748: Private variable _Py_PackageContext is now of type "const char *"
420+
rather of "char *".
421+
419422
- Issue #19569: Compiler warnings are now emitted if use most of deprecated
420423
functions.
421424

Objects/moduleobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ PyModule_Create2(struct PyModuleDef* module, int module_api_version)
188188
(if the name actually matches).
189189
*/
190190
if (_Py_PackageContext != NULL) {
191-
char *p = strrchr(_Py_PackageContext, '.');
191+
const char *p = strrchr(_Py_PackageContext, '.');
192192
if (p != NULL && strcmp(module->m_name, p+1) == 0) {
193193
name = _Py_PackageContext;
194194
_Py_PackageContext = NULL;

Python/importdl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp)
9494
#endif
9595
PyObject *name_unicode = NULL, *name = NULL, *path = NULL, *m = NULL;
9696
const char *name_buf, *hook_prefix;
97-
char *oldcontext;
97+
const char *oldcontext;
9898
dl_funcptr exportfunc;
9999
PyModuleDef *def;
100100
PyObject *(*p0)(void);

Python/modsupport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ typedef double va_double;
99
static PyObject *va_build_value(const char *, va_list, int);
1010

1111
/* Package context -- the full module name for package imports */
12-
char *_Py_PackageContext = NULL;
12+
const char *_Py_PackageContext = NULL;
1313

1414
/* Helper for mkvalue() to scan the length of a format */
1515

0 commit comments

Comments
 (0)