summaryrefslogtreecommitdiff
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-10 09:53:09 +0100
committerGitHub <noreply@github.com>2020-03-10 09:53:09 +0100
commit8510f430781118d9b603c3a2f06945d6ebc5fe42 (patch)
tree511cb42b478dd031ff36297a5e0c78b27a4e77a2 /Python/sysmodule.c
parent700cb587303461d5a96456c56902cfdd8ad50e2d (diff)
downloadcpython-git-8510f430781118d9b603c3a2f06945d6ebc5fe42.tar.gz
bpo-1294959: Add sys.platlibdir attribute (GH-18381)
Add --with-platlibdir option to the configure script: name of the platform-specific library directory, stored in the new sys.platlitdir attribute. It is used to build the path of platform-specific dynamic libraries and the path of the standard library. It is equal to "lib" on most platforms. On Fedora and SuSE, it is equal to "lib64" on 64-bit systems. Co-Authored-By: Jan Matějek <jmatejek@suse.com> Co-Authored-By: Matěj Cepl <mcepl@cepl.eu> Co-Authored-By: Charalampos Stratakis <cstratak@redhat.com>
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index f086514a03..2a8d12c03c 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -2739,8 +2739,6 @@ err_occurred:
return _PyStatus_ERR("can't initialize sys module");
}
-#undef SET_SYS_FROM_STRING
-
/* Updating the sys namespace, returning integer error codes */
#define SET_SYS_FROM_STRING_INT_RESULT(key, value) \
do { \
@@ -2844,6 +2842,13 @@ _PySys_InitMain(PyThreadState *tstate)
SET_SYS_FROM_WSTR("base_prefix", config->base_prefix);
SET_SYS_FROM_WSTR("exec_prefix", config->exec_prefix);
SET_SYS_FROM_WSTR("base_exec_prefix", config->base_exec_prefix);
+ {
+ PyObject *str = PyUnicode_FromString(PLATLIBDIR);
+ if (str == NULL) {
+ return -1;
+ }
+ SET_SYS_FROM_STRING("platlibdir", str);
+ }
if (config->pycache_prefix != NULL) {
SET_SYS_FROM_WSTR("pycache_prefix", config->pycache_prefix);
@@ -2864,6 +2869,7 @@ _PySys_InitMain(PyThreadState *tstate)
#undef COPY_LIST
#undef SET_SYS_FROM_WSTR
+
/* Set flags to their final values */
SET_SYS_FROM_STRING_INT_RESULT("flags", make_flags(tstate));
/* prevent user from creating new instances */
@@ -2897,6 +2903,7 @@ err_occurred:
return -1;
}
+#undef SET_SYS_FROM_STRING
#undef SET_SYS_FROM_STRING_BORROW
#undef SET_SYS_FROM_STRING_INT_RESULT