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

Skip to content

Commit 6b42eb1

Browse files
authored
bpo-29585: Fix sysconfig.get_config_var("PYTHONFRAMEWORK") (GH-2483)
`PYTHONFRAMEWORK` is defined in `Makefile` and it shoulnd't be used in `pyconfig.h`. `sysconfig.py --generate-posix-vars` reads config vars from Makefile and `pyconfig.h`. Conflicting variables should be avoided. Especially, string config variables in Makefile are unquoted, but in `pyconfig.h` are keep quoted. So it should be private (starts with underscore).
1 parent 7526cad commit 6b42eb1

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

PC/pyconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,6 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
694694
#define HAVE_INET_PTON 1
695695

696696
/* framework name */
697-
#define PYTHONFRAMEWORK ""
697+
#define _PYTHONFRAMEWORK ""
698698

699699
#endif /* !Py_CONFIG_H */

Python/sysmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1965,7 +1965,7 @@ _PySys_BeginInit(void)
19651965
SET_SYS_FROM_STRING("_git",
19661966
Py_BuildValue("(szz)", "CPython", _Py_gitidentifier(),
19671967
_Py_gitversion()));
1968-
SET_SYS_FROM_STRING("_framework", PyUnicode_FromString(PYTHONFRAMEWORK));
1968+
SET_SYS_FROM_STRING("_framework", PyUnicode_FromString(_PYTHONFRAMEWORK));
19691969
SET_SYS_FROM_STRING("api_version",
19701970
PyLong_FromLong(PYTHON_API_VERSION));
19711971
SET_SYS_FROM_STRING("copyright",

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3245,7 +3245,7 @@ fi
32453245

32463246

32473247
cat >>confdefs.h <<_ACEOF
3248-
#define PYTHONFRAMEWORK "${PYTHONFRAMEWORK}"
3248+
#define _PYTHONFRAMEWORK "${PYTHONFRAMEWORK}"
32493249
_ACEOF
32503250

32513251

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ AC_SUBST(FRAMEWORKPYTHONW)
355355
AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
356356
AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
357357

358-
AC_DEFINE_UNQUOTED(PYTHONFRAMEWORK, "${PYTHONFRAMEWORK}", [framework name])
358+
AC_DEFINE_UNQUOTED(_PYTHONFRAMEWORK, "${PYTHONFRAMEWORK}", [framework name])
359359

360360
##AC_ARG_WITH(dyld,
361361
## AS_HELP_STRING([--with-dyld],

pyconfig.h.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,9 +1247,6 @@
12471247
/* Define as the preferred size in bits of long digits */
12481248
#undef PYLONG_BITS_IN_DIGIT
12491249

1250-
/* framework name */
1251-
#undef PYTHONFRAMEWORK
1252-
12531250
/* Define if you want to coerce the C locale to a UTF-8 based locale */
12541251
#undef PY_COERCE_C_LOCALE
12551252

@@ -1464,6 +1461,9 @@
14641461
/* Define if you have POSIX threads, and your system does not define that. */
14651462
#undef _POSIX_THREADS
14661463

1464+
/* framework name */
1465+
#undef _PYTHONFRAMEWORK
1466+
14671467
/* Define to force use of thread-safe errno, h_errno, and other functions */
14681468
#undef _REENTRANT
14691469

0 commit comments

Comments
 (0)