Merge from python37, update to 3.7.0rc1
This commit is contained in:
commit
cb1167a878
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
/*.tar.*
|
/*.tar.*
|
||||||
|
/*.src.rpm
|
||||||
|
/results_python3*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
|
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
|
||||||
index 9474e9c..c0ce4c6 100644
|
index 0258d3d..4b969bf 100644
|
||||||
--- a/Lib/distutils/command/install.py
|
--- a/Lib/distutils/command/install.py
|
||||||
+++ b/Lib/distutils/command/install.py
|
+++ b/Lib/distutils/command/install.py
|
||||||
@@ -30,14 +30,14 @@ WINDOWS_SCHEME = {
|
@@ -30,14 +30,14 @@ WINDOWS_SCHEME = {
|
||||||
@ -20,10 +20,10 @@ index 9474e9c..c0ce4c6 100644
|
|||||||
'scripts': '$base/bin',
|
'scripts': '$base/bin',
|
||||||
'data' : '$base',
|
'data' : '$base',
|
||||||
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
|
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
|
||||||
index 026cca7..6d3e077 100644
|
index e07a6c8..554740d 100644
|
||||||
--- a/Lib/distutils/sysconfig.py
|
--- a/Lib/distutils/sysconfig.py
|
||||||
+++ b/Lib/distutils/sysconfig.py
|
+++ b/Lib/distutils/sysconfig.py
|
||||||
@@ -132,8 +132,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
|
@@ -129,8 +129,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
|
||||||
prefix = plat_specific and EXEC_PREFIX or PREFIX
|
prefix = plat_specific and EXEC_PREFIX or PREFIX
|
||||||
|
|
||||||
if os.name == "posix":
|
if os.name == "posix":
|
||||||
@ -37,10 +37,11 @@ index 026cca7..6d3e077 100644
|
|||||||
if standard_lib:
|
if standard_lib:
|
||||||
return libpython
|
return libpython
|
||||||
else:
|
else:
|
||||||
diff a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py
|
diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py
|
||||||
|
index 287ab19..d4c05e0 100644
|
||||||
--- a/Lib/distutils/tests/test_install.py
|
--- a/Lib/distutils/tests/test_install.py
|
||||||
+++ b/Lib/distutils/tests/test_install.py
|
+++ b/Lib/distutils/tests/test_install.py
|
||||||
@@ -57,8 +57,9 @@
|
@@ -57,8 +57,9 @@ class InstallTestCase(support.TempdirManager,
|
||||||
self.assertEqual(got, expected)
|
self.assertEqual(got, expected)
|
||||||
|
|
||||||
libdir = os.path.join(destination, "lib", "python")
|
libdir = os.path.join(destination, "lib", "python")
|
||||||
@ -52,10 +53,10 @@ diff a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py
|
|||||||
check_path(cmd.install_headers,
|
check_path(cmd.install_headers,
|
||||||
os.path.join(destination, "include", "python", "foopkg"))
|
os.path.join(destination, "include", "python", "foopkg"))
|
||||||
diff --git a/Lib/site.py b/Lib/site.py
|
diff --git a/Lib/site.py b/Lib/site.py
|
||||||
index a84e3bb..ba0d3ea 100644
|
index 7dc1b04..85016b4 100644
|
||||||
--- a/Lib/site.py
|
--- a/Lib/site.py
|
||||||
+++ b/Lib/site.py
|
+++ b/Lib/site.py
|
||||||
@@ -303,11 +303,15 @@ def getsitepackages(prefixes=None):
|
@@ -334,11 +334,15 @@ def getsitepackages(prefixes=None):
|
||||||
seen.add(prefix)
|
seen.add(prefix)
|
||||||
|
|
||||||
if os.sep == '/':
|
if os.sep == '/':
|
||||||
@ -69,10 +70,10 @@ index a84e3bb..ba0d3ea 100644
|
|||||||
sitepackages.append(prefix)
|
sitepackages.append(prefix)
|
||||||
+ sitepackages.append(os.path.join(prefix, "lib64", "site-packages"))
|
+ sitepackages.append(os.path.join(prefix, "lib64", "site-packages"))
|
||||||
sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
|
sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
|
||||||
if sys.platform == "darwin":
|
return sitepackages
|
||||||
# for framework builds *only* we add the standard Apple
|
|
||||||
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
|
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
|
||||||
index b9bbfe5..2a5f29c 100644
|
index 9ee4d31..53c8606 100644
|
||||||
--- a/Lib/sysconfig.py
|
--- a/Lib/sysconfig.py
|
||||||
+++ b/Lib/sysconfig.py
|
+++ b/Lib/sysconfig.py
|
||||||
@@ -20,10 +20,10 @@ __all__ = [
|
@@ -20,10 +20,10 @@ __all__ = [
|
||||||
@ -89,7 +90,7 @@ index b9bbfe5..2a5f29c 100644
|
|||||||
'include':
|
'include':
|
||||||
'{installed_base}/include/python{py_version_short}{abiflags}',
|
'{installed_base}/include/python{py_version_short}{abiflags}',
|
||||||
'platinclude':
|
'platinclude':
|
||||||
@@ -61,10 +61,10 @@ _INSTALL_SCHEMES = {
|
@@ -62,10 +62,10 @@ _INSTALL_SCHEMES = {
|
||||||
'data': '{userbase}',
|
'data': '{userbase}',
|
||||||
},
|
},
|
||||||
'posix_user': {
|
'posix_user': {
|
||||||
@ -104,13 +105,13 @@ index b9bbfe5..2a5f29c 100644
|
|||||||
'scripts': '{userbase}/bin',
|
'scripts': '{userbase}/bin',
|
||||||
'data': '{userbase}',
|
'data': '{userbase}',
|
||||||
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
|
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
|
||||||
index f698927..bc977b5 100644
|
index 266adf0..e8513b6 100644
|
||||||
--- a/Lib/test/test_site.py
|
--- a/Lib/test/test_site.py
|
||||||
+++ b/Lib/test/test_site.py
|
+++ b/Lib/test/test_site.py
|
||||||
@@ -248,8 +248,8 @@ class HelperFunctionsTests(unittest.TestCase):
|
@@ -275,8 +275,8 @@ class HelperFunctionsTests(unittest.TestCase):
|
||||||
self.assertEqual(dirs[1], wanted)
|
dirs = site.getsitepackages()
|
||||||
elif os.sep == '/':
|
if os.sep == '/':
|
||||||
# OS X non-framework builds, Linux, FreeBSD, etc
|
# OS X, Linux, FreeBSD, etc
|
||||||
- self.assertEqual(len(dirs), 1)
|
- self.assertEqual(len(dirs), 1)
|
||||||
- wanted = os.path.join('xoxo', 'lib',
|
- wanted = os.path.join('xoxo', 'lib',
|
||||||
+ self.assertEqual(len(dirs), 2)
|
+ self.assertEqual(len(dirs), 2)
|
||||||
@ -119,10 +120,10 @@ index f698927..bc977b5 100644
|
|||||||
'site-packages')
|
'site-packages')
|
||||||
self.assertEqual(dirs[0], wanted)
|
self.assertEqual(dirs[0], wanted)
|
||||||
diff --git a/Makefile.pre.in b/Makefile.pre.in
|
diff --git a/Makefile.pre.in b/Makefile.pre.in
|
||||||
index 8fa7934..a693917 100644
|
index 59ba9d4..5780ed8 100644
|
||||||
--- a/Makefile.pre.in
|
--- a/Makefile.pre.in
|
||||||
+++ b/Makefile.pre.in
|
+++ b/Makefile.pre.in
|
||||||
@@ -126,7 +126,7 @@ LIBDIR= @libdir@
|
@@ -133,7 +133,7 @@ LIBDIR= @libdir@
|
||||||
MANDIR= @mandir@
|
MANDIR= @mandir@
|
||||||
INCLUDEDIR= @includedir@
|
INCLUDEDIR= @includedir@
|
||||||
CONFINCLUDEDIR= $(exec_prefix)/include
|
CONFINCLUDEDIR= $(exec_prefix)/include
|
||||||
@ -132,41 +133,41 @@ index 8fa7934..a693917 100644
|
|||||||
|
|
||||||
# Detailed destination directories
|
# Detailed destination directories
|
||||||
diff --git a/Modules/getpath.c b/Modules/getpath.c
|
diff --git a/Modules/getpath.c b/Modules/getpath.c
|
||||||
index 65b47a3..eaa756c 100644
|
index 85e737b..2a1fc79 100644
|
||||||
--- a/Modules/getpath.c
|
--- a/Modules/getpath.c
|
||||||
+++ b/Modules/getpath.c
|
+++ b/Modules/getpath.c
|
||||||
@@ -494,7 +494,7 @@ calculate_path(void)
|
@@ -500,7 +500,7 @@ calculate_exec_prefix(const _PyCoreConfig *core_config,
|
||||||
_pythonpath = Py_DecodeLocale(PYTHONPATH, NULL);
|
|
||||||
_prefix = Py_DecodeLocale(PREFIX, NULL);
|
|
||||||
_exec_prefix = Py_DecodeLocale(EXEC_PREFIX, NULL);
|
|
||||||
- lib_python = Py_DecodeLocale("lib/python" VERSION, NULL);
|
|
||||||
+ lib_python = Py_DecodeLocale("lib64/python" VERSION, NULL);
|
|
||||||
|
|
||||||
if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) {
|
|
||||||
Py_FatalError(
|
|
||||||
@@ -683,7 +683,7 @@ calculate_path(void)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
wcsncpy(zip_path, _prefix, MAXPATHLEN);
|
|
||||||
- joinpath(zip_path, L"lib/python00.zip");
|
|
||||||
+ joinpath(zip_path, L"lib64/python00.zip");
|
|
||||||
bufsz = wcslen(zip_path); /* Replace "00" with version */
|
|
||||||
zip_path[bufsz - 6] = VERSION[0];
|
|
||||||
zip_path[bufsz - 5] = VERSION[2];
|
|
||||||
@@ -695,7 +695,7 @@ calculate_path(void)
|
|
||||||
fprintf(stderr,
|
|
||||||
"Could not find platform dependent libraries <exec_prefix>\n");
|
"Could not find platform dependent libraries <exec_prefix>\n");
|
||||||
wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN);
|
}
|
||||||
|
wcsncpy(exec_prefix, calculate->exec_prefix, MAXPATHLEN);
|
||||||
- joinpath(exec_prefix, L"lib/lib-dynload");
|
- joinpath(exec_prefix, L"lib/lib-dynload");
|
||||||
+ joinpath(exec_prefix, L"lib64/lib-dynload");
|
+ joinpath(exec_prefix, L"lib64/lib-dynload");
|
||||||
}
|
}
|
||||||
/* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */
|
/* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */
|
||||||
|
}
|
||||||
|
@@ -742,7 +742,7 @@ calculate_zip_path(PyCalculatePath *calculate, const wchar_t *prefix)
|
||||||
|
else {
|
||||||
|
wcsncpy(calculate->zip_path, calculate->prefix, MAXPATHLEN);
|
||||||
|
}
|
||||||
|
- joinpath(calculate->zip_path, L"lib/python00.zip");
|
||||||
|
+ joinpath(calculate->zip_path, L"lib64/python00.zip");
|
||||||
|
|
||||||
|
/* Replace "00" with version */
|
||||||
|
size_t bufsz = wcslen(calculate->zip_path);
|
||||||
|
@@ -867,7 +867,7 @@ calculate_init(PyCalculatePath *calculate,
|
||||||
|
if (!calculate->prefix) {
|
||||||
|
return DECODE_LOCALE_ERR("EXEC_PREFIX define", len);
|
||||||
|
}
|
||||||
|
- calculate->lib_python = Py_DecodeLocale("lib/python" VERSION, &len);
|
||||||
|
+ calculate->lib_python = Py_DecodeLocale("lib64/python" VERSION, &len);
|
||||||
|
if (!calculate->lib_python) {
|
||||||
|
return DECODE_LOCALE_ERR("EXEC_PREFIX define", len);
|
||||||
|
}
|
||||||
diff --git a/setup.py b/setup.py
|
diff --git a/setup.py b/setup.py
|
||||||
index 0f2dfc4..da37896 100644
|
index f1933f7..450cd8a 100644
|
||||||
--- a/setup.py
|
--- a/setup.py
|
||||||
+++ b/setup.py
|
+++ b/setup.py
|
||||||
@@ -492,7 +492,7 @@ class PyBuildExt(build_ext):
|
@@ -531,7 +531,7 @@ class PyBuildExt(build_ext):
|
||||||
# directories (i.e. '.' and 'Include') must be first. See issue
|
# directories (i.e. '.' and 'Include') must be first. See issue
|
||||||
# 10520.
|
# 10520.
|
||||||
if not cross_compiling:
|
if not cross_compiling:
|
||||||
@ -175,7 +176,7 @@ index 0f2dfc4..da37896 100644
|
|||||||
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
||||||
# only change this for cross builds for 3.3, issues on Mageia
|
# only change this for cross builds for 3.3, issues on Mageia
|
||||||
if cross_compiling:
|
if cross_compiling:
|
||||||
@@ -780,11 +780,11 @@ class PyBuildExt(build_ext):
|
@@ -830,11 +830,11 @@ class PyBuildExt(build_ext):
|
||||||
elif curses_library:
|
elif curses_library:
|
||||||
readline_libs.append(curses_library)
|
readline_libs.append(curses_library)
|
||||||
elif self.compiler.find_library_file(lib_dirs +
|
elif self.compiler.find_library_file(lib_dirs +
|
||||||
@ -189,14 +190,3 @@ index 0f2dfc4..da37896 100644
|
|||||||
extra_link_args=readline_extra_link_args,
|
extra_link_args=readline_extra_link_args,
|
||||||
libraries=readline_libs) )
|
libraries=readline_libs) )
|
||||||
else:
|
else:
|
||||||
@@ -821,8 +821,8 @@ class PyBuildExt(build_ext):
|
|
||||||
if krb5_h:
|
|
||||||
ssl_incs += krb5_h
|
|
||||||
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
|
|
||||||
- ['/usr/local/ssl/lib',
|
|
||||||
- '/usr/contrib/ssl/lib/'
|
|
||||||
+ ['/usr/local/ssl/lib64',
|
|
||||||
+ '/usr/contrib/ssl/lib64/'
|
|
||||||
] )
|
|
||||||
|
|
||||||
if (ssl_incs is not None and
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
diff --git a/Makefile.pre.in b/Makefile.pre.in
|
diff --git a/Makefile.pre.in b/Makefile.pre.in
|
||||||
index 4b093e3..1088435 100644
|
index 0eddd13..7ed4f3c 100644
|
||||||
--- a/Makefile.pre.in
|
--- a/Makefile.pre.in
|
||||||
+++ b/Makefile.pre.in
|
+++ b/Makefile.pre.in
|
||||||
@@ -543,7 +543,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
|
@@ -565,7 +565,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
|
||||||
$(PYTHON_FOR_REGEN) ./Tools/clinic/clinic.py --make
|
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)
|
||||||
|
|
||||||
# Build the interpreter
|
# Build the interpreter
|
||||||
-$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
|
-$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
|
||||||
@ -11,26 +11,20 @@ index 4b093e3..1088435 100644
|
|||||||
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
|
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
|
||||||
|
|
||||||
platform: $(BUILDPYTHON) pybuilddir.txt
|
platform: $(BUILDPYTHON) pybuilddir.txt
|
||||||
@@ -588,18 +588,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
|
@@ -609,12 +609,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
|
||||||
|
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
|
||||||
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
|
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
|
||||||
|
|
||||||
|
-
|
||||||
-# Build static library
|
-# Build static library
|
||||||
-# avoid long command lines, same as LIBRARY_OBJS
|
|
||||||
-$(LIBRARY): $(LIBRARY_OBJS)
|
-$(LIBRARY): $(LIBRARY_OBJS)
|
||||||
- -rm -f $@
|
- -rm -f $@
|
||||||
- $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
|
- $(AR) $(ARFLAGS) $@ $(LIBRARY_OBJS)
|
||||||
- $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
|
|
||||||
- $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
|
|
||||||
- $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) Python/frozen.o
|
|
||||||
- $(AR) $(ARFLAGS) $@ $(MODULE_OBJS)
|
|
||||||
- $(AR) $(ARFLAGS) $@ $(MODOBJS)
|
|
||||||
- $(RANLIB) $@
|
|
||||||
-
|
-
|
||||||
libpython$(LDVERSION).so: $(LIBRARY_OBJS)
|
libpython$(LDVERSION).so: $(LIBRARY_OBJS)
|
||||||
if test $(INSTSONAME) != $(LDLIBRARY); then \
|
if test $(INSTSONAME) != $(LDLIBRARY); then \
|
||||||
$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
||||||
@@ -689,7 +677,7 @@ Modules/Setup: $(srcdir)/Modules/Setup.dist
|
@@ -702,7 +696,7 @@ Modules/Setup: $(srcdir)/Modules/Setup.dist
|
||||||
echo "-----------------------------------------------"; \
|
echo "-----------------------------------------------"; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -39,7 +33,7 @@ index 4b093e3..1088435 100644
|
|||||||
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
|
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
@@ -1425,18 +1413,6 @@ libainstall: @DEF_MAKE_RULE@ python-config
|
@@ -1460,17 +1454,6 @@ libainstall: @DEF_MAKE_RULE@ python-config
|
||||||
else true; \
|
else true; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
@ -49,7 +43,6 @@ index 4b093e3..1088435 100644
|
|||||||
- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
|
- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
|
||||||
- else \
|
- else \
|
||||||
- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
|
- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
|
||||||
- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
|
|
||||||
- fi; \
|
- fi; \
|
||||||
- else \
|
- else \
|
||||||
- echo Skip install of $(LIBRARY) - use make frameworkinstall; \
|
- echo Skip install of $(LIBRARY) - use make frameworkinstall; \
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
diff --git a/Include/object.h b/Include/object.h
|
diff --git a/Include/object.h b/Include/object.h
|
||||||
index 0c88603..e3413e8 100644
|
index c772dea..5729797 100644
|
||||||
--- a/Include/object.h
|
--- a/Include/object.h
|
||||||
+++ b/Include/object.h
|
+++ b/Include/object.h
|
||||||
@@ -1059,6 +1059,49 @@ PyAPI_FUNC(void)
|
@@ -1098,6 +1098,49 @@ PyAPI_FUNC(void)
|
||||||
_PyObject_DebugTypeStats(FILE *out);
|
_PyObject_DebugTypeStats(FILE *out);
|
||||||
#endif /* ifndef Py_LIMITED_API */
|
#endif /* ifndef Py_LIMITED_API */
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ index 0c88603..e3413e8 100644
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
|
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
|
||||||
index e727499..6efcafb 100644
|
index 904fc7d..288e242 100644
|
||||||
--- a/Lib/test/test_gc.py
|
--- a/Lib/test/test_gc.py
|
||||||
+++ b/Lib/test/test_gc.py
|
+++ b/Lib/test/test_gc.py
|
||||||
@@ -1,10 +1,11 @@
|
@@ -1,10 +1,11 @@
|
||||||
@ -69,7 +69,7 @@ index e727499..6efcafb 100644
|
|||||||
import time
|
import time
|
||||||
import gc
|
import gc
|
||||||
import weakref
|
import weakref
|
||||||
@@ -50,6 +51,8 @@ class GC_Detector(object):
|
@@ -46,6 +47,8 @@ class GC_Detector(object):
|
||||||
# gc collects it.
|
# gc collects it.
|
||||||
self.wr = weakref.ref(C1055820(666), it_happened)
|
self.wr = weakref.ref(C1055820(666), it_happened)
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ index e727499..6efcafb 100644
|
|||||||
@with_tp_del
|
@with_tp_del
|
||||||
class Uncollectable(object):
|
class Uncollectable(object):
|
||||||
"""Create a reference cycle with multiple __del__ methods.
|
"""Create a reference cycle with multiple __del__ methods.
|
||||||
@@ -862,6 +865,50 @@ class GCCallbackTests(unittest.TestCase):
|
@@ -863,6 +866,50 @@ class GCCallbackTests(unittest.TestCase):
|
||||||
self.assertEqual(len(gc.garbage), 0)
|
self.assertEqual(len(gc.garbage), 0)
|
||||||
|
|
||||||
|
|
||||||
@ -130,10 +130,10 @@ index e727499..6efcafb 100644
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
gc.enable()
|
gc.enable()
|
||||||
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
|
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
|
||||||
index 0c6f444..87edd5a 100644
|
index 8ba1093..e795308 100644
|
||||||
--- a/Modules/gcmodule.c
|
--- a/Modules/gcmodule.c
|
||||||
+++ b/Modules/gcmodule.c
|
+++ b/Modules/gcmodule.c
|
||||||
@@ -341,7 +341,8 @@ update_refs(PyGC_Head *containers)
|
@@ -239,7 +239,8 @@ update_refs(PyGC_Head *containers)
|
||||||
{
|
{
|
||||||
PyGC_Head *gc = containers->gc.gc_next;
|
PyGC_Head *gc = containers->gc.gc_next;
|
||||||
for (; gc != containers; gc = gc->gc.gc_next) {
|
for (; gc != containers; gc = gc->gc.gc_next) {
|
||||||
@ -143,7 +143,7 @@ index 0c6f444..87edd5a 100644
|
|||||||
_PyGCHead_SET_REFS(gc, Py_REFCNT(FROM_GC(gc)));
|
_PyGCHead_SET_REFS(gc, Py_REFCNT(FROM_GC(gc)));
|
||||||
/* Python's cyclic gc should never see an incoming refcount
|
/* Python's cyclic gc should never see an incoming refcount
|
||||||
* of 0: if something decref'ed to 0, it should have been
|
* of 0: if something decref'ed to 0, it should have been
|
||||||
@@ -361,7 +362,8 @@ update_refs(PyGC_Head *containers)
|
@@ -259,7 +260,8 @@ update_refs(PyGC_Head *containers)
|
||||||
* so serious that maybe this should be a release-build
|
* so serious that maybe this should be a release-build
|
||||||
* check instead of an assert?
|
* check instead of an assert?
|
||||||
*/
|
*/
|
||||||
@ -153,7 +153,7 @@ index 0c6f444..87edd5a 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +378,9 @@ visit_decref(PyObject *op, void *data)
|
@@ -274,7 +276,9 @@ visit_decref(PyObject *op, void *data)
|
||||||
* generation being collected, which can be recognized
|
* generation being collected, which can be recognized
|
||||||
* because only they have positive gc_refs.
|
* because only they have positive gc_refs.
|
||||||
*/
|
*/
|
||||||
@ -164,7 +164,7 @@ index 0c6f444..87edd5a 100644
|
|||||||
if (_PyGCHead_REFS(gc) > 0)
|
if (_PyGCHead_REFS(gc) > 0)
|
||||||
_PyGCHead_DECREF(gc);
|
_PyGCHead_DECREF(gc);
|
||||||
}
|
}
|
||||||
@@ -436,9 +440,10 @@ visit_reachable(PyObject *op, PyGC_Head *reachable)
|
@@ -334,9 +338,10 @@ visit_reachable(PyObject *op, PyGC_Head *reachable)
|
||||||
* If gc_refs == GC_UNTRACKED, it must be ignored.
|
* If gc_refs == GC_UNTRACKED, it must be ignored.
|
||||||
*/
|
*/
|
||||||
else {
|
else {
|
||||||
@ -178,7 +178,7 @@ index 0c6f444..87edd5a 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -480,7 +485,7 @@ move_unreachable(PyGC_Head *young, PyGC_Head *unreachable)
|
@@ -378,7 +383,7 @@ move_unreachable(PyGC_Head *young, PyGC_Head *unreachable)
|
||||||
*/
|
*/
|
||||||
PyObject *op = FROM_GC(gc);
|
PyObject *op = FROM_GC(gc);
|
||||||
traverseproc traverse = Py_TYPE(op)->tp_traverse;
|
traverseproc traverse = Py_TYPE(op)->tp_traverse;
|
||||||
@ -187,7 +187,7 @@ index 0c6f444..87edd5a 100644
|
|||||||
_PyGCHead_SET_REFS(gc, GC_REACHABLE);
|
_PyGCHead_SET_REFS(gc, GC_REACHABLE);
|
||||||
(void) traverse(op,
|
(void) traverse(op,
|
||||||
(visitproc)visit_reachable,
|
(visitproc)visit_reachable,
|
||||||
@@ -543,7 +548,7 @@ move_legacy_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers)
|
@@ -441,7 +446,7 @@ move_legacy_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers)
|
||||||
for (gc = unreachable->gc.gc_next; gc != unreachable; gc = next) {
|
for (gc = unreachable->gc.gc_next; gc != unreachable; gc = next) {
|
||||||
PyObject *op = FROM_GC(gc);
|
PyObject *op = FROM_GC(gc);
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ index 0c6f444..87edd5a 100644
|
|||||||
next = gc->gc.gc_next;
|
next = gc->gc.gc_next;
|
||||||
|
|
||||||
if (has_legacy_finalizer(op)) {
|
if (has_legacy_finalizer(op)) {
|
||||||
@@ -619,7 +624,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
@@ -517,7 +522,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
||||||
PyWeakReference **wrlist;
|
PyWeakReference **wrlist;
|
||||||
|
|
||||||
op = FROM_GC(gc);
|
op = FROM_GC(gc);
|
||||||
@ -205,7 +205,7 @@ index 0c6f444..87edd5a 100644
|
|||||||
next = gc->gc.gc_next;
|
next = gc->gc.gc_next;
|
||||||
|
|
||||||
if (! PyType_SUPPORTS_WEAKREFS(Py_TYPE(op)))
|
if (! PyType_SUPPORTS_WEAKREFS(Py_TYPE(op)))
|
||||||
@@ -640,9 +645,9 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
@@ -538,9 +543,9 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
||||||
* the callback pointer intact. Obscure: it also
|
* the callback pointer intact. Obscure: it also
|
||||||
* changes *wrlist.
|
* changes *wrlist.
|
||||||
*/
|
*/
|
||||||
@ -217,7 +217,7 @@ index 0c6f444..87edd5a 100644
|
|||||||
if (wr->wr_callback == NULL)
|
if (wr->wr_callback == NULL)
|
||||||
continue; /* no callback */
|
continue; /* no callback */
|
||||||
|
|
||||||
@@ -676,7 +681,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
@@ -574,7 +579,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
||||||
*/
|
*/
|
||||||
if (IS_TENTATIVELY_UNREACHABLE(wr))
|
if (IS_TENTATIVELY_UNREACHABLE(wr))
|
||||||
continue;
|
continue;
|
||||||
@ -226,7 +226,7 @@ index 0c6f444..87edd5a 100644
|
|||||||
|
|
||||||
/* Create a new reference so that wr can't go away
|
/* Create a new reference so that wr can't go away
|
||||||
* before we can process it again.
|
* before we can process it again.
|
||||||
@@ -685,7 +690,8 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
@@ -583,7 +588,8 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
||||||
|
|
||||||
/* Move wr to wrcb_to_call, for the next pass. */
|
/* Move wr to wrcb_to_call, for the next pass. */
|
||||||
wrasgc = AS_GC(wr);
|
wrasgc = AS_GC(wr);
|
||||||
@ -236,7 +236,7 @@ index 0c6f444..87edd5a 100644
|
|||||||
next isn't, so they can't
|
next isn't, so they can't
|
||||||
be the same */
|
be the same */
|
||||||
gc_list_move(wrasgc, &wrcb_to_call);
|
gc_list_move(wrasgc, &wrcb_to_call);
|
||||||
@@ -701,11 +707,11 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
@@ -599,11 +605,11 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
||||||
|
|
||||||
gc = wrcb_to_call.gc.gc_next;
|
gc = wrcb_to_call.gc.gc_next;
|
||||||
op = FROM_GC(gc);
|
op = FROM_GC(gc);
|
||||||
@ -251,7 +251,7 @@ index 0c6f444..87edd5a 100644
|
|||||||
|
|
||||||
/* copy-paste of weakrefobject.c's handle_callback() */
|
/* copy-paste of weakrefobject.c's handle_callback() */
|
||||||
temp = PyObject_CallFunctionObjArgs(callback, wr, NULL);
|
temp = PyObject_CallFunctionObjArgs(callback, wr, NULL);
|
||||||
@@ -822,12 +828,14 @@ check_garbage(PyGC_Head *collectable)
|
@@ -720,12 +726,14 @@ check_garbage(PyGC_Head *collectable)
|
||||||
for (gc = collectable->gc.gc_next; gc != collectable;
|
for (gc = collectable->gc.gc_next; gc != collectable;
|
||||||
gc = gc->gc.gc_next) {
|
gc = gc->gc.gc_next) {
|
||||||
_PyGCHead_SET_REFS(gc, Py_REFCNT(FROM_GC(gc)));
|
_PyGCHead_SET_REFS(gc, Py_REFCNT(FROM_GC(gc)));
|
||||||
@ -269,11 +269,11 @@ index 0c6f444..87edd5a 100644
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
diff --git a/Objects/object.c b/Objects/object.c
|
diff --git a/Objects/object.c b/Objects/object.c
|
||||||
index 559794f..a47d47f 100644
|
index 220aa90..f6c7161 100644
|
||||||
--- a/Objects/object.c
|
--- a/Objects/object.c
|
||||||
+++ b/Objects/object.c
|
+++ b/Objects/object.c
|
||||||
@@ -2022,6 +2022,35 @@ _PyTrash_thread_destroy_chain(void)
|
@@ -2177,6 +2177,35 @@ _PyTrash_thread_destroy_chain(void)
|
||||||
}
|
--tstate->trash_delete_nesting;
|
||||||
}
|
}
|
||||||
|
|
||||||
+PyAPI_FUNC(void)
|
+PyAPI_FUNC(void)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py
|
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py
|
||||||
index d69e09f..5cb12df 100644
|
index 7ff938b..8c3d062 100644
|
||||||
--- a/Lib/ensurepip/__init__.py
|
--- a/Lib/ensurepip/__init__.py
|
||||||
+++ b/Lib/ensurepip/__init__.py
|
+++ b/Lib/ensurepip/__init__.py
|
||||||
@@ -1,8 +1,10 @@
|
@@ -1,8 +1,10 @@
|
||||||
@ -13,16 +13,25 @@ index d69e09f..5cb12df 100644
|
|||||||
|
|
||||||
|
|
||||||
__all__ = ["version", "bootstrap"]
|
__all__ = ["version", "bootstrap"]
|
||||||
@@ -25,6 +27,8 @@ def _run_pip(args, additional_paths=None):
|
@@ -24,8 +26,15 @@ def _run_pip(args, additional_paths=None):
|
||||||
|
sys.path = additional_paths + sys.path
|
||||||
|
|
||||||
# Install the bundled software
|
# Install the bundled software
|
||||||
import pip
|
- import pip._internal
|
||||||
|
- return pip._internal.main(args)
|
||||||
|
+ try:
|
||||||
|
+ # pip 10
|
||||||
|
+ from pip._internal import main
|
||||||
|
+ except ImportError:
|
||||||
|
+ # pip 9
|
||||||
|
+ from pip import main
|
||||||
+ if args[0] in ["install", "list", "wheel"]:
|
+ if args[0] in ["install", "list", "wheel"]:
|
||||||
+ args.append('--pre')
|
+ args.append('--pre')
|
||||||
return pip.main(args)
|
+ return main(args)
|
||||||
|
|
||||||
|
|
||||||
@@ -88,20 +92,39 @@ def _bootstrap(*, root=None, upgrade=False, user=False,
|
def version():
|
||||||
|
@@ -88,20 +97,39 @@ def _bootstrap(*, root=None, upgrade=False, user=False,
|
||||||
# omit pip and easy_install
|
# omit pip and easy_install
|
||||||
os.environ["ENSUREPIP_OPTIONS"] = "install"
|
os.environ["ENSUREPIP_OPTIONS"] = "install"
|
||||||
|
|
||||||
@ -72,9 +81,11 @@ index d69e09f..5cb12df 100644
|
|||||||
|
|
||||||
# Construct the arguments to be passed to the pip command
|
# Construct the arguments to be passed to the pip command
|
||||||
args = ["install", "--no-index", "--find-links", tmpdir]
|
args = ["install", "--no-index", "--find-links", tmpdir]
|
||||||
diff -Nur Python-3.4.1/Lib/ensurepip/rewheel/__init__.py Python-3.4.1-rewheel/Lib/ensurepip/rewheel/__init__.py
|
diff --git a/Lib/ensurepip/rewheel/__init__.py b/Lib/ensurepip/rewheel/__init__.py
|
||||||
--- Python-3.4.1/Lib/ensurepip/rewheel/__init__.py 1970-01-01 01:00:00.000000000 +0100
|
new file mode 100644
|
||||||
+++ Python-3.4.1-rewheel/Lib/ensurepip/rewheel/__init__.py 2014-08-21 10:11:22.560320121 +0200
|
index 0000000..753c764
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/Lib/ensurepip/rewheel/__init__.py
|
||||||
@@ -0,0 +1,143 @@
|
@@ -0,0 +1,143 @@
|
||||||
+import argparse
|
+import argparse
|
||||||
+import codecs
|
+import codecs
|
||||||
@ -219,10 +230,11 @@ diff -Nur Python-3.4.1/Lib/ensurepip/rewheel/__init__.py Python-3.4.1-rewheel/Li
|
|||||||
+ else:
|
+ else:
|
||||||
+ pass # bad RECORD or empty line
|
+ pass # bad RECORD or empty line
|
||||||
+ return to_write, to_omit
|
+ return to_write, to_omit
|
||||||
diff -Nur Python-3.4.1/Makefile.pre.in Python-3.4.1-rewheel/Makefile.pre.in
|
diff --git a/Makefile.pre.in b/Makefile.pre.in
|
||||||
--- Python-3.4.1/Makefile.pre.in 2014-08-21 10:49:31.512695040 +0200
|
index d07b312..1c6720e 100644
|
||||||
+++ Python-3.4.1-rewheel/Makefile.pre.in 2014-08-21 10:10:41.961341722 +0200
|
--- a/Makefile.pre.in
|
||||||
@@ -1145,7 +1145,7 @@
|
+++ b/Makefile.pre.in
|
||||||
|
@@ -1301,7 +1301,7 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
|
||||||
test/test_asyncio \
|
test/test_asyncio \
|
||||||
collections concurrent concurrent/futures encodings \
|
collections concurrent concurrent/futures encodings \
|
||||||
email email/mime test/test_email test/test_email/data \
|
email email/mime test/test_email test/test_email/data \
|
||||||
|
@ -1,940 +0,0 @@
|
|||||||
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst
|
|
||||||
index 9ffb714..3f7201a 100644
|
|
||||||
--- a/Doc/using/cmdline.rst
|
|
||||||
+++ b/Doc/using/cmdline.rst
|
|
||||||
@@ -711,6 +711,45 @@ conflict.
|
|
||||||
|
|
||||||
.. versionadded:: 3.6
|
|
||||||
|
|
||||||
+
|
|
||||||
+.. envvar:: PYTHONCOERCECLOCALE
|
|
||||||
+
|
|
||||||
+ If set to the value ``0``, causes the main Python command line application
|
|
||||||
+ to skip coercing the legacy ASCII-based C locale to a more capable UTF-8
|
|
||||||
+ based alternative. Note that this setting is checked even when the
|
|
||||||
+ :option:`-E` or :option:`-I` options are used, as it is handled prior to
|
|
||||||
+ the processing of command line options.
|
|
||||||
+
|
|
||||||
+ If this variable is *not* set, or is set to a value other than ``0``, and
|
|
||||||
+ the current locale reported for the ``LC_CTYPE`` category is the default
|
|
||||||
+ ``C`` locale, then the Python CLI will attempt to configure one of the
|
|
||||||
+ following locales for the given locale categories before loading the
|
|
||||||
+ interpreter runtime:
|
|
||||||
+
|
|
||||||
+ * ``C.UTF-8`` (``LC_ALL``)
|
|
||||||
+ * ``C.utf8`` (``LC_ALL``)
|
|
||||||
+ * ``UTF-8`` (``LC_CTYPE``)
|
|
||||||
+
|
|
||||||
+ If setting one of these locale categories succeeds, then the matching
|
|
||||||
+ environment variables will be set (both ``LC_ALL`` and ``LANG`` for the
|
|
||||||
+ ``LC_ALL`` category, and ``LC_CTYPE`` for the ``LC_CTYPE`` category) in
|
|
||||||
+ the current process environment before the Python runtime is initialized.
|
|
||||||
+
|
|
||||||
+ Configuring one of these locales (either explicitly or via the above
|
|
||||||
+ implicit locale coercion) will automatically set the error handler for
|
|
||||||
+ :data:`sys.stdin` and :data:`sys.stdout` to ``surrogateescape``. This
|
|
||||||
+ behavior can be overridden using :envvar:`PYTHONIOENCODING` as usual.
|
|
||||||
+
|
|
||||||
+ For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause
|
|
||||||
+ Python to emit warning messages on ``stderr`` if either the locale coercion
|
|
||||||
+ activates, or else if a locale that *would* have triggered coercion is
|
|
||||||
+ still active when the Python runtime is initialized.
|
|
||||||
+
|
|
||||||
+ Availability: \*nix
|
|
||||||
+
|
|
||||||
+ .. versionadded:: 3.7
|
|
||||||
+ See :pep:`538` for more details.
|
|
||||||
+
|
|
||||||
Debug-mode variables
|
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py
|
|
||||||
index ca5f9c2..7aa460b 100644
|
|
||||||
--- a/Lib/test/support/script_helper.py
|
|
||||||
+++ b/Lib/test/support/script_helper.py
|
|
||||||
@@ -51,8 +51,35 @@ def interpreter_requires_environment():
|
|
||||||
return __cached_interp_requires_environment
|
|
||||||
|
|
||||||
|
|
||||||
-_PythonRunResult = collections.namedtuple("_PythonRunResult",
|
|
||||||
- ("rc", "out", "err"))
|
|
||||||
+class _PythonRunResult(collections.namedtuple("_PythonRunResult",
|
|
||||||
+ ("rc", "out", "err"))):
|
|
||||||
+ """Helper for reporting Python subprocess run results"""
|
|
||||||
+ def fail(self, cmd_line):
|
|
||||||
+ """Provide helpful details about failed subcommand runs"""
|
|
||||||
+ # Limit to 80 lines to ASCII characters
|
|
||||||
+ maxlen = 80 * 100
|
|
||||||
+ out, err = self.out, self.err
|
|
||||||
+ if len(out) > maxlen:
|
|
||||||
+ out = b'(... truncated stdout ...)' + out[-maxlen:]
|
|
||||||
+ if len(err) > maxlen:
|
|
||||||
+ err = b'(... truncated stderr ...)' + err[-maxlen:]
|
|
||||||
+ out = out.decode('ascii', 'replace').rstrip()
|
|
||||||
+ err = err.decode('ascii', 'replace').rstrip()
|
|
||||||
+ raise AssertionError("Process return code is %d\n"
|
|
||||||
+ "command line: %r\n"
|
|
||||||
+ "\n"
|
|
||||||
+ "stdout:\n"
|
|
||||||
+ "---\n"
|
|
||||||
+ "%s\n"
|
|
||||||
+ "---\n"
|
|
||||||
+ "\n"
|
|
||||||
+ "stderr:\n"
|
|
||||||
+ "---\n"
|
|
||||||
+ "%s\n"
|
|
||||||
+ "---"
|
|
||||||
+ % (self.rc, cmd_line,
|
|
||||||
+ out,
|
|
||||||
+ err))
|
|
||||||
|
|
||||||
|
|
||||||
# Executing the interpreter in a subprocess
|
|
||||||
@@ -110,30 +137,7 @@ def run_python_until_end(*args, **env_vars):
|
|
||||||
def _assert_python(expected_success, *args, **env_vars):
|
|
||||||
res, cmd_line = run_python_until_end(*args, **env_vars)
|
|
||||||
if (res.rc and expected_success) or (not res.rc and not expected_success):
|
|
||||||
- # Limit to 80 lines to ASCII characters
|
|
||||||
- maxlen = 80 * 100
|
|
||||||
- out, err = res.out, res.err
|
|
||||||
- if len(out) > maxlen:
|
|
||||||
- out = b'(... truncated stdout ...)' + out[-maxlen:]
|
|
||||||
- if len(err) > maxlen:
|
|
||||||
- err = b'(... truncated stderr ...)' + err[-maxlen:]
|
|
||||||
- out = out.decode('ascii', 'replace').rstrip()
|
|
||||||
- err = err.decode('ascii', 'replace').rstrip()
|
|
||||||
- raise AssertionError("Process return code is %d\n"
|
|
||||||
- "command line: %r\n"
|
|
||||||
- "\n"
|
|
||||||
- "stdout:\n"
|
|
||||||
- "---\n"
|
|
||||||
- "%s\n"
|
|
||||||
- "---\n"
|
|
||||||
- "\n"
|
|
||||||
- "stderr:\n"
|
|
||||||
- "---\n"
|
|
||||||
- "%s\n"
|
|
||||||
- "---"
|
|
||||||
- % (res.rc, cmd_line,
|
|
||||||
- out,
|
|
||||||
- err))
|
|
||||||
+ res.fail(cmd_line)
|
|
||||||
return res
|
|
||||||
|
|
||||||
def assert_python_ok(*args, **env_vars):
|
|
||||||
diff --git a/Lib/test/test_c_locale_coercion.py b/Lib/test/test_c_locale_coercion.py
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..635c98f
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/Lib/test/test_c_locale_coercion.py
|
|
||||||
@@ -0,0 +1,371 @@
|
|
||||||
+# Tests the attempted automatic coercion of the C locale to a UTF-8 locale
|
|
||||||
+
|
|
||||||
+import unittest
|
|
||||||
+import locale
|
|
||||||
+import os
|
|
||||||
+import sys
|
|
||||||
+import sysconfig
|
|
||||||
+import shutil
|
|
||||||
+import subprocess
|
|
||||||
+from collections import namedtuple
|
|
||||||
+
|
|
||||||
+import test.support
|
|
||||||
+from test.support.script_helper import (
|
|
||||||
+ run_python_until_end,
|
|
||||||
+ interpreter_requires_environment,
|
|
||||||
+)
|
|
||||||
+
|
|
||||||
+# Set our expectation for the default encoding used in the C locale
|
|
||||||
+# for the filesystem encoding and the standard streams
|
|
||||||
+
|
|
||||||
+# AIX uses iso8859-1 in the C locale, other *nix platforms use ASCII
|
|
||||||
+if sys.platform.startswith("aix"):
|
|
||||||
+ C_LOCALE_STREAM_ENCODING = "iso8859-1"
|
|
||||||
+else:
|
|
||||||
+ C_LOCALE_STREAM_ENCODING = "ascii"
|
|
||||||
+
|
|
||||||
+# FS encoding is UTF-8 on macOS, other *nix platforms use the locale encoding
|
|
||||||
+if sys.platform == "darwin":
|
|
||||||
+ C_LOCALE_FS_ENCODING = "utf-8"
|
|
||||||
+else:
|
|
||||||
+ C_LOCALE_FS_ENCODING = C_LOCALE_STREAM_ENCODING
|
|
||||||
+
|
|
||||||
+# Note that the above is probably still wrong in some cases, such as:
|
|
||||||
+# * Windows when PYTHONLEGACYWINDOWSFSENCODING is set
|
|
||||||
+# * AIX and any other platforms that use latin-1 in the C locale
|
|
||||||
+#
|
|
||||||
+# Options for dealing with this:
|
|
||||||
+# * Don't set PYTHON_COERCE_C_LOCALE on such platforms (e.g. Windows doesn't)
|
|
||||||
+# * Fix the test expectations to match the actual platform behaviour
|
|
||||||
+
|
|
||||||
+# In order to get the warning messages to match up as expected, the candidate
|
|
||||||
+# order here must much the target locale order in Python/pylifecycle.c
|
|
||||||
+_C_UTF8_LOCALES = ("C.UTF-8", "C.utf8", "UTF-8")
|
|
||||||
+
|
|
||||||
+# There's no reliable cross-platform way of checking locale alias
|
|
||||||
+# lists, so the only way of knowing which of these locales will work
|
|
||||||
+# is to try them with locale.setlocale(). We do that in a subprocess
|
|
||||||
+# to avoid altering the locale of the test runner.
|
|
||||||
+#
|
|
||||||
+# If the relevant locale module attributes exist, and we're not on a platform
|
|
||||||
+# where we expect it to always succeed, we also check that
|
|
||||||
+# `locale.nl_langinfo(locale.CODESET)` works, as if it fails, the interpreter
|
|
||||||
+# will skip locale coercion for that particular target locale
|
|
||||||
+_check_nl_langinfo_CODESET = bool(
|
|
||||||
+ sys.platform not in ("darwin", "linux") and
|
|
||||||
+ hasattr(locale, "nl_langinfo") and
|
|
||||||
+ hasattr(locale, "CODESET")
|
|
||||||
+)
|
|
||||||
+
|
|
||||||
+def _set_locale_in_subprocess(locale_name):
|
|
||||||
+ cmd_fmt = "import locale; print(locale.setlocale(locale.LC_CTYPE, '{}'))"
|
|
||||||
+ if _check_nl_langinfo_CODESET:
|
|
||||||
+ # If there's no valid CODESET, we expect coercion to be skipped
|
|
||||||
+ cmd_fmt += "; import sys; sys.exit(not locale.nl_langinfo(locale.CODESET))"
|
|
||||||
+ cmd = cmd_fmt.format(locale_name)
|
|
||||||
+ result, py_cmd = run_python_until_end("-c", cmd, __isolated=True)
|
|
||||||
+ return result.rc == 0
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+_fields = "fsencoding stdin_info stdout_info stderr_info lang lc_ctype lc_all"
|
|
||||||
+_EncodingDetails = namedtuple("EncodingDetails", _fields)
|
|
||||||
+
|
|
||||||
+class EncodingDetails(_EncodingDetails):
|
|
||||||
+ # XXX (ncoghlan): Using JSON for child state reporting may be less fragile
|
|
||||||
+ CHILD_PROCESS_SCRIPT = ";".join([
|
|
||||||
+ "import sys, os",
|
|
||||||
+ "print(sys.getfilesystemencoding())",
|
|
||||||
+ "print(sys.stdin.encoding + ':' + sys.stdin.errors)",
|
|
||||||
+ "print(sys.stdout.encoding + ':' + sys.stdout.errors)",
|
|
||||||
+ "print(sys.stderr.encoding + ':' + sys.stderr.errors)",
|
|
||||||
+ "print(os.environ.get('LANG', 'not set'))",
|
|
||||||
+ "print(os.environ.get('LC_CTYPE', 'not set'))",
|
|
||||||
+ "print(os.environ.get('LC_ALL', 'not set'))",
|
|
||||||
+ ])
|
|
||||||
+
|
|
||||||
+ @classmethod
|
|
||||||
+ def get_expected_details(cls, coercion_expected, fs_encoding, stream_encoding, env_vars):
|
|
||||||
+ """Returns expected child process details for a given encoding"""
|
|
||||||
+ _stream = stream_encoding + ":{}"
|
|
||||||
+ # stdin and stdout should use surrogateescape either because the
|
|
||||||
+ # coercion triggered, or because the C locale was detected
|
|
||||||
+ stream_info = 2*[_stream.format("surrogateescape")]
|
|
||||||
+ # stderr should always use backslashreplace
|
|
||||||
+ stream_info.append(_stream.format("backslashreplace"))
|
|
||||||
+ expected_lang = env_vars.get("LANG", "not set").lower()
|
|
||||||
+ if coercion_expected:
|
|
||||||
+ expected_lc_ctype = CLI_COERCION_TARGET.lower()
|
|
||||||
+ else:
|
|
||||||
+ expected_lc_ctype = env_vars.get("LC_CTYPE", "not set").lower()
|
|
||||||
+ expected_lc_all = env_vars.get("LC_ALL", "not set").lower()
|
|
||||||
+ env_info = expected_lang, expected_lc_ctype, expected_lc_all
|
|
||||||
+ return dict(cls(fs_encoding, *stream_info, *env_info)._asdict())
|
|
||||||
+
|
|
||||||
+ @staticmethod
|
|
||||||
+ def _handle_output_variations(data):
|
|
||||||
+ """Adjust the output to handle platform specific idiosyncrasies
|
|
||||||
+
|
|
||||||
+ * Some platforms report ASCII as ANSI_X3.4-1968
|
|
||||||
+ * Some platforms report ASCII as US-ASCII
|
|
||||||
+ * Some platforms report UTF-8 instead of utf-8
|
|
||||||
+ """
|
|
||||||
+ data = data.replace(b"ANSI_X3.4-1968", b"ascii")
|
|
||||||
+ data = data.replace(b"US-ASCII", b"ascii")
|
|
||||||
+ data = data.lower()
|
|
||||||
+ return data
|
|
||||||
+
|
|
||||||
+ @classmethod
|
|
||||||
+ def get_child_details(cls, env_vars):
|
|
||||||
+ """Retrieves fsencoding and standard stream details from a child process
|
|
||||||
+
|
|
||||||
+ Returns (encoding_details, stderr_lines):
|
|
||||||
+
|
|
||||||
+ - encoding_details: EncodingDetails for eager decoding
|
|
||||||
+ - stderr_lines: result of calling splitlines() on the stderr output
|
|
||||||
+
|
|
||||||
+ The child is run in isolated mode if the current interpreter supports
|
|
||||||
+ that.
|
|
||||||
+ """
|
|
||||||
+ result, py_cmd = run_python_until_end(
|
|
||||||
+ "-c", cls.CHILD_PROCESS_SCRIPT,
|
|
||||||
+ __isolated=True,
|
|
||||||
+ **env_vars
|
|
||||||
+ )
|
|
||||||
+ if not result.rc == 0:
|
|
||||||
+ result.fail(py_cmd)
|
|
||||||
+ # All subprocess outputs in this test case should be pure ASCII
|
|
||||||
+ adjusted_output = cls._handle_output_variations(result.out)
|
|
||||||
+ stdout_lines = adjusted_output.decode("ascii").splitlines()
|
|
||||||
+ child_encoding_details = dict(cls(*stdout_lines)._asdict())
|
|
||||||
+ stderr_lines = result.err.decode("ascii").rstrip().splitlines()
|
|
||||||
+ return child_encoding_details, stderr_lines
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+# Details of the shared library warning emitted at runtime
|
|
||||||
+LEGACY_LOCALE_WARNING = (
|
|
||||||
+ "Python runtime initialized with LC_CTYPE=C (a locale with default ASCII "
|
|
||||||
+ "encoding), which may cause Unicode compatibility problems. Using C.UTF-8, "
|
|
||||||
+ "C.utf8, or UTF-8 (if available) as alternative Unicode-compatible "
|
|
||||||
+ "locales is recommended."
|
|
||||||
+)
|
|
||||||
+
|
|
||||||
+# Details of the CLI locale coercion warning emitted at runtime
|
|
||||||
+CLI_COERCION_WARNING_FMT = (
|
|
||||||
+ "Python detected LC_CTYPE=C: LC_CTYPE coerced to {} (set another locale "
|
|
||||||
+ "or PYTHONCOERCECLOCALE=0 to disable this locale coercion behavior)."
|
|
||||||
+)
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+AVAILABLE_TARGETS = None
|
|
||||||
+CLI_COERCION_TARGET = None
|
|
||||||
+CLI_COERCION_WARNING = None
|
|
||||||
+
|
|
||||||
+def setUpModule():
|
|
||||||
+ global AVAILABLE_TARGETS
|
|
||||||
+ global CLI_COERCION_TARGET
|
|
||||||
+ global CLI_COERCION_WARNING
|
|
||||||
+
|
|
||||||
+ if AVAILABLE_TARGETS is not None:
|
|
||||||
+ # initialization already done
|
|
||||||
+ return
|
|
||||||
+ AVAILABLE_TARGETS = []
|
|
||||||
+
|
|
||||||
+ # Find the target locales available in the current system
|
|
||||||
+ for target_locale in _C_UTF8_LOCALES:
|
|
||||||
+ if _set_locale_in_subprocess(target_locale):
|
|
||||||
+ AVAILABLE_TARGETS.append(target_locale)
|
|
||||||
+
|
|
||||||
+ if AVAILABLE_TARGETS:
|
|
||||||
+ # Coercion is expected to use the first available target locale
|
|
||||||
+ CLI_COERCION_TARGET = AVAILABLE_TARGETS[0]
|
|
||||||
+ CLI_COERCION_WARNING = CLI_COERCION_WARNING_FMT.format(CLI_COERCION_TARGET)
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+class _LocaleHandlingTestCase(unittest.TestCase):
|
|
||||||
+ # Base class to check expected locale handling behaviour
|
|
||||||
+
|
|
||||||
+ def _check_child_encoding_details(self,
|
|
||||||
+ env_vars,
|
|
||||||
+ expected_fs_encoding,
|
|
||||||
+ expected_stream_encoding,
|
|
||||||
+ expected_warnings,
|
|
||||||
+ coercion_expected):
|
|
||||||
+ """Check the C locale handling for the given process environment
|
|
||||||
+
|
|
||||||
+ Parameters:
|
|
||||||
+ expected_fs_encoding: expected sys.getfilesystemencoding() result
|
|
||||||
+ expected_stream_encoding: expected encoding for standard streams
|
|
||||||
+ expected_warning: stderr output to expect (if any)
|
|
||||||
+ """
|
|
||||||
+ result = EncodingDetails.get_child_details(env_vars)
|
|
||||||
+ encoding_details, stderr_lines = result
|
|
||||||
+ expected_details = EncodingDetails.get_expected_details(
|
|
||||||
+ coercion_expected,
|
|
||||||
+ expected_fs_encoding,
|
|
||||||
+ expected_stream_encoding,
|
|
||||||
+ env_vars
|
|
||||||
+ )
|
|
||||||
+ self.assertEqual(encoding_details, expected_details)
|
|
||||||
+ if expected_warnings is None:
|
|
||||||
+ expected_warnings = []
|
|
||||||
+ self.assertEqual(stderr_lines, expected_warnings)
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+class LocaleConfigurationTests(_LocaleHandlingTestCase):
|
|
||||||
+ # Test explicit external configuration via the process environment
|
|
||||||
+
|
|
||||||
+ def setUpClass():
|
|
||||||
+ # This relies on setupModule() having been run, so it can't be
|
|
||||||
+ # handled via the @unittest.skipUnless decorator
|
|
||||||
+ if not AVAILABLE_TARGETS:
|
|
||||||
+ raise unittest.SkipTest("No C-with-UTF-8 locale available")
|
|
||||||
+
|
|
||||||
+ def test_external_target_locale_configuration(self):
|
|
||||||
+
|
|
||||||
+ # Explicitly setting a target locale should give the same behaviour as
|
|
||||||
+ # is seen when implicitly coercing to that target locale
|
|
||||||
+ self.maxDiff = None
|
|
||||||
+
|
|
||||||
+ expected_fs_encoding = "utf-8"
|
|
||||||
+ expected_stream_encoding = "utf-8"
|
|
||||||
+
|
|
||||||
+ base_var_dict = {
|
|
||||||
+ "LANG": "",
|
|
||||||
+ "LC_CTYPE": "",
|
|
||||||
+ "LC_ALL": "",
|
|
||||||
+ }
|
|
||||||
+ for env_var in ("LANG", "LC_CTYPE"):
|
|
||||||
+ for locale_to_set in AVAILABLE_TARGETS:
|
|
||||||
+ # XXX (ncoghlan): LANG=UTF-8 doesn't appear to work as
|
|
||||||
+ # expected, so skip that combination for now
|
|
||||||
+ # See https://bugs.python.org/issue30672 for discussion
|
|
||||||
+ if env_var == "LANG" and locale_to_set == "UTF-8":
|
|
||||||
+ continue
|
|
||||||
+
|
|
||||||
+ with self.subTest(env_var=env_var,
|
|
||||||
+ configured_locale=locale_to_set):
|
|
||||||
+ var_dict = base_var_dict.copy()
|
|
||||||
+ var_dict[env_var] = locale_to_set
|
|
||||||
+ self._check_child_encoding_details(var_dict,
|
|
||||||
+ expected_fs_encoding,
|
|
||||||
+ expected_stream_encoding,
|
|
||||||
+ expected_warnings=None,
|
|
||||||
+ coercion_expected=False)
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+@test.support.cpython_only
|
|
||||||
+@unittest.skipUnless(sysconfig.get_config_var("PY_COERCE_C_LOCALE"),
|
|
||||||
+ "C locale coercion disabled at build time")
|
|
||||||
+class LocaleCoercionTests(_LocaleHandlingTestCase):
|
|
||||||
+ # Test implicit reconfiguration of the environment during CLI startup
|
|
||||||
+
|
|
||||||
+ def _check_c_locale_coercion(self,
|
|
||||||
+ fs_encoding, stream_encoding,
|
|
||||||
+ coerce_c_locale,
|
|
||||||
+ expected_warnings=None,
|
|
||||||
+ coercion_expected=True,
|
|
||||||
+ **extra_vars):
|
|
||||||
+ """Check the C locale handling for various configurations
|
|
||||||
+
|
|
||||||
+ Parameters:
|
|
||||||
+ fs_encoding: expected sys.getfilesystemencoding() result
|
|
||||||
+ stream_encoding: expected encoding for standard streams
|
|
||||||
+ coerce_c_locale: setting to use for PYTHONCOERCECLOCALE
|
|
||||||
+ None: don't set the variable at all
|
|
||||||
+ str: the value set in the child's environment
|
|
||||||
+ expected_warnings: expected warning lines on stderr
|
|
||||||
+ extra_vars: additional environment variables to set in subprocess
|
|
||||||
+ """
|
|
||||||
+ self.maxDiff = None
|
|
||||||
+
|
|
||||||
+ if not AVAILABLE_TARGETS:
|
|
||||||
+ # Locale coercion is disabled when there aren't any target locales
|
|
||||||
+ fs_encoding = C_LOCALE_FS_ENCODING
|
|
||||||
+ stream_encoding = C_LOCALE_STREAM_ENCODING
|
|
||||||
+ coercion_expected = False
|
|
||||||
+ if expected_warnings:
|
|
||||||
+ expected_warnings = [LEGACY_LOCALE_WARNING]
|
|
||||||
+
|
|
||||||
+ base_var_dict = {
|
|
||||||
+ "LANG": "",
|
|
||||||
+ "LC_CTYPE": "",
|
|
||||||
+ "LC_ALL": "",
|
|
||||||
+ }
|
|
||||||
+ base_var_dict.update(extra_vars)
|
|
||||||
+ for env_var in ("LANG", "LC_CTYPE"):
|
|
||||||
+ for locale_to_set in ("", "C", "POSIX", "invalid.ascii"):
|
|
||||||
+ # XXX (ncoghlan): *BSD platforms don't behave as expected in the
|
|
||||||
+ # POSIX locale, so we skip that for now
|
|
||||||
+ # See https://bugs.python.org/issue30672 for discussion
|
|
||||||
+ if locale_to_set == "POSIX":
|
|
||||||
+ continue
|
|
||||||
+ with self.subTest(env_var=env_var,
|
|
||||||
+ nominal_locale=locale_to_set,
|
|
||||||
+ PYTHONCOERCECLOCALE=coerce_c_locale):
|
|
||||||
+ var_dict = base_var_dict.copy()
|
|
||||||
+ var_dict[env_var] = locale_to_set
|
|
||||||
+ if coerce_c_locale is not None:
|
|
||||||
+ var_dict["PYTHONCOERCECLOCALE"] = coerce_c_locale
|
|
||||||
+ # Check behaviour on successful coercion
|
|
||||||
+ self._check_child_encoding_details(var_dict,
|
|
||||||
+ fs_encoding,
|
|
||||||
+ stream_encoding,
|
|
||||||
+ expected_warnings,
|
|
||||||
+ coercion_expected)
|
|
||||||
+
|
|
||||||
+ def test_test_PYTHONCOERCECLOCALE_not_set(self):
|
|
||||||
+ # This should coerce to the first available target locale by default
|
|
||||||
+ self._check_c_locale_coercion("utf-8", "utf-8", coerce_c_locale=None)
|
|
||||||
+
|
|
||||||
+ def test_PYTHONCOERCECLOCALE_not_zero(self):
|
|
||||||
+ # *Any* string other than "0" is considered "set" for our purposes
|
|
||||||
+ # and hence should result in the locale coercion being enabled
|
|
||||||
+ for setting in ("", "1", "true", "false"):
|
|
||||||
+ self._check_c_locale_coercion("utf-8", "utf-8", coerce_c_locale=setting)
|
|
||||||
+
|
|
||||||
+ def test_PYTHONCOERCECLOCALE_set_to_warn(self):
|
|
||||||
+ # PYTHONCOERCECLOCALE=warn enables runtime warnings for legacy locales
|
|
||||||
+ self._check_c_locale_coercion("utf-8", "utf-8",
|
|
||||||
+ coerce_c_locale="warn",
|
|
||||||
+ expected_warnings=[CLI_COERCION_WARNING])
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ def test_PYTHONCOERCECLOCALE_set_to_zero(self):
|
|
||||||
+ # The setting "0" should result in the locale coercion being disabled
|
|
||||||
+ self._check_c_locale_coercion(C_LOCALE_FS_ENCODING,
|
|
||||||
+ C_LOCALE_STREAM_ENCODING,
|
|
||||||
+ coerce_c_locale="0",
|
|
||||||
+ coercion_expected=False)
|
|
||||||
+ # Setting LC_ALL=C shouldn't make any difference to the behaviour
|
|
||||||
+ self._check_c_locale_coercion(C_LOCALE_FS_ENCODING,
|
|
||||||
+ C_LOCALE_STREAM_ENCODING,
|
|
||||||
+ coerce_c_locale="0",
|
|
||||||
+ LC_ALL="C",
|
|
||||||
+ coercion_expected=False)
|
|
||||||
+
|
|
||||||
+ def test_LC_ALL_set_to_C(self):
|
|
||||||
+ # Setting LC_ALL should render the locale coercion ineffective
|
|
||||||
+ self._check_c_locale_coercion(C_LOCALE_FS_ENCODING,
|
|
||||||
+ C_LOCALE_STREAM_ENCODING,
|
|
||||||
+ coerce_c_locale=None,
|
|
||||||
+ LC_ALL="C",
|
|
||||||
+ coercion_expected=False)
|
|
||||||
+ # And result in a warning about a lack of locale compatibility
|
|
||||||
+ self._check_c_locale_coercion(C_LOCALE_FS_ENCODING,
|
|
||||||
+ C_LOCALE_STREAM_ENCODING,
|
|
||||||
+ coerce_c_locale="warn",
|
|
||||||
+ LC_ALL="C",
|
|
||||||
+ expected_warnings=[LEGACY_LOCALE_WARNING],
|
|
||||||
+ coercion_expected=False)
|
|
||||||
+
|
|
||||||
+def test_main():
|
|
||||||
+ test.support.run_unittest(
|
|
||||||
+ LocaleConfigurationTests,
|
|
||||||
+ LocaleCoercionTests
|
|
||||||
+ )
|
|
||||||
+ test.support.reap_children()
|
|
||||||
+
|
|
||||||
+if __name__ == "__main__":
|
|
||||||
+ test_main()
|
|
||||||
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
|
|
||||||
index 6e4286e..594dfa9 100644
|
|
||||||
--- a/Lib/test/test_capi.py
|
|
||||||
+++ b/Lib/test/test_capi.py
|
|
||||||
@@ -425,32 +425,21 @@ class EmbeddingTests(unittest.TestCase):
|
|
||||||
def test_repeated_init_and_subinterpreters(self):
|
|
||||||
# This is just a "don't crash" test
|
|
||||||
out, err = self.run_embedded_interpreter('repeated_init_and_subinterpreters')
|
|
||||||
- if support.verbose:
|
|
||||||
+ if support.verbose > 1:
|
|
||||||
print()
|
|
||||||
print(out)
|
|
||||||
print(err)
|
|
||||||
|
|
||||||
- @staticmethod
|
|
||||||
- def _get_default_pipe_encoding():
|
|
||||||
- rp, wp = os.pipe()
|
|
||||||
- try:
|
|
||||||
- with os.fdopen(wp, 'w') as w:
|
|
||||||
- default_pipe_encoding = w.encoding
|
|
||||||
- finally:
|
|
||||||
- os.close(rp)
|
|
||||||
- return default_pipe_encoding
|
|
||||||
-
|
|
||||||
def test_forced_io_encoding(self):
|
|
||||||
# Checks forced configuration of embedded interpreter IO streams
|
|
||||||
env = dict(os.environ, PYTHONIOENCODING="utf-8:surrogateescape")
|
|
||||||
out, err = self.run_embedded_interpreter("forced_io_encoding", env=env)
|
|
||||||
- if support.verbose:
|
|
||||||
+ if support.verbose > 1:
|
|
||||||
print()
|
|
||||||
print(out)
|
|
||||||
print(err)
|
|
||||||
expected_stream_encoding = "utf-8"
|
|
||||||
expected_errors = "surrogateescape"
|
|
||||||
- expected_pipe_encoding = self._get_default_pipe_encoding()
|
|
||||||
expected_output = '\n'.join([
|
|
||||||
"--- Use defaults ---",
|
|
||||||
"Expected encoding: default",
|
|
||||||
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
|
|
||||||
index ae2bcd4..0a302ff 100644
|
|
||||||
--- a/Lib/test/test_cmd_line.py
|
|
||||||
+++ b/Lib/test/test_cmd_line.py
|
|
||||||
@@ -151,6 +152,7 @@ class CmdLineTest(unittest.TestCase):
|
|
||||||
env = os.environ.copy()
|
|
||||||
# Use C locale to get ascii for the locale encoding
|
|
||||||
env['LC_ALL'] = 'C'
|
|
||||||
+ env['PYTHONCOERCECLOCALE'] = '0'
|
|
||||||
code = (
|
|
||||||
b'import locale; '
|
|
||||||
b'print(ascii("' + undecodable + b'"), '
|
|
||||||
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
|
|
||||||
index 7866a5c..b41239a 100644
|
|
||||||
--- a/Lib/test/test_sys.py
|
|
||||||
+++ b/Lib/test/test_sys.py
|
|
||||||
@@ -680,6 +680,7 @@ class SysModuleTest(unittest.TestCase):
|
|
||||||
# Force the POSIX locale
|
|
||||||
env = os.environ.copy()
|
|
||||||
env["LC_ALL"] = "C"
|
|
||||||
+ env["PYTHONCOERCECLOCALE"] = "0"
|
|
||||||
code = '\n'.join((
|
|
||||||
'import sys',
|
|
||||||
'def dump(name):',
|
|
||||||
diff --git a/Modules/main.c b/Modules/main.c
|
|
||||||
index b0fb78f..0d8590a 100644
|
|
||||||
--- a/Modules/main.c
|
|
||||||
+++ b/Modules/main.c
|
|
||||||
@@ -105,7 +105,11 @@ static const char usage_6[] =
|
|
||||||
" predictable seed.\n"
|
|
||||||
"PYTHONMALLOC: set the Python memory allocators and/or install debug hooks\n"
|
|
||||||
" on Python memory allocators. Use PYTHONMALLOC=debug to install debug\n"
|
|
||||||
-" hooks.\n";
|
|
||||||
+" hooks.\n"
|
|
||||||
+
|
|
||||||
+"PYTHONCOERCECLOCALE: if this variable is set to 0, it disables the locale\n"
|
|
||||||
+" coercion behavior. Use PYTHONCOERCECLOCALE=warn to request display of\n"
|
|
||||||
+" locale coercion and locale compatibility warnings on stderr.\n";
|
|
||||||
|
|
||||||
static int
|
|
||||||
usage(int exitcode, const wchar_t* program)
|
|
||||||
diff --git a/Programs/_testembed.c b/Programs/_testembed.c
|
|
||||||
index b0f9087..da892bf 100644
|
|
||||||
--- a/Programs/_testembed.c
|
|
||||||
+++ b/Programs/_testembed.c
|
|
||||||
@@ -1,4 +1,5 @@
|
|
||||||
#include <Python.h>
|
|
||||||
+#include "pyconfig.h"
|
|
||||||
#include "pythread.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
diff --git a/Programs/python.c b/Programs/python.c
|
|
||||||
index a7afbc7..03f8295 100644
|
|
||||||
--- a/Programs/python.c
|
|
||||||
+++ b/Programs/python.c
|
|
||||||
@@ -15,6 +15,21 @@ wmain(int argc, wchar_t **argv)
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
+/* Access private pylifecycle helper API to better handle the legacy C locale
|
|
||||||
+ *
|
|
||||||
+ * The legacy C locale assumes ASCII as the default text encoding, which
|
|
||||||
+ * causes problems not only for the CPython runtime, but also other
|
|
||||||
+ * components like GNU readline.
|
|
||||||
+ *
|
|
||||||
+ * Accordingly, when the CLI detects it, it attempts to coerce it to a
|
|
||||||
+ * more capable UTF-8 based alternative.
|
|
||||||
+ *
|
|
||||||
+ * See the documentation of the PYTHONCOERCECLOCALE setting for more details.
|
|
||||||
+ *
|
|
||||||
+ */
|
|
||||||
+extern int _Py_LegacyLocaleDetected(void);
|
|
||||||
+extern void _Py_CoerceLegacyLocale(void);
|
|
||||||
+
|
|
||||||
int
|
|
||||||
main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
@@ -25,7 +40,11 @@ main(int argc, char **argv)
|
|
||||||
char *oldloc;
|
|
||||||
|
|
||||||
/* Force malloc() allocator to bootstrap Python */
|
|
||||||
+#ifdef Py_DEBUG
|
|
||||||
+ (void)_PyMem_SetupAllocators("malloc_debug");
|
|
||||||
+# else
|
|
||||||
(void)_PyMem_SetupAllocators("malloc");
|
|
||||||
+# endif
|
|
||||||
|
|
||||||
argv_copy = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1));
|
|
||||||
argv_copy2 = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1));
|
|
||||||
@@ -49,7 +68,21 @@ main(int argc, char **argv)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef __ANDROID__
|
|
||||||
+ /* Passing "" to setlocale() on Android requests the C locale rather
|
|
||||||
+ * than checking environment variables, so request C.UTF-8 explicitly
|
|
||||||
+ */
|
|
||||||
+ setlocale(LC_ALL, "C.UTF-8");
|
|
||||||
+#else
|
|
||||||
+ /* Reconfigure the locale to the default for this process */
|
|
||||||
setlocale(LC_ALL, "");
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+ if (_Py_LegacyLocaleDetected()) {
|
|
||||||
+ _Py_CoerceLegacyLocale();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Convert from char to wchar_t based on the locale settings */
|
|
||||||
for (i = 0; i < argc; i++) {
|
|
||||||
argv_copy[i] = Py_DecodeLocale(argv[i], NULL);
|
|
||||||
if (!argv_copy[i]) {
|
|
||||||
@@ -70,7 +103,11 @@ main(int argc, char **argv)
|
|
||||||
|
|
||||||
/* Force again malloc() allocator to release memory blocks allocated
|
|
||||||
before Py_Main() */
|
|
||||||
+#ifdef Py_DEBUG
|
|
||||||
+ (void)_PyMem_SetupAllocators("malloc_debug");
|
|
||||||
+# else
|
|
||||||
(void)_PyMem_SetupAllocators("malloc");
|
|
||||||
+# endif
|
|
||||||
|
|
||||||
for (i = 0; i < argc; i++) {
|
|
||||||
PyMem_RawFree(argv_copy2[i]);
|
|
||||||
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
|
|
||||||
index 640271f..2a22b24 100644
|
|
||||||
--- a/Python/pylifecycle.c
|
|
||||||
+++ b/Python/pylifecycle.c
|
|
||||||
@@ -167,6 +167,7 @@ Py_SetStandardStreamEncoding(const char *encoding, const char *errors)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+
|
|
||||||
/* Global initializations. Can be undone by Py_FinalizeEx(). Don't
|
|
||||||
call this twice without an intervening Py_FinalizeEx() call. When
|
|
||||||
initializations fail, a fatal error is issued and the function does
|
|
||||||
@@ -301,6 +302,183 @@ import_init(PyInterpreterState *interp, PyObject *sysmod)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+/* Helper functions to better handle the legacy C locale
|
|
||||||
+ *
|
|
||||||
+ * The legacy C locale assumes ASCII as the default text encoding, which
|
|
||||||
+ * causes problems not only for the CPython runtime, but also other
|
|
||||||
+ * components like GNU readline.
|
|
||||||
+ *
|
|
||||||
+ * Accordingly, when the CLI detects it, it attempts to coerce it to a
|
|
||||||
+ * more capable UTF-8 based alternative as follows:
|
|
||||||
+ *
|
|
||||||
+ * if (_Py_LegacyLocaleDetected()) {
|
|
||||||
+ * _Py_CoerceLegacyLocale();
|
|
||||||
+ * }
|
|
||||||
+ *
|
|
||||||
+ * See the documentation of the PYTHONCOERCECLOCALE setting for more details.
|
|
||||||
+ *
|
|
||||||
+ * Locale coercion also impacts the default error handler for the standard
|
|
||||||
+ * streams: while the usual default is "strict", the default for the legacy
|
|
||||||
+ * C locale and for any of the coercion target locales is "surrogateescape".
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+_Py_LegacyLocaleDetected(void)
|
|
||||||
+{
|
|
||||||
+#ifndef MS_WINDOWS
|
|
||||||
+ /* On non-Windows systems, the C locale is considered a legacy locale */
|
|
||||||
+ /* XXX (ncoghlan): some platforms (notably Mac OS X) don't appear to treat
|
|
||||||
+ * the POSIX locale as a simple alias for the C locale, so
|
|
||||||
+ * we may also want to check for that explicitly.
|
|
||||||
+ */
|
|
||||||
+ const char *ctype_loc = setlocale(LC_CTYPE, NULL);
|
|
||||||
+ return ctype_loc != NULL && strcmp(ctype_loc, "C") == 0;
|
|
||||||
+#else
|
|
||||||
+ /* Windows uses code pages instead of locales, so no locale is legacy */
|
|
||||||
+ return 0;
|
|
||||||
+#endif
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+static const char *_C_LOCALE_WARNING =
|
|
||||||
+ "Python runtime initialized with LC_CTYPE=C (a locale with default ASCII "
|
|
||||||
+ "encoding), which may cause Unicode compatibility problems. Using C.UTF-8, "
|
|
||||||
+ "C.utf8, or UTF-8 (if available) as alternative Unicode-compatible "
|
|
||||||
+ "locales is recommended.\n";
|
|
||||||
+
|
|
||||||
+static int
|
|
||||||
+_legacy_locale_warnings_enabled(void)
|
|
||||||
+{
|
|
||||||
+ const char *coerce_c_locale = getenv("PYTHONCOERCECLOCALE");
|
|
||||||
+ return (coerce_c_locale != NULL &&
|
|
||||||
+ strncmp(coerce_c_locale, "warn", 5) == 0);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+_emit_stderr_warning_for_legacy_locale(void)
|
|
||||||
+{
|
|
||||||
+ if (_legacy_locale_warnings_enabled()) {
|
|
||||||
+ if (_Py_LegacyLocaleDetected()) {
|
|
||||||
+ fprintf(stderr, "%s", _C_LOCALE_WARNING);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+typedef struct _CandidateLocale {
|
|
||||||
+ const char *locale_name; /* The locale to try as a coercion target */
|
|
||||||
+} _LocaleCoercionTarget;
|
|
||||||
+
|
|
||||||
+static _LocaleCoercionTarget _TARGET_LOCALES[] = {
|
|
||||||
+ {"C.UTF-8"},
|
|
||||||
+ {"C.utf8"},
|
|
||||||
+ {"UTF-8"},
|
|
||||||
+ {NULL}
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static char *
|
|
||||||
+get_default_standard_stream_error_handler(void)
|
|
||||||
+{
|
|
||||||
+ const char *ctype_loc = setlocale(LC_CTYPE, NULL);
|
|
||||||
+ if (ctype_loc != NULL) {
|
|
||||||
+ /* "surrogateescape" is the default in the legacy C locale */
|
|
||||||
+ if (strcmp(ctype_loc, "C") == 0) {
|
|
||||||
+ return "surrogateescape";
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+#ifdef PY_COERCE_C_LOCALE
|
|
||||||
+ /* "surrogateescape" is the default in locale coercion target locales */
|
|
||||||
+ const _LocaleCoercionTarget *target = NULL;
|
|
||||||
+ for (target = _TARGET_LOCALES; target->locale_name; target++) {
|
|
||||||
+ if (strcmp(ctype_loc, target->locale_name) == 0) {
|
|
||||||
+ return "surrogateescape";
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Otherwise return NULL to request the typical default error handler */
|
|
||||||
+ return NULL;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#ifdef PY_COERCE_C_LOCALE
|
|
||||||
+static const char *_C_LOCALE_COERCION_WARNING =
|
|
||||||
+ "Python detected LC_CTYPE=C: LC_CTYPE coerced to %.20s (set another locale "
|
|
||||||
+ "or PYTHONCOERCECLOCALE=0 to disable this locale coercion behavior).\n";
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+_coerce_default_locale_settings(const _LocaleCoercionTarget *target)
|
|
||||||
+{
|
|
||||||
+
|
|
||||||
+ const char *newloc = target->locale_name;
|
|
||||||
+
|
|
||||||
+ /* Reset locale back to currently configured defaults */
|
|
||||||
+ setlocale(LC_ALL, "");
|
|
||||||
+
|
|
||||||
+ /* Set the relevant locale environment variable */
|
|
||||||
+ if (setenv("LC_CTYPE", newloc, 1)) {
|
|
||||||
+ fprintf(stderr,
|
|
||||||
+ "Error setting LC_CTYPE, skipping C locale coercion\n");
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ if (_legacy_locale_warnings_enabled()) {
|
|
||||||
+ fprintf(stderr, _C_LOCALE_COERCION_WARNING, newloc);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Reconfigure with the overridden environment variables */
|
|
||||||
+ setlocale(LC_ALL, "");
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+_Py_CoerceLegacyLocale(void)
|
|
||||||
+{
|
|
||||||
+#ifdef PY_COERCE_C_LOCALE
|
|
||||||
+ /* We ignore the Python -E and -I flags here, as the CLI needs to sort out
|
|
||||||
+ * the locale settings *before* we try to do anything with the command
|
|
||||||
+ * line arguments. For cross-platform debugging purposes, we also need
|
|
||||||
+ * to give end users a way to force even scripts that are otherwise
|
|
||||||
+ * isolated from their environment to use the legacy ASCII-centric C
|
|
||||||
+ * locale.
|
|
||||||
+ *
|
|
||||||
+ * Ignoring -E and -I is safe from a security perspective, as we only use
|
|
||||||
+ * the setting to turn *off* the implicit locale coercion, and anyone with
|
|
||||||
+ * access to the process environment already has the ability to set
|
|
||||||
+ * `LC_ALL=C` to override the C level locale settings anyway.
|
|
||||||
+ */
|
|
||||||
+ const char *coerce_c_locale = getenv("PYTHONCOERCECLOCALE");
|
|
||||||
+ if (coerce_c_locale == NULL || strncmp(coerce_c_locale, "0", 2) != 0) {
|
|
||||||
+ /* PYTHONCOERCECLOCALE is not set, or is set to something other than "0" */
|
|
||||||
+ const char *locale_override = getenv("LC_ALL");
|
|
||||||
+ if (locale_override == NULL || *locale_override == '\0') {
|
|
||||||
+ /* LC_ALL is also not set (or is set to an empty string) */
|
|
||||||
+ const _LocaleCoercionTarget *target = NULL;
|
|
||||||
+ for (target = _TARGET_LOCALES; target->locale_name; target++) {
|
|
||||||
+ const char *new_locale = setlocale(LC_CTYPE,
|
|
||||||
+ target->locale_name);
|
|
||||||
+ if (new_locale != NULL) {
|
|
||||||
+#if !defined(__APPLE__) && defined(HAVE_LANGINFO_H) && defined(CODESET)
|
|
||||||
+ /* Also ensure that nl_langinfo works in this locale */
|
|
||||||
+ char *codeset = nl_langinfo(CODESET);
|
|
||||||
+ if (!codeset || *codeset == '\0') {
|
|
||||||
+ /* CODESET is not set or empty, so skip coercion */
|
|
||||||
+ new_locale = NULL;
|
|
||||||
+ setlocale(LC_CTYPE, "");
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
+ /* Successfully configured locale, so make it the default */
|
|
||||||
+ _coerce_default_locale_settings(target);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ /* No C locale warning here, as Py_Initialize will emit one later */
|
|
||||||
+#endif
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
void
|
|
||||||
_Py_InitializeEx_Private(int install_sigs, int install_importlib)
|
|
||||||
{
|
|
||||||
@@ -315,11 +493,19 @@ _Py_InitializeEx_Private(int install_sigs, int install_importlib)
|
|
||||||
initialized = 1;
|
|
||||||
_Py_Finalizing = NULL;
|
|
||||||
|
|
||||||
-#ifdef HAVE_SETLOCALE
|
|
||||||
+#ifdef __ANDROID__
|
|
||||||
+ /* Passing "" to setlocale() on Android requests the C locale rather
|
|
||||||
+ * than checking environment variables, so request C.UTF-8 explicitly
|
|
||||||
+ */
|
|
||||||
+ setlocale(LC_CTYPE, "C.UTF-8");
|
|
||||||
+#else
|
|
||||||
+#ifndef MS_WINDOWS
|
|
||||||
/* Set up the LC_CTYPE locale, so we can obtain
|
|
||||||
the locale's charset without having to switch
|
|
||||||
locales. */
|
|
||||||
setlocale(LC_CTYPE, "");
|
|
||||||
+ _emit_stderr_warning_for_legacy_locale();
|
|
||||||
+#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((p = Py_GETENV("PYTHONDEBUG")) && *p != '\0')
|
|
||||||
@@ -1251,12 +1437,8 @@ initstdio(void)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!errors && !(pythonioencoding && *pythonioencoding)) {
|
|
||||||
- /* When the LC_CTYPE locale is the POSIX locale ("C locale"),
|
|
||||||
- stdin and stdout use the surrogateescape error handler by
|
|
||||||
- default, instead of the strict error handler. */
|
|
||||||
- char *loc = setlocale(LC_CTYPE, NULL);
|
|
||||||
- if (loc != NULL && strcmp(loc, "C") == 0)
|
|
||||||
- errors = "surrogateescape";
|
|
||||||
+ /* Choose the default error handler based on the current locale */
|
|
||||||
+ errors = get_default_standard_stream_error_handler();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index 601cc84..5cdc021 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -3310,6 +3310,40 @@ then
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT($with_pymalloc)
|
|
||||||
|
|
||||||
+# Check for --with-c-locale-coercion
|
|
||||||
+AC_MSG_CHECKING(for --with-c-locale-coercion)
|
|
||||||
+AC_ARG_WITH(c-locale-coercion,
|
|
||||||
+ AS_HELP_STRING([--with(out)-c-locale-coercion],
|
|
||||||
+ [disable/enable C locale coercion to a UTF-8 based locale]))
|
|
||||||
+
|
|
||||||
+if test -z "$with_c_locale_coercion"
|
|
||||||
+then
|
|
||||||
+ with_c_locale_coercion="yes"
|
|
||||||
+fi
|
|
||||||
+if test "$with_c_locale_coercion" != "no"
|
|
||||||
+then
|
|
||||||
+ AC_DEFINE(PY_COERCE_C_LOCALE, 1,
|
|
||||||
+ [Define if you want to coerce the C locale to a UTF-8 based locale])
|
|
||||||
+fi
|
|
||||||
+AC_MSG_RESULT($with_c_locale_coercion)
|
|
||||||
+
|
|
||||||
+# Check for --with-c-locale-warning
|
|
||||||
+AC_MSG_CHECKING(for --with-c-locale-warning)
|
|
||||||
+AC_ARG_WITH(c-locale-warning,
|
|
||||||
+ AS_HELP_STRING([--with(out)-c-locale-warning],
|
|
||||||
+ [disable/enable locale compatibility warning in the C locale]))
|
|
||||||
+
|
|
||||||
+if test -z "$with_c_locale_warning"
|
|
||||||
+then
|
|
||||||
+ with_c_locale_warning="yes"
|
|
||||||
+fi
|
|
||||||
+if test "$with_c_locale_warning" != "no"
|
|
||||||
+then
|
|
||||||
+ AC_DEFINE(PY_WARN_ON_C_LOCALE, 1,
|
|
||||||
+ [Define to emit a locale compatibility warning in the C locale])
|
|
||||||
+fi
|
|
||||||
+AC_MSG_RESULT($with_c_locale_warning)
|
|
||||||
+
|
|
||||||
# Check for Valgrind support
|
|
||||||
AC_MSG_CHECKING([for --with-valgrind])
|
|
||||||
AC_ARG_WITH([valgrind],
|
|
@ -1,7 +1,21 @@
|
|||||||
diff -up Python-3.5.0/configure.ac.than Python-3.5.0/configure.ac
|
diff --git a/config.sub b/config.sub
|
||||||
--- Python-3.5.0/configure.ac.than 2015-11-13 11:51:32.039560172 -0500
|
index ba37cf9..52a9ec6 100755
|
||||||
+++ Python-3.5.0/configure.ac 2015-11-13 11:52:11.670168157 -0500
|
--- a/config.sub
|
||||||
@@ -788,9 +788,9 @@ cat >> conftest.c <<EOF
|
+++ b/config.sub
|
||||||
|
@@ -1042,7 +1042,7 @@ case $basic_machine in
|
||||||
|
;;
|
||||||
|
ppc64) basic_machine=powerpc64-unknown
|
||||||
|
;;
|
||||||
|
- ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
|
+ ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
ppc64le | powerpc64little)
|
||||||
|
basic_machine=powerpc64le-unknown
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 2535969..9fb3193 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -765,9 +765,9 @@ cat >> conftest.c <<EOF
|
||||||
alpha-linux-gnu
|
alpha-linux-gnu
|
||||||
# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
|
# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
|
||||||
# if defined(__ARMEL__)
|
# if defined(__ARMEL__)
|
||||||
@ -13,7 +27,7 @@ diff -up Python-3.5.0/configure.ac.than Python-3.5.0/configure.ac
|
|||||||
# endif
|
# endif
|
||||||
# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
|
# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
|
||||||
# if defined(__ARMEL__)
|
# if defined(__ARMEL__)
|
||||||
@@ -810,7 +810,7 @@ cat >> conftest.c <<EOF
|
@@ -807,7 +807,7 @@ cat >> conftest.c <<EOF
|
||||||
# elif _MIPS_SIM == _ABIN32
|
# elif _MIPS_SIM == _ABIN32
|
||||||
mips64el-linux-gnuabin32
|
mips64el-linux-gnuabin32
|
||||||
# elif _MIPS_SIM == _ABI64
|
# elif _MIPS_SIM == _ABI64
|
||||||
@ -22,7 +36,7 @@ diff -up Python-3.5.0/configure.ac.than Python-3.5.0/configure.ac
|
|||||||
# else
|
# else
|
||||||
# error unknown platform triplet
|
# error unknown platform triplet
|
||||||
# endif
|
# endif
|
||||||
@@ -820,7 +820,7 @@ cat >> conftest.c <<EOF
|
@@ -817,7 +817,7 @@ cat >> conftest.c <<EOF
|
||||||
# elif _MIPS_SIM == _ABIN32
|
# elif _MIPS_SIM == _ABIN32
|
||||||
mips64-linux-gnuabin32
|
mips64-linux-gnuabin32
|
||||||
# elif _MIPS_SIM == _ABI64
|
# elif _MIPS_SIM == _ABI64
|
||||||
@ -31,7 +45,7 @@ diff -up Python-3.5.0/configure.ac.than Python-3.5.0/configure.ac
|
|||||||
# else
|
# else
|
||||||
# error unknown platform triplet
|
# error unknown platform triplet
|
||||||
# endif
|
# endif
|
||||||
@@ -830,9 +830,9 @@ cat >> conftest.c <<EOF
|
@@ -827,9 +827,9 @@ cat >> conftest.c <<EOF
|
||||||
powerpc-linux-gnuspe
|
powerpc-linux-gnuspe
|
||||||
# elif defined(__powerpc64__)
|
# elif defined(__powerpc64__)
|
||||||
# if defined(__LITTLE_ENDIAN__)
|
# if defined(__LITTLE_ENDIAN__)
|
||||||
@ -43,16 +57,3 @@ diff -up Python-3.5.0/configure.ac.than Python-3.5.0/configure.ac
|
|||||||
# endif
|
# endif
|
||||||
# elif defined(__powerpc__)
|
# elif defined(__powerpc__)
|
||||||
powerpc-linux-gnu
|
powerpc-linux-gnu
|
||||||
diff --git a/config.sub b/config.sub
|
|
||||||
index 40ea5df..932128b 100755
|
|
||||||
--- a/config.sub
|
|
||||||
+++ b/config.sub
|
|
||||||
@@ -1045,7 +1045,7 @@ case $basic_machine in
|
|
||||||
;;
|
|
||||||
ppc64) basic_machine=powerpc64-unknown
|
|
||||||
;;
|
|
||||||
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
|
||||||
+ ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
|
||||||
;;
|
|
||||||
ppc64le | powerpc64little)
|
|
||||||
basic_machine=powerpc64le-unknown
|
|
||||||
|
25
00291-setup-Link-ctypes-against-dl-explicitly.patch
Normal file
25
00291-setup-Link-ctypes-against-dl-explicitly.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From aae2ef0bace0e38f4ee5aaa4642aa32450a84216 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
|
||||||
|
Date: Tue, 23 Jan 2018 14:43:43 +0100
|
||||||
|
Subject: [PATCH] setup: Link ctypes against dl explicitly
|
||||||
|
|
||||||
|
---
|
||||||
|
setup.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index c23628a2a9..9e40bb53e6 100644
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -1935,7 +1935,7 @@ class PyBuildExt(build_ext):
|
||||||
|
self.use_system_libffi = False
|
||||||
|
include_dirs = []
|
||||||
|
extra_compile_args = []
|
||||||
|
- extra_link_args = []
|
||||||
|
+ extra_link_args = ['-ldl']
|
||||||
|
sources = ['_ctypes/_ctypes.c',
|
||||||
|
'_ctypes/callbacks.c',
|
||||||
|
'_ctypes/callproc.c',
|
||||||
|
--
|
||||||
|
2.16.1
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
# Note that the path could itself be a python file, or a directory
|
|
||||||
|
|
||||||
# Python's compile_all module only works on directories, and requires a max
|
|
||||||
# recursion depth
|
|
||||||
|
|
||||||
# Note that the py_byte_compile macro should work for python2 as well
|
|
||||||
# Which unfortunately makes the definition more complicated than it should be
|
|
||||||
# The condition should be reversed once /usr/bin/python is python3!
|
|
||||||
|
|
||||||
%py_byte_compile()\
|
|
||||||
py2_byte_compile () {\
|
|
||||||
python_binary="%1"\
|
|
||||||
bytecode_compilation_path="%2"\
|
|
||||||
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("$RPM_BUILD_ROOT")[2]) for f in sys.argv[1:]]' || :\
|
|
||||||
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("$RPM_BUILD_ROOT")[2]) for f in sys.argv[1:]]' || :\
|
|
||||||
}\
|
|
||||||
\
|
|
||||||
py3_byte_compile () {\
|
|
||||||
python_binary="%1"\
|
|
||||||
bytecode_compilation_path="%2"\
|
|
||||||
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("$RPM_BUILD_ROOT")[2], optimize=opt) for opt in range(2) for f in sys.argv[1:]]' || :\
|
|
||||||
}\
|
|
||||||
\
|
|
||||||
[[ "%1" == *python3* ]] || py2_byte_compile "%1" "%2" && py3_byte_compile "%1" "%2" \
|
|
||||||
%{nil}
|
|
@ -1 +0,0 @@
|
|||||||
%system_python_abi %{expand: }
|
|
@ -18,6 +18,9 @@ addFilter(r'self-obsoletion python3\d obsoletes python3\d')
|
|||||||
# intentionally hardcoded
|
# intentionally hardcoded
|
||||||
addFilter(r'hardcoded-library-path in %{_prefix}/lib/(debug/%{_libdir}|python%{pybasever})')
|
addFilter(r'hardcoded-library-path in %{_prefix}/lib/(debug/%{_libdir}|python%{pybasever})')
|
||||||
|
|
||||||
|
# intentional for our pythonXY package
|
||||||
|
addFilter(r'python3\d\.[^:]+: (E|W): devel-file-in-non-devel-package')
|
||||||
|
|
||||||
# we have non binary stuff, python files
|
# we have non binary stuff, python files
|
||||||
addFilter(r'only-non-binary-in-usr-lib')
|
addFilter(r'only-non-binary-in-usr-lib')
|
||||||
|
|
||||||
@ -39,10 +42,15 @@ addFilter(r'^python3\d?-(debug|tkinter|test|idle)\.[^:]+: (E|W): no-documentatio
|
|||||||
addFilter(r'obsolete-not-provided platform-python')
|
addFilter(r'obsolete-not-provided platform-python')
|
||||||
|
|
||||||
|
|
||||||
# RPMLINT IMPERFECTIONS:
|
# RPMLINT IMPERFECTIONS
|
||||||
# ifarch applied patches are OK
|
# https://github.com/rpm-software-management/rpmlint/issues/123
|
||||||
# https://fedoraproject.org/wiki/Packaging:Guidelines#Architecture_Support
|
addFilter(r'python-bytecode-wrong-magic-value .* expected 33\d\d \(3\.7\), found 3393')
|
||||||
addFilter(r'%ifarch-applied-patch')
|
# https://github.com/rpm-software-management/rpmlint/pull/133
|
||||||
|
addFilter(r'python-bytecode-wrong-magic-value .* expected 33\d\d \(3\.7\), found 3394')
|
||||||
|
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1550562
|
||||||
|
# https://github.com/rpm-software-management/rpmlint/issues/128
|
||||||
|
addFilter(r'python-bytecode-inconsistent-mtime .* 1970')
|
||||||
|
|
||||||
# debugsource
|
# debugsource
|
||||||
addFilter(r'^python3\d?-debugsource\.[^:]+: (E|W): no-documentation')
|
addFilter(r'^python3\d?-debugsource\.[^:]+: (E|W): no-documentation')
|
||||||
|
141
python3.spec
141
python3.spec
@ -2,19 +2,23 @@
|
|||||||
# Top-level metadata
|
# Top-level metadata
|
||||||
# ==================
|
# ==================
|
||||||
|
|
||||||
%global pybasever 3.6
|
%global pybasever 3.7
|
||||||
|
|
||||||
# pybasever without the dot:
|
# pybasever without the dot:
|
||||||
%global pyshortver 36
|
%global pyshortver 37
|
||||||
|
|
||||||
Name: python3
|
Name: python3
|
||||||
Summary: Interpreter of the Python programming language
|
Summary: Interpreter of the Python programming language
|
||||||
URL: https://www.python.org/
|
URL: https://www.python.org/
|
||||||
|
|
||||||
|
|
||||||
|
# First rc
|
||||||
|
%global prerel rc1
|
||||||
|
|
||||||
# WARNING When rebasing to a new Python version,
|
# WARNING When rebasing to a new Python version,
|
||||||
# remember to update the python3-docs package as well
|
# remember to update the python3-docs package as well
|
||||||
Version: %{pybasever}.5
|
Version: %{pybasever}.0
|
||||||
Release: 4%{?dist}
|
Release: 0.20.%{?prerel}%{?dist}
|
||||||
License: Python
|
License: Python
|
||||||
|
|
||||||
|
|
||||||
@ -25,10 +29,11 @@ License: Python
|
|||||||
# Note that the bcond macros are named for the CLI option they create.
|
# Note that the bcond macros are named for the CLI option they create.
|
||||||
# "%%bcond_without" means "ENABLE by default and create a --without option"
|
# "%%bcond_without" means "ENABLE by default and create a --without option"
|
||||||
|
|
||||||
|
|
||||||
# Flat package, i.e. python36, python37, python38 for tox etc.
|
# Flat package, i.e. python36, python37, python38 for tox etc.
|
||||||
# warning: changes some other defaults
|
# warning: changes some other defaults
|
||||||
# in Fedora, never turn this on for the python3 package
|
# in Fedora, never turn this on for the python3 package
|
||||||
# and always keep it on for python36 etc.
|
# and always keep it on for python37 etc.
|
||||||
# WARNING: This does not change the package name and summary above
|
# WARNING: This does not change the package name and summary above
|
||||||
%bcond_with flatpackage
|
%bcond_with flatpackage
|
||||||
|
|
||||||
@ -195,6 +200,7 @@ BuildRequires: libffi-devel
|
|||||||
BuildRequires: libnsl2-devel
|
BuildRequires: libnsl2-devel
|
||||||
BuildRequires: libtirpc-devel
|
BuildRequires: libtirpc-devel
|
||||||
BuildRequires: libGL-devel
|
BuildRequires: libGL-devel
|
||||||
|
BuildRequires: libuuid-devel
|
||||||
BuildRequires: libX11-devel
|
BuildRequires: libX11-devel
|
||||||
BuildRequires: ncurses-devel
|
BuildRequires: ncurses-devel
|
||||||
|
|
||||||
@ -231,22 +237,13 @@ BuildRequires: python3-pip
|
|||||||
# Source code and patches
|
# Source code and patches
|
||||||
# =======================
|
# =======================
|
||||||
|
|
||||||
Source: https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz
|
Source: https://www.python.org/ftp/python/%{version}/Python-%{version}%{prerel}.tar.xz
|
||||||
|
|
||||||
# Supply an RPM macro "py_byte_compile" for the python3-devel subpackage
|
|
||||||
# to enable specfiles to selectively byte-compile individual files and paths
|
|
||||||
# with different Python runtimes as necessary:
|
|
||||||
Source3: macros.pybytecompile%{pybasever}
|
|
||||||
|
|
||||||
# A simple script to check timestamps of bytecode files
|
# A simple script to check timestamps of bytecode files
|
||||||
# Run in check section with Python that is currently being built
|
# Run in check section with Python that is currently being built
|
||||||
# Written by bkabrda
|
# Written by bkabrda
|
||||||
Source8: check-pyc-and-pyo-timestamps.py
|
Source8: check-pyc-and-pyo-timestamps.py
|
||||||
|
|
||||||
# Backward compatible no-op macro for system-python
|
|
||||||
# Remove in Fedora 29
|
|
||||||
Source9: macros.systempython
|
|
||||||
|
|
||||||
# Desktop menu entry for idle3
|
# Desktop menu entry for idle3
|
||||||
Source10: idle3.desktop
|
Source10: idle3.desktop
|
||||||
|
|
||||||
@ -340,42 +337,15 @@ Patch205: 00205-make-libpl-respect-lib64.patch
|
|||||||
# Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
|
# Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
|
||||||
Patch251: 00251-change-user-install-location.patch
|
Patch251: 00251-change-user-install-location.patch
|
||||||
|
|
||||||
# 00262 #
|
|
||||||
# Backport of PEP 538: Coercing the legacy C locale to a UTF-8 based locale
|
|
||||||
# https://www.python.org/dev/peps/pep-0538/
|
|
||||||
# Fedora Change: https://fedoraproject.org/wiki/Changes/python3_c.utf-8_locale
|
|
||||||
# Original proposal: https://bugzilla.redhat.com/show_bug.cgi?id=1404918
|
|
||||||
Patch262: 00262-pep538_coerce_legacy_c_locale.patch
|
|
||||||
|
|
||||||
# 00274 #
|
# 00274 #
|
||||||
# Upstream uses Debian-style architecture naming. Change to match Fedora.
|
# Upstream uses Debian-style architecture naming. Change to match Fedora.
|
||||||
Patch274: 00274-fix-arch-names.patch
|
Patch274: 00274-fix-arch-names.patch
|
||||||
|
|
||||||
# 00292 #
|
# 00291 #
|
||||||
# Restore the public PyExc_RecursionErrorInst symbol that was removed
|
# Build fails with undefined references to dlopen / dlsym otherwise.
|
||||||
# from the 3.6.4 release upstream.
|
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1537489
|
||||||
# Reported upstream: https://bugs.python.org/issue30697
|
# and: https://src.fedoraproject.org/rpms/redhat-rpm-config/c/078af19
|
||||||
Patch292: 00292-restore-PyExc_RecursionErrorInst-symbol.patch
|
Patch291: 00291-setup-Link-ctypes-against-dl-explicitly.patch
|
||||||
|
|
||||||
# 00294 #
|
|
||||||
# Define TLS cipher suite on build time depending
|
|
||||||
# on the OpenSSL default cipher suite selection.
|
|
||||||
# Fixed upstream on CPython's 3.7 branch:
|
|
||||||
# https://bugs.python.org/issue31429
|
|
||||||
# See also: https://bugzilla.redhat.com/show_bug.cgi?id=1489816
|
|
||||||
Patch294: 00294-define-TLS-cipher-suite-on-build-time.patch
|
|
||||||
|
|
||||||
# 00301 #
|
|
||||||
# Tools/scripts/pathfix.py: Add -n option for no backup~
|
|
||||||
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1546990
|
|
||||||
# Fixed upstream: https://bugs.python.org/issue32885
|
|
||||||
Patch301: 00301-pathfix-add-n-option-for-no-backup.patch
|
|
||||||
|
|
||||||
# 00302 #
|
|
||||||
# Fix multiprocessing regression on newer glibcs
|
|
||||||
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1569933
|
|
||||||
# and: https://bugs.python.org/issue33329
|
|
||||||
Patch302: 00302-fix-multiprocessing-regression-on-newer-glibcs.patch
|
|
||||||
|
|
||||||
# (New patches go here ^^^)
|
# (New patches go here ^^^)
|
||||||
#
|
#
|
||||||
@ -504,7 +474,12 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
|||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
Requires: python-rpm-macros
|
Requires: python-rpm-macros
|
||||||
Requires: python3-rpm-macros
|
Requires: python3-rpm-macros
|
||||||
|
|
||||||
|
%if %{with rewheel}
|
||||||
|
# without rewheel is used to bootstrap setuptools+pip
|
||||||
|
# python3-rpm-generators needs python3-setuptools, so we cannot have it yet
|
||||||
Requires: python3-rpm-generators
|
Requires: python3-rpm-generators
|
||||||
|
%endif
|
||||||
|
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1217376
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1217376
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1496757
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1496757
|
||||||
@ -525,7 +500,7 @@ Conflicts: python-tools < 2.7.13-17
|
|||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1312030
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1312030
|
||||||
# /usr/bin/2to3 was moved from python3-tools to python3-devel
|
# /usr/bin/2to3 was moved from python3-tools to python3-devel
|
||||||
# TODO Remove in Fedora 30
|
# TODO Remove in Fedora 30
|
||||||
Conflicts: python3-tools < 3.6.4-14
|
Conflicts: python3-tools < 3.7
|
||||||
|
|
||||||
# Shall be removed in Fedora 31
|
# Shall be removed in Fedora 31
|
||||||
Obsoletes: platform-python-devel < %{platpyver}
|
Obsoletes: platform-python-devel < %{platpyver}
|
||||||
@ -636,18 +611,17 @@ Requires: redhat-rpm-config
|
|||||||
%global __provides_exclude ^python\\(abi\\) = 3\\..$
|
%global __provides_exclude ^python\\(abi\\) = 3\\..$
|
||||||
|
|
||||||
# We keep those inside on purpose
|
# We keep those inside on purpose
|
||||||
Provides: bundled(python3-pip) = 9.0.3
|
Provides: bundled(python3-pip) = 10.0.1
|
||||||
Provides: bundled(python3-setuptools) = 39.0.1
|
Provides: bundled(python3-setuptools) = 39.0.1
|
||||||
|
|
||||||
# The description for the flat package
|
# The description for the flat package
|
||||||
%description
|
%description
|
||||||
Python %{pybasever} package for developers.
|
Python %{pybasever} package for developers.
|
||||||
|
|
||||||
This package exists to allow developers to test their code against an older
|
This package exists to allow developers to test their code against a newer
|
||||||
version of Python. This is not a full Python stack and if you wish to run
|
version of Python. This is not a full Python stack and if you wish to run
|
||||||
your applications with Python %{pybasever}, see other distributions
|
your applications with Python %{pybasever}, update your Fedora to a newer
|
||||||
that support it, such as CentOS or RHEL with Software Collections
|
version once Python %{pybasever} is stable.
|
||||||
or older Fedora releases.
|
|
||||||
|
|
||||||
%endif # with flatpackage
|
%endif # with flatpackage
|
||||||
|
|
||||||
@ -660,10 +634,9 @@ or older Fedora releases.
|
|||||||
|
|
||||||
# Remove bundled libraries to ensure that we're using the system copy.
|
# Remove bundled libraries to ensure that we're using the system copy.
|
||||||
rm -r Modules/expat
|
rm -r Modules/expat
|
||||||
rm -r Modules/zlib
|
|
||||||
|
|
||||||
%if %{with rewheel}
|
%if %{with rewheel}
|
||||||
%global pip_version 9.0.3
|
%global pip_version 9.0.1
|
||||||
sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/ensurepip/__init__.py
|
sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/ensurepip/__init__.py
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@ -689,12 +662,8 @@ sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/en
|
|||||||
|
|
||||||
%patch205 -p1
|
%patch205 -p1
|
||||||
%patch251 -p1
|
%patch251 -p1
|
||||||
%patch262 -p1
|
|
||||||
%patch274 -p1
|
%patch274 -p1
|
||||||
%patch292 -p1
|
%patch291 -p1
|
||||||
%patch294 -p1
|
|
||||||
%patch301 -p1
|
|
||||||
%patch302 -p1
|
|
||||||
|
|
||||||
|
|
||||||
# Remove files that should be generated by the build
|
# Remove files that should be generated by the build
|
||||||
@ -990,13 +959,6 @@ rm -rf %{buildroot}%{_bindir}/__pycache__
|
|||||||
# Fixup permissions for shared libraries from non-standard 555 to standard 755:
|
# Fixup permissions for shared libraries from non-standard 555 to standard 755:
|
||||||
find %{buildroot} -perm 555 -exec chmod 755 {} \;
|
find %{buildroot} -perm 555 -exec chmod 755 {} \;
|
||||||
|
|
||||||
%if %{without flatpackage}
|
|
||||||
# Install macros for rpm:
|
|
||||||
mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d/
|
|
||||||
install -m 644 %{SOURCE3} %{buildroot}/%{_rpmconfigdir}/macros.d/
|
|
||||||
install -m 644 %{SOURCE9} %{buildroot}/%{_rpmconfigdir}/macros.d/
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# Create "/usr/bin/python3-debug", a symlink to the python3 debug binary, to
|
# Create "/usr/bin/python3-debug", a symlink to the python3 debug binary, to
|
||||||
# avoid the user having to know the precise version and ABI flags.
|
# avoid the user having to know the precise version and ABI flags.
|
||||||
# See e.g. https://bugzilla.redhat.com/show_bug.cgi?id=676748
|
# See e.g. https://bugzilla.redhat.com/show_bug.cgi?id=676748
|
||||||
@ -1013,6 +975,11 @@ mkdir -p %{buildroot}%{_libexecdir}
|
|||||||
ln -s %{_bindir}/python%{pybasever} %{buildroot}%{_libexecdir}/system-python
|
ln -s %{_bindir}/python%{pybasever} %{buildroot}%{_libexecdir}/system-python
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
# There's 2to3-X.X executable and 2to3 soft link to it.
|
||||||
|
# No reason to have both, so keep only 2to3 as an executable.
|
||||||
|
# See https://bugzilla.redhat.com/show_bug.cgi?id=1111275
|
||||||
|
mv %{buildroot}%{_bindir}/2to3-%{pybasever} %{buildroot}%{_bindir}/2to3
|
||||||
|
|
||||||
%if %{with flatpackage}
|
%if %{with flatpackage}
|
||||||
# Remove stuff that would conflict with python3 package
|
# Remove stuff that would conflict with python3 package
|
||||||
rm %{buildroot}%{_bindir}/python3
|
rm %{buildroot}%{_bindir}/python3
|
||||||
@ -1021,12 +988,13 @@ rm %{buildroot}%{_bindir}/pathfix.py
|
|||||||
rm %{buildroot}%{_bindir}/idle3
|
rm %{buildroot}%{_bindir}/idle3
|
||||||
rm %{buildroot}%{_bindir}/python3-*
|
rm %{buildroot}%{_bindir}/python3-*
|
||||||
rm %{buildroot}%{_bindir}/pyvenv
|
rm %{buildroot}%{_bindir}/pyvenv
|
||||||
rm %{buildroot}%{_bindir}/2to3*
|
rm %{buildroot}%{_bindir}/2to3
|
||||||
rm %{buildroot}%{_libdir}/libpython3.so
|
rm %{buildroot}%{_libdir}/libpython3.so
|
||||||
rm %{buildroot}%{_mandir}/man1/python3.1*
|
rm %{buildroot}%{_mandir}/man1/python3.1*
|
||||||
rm %{buildroot}%{_libdir}/pkgconfig/python3.pc
|
rm %{buildroot}%{_libdir}/pkgconfig/python3.pc
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
# ======================================================
|
# ======================================================
|
||||||
# Checks for packaging issues
|
# Checks for packaging issues
|
||||||
# ======================================================
|
# ======================================================
|
||||||
@ -1062,6 +1030,7 @@ for Module in %{buildroot}/%{dynload_dir}/*.so ; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# ======================================================
|
# ======================================================
|
||||||
# Running the upstream test suite
|
# Running the upstream test suite
|
||||||
# ======================================================
|
# ======================================================
|
||||||
@ -1080,20 +1049,17 @@ CheckPython() {
|
|||||||
# our non-standard decorators take effect on the relevant tests:
|
# our non-standard decorators take effect on the relevant tests:
|
||||||
# @unittest._skipInRpmBuild(reason)
|
# @unittest._skipInRpmBuild(reason)
|
||||||
# @unittest._expectedFailureInRpmBuild
|
# @unittest._expectedFailureInRpmBuild
|
||||||
# test_faulthandler.test_register_chain currently fails on ppc64le and
|
|
||||||
# aarch64, see upstream bug http://bugs.python.org/issue21131
|
|
||||||
WITHIN_PYTHON_RPM_BUILD= \
|
WITHIN_PYTHON_RPM_BUILD= \
|
||||||
LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.regrtest \
|
LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.regrtest \
|
||||||
-wW --slowest --findleaks \
|
-wW --slowest --findleaks \
|
||||||
-x test_distutils \
|
-x test_distutils \
|
||||||
-x test_bdist_rpm \
|
-x test_bdist_rpm \
|
||||||
-x test_gdb \
|
|
||||||
%ifarch ppc64le aarch64
|
|
||||||
-x test_faulthandler \
|
|
||||||
%endif
|
|
||||||
%ifarch %{mips64}
|
%ifarch %{mips64}
|
||||||
-x test_ctypes \
|
-x test_ctypes \
|
||||||
%endif
|
%endif
|
||||||
|
%ifarch %{power64} s390 s390x armv7hl %{mips}
|
||||||
|
-x test_gdb \
|
||||||
|
%endif
|
||||||
%ifarch ppc64le
|
%ifarch ppc64le
|
||||||
-x test_buffer \
|
-x test_buffer \
|
||||||
%endif
|
%endif
|
||||||
@ -1122,17 +1088,17 @@ CheckPython optimized
|
|||||||
%{_bindir}/pydoc*
|
%{_bindir}/pydoc*
|
||||||
%{_bindir}/python3
|
%{_bindir}/python3
|
||||||
%{_bindir}/pyvenv
|
%{_bindir}/pyvenv
|
||||||
%{_mandir}/*/*
|
|
||||||
%{_bindir}/pyvenv
|
|
||||||
# Remove in Fedora 29:
|
# Remove in Fedora 29:
|
||||||
%{_libexecdir}/system-python
|
%{_libexecdir}/system-python
|
||||||
%else
|
%else
|
||||||
%{_bindir}/pydoc%{pybasever}
|
%{_bindir}/pydoc%{pybasever}
|
||||||
%{_mandir}/*/python%{pybasever}*
|
|
||||||
%endif
|
%endif
|
||||||
%{_bindir}/pyvenv-%{pybasever}
|
|
||||||
%{_bindir}/python%{pybasever}
|
%{_bindir}/python%{pybasever}
|
||||||
%{_bindir}/python%{pybasever}m
|
%{_bindir}/python%{pybasever}m
|
||||||
|
%{_bindir}/pyvenv-%{pybasever}
|
||||||
|
%{_mandir}/*/*
|
||||||
|
|
||||||
|
|
||||||
%if %{without flatpackage}
|
%if %{without flatpackage}
|
||||||
%files libs
|
%files libs
|
||||||
@ -1224,6 +1190,7 @@ CheckPython optimized
|
|||||||
%{dynload_dir}/_codecs_jp.%{SOABI_optimized}.so
|
%{dynload_dir}/_codecs_jp.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_codecs_kr.%{SOABI_optimized}.so
|
%{dynload_dir}/_codecs_kr.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_codecs_tw.%{SOABI_optimized}.so
|
%{dynload_dir}/_codecs_tw.%{SOABI_optimized}.so
|
||||||
|
%{dynload_dir}/_contextvars.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_crypt.%{SOABI_optimized}.so
|
%{dynload_dir}/_crypt.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_csv.%{SOABI_optimized}.so
|
%{dynload_dir}/_csv.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_ctypes.%{SOABI_optimized}.so
|
%{dynload_dir}/_ctypes.%{SOABI_optimized}.so
|
||||||
@ -1245,6 +1212,7 @@ CheckPython optimized
|
|||||||
%{dynload_dir}/_opcode.%{SOABI_optimized}.so
|
%{dynload_dir}/_opcode.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_pickle.%{SOABI_optimized}.so
|
%{dynload_dir}/_pickle.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_posixsubprocess.%{SOABI_optimized}.so
|
%{dynload_dir}/_posixsubprocess.%{SOABI_optimized}.so
|
||||||
|
%{dynload_dir}/_queue.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_random.%{SOABI_optimized}.so
|
%{dynload_dir}/_random.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_socket.%{SOABI_optimized}.so
|
%{dynload_dir}/_socket.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_sqlite3.%{SOABI_optimized}.so
|
%{dynload_dir}/_sqlite3.%{SOABI_optimized}.so
|
||||||
@ -1271,6 +1239,7 @@ CheckPython optimized
|
|||||||
%{dynload_dir}/termios.%{SOABI_optimized}.so
|
%{dynload_dir}/termios.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_testmultiphase.%{SOABI_optimized}.so
|
%{dynload_dir}/_testmultiphase.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/unicodedata.%{SOABI_optimized}.so
|
%{dynload_dir}/unicodedata.%{SOABI_optimized}.so
|
||||||
|
%{dynload_dir}/_uuid.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/xxlimited.%{SOABI_optimized}.so
|
%{dynload_dir}/xxlimited.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/zlib.%{SOABI_optimized}.so
|
%{dynload_dir}/zlib.%{SOABI_optimized}.so
|
||||||
|
|
||||||
@ -1364,12 +1333,11 @@ CheckPython optimized
|
|||||||
%{_libdir}/libpython3.so
|
%{_libdir}/libpython3.so
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%if %{without flatpackage}
|
%if %{without flatpackage}
|
||||||
%files devel
|
%files devel
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%{_bindir}/2to3
|
%{_bindir}/2to3
|
||||||
# TODO: Remove 2to3-3.7 once rebased to 3.7
|
|
||||||
%{_bindir}/2to3-%{pybasever}
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/*
|
%{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/*
|
||||||
@ -1384,8 +1352,6 @@ CheckPython optimized
|
|||||||
%if %{without flatpackage}
|
%if %{without flatpackage}
|
||||||
%{_bindir}/python3-config
|
%{_bindir}/python3-config
|
||||||
%{_libdir}/pkgconfig/python3.pc
|
%{_libdir}/pkgconfig/python3.pc
|
||||||
%{_rpmconfigdir}/macros.d/macros.pybytecompile%{pybasever}
|
|
||||||
%{_rpmconfigdir}/macros.d/macros.systempython
|
|
||||||
%{_bindir}/pathfix.py
|
%{_bindir}/pathfix.py
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@ -1396,6 +1362,7 @@ CheckPython optimized
|
|||||||
%{_libdir}/pkgconfig/python-%{LDVERSION_optimized}.pc
|
%{_libdir}/pkgconfig/python-%{LDVERSION_optimized}.pc
|
||||||
%{_libdir}/pkgconfig/python-%{pybasever}.pc
|
%{_libdir}/pkgconfig/python-%{pybasever}.pc
|
||||||
|
|
||||||
|
|
||||||
%if %{without flatpackage}
|
%if %{without flatpackage}
|
||||||
%files idle
|
%files idle
|
||||||
%defattr(-,root,root,755)
|
%defattr(-,root,root,755)
|
||||||
@ -1431,10 +1398,12 @@ CheckPython optimized
|
|||||||
%dir %{pylibdir}/turtledemo/__pycache__/
|
%dir %{pylibdir}/turtledemo/__pycache__/
|
||||||
%{pylibdir}/turtledemo/__pycache__/*%{bytecode_suffixes}
|
%{pylibdir}/turtledemo/__pycache__/*%{bytecode_suffixes}
|
||||||
|
|
||||||
|
|
||||||
%if %{without flatpackage}
|
%if %{without flatpackage}
|
||||||
%files test
|
%files test
|
||||||
%defattr(-, root, root)
|
%defattr(-, root, root)
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%{pylibdir}/ctypes/test
|
%{pylibdir}/ctypes/test
|
||||||
%{pylibdir}/distutils/tests
|
%{pylibdir}/distutils/tests
|
||||||
%{pylibdir}/sqlite3/test
|
%{pylibdir}/sqlite3/test
|
||||||
@ -1443,6 +1412,7 @@ CheckPython optimized
|
|||||||
%{dynload_dir}/_testbuffer.%{SOABI_optimized}.so
|
%{dynload_dir}/_testbuffer.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_testcapi.%{SOABI_optimized}.so
|
%{dynload_dir}/_testcapi.%{SOABI_optimized}.so
|
||||||
%{dynload_dir}/_testimportmultiple.%{SOABI_optimized}.so
|
%{dynload_dir}/_testimportmultiple.%{SOABI_optimized}.so
|
||||||
|
%{dynload_dir}/_xxtestfuzz.%{SOABI_optimized}.so
|
||||||
%{pylibdir}/lib2to3/tests
|
%{pylibdir}/lib2to3/tests
|
||||||
%{pylibdir}/tkinter/test
|
%{pylibdir}/tkinter/test
|
||||||
%{pylibdir}/unittest/test
|
%{pylibdir}/unittest/test
|
||||||
@ -1483,6 +1453,7 @@ CheckPython optimized
|
|||||||
%{dynload_dir}/_codecs_jp.%{SOABI_debug}.so
|
%{dynload_dir}/_codecs_jp.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/_codecs_kr.%{SOABI_debug}.so
|
%{dynload_dir}/_codecs_kr.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/_codecs_tw.%{SOABI_debug}.so
|
%{dynload_dir}/_codecs_tw.%{SOABI_debug}.so
|
||||||
|
%{dynload_dir}/_contextvars.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/_crypt.%{SOABI_debug}.so
|
%{dynload_dir}/_crypt.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/_csv.%{SOABI_debug}.so
|
%{dynload_dir}/_csv.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/_ctypes.%{SOABI_debug}.so
|
%{dynload_dir}/_ctypes.%{SOABI_debug}.so
|
||||||
@ -1504,6 +1475,7 @@ CheckPython optimized
|
|||||||
%{dynload_dir}/_opcode.%{SOABI_debug}.so
|
%{dynload_dir}/_opcode.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/_pickle.%{SOABI_debug}.so
|
%{dynload_dir}/_pickle.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/_posixsubprocess.%{SOABI_debug}.so
|
%{dynload_dir}/_posixsubprocess.%{SOABI_debug}.so
|
||||||
|
%{dynload_dir}/_queue.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/_random.%{SOABI_debug}.so
|
%{dynload_dir}/_random.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/_socket.%{SOABI_debug}.so
|
%{dynload_dir}/_socket.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/_sqlite3.%{SOABI_debug}.so
|
%{dynload_dir}/_sqlite3.%{SOABI_debug}.so
|
||||||
@ -1530,6 +1502,8 @@ CheckPython optimized
|
|||||||
%{dynload_dir}/termios.%{SOABI_debug}.so
|
%{dynload_dir}/termios.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/_testmultiphase.%{SOABI_debug}.so
|
%{dynload_dir}/_testmultiphase.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/unicodedata.%{SOABI_debug}.so
|
%{dynload_dir}/unicodedata.%{SOABI_debug}.so
|
||||||
|
%{dynload_dir}/_uuid.%{SOABI_debug}.so
|
||||||
|
%{dynload_dir}/_xxtestfuzz.%{SOABI_debug}.so
|
||||||
%{dynload_dir}/zlib.%{SOABI_debug}.so
|
%{dynload_dir}/zlib.%{SOABI_debug}.so
|
||||||
|
|
||||||
# No need to split things out the "Makefile" and the config-32/64.h file as we
|
# No need to split things out the "Makefile" and the config-32/64.h file as we
|
||||||
@ -1583,6 +1557,9 @@ CheckPython optimized
|
|||||||
# ======================================================
|
# ======================================================
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jun 12 2018 Miro Hrončok <mhroncok@redhat.com> - 3.7.0-0.20.rc1
|
||||||
|
- Update to 3.7.0rc1
|
||||||
|
|
||||||
* Mon Apr 23 2018 Miro Hrončok <mhroncok@redhat.com> - 3.6.5-4
|
* Mon Apr 23 2018 Miro Hrončok <mhroncok@redhat.com> - 3.6.5-4
|
||||||
- Fix multiprocessing regression on newer glibcs
|
- Fix multiprocessing regression on newer glibcs
|
||||||
- Enable test_multiprocessing_fork(server) and _spawn again
|
- Enable test_multiprocessing_fork(server) and _spawn again
|
||||||
|
2
sources
2
sources
@ -1 +1 @@
|
|||||||
SHA512 (Python-3.6.5.tar.xz) = 6b26fcd296b9bd8e67861eff10d14db7507711ddba947288d16d6def53135c39326b7f969c04bb2b2993f924d9e7ad3f5c5282a3915760bc0885cf0a8ea5eb51
|
SHA512 (Python-3.7.0rc1.tar.xz) = cc4c29dfce7e2fca6328f802bd435e1ffc4acecd70d83d602a894bf076bdb95fb4635c891043ba1c3b6438d23ba7f76545cfe323ec0b57029b5c0f639fc6d2c5
|
||||||
|
Loading…
Reference in New Issue
Block a user