The package rpms/python37.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s): https://src.fedoraproject.org/cgit/rpms/python37.git/commit/?id=51bab8ac8920....
Change: +%ifarch %{valgrind_arches}
Thanks.
Full change: ============
commit 23250244c67709cf2e24b8aaf80a59de1bbb943b Author: Miro Hronok miro@hroncok.cz Date: Mon Sep 24 11:51:29 2018 +0200
Security fix for CVE-2018-14647 (#1631822)
diff --git a/00310-use-xml-sethashsalt-in-elementtree.patch b/00310-use-xml-sethashsalt-in-elementtree.patch new file mode 100644 index 0000000..a206928 --- /dev/null +++ b/00310-use-xml-sethashsalt-in-elementtree.patch @@ -0,0 +1,84 @@ +From 5f610ec2043aa6b52cb6a6b5e436df091a4f2d91 Mon Sep 17 00:00:00 2001 +From: Christian Heimes christian@python.org +Date: Tue, 18 Sep 2018 14:38:58 +0200 +Subject: [PATCH] bpo-34623: Use XML_SetHashSalt in _elementtree (GH-9146) + +The C accelerated _elementtree module now initializes hash randomization +salt from _Py_HashSecret instead of libexpat's default CPRNG. + +Signed-off-by: Christian Heimes christian@python.org + +https://bugs.python.org/issue34623 +(cherry picked from commit cb5778f00ce48631c7140f33ba242496aaf7102b) + +Co-authored-by: Christian Heimes christian@python.org +--- + Include/pyexpat.h | 4 +++- + .../next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst | 2 ++ + Modules/_elementtree.c | 5 +++++ + Modules/pyexpat.c | 5 +++++ + 4 files changed, 15 insertions(+), 1 deletion(-) + create mode 100644 Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst + +diff --git a/Include/pyexpat.h b/Include/pyexpat.h +index 44259bf6d716..07020b5dc964 100644 +--- a/Include/pyexpat.h ++++ b/Include/pyexpat.h +@@ -3,7 +3,7 @@ + + /* note: you must import expat.h before importing this module! */ + +-#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0" ++#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.1" + #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" + + struct PyExpat_CAPI +@@ -48,6 +48,8 @@ struct PyExpat_CAPI + enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding); + int (*DefaultUnknownEncodingHandler)( + void *encodingHandlerData, const XML_Char *name, XML_Encoding *info); ++ /* might be none for expat < 2.1.0 */ ++ int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt); + /* always add new stuff to the end! */ + }; + +diff --git a/Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst b/Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst +new file mode 100644 +index 000000000000..31ad92ef8582 +--- /dev/null ++++ b/Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst +@@ -0,0 +1,2 @@ ++The C accelerated _elementtree module now initializes hash randomization ++salt from _Py_HashSecret instead of libexpat's default CSPRNG. +diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c +index 1dfdb3ce34f3..4b86f96a70d3 100644 +--- a/Modules/_elementtree.c ++++ b/Modules/_elementtree.c +@@ -3305,6 +3305,11 @@ _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *html, + PyErr_NoMemory(); + return -1; + } ++ /* expat < 2.1.0 has no XML_SetHashSalt() */ ++ if (EXPAT(SetHashSalt) != NULL) { ++ EXPAT(SetHashSalt)(self->parser, ++ (unsigned long)_Py_HashSecret.expat.hashsalt); ++ } + + if (target) { + Py_INCREF(target); +diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c +index c8a01d4e088e..c52079e518f2 100644 +--- a/Modules/pyexpat.c ++++ b/Modules/pyexpat.c +@@ -1877,6 +1877,11 @@ MODULE_INITFUNC(void) + capi.SetStartDoctypeDeclHandler = XML_SetStartDoctypeDeclHandler; + capi.SetEncoding = XML_SetEncoding; + capi.DefaultUnknownEncodingHandler = PyUnknownEncodingHandler; ++#if XML_COMBINED_VERSION >= 20100 ++ capi.SetHashSalt = XML_SetHashSalt; ++#else ++ capi.SetHashSalt = NULL; ++#endif + + /* export using capsule */ + capi_object = PyCapsule_New(&capi, PyExpat_CAPSULE_NAME, NULL); diff --git a/python37.spec b/python37.spec index 5759897..8fad1f4 100644 --- a/python37.spec +++ b/python37.spec @@ -15,7 +15,7 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well Version: %{pybasever}.0 -Release: 8%{?dist} +Release: 10%{?dist} License: Python
@@ -317,6 +317,13 @@ Patch291: 00291-setup-Link-ctypes-against-dl-explicitly.patch # and: https://bugs.python.org/issue34008 Patch307: 00307-allow-to-call-Py_Main-after-Py_Initialize.patch
+# 00310 # +# CVE-2018-14647 +# Use XML_SetHashSalt in _elementtree +# rhbz#1631822 +# Fixed upstream https://bugs.python.org/issue34623 +Patch310: 00310-use-xml-sethashsalt-in-elementtree.patch + # (New patches go here ^^^) # # When adding new patches to "python" and "python3" in Fedora, EL, etc., @@ -635,6 +642,7 @@ sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/en %patch274 -p1 %patch291 -p1 %patch307 -p1 +%patch310 -p1
# Remove files that should be generated by the build @@ -1537,6 +1545,9 @@ CheckPython optimized # ======================================================
%changelog +* Mon Sep 24 2018 Miro Hronok mhroncok@redhat.com - 3.7.0-10 +- Security fix for CVE-2018-14647 (#1631822) + * Fri Aug 17 2018 Miro Hronok mhroncok@redhat.com - 3.7.0-8 - Add /usr/bin/pygettext3.py and msgfmt3.py to python3-devel Resolves: rhbz#1571474
commit 848900d29f5d5260951b8a248eb89ef252bbbe2c Author: Miro Hronok miro@hroncok.cz Date: Mon Sep 3 14:10:31 2018 +0200
rpmlintrc updates
* put 64 in ()? to support 32bit RPMs * add new executables to the manpages ignore list
diff --git a/python37.rpmlintrc b/python37.rpmlintrc index 6c1ce83..d59fe13 100644 --- a/python37.rpmlintrc +++ b/python37.rpmlintrc @@ -26,12 +26,12 @@ addFilter(r'only-non-binary-in-usr-lib')
# some devel files that are deliberately needed addFilter(r'devel-file-in-non-devel-package /usr/include/python3.\dm/pyconfig-(32|64).h') -addFilter(r'devel-file-in-non-devel-package /usr/lib64/python3.\d/distutils/tests/xxmodule.c') +addFilter(r'devel-file-in-non-devel-package /usr/lib(64)?/python3.\d/distutils/tests/xxmodule.c')
# SORRY, NOT SORRY: # manual pages -addFilter(r'no-manual-page-for-binary (idle|pydoc|pyvenv|2to3|python3-debug|pathfix.py)') +addFilter(r'no-manual-page-for-binary (idle|pydoc|pyvenv|2to3|python3-debug|pathfix|msgfmt|pygettext)') addFilter(r'no-manual-page-for-binary python3.*-config$') addFilter(r'no-manual-page-for-binary python3.\dd?m$')
commit d1d8450584d406af872d1fd032d05318d2c4c1ce Author: Petr plchal psplicha@redhat.com Date: Thu Jul 19 17:02:45 2018 +0200
Enable basic venv smoke test in the CI
This executes virtual environment smoke test from the shared python tests repository against Python 3.7.
diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..2e14ca0 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,17 @@ +--- +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + repositories: + - repo: "https://src.fedoraproject.org/tests/python.git" + dest: "python" + tests: + - smoke: + dir: python/smoke + run: VERSION=3.7 ./venv.sh + required_packages: + - gcc + - python3-tox + - python3-devel
commit a6973b589d2de739b7346e1b44a865e7b8eaef58 Author: Miro Hronok miro@hroncok.cz Date: Thu Jul 26 14:19:23 2018 +0200
Renew check-pyc-timestamps.py
- rename it, the are no pyo files on Python 3 - make sure to check all levels of pyc files optimization - use path globs - use comprehensions instead of map + filter - use f-strings and print() instead of sys.stderr.write()
diff --git a/check-pyc-and-pyo-timestamps.py b/check-pyc-and-pyo-timestamps.py deleted file mode 100644 index 262a985..0000000 --- a/check-pyc-and-pyo-timestamps.py +++ /dev/null @@ -1,62 +0,0 @@ -"""Checks if all *.pyc and *.pyo files have later mtime than their *.py files.""" - -import importlib.util -import os -import sys - -# list of test and other files that we expect not to have bytecode -not_compiled = [ - '/usr/bin/pathfix.py', - 'test/bad_coding.py', - 'test/bad_coding2.py', - 'test/badsyntax_3131.py', - 'test/badsyntax_future3.py', - 'test/badsyntax_future4.py', - 'test/badsyntax_future5.py', - 'test/badsyntax_future6.py', - 'test/badsyntax_future7.py', - 'test/badsyntax_future8.py', - 'test/badsyntax_future9.py', - 'test/badsyntax_future10.py', - 'test/badsyntax_async1.py', - 'test/badsyntax_async2.py', - 'test/badsyntax_async3.py', - 'test/badsyntax_async4.py', - 'test/badsyntax_async5.py', - 'test/badsyntax_async6.py', - 'test/badsyntax_async7.py', - 'test/badsyntax_async8.py', - 'test/badsyntax_async9.py', - 'test/badsyntax_pep3120.py', - 'lib2to3/tests/data/bom.py', - 'lib2to3/tests/data/crlf.py', - 'lib2to3/tests/data/different_encoding.py', - 'lib2to3/tests/data/false_encoding.py', - 'lib2to3/tests/data/py2_test_grammar.py', - '.debug-gdb.py', -] -failed = 0 - - -def bytecode_expected(source): - for f in not_compiled: - if source.endswith(f): - return False - return True - - -compiled = filter(lambda f: bytecode_expected(f), sys.argv[1:]) -for f in compiled: - # check both pyo and pyc - to_check = map(lambda b: importlib.util.cache_from_source(f, b), (True, False)) - f_mtime = os.path.getmtime(f) - for c in to_check: - c_mtime = os.path.getmtime(c) - if c_mtime < f_mtime: - sys.stderr.write('Failed bytecompilation timestamps check: ') - sys.stderr.write('Bytecode file {} is older than source file {}.\n'.format(c, f)) - failed += 1 - -if failed: - sys.stderr.write('\n{} files failed bytecompilation timestamps check.\n'.format(failed)) - sys.exit(1) diff --git a/check-pyc-timestamps.py b/check-pyc-timestamps.py new file mode 100644 index 0000000..91af4fd --- /dev/null +++ b/check-pyc-timestamps.py @@ -0,0 +1,55 @@ +"""Checks if all *.pyc files have later mtime than their *.py files.""" + +import os +import sys +from importlib.util import cache_from_source +from pathlib import Path + + +RPM_BUILD_ROOT = os.environ.get('RPM_BUILD_ROOT', '') + +# ...cpython-3X.pyc +# ...cpython-3X.opt-1.pyc +# ...cpython-3X.opt-2.pyc +LEVELS = (None, 1, 2) + +# list of globs of test and other files that we expect not to have bytecode +not_compiled = [ + '/usr/bin/*', + '*/test/bad_coding.py', + '*/test/bad_coding2.py', + '*/test/badsyntax_*.py', + '*/lib2to3/tests/data/bom.py', + '*/lib2to3/tests/data/crlf.py', + '*/lib2to3/tests/data/different_encoding.py', + '*/lib2to3/tests/data/false_encoding.py', + '*/lib2to3/tests/data/py2_test_grammar.py', + '*.debug-gdb.py', +] + + +def bytecode_expected(path): + path = Path(path[len(RPM_BUILD_ROOT):]) + for glob in not_compiled: + if path.match(glob): + return False + return True + + +failed = 0 +compiled = (path for path in sys.argv[1:] if bytecode_expected(path)) +for path in compiled: + to_check = (cache_from_source(path, optimization=opt) for opt in LEVELS) + f_mtime = os.path.getmtime(path) + for pyc in to_check: + c_mtime = os.path.getmtime(pyc) + if c_mtime < f_mtime: + print('Failed bytecompilation timestamps check: ' + f'Bytecode file {pyc} is older than source file {path}', + file=sys.stderr) + failed += 1 + +if failed: + print(f'\n{failed} files failed bytecompilation timestamps check.', + file=sys.stderr) + sys.exit(1) diff --git a/python37.spec b/python37.spec index 3056f2c..5759897 100644 --- a/python37.spec +++ b/python37.spec @@ -205,8 +205,8 @@ Source: https://www.python.org/ftp/python/%%7Bversion%7D/Python-%%7Bversion%7D.tar.x...
# A simple script to check timestamps of bytecode files # Run in check section with Python that is currently being built -# Written by bkabrda -Source8: check-pyc-and-pyo-timestamps.py +# Originally written by bkabrda +Source8: check-pyc-timestamps.py
# Desktop menu entry for idle3 Source10: idle3.desktop
commit 95ce51cb2be97b786adb9e71133bf6a97c5725b4 Author: Miro Hronok miro@hroncok.cz Date: Thu Jul 26 13:44:49 2018 +0200
Add /usr/bin/pygettext3.py and msgfmt3.py to python3-devel
Resolves: rhbz#1571474
diff --git a/python37.spec b/python37.spec index f87db9d..3056f2c 100644 --- a/python37.spec +++ b/python37.spec @@ -15,7 +15,7 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well Version: %{pybasever}.0 -Release: 5%{?dist} +Release: 8%{?dist} License: Python
@@ -885,6 +885,14 @@ sed -i -e "s/'pyconfig.h'/'%{_pyconfig_h}'/" \ # See https://github.com/fedora-python/python-rpm-porting/issues/24 cp -p Tools/scripts/pathfix.py %{buildroot}%{_bindir}/
+# Install i18n tools to bindir +# They are also in python2, so we version them +# https://bugzilla.redhat.com/show_bug.cgi?id=1571474 +for tool in pygettext msgfmt; do + cp -p Tools/i18n/${tool}.py %{buildroot}%{_bindir}/${tool}%{pybasever}.py + ln -s ${tool}%{pybasever}.py %{buildroot}%{_bindir}/${tool}3.py +done + # Switch all shebangs to refer to the specific Python version. # This currently only covers files matching ^[a-zA-Z0-9_]+.py$, # so handle files named using other naming scheme separately. @@ -892,6 +900,7 @@ LD_LIBRARY_PATH=./build/optimized ./build/optimized/python \ Tools/scripts/pathfix.py \ -i "%{_bindir}/python%{pybasever}" -pn \ %{buildroot} \ + %{buildroot}%{_bindir}/*%{pybasever}.py \ %{?with_gdb_hooks:%{buildroot}$DirHoldingGdbPy/*.py}
# Remove tests for python3-tools which was removed in @@ -956,6 +965,8 @@ mv %{buildroot}%{_bindir}/2to3-%{pybasever} %{buildroot}%{_bindir}/2to3 rm %{buildroot}%{_bindir}/python3 rm %{buildroot}%{_bindir}/pydoc3 rm %{buildroot}%{_bindir}/pathfix.py +rm %{buildroot}%{_bindir}/pygettext3.py +rm %{buildroot}%{_bindir}/msgfmt3.py rm %{buildroot}%{_bindir}/idle3 rm %{buildroot}%{_bindir}/python3-* rm %{buildroot}%{_bindir}/pyvenv @@ -1321,8 +1332,13 @@ CheckPython optimized %{_bindir}/python3-config %{_libdir}/pkgconfig/python3.pc %{_bindir}/pathfix.py +%{_bindir}/pygettext3.py +%{_bindir}/msgfmt3.py %endif
+%{_bindir}/pygettext%{pybasever}.py +%{_bindir}/msgfmt%{pybasever}.py + %{_bindir}/python%{pybasever}-config %{_bindir}/python%{LDVERSION_optimized}-config %{_bindir}/python%{LDVERSION_optimized}-*-config @@ -1521,6 +1537,10 @@ CheckPython optimized # ======================================================
%changelog +* Fri Aug 17 2018 Miro Hronok mhroncok@redhat.com - 3.7.0-8 +- Add /usr/bin/pygettext3.py and msgfmt3.py to python3-devel +Resolves: rhbz#1571474 + * Fri Aug 10 2018 Igor Gnatenko ignatenkobrain@fedoraproject.org - 3.7.0-5 - Fix wrong requirement on gdbm
commit b31a7f9fe72faab2cef1d96b6a89a768fab0e5b5 Author: Igor Gnatenko ignatenkobrain@fedoraproject.org Date: Fri Aug 10 12:56:24 2018 +0200
Fix wrong requirement on gdbm
Signed-off-by: Igor Gnatenko ignatenkobrain@fedoraproject.org
diff --git a/python37.spec b/python37.spec index cba7309..f87db9d 100644 --- a/python37.spec +++ b/python37.spec @@ -15,7 +15,7 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well Version: %{pybasever}.0 -Release: 4%{?dist} +Release: 5%{?dist} License: Python
@@ -412,7 +412,7 @@ Requires: glibc%{?_isa} >= 2.24.90-26
%if %{with gdbm} # When built with this (as guarded by the BuildRequires above), require it -Requires: gdbm%{?_isa} >= 1:1.13 +Requires: gdbm-libs%{?_isa} >= 1:1.13 %endif
# There are files in the standard library that have python shebang. @@ -1521,6 +1521,9 @@ CheckPython optimized # ======================================================
%changelog +* Fri Aug 10 2018 Igor Gnatenko ignatenkobrain@fedoraproject.org - 3.7.0-5 +- Fix wrong requirement on gdbm + * Fri Jul 20 2018 Miro Hronok mhroncok@redhat.com - 3.7.0-4 - Allow to call Py_Main() after Py_Initialize() Resolves: rhbz#1595421
commit 51bab8ac89209c17713e7c20298e9da70a78cc61 Author: Miro Hronok miro@hroncok.cz Date: Sat Aug 4 22:07:21 2018 +0200
Use the %{valgrind_arches} macro instead of hardcoding unsupported arches
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/...
diff --git a/python37.spec b/python37.spec index 7bf41a6..cba7309 100644 --- a/python37.spec +++ b/python37.spec @@ -72,10 +72,9 @@ License: Python %bcond_without computed_gotos
# Support for the Valgrind debugger/profiler -%ifnarch s390 %{mips} riscv64 +%ifarch %{valgrind_arches} %bcond_without valgrind %else -# Some arches don't have valgrind, disable support for it there. %bcond_with valgrind %endif
commit 24f4643573ef2008e095f9ca646dd4b3f763bc09 Author: Miro Hronok miro@hroncok.cz Date: Fri Jul 20 17:47:22 2018 +0200
Allow to call Py_Main() after Py_Initialize()
Resolves: rhbz#1595421
diff --git a/00307-allow-to-call-Py_Main-after-Py_Initialize.patch b/00307-allow-to-call-Py_Main-after-Py_Initialize.patch new file mode 100644 index 0000000..d9c0486 --- /dev/null +++ b/00307-allow-to-call-Py_Main-after-Py_Initialize.patch @@ -0,0 +1,150 @@ +From bbd6fc7e77dbd33ae7d3670eaf7800b5d3ff42d3 Mon Sep 17 00:00:00 2001 +From: Victor Stinner vstinner@redhat.com +Date: Fri, 20 Jul 2018 17:34:23 +0200 +Subject: [PATCH] bpo-34008: Allow to call Py_Main() after Py_Initialize() + (GH-8043) + +Py_Main() can again be called after Py_Initialize(), as in Python +3.6. The new configuration is ignored, except of +_PyMainInterpreterConfig.argv which is used to update sys.argv. +(cherry picked from commit fb47bca9ee2d07ce96df94b4e4abafd11826eb01) + +Co-authored-by: Victor Stinner vstinner@redhat.com +--- + Lib/test/test_embed.py | 8 ++++++++ + .../C API/2018-07-02-10-58-11.bpo-34008.COewz-.rst | 1 + + Modules/main.c | 10 +++++++--- + Programs/_testembed.c | 16 +++++++++++++++ + Python/pylifecycle.c | 23 +++++++++++++++++++--- + 5 files changed, 52 insertions(+), 6 deletions(-) + create mode 100644 Misc/NEWS.d/next/C API/2018-07-02-10-58-11.bpo-34008.COewz-.rst + +diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py +index f3b60433ccc1..024c3f99a85d 100644 +--- a/Lib/test/test_embed.py ++++ b/Lib/test/test_embed.py +@@ -238,6 +238,14 @@ def test_initialize_twice(self): + self.assertEqual(out, '') + self.assertEqual(err, '') + ++ def test_initialize_pymain(self): ++ """ ++ bpo-34008: Calling Py_Main() after Py_Initialize() must not fail. ++ """ ++ out, err = self.run_embedded_interpreter("initialize_pymain") ++ self.assertEqual(out.rstrip(), "Py_Main() after Py_Initialize: sys.argv=['-c', 'arg2']") ++ self.assertEqual(err, '') ++ + + if __name__ == "__main__": + unittest.main() +diff --git a/Misc/NEWS.d/next/C API/2018-07-02-10-58-11.bpo-34008.COewz-.rst b/Misc/NEWS.d/next/C API/2018-07-02-10-58-11.bpo-34008.COewz-.rst +new file mode 100644 +index 000000000000..d9881b9945df +--- /dev/null ++++ b/Misc/NEWS.d/next/C API/2018-07-02-10-58-11.bpo-34008.COewz-.rst +@@ -0,0 +1 @@ ++Py_Main() can again be called after Py_Initialize(), as in Python 3.6. +diff --git a/Modules/main.c b/Modules/main.c +index 3809fa4abef5..31ebbceb83e0 100644 +--- a/Modules/main.c ++++ b/Modules/main.c +@@ -2647,9 +2647,13 @@ pymain_main(_PyMain *pymain) + + pymain_init_stdio(pymain); + +- pymain->err = _Py_InitializeCore(&pymain->config); +- if (_Py_INIT_FAILED(pymain->err)) { +- _Py_FatalInitError(pymain->err); ++ /* bpo-34008: For backward compatibility reasons, calling Py_Main() after ++ Py_Initialize() ignores the new configuration. */ ++ if (!_PyRuntime.initialized) { ++ pymain->err = _Py_InitializeCore(&pymain->config); ++ if (_Py_INIT_FAILED(pymain->err)) { ++ _Py_FatalInitError(pymain->err); ++ } + } + + if (pymain_init_python_main(pymain) < 0) { +diff --git a/Programs/_testembed.c b/Programs/_testembed.c +index b8827f074b9c..b1be682f7adc 100644 +--- a/Programs/_testembed.c ++++ b/Programs/_testembed.c +@@ -276,6 +276,21 @@ static int test_initialize_twice(void) + return 0; + } + ++static int test_initialize_pymain(void) ++{ ++ wchar_t *argv[] = {L"PYTHON", L"-c", ++ L"import sys; print(f'Py_Main() after Py_Initialize: sys.argv={sys.argv}')", ++ L"arg2"}; ++ _testembed_Py_Initialize(); ++ ++ /* bpo-34008: Calling Py_Main() after Py_Initialize() must not crash */ ++ Py_Main(Py_ARRAY_LENGTH(argv), argv); ++ ++ Py_Finalize(); ++ ++ return 0; ++} ++ + + /* ********************************************************* + * List of test cases and the function that implements it. +@@ -302,6 +317,7 @@ static struct TestCase TestCases[] = { + { "pre_initialization_sys_options", test_pre_initialization_sys_options }, + { "bpo20891", test_bpo20891 }, + { "initialize_twice", test_initialize_twice }, ++ { "initialize_pymain", test_initialize_pymain }, + { NULL, NULL } + }; + +diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c +index fdb759f480be..219a46558825 100644 +--- a/Python/pylifecycle.c ++++ b/Python/pylifecycle.c +@@ -775,6 +775,22 @@ _Py_InitializeCore(const _PyCoreConfig *core_config) + return _Py_INIT_OK(); + } + ++/* Py_Initialize() has already been called: update the main interpreter ++ configuration. Example of bpo-34008: Py_Main() called after ++ Py_Initialize(). */ ++static _PyInitError ++_Py_ReconfigureMainInterpreter(PyInterpreterState *interp, ++ const _PyMainInterpreterConfig *config) ++{ ++ if (config->argv != NULL) { ++ int res = PyDict_SetItemString(interp->sysdict, "argv", config->argv); ++ if (res < 0) { ++ return _Py_INIT_ERR("fail to set sys.argv"); ++ } ++ } ++ return _Py_INIT_OK(); ++} ++ + /* Update interpreter state based on supplied configuration settings + * + * After calling this function, most of the restrictions on the interpreter +@@ -796,9 +812,6 @@ _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) + if (!_PyRuntime.core_initialized) { + return _Py_INIT_ERR("runtime core not initialized"); + } +- if (_PyRuntime.initialized) { +- return _Py_INIT_ERR("main interpreter already initialized"); +- } + + /* Get current thread state and interpreter pointer */ + tstate = PyThreadState_GET(); +@@ -813,6 +826,10 @@ _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) + return _Py_INIT_ERR("failed to copy main interpreter config"); + } + ++ if (_PyRuntime.initialized) { ++ return _Py_ReconfigureMainInterpreter(interp, config); ++ } ++ + if (interp->core_config._disable_importlib) { + /* Special mode for freeze_importlib: run with no import system + * diff --git a/python37.spec b/python37.spec index 68544df..7bf41a6 100644 --- a/python37.spec +++ b/python37.spec @@ -15,7 +15,7 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well Version: %{pybasever}.0 -Release: 3%{?dist} +Release: 4%{?dist} License: Python
@@ -312,6 +312,12 @@ Patch274: 00274-fix-arch-names.patch # and: https://src.fedoraproject.org/rpms/redhat-rpm-config/c/078af19 Patch291: 00291-setup-Link-ctypes-against-dl-explicitly.patch
+# 00307 # +# Allow to call Py_Main() after Py_Initialize() +# See: https://bugzilla.redhat.com/show_bug.cgi?id=1595421 +# and: https://bugs.python.org/issue34008 +Patch307: 00307-allow-to-call-Py_Main-after-Py_Initialize.patch + # (New patches go here ^^^) # # When adding new patches to "python" and "python3" in Fedora, EL, etc., @@ -629,6 +635,7 @@ sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/en %patch251 -p1 %patch274 -p1 %patch291 -p1 +%patch307 -p1
# Remove files that should be generated by the build @@ -1515,6 +1522,10 @@ CheckPython optimized # ======================================================
%changelog +* Fri Jul 20 2018 Miro Hronok mhroncok@redhat.com - 3.7.0-4 +- Allow to call Py_Main() after Py_Initialize() +Resolves: rhbz#1595421 + * Sat Jul 14 2018 Fedora Release Engineering releng@fedoraproject.org - 3.7.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
commit 8dc25788ccce382380b06f5638b5c2504d2f8b29 Author: Miro Hronok miro@hroncok.cz Date: Mon Jul 9 12:53:43 2018 +0200
Replace no longer relevant notes from bootstrapping 3.6 with link to 3.7
diff --git a/python37.spec b/python37.spec index ae36c6c..68544df 100644 --- a/python37.spec +++ b/python37.spec @@ -80,40 +80,8 @@ License: Python %endif
-# ================================== -# Notes from bootstraping Python 3.6 -# ================================== -# -# New Python major version (3.X) break ABI and bytecode compatibility, -# so all packages depending on it need to be rebuilt. -# -# Due to a dependency cycle between Python, gdb, rpm, pip, setuptools, wheel, -# and other packages, this isn't straightforward. -# Build in the following order: -# -# 1. At the same time: -# - gdb without python support (add %%global _without_python 1 on top of -# gdb's SPEC file) -# - python-rpm-generators -# (this can be done also during step 2., but should be done before 3.) -# 2. python3 without rewheel (use %%bcond_with rewheel instead of -# %%bcond_without) -# 3. gdb with python support (remove %%global _without_python 1 on top of -# gdb's SPEC file) -# 4. rpm -# 5. python-setuptools with bootstrap set to 1 -# 6. python-pip with build_wheel set to 0 -# 7. python-wheel with %%bcond_without bootstrap -# 8. python-setuptools with bootstrap set to 0 and also with_check set to 0 -# 9. python-pip with build_wheel set to 1 -# 10. pyparsing -# 11. python3 with rewheel -# -# Then the most important packages have to be built, in dependency order. -# These were: -# python-sphinx, pytest, python-requests, cloud-init, dnf, anaconda, abrt -# -# After these have been built, a targeted rebuild should be done for the rest. +# Notes from bootstraping Python 3.7: +# https://fedoraproject.org/wiki/SIGs/Python/UpgradingPython
# =====================
commit 725fdda26f873aa883e699ee870f58ef98313a45 Author: Fedora Release Engineering releng@fedoraproject.org Date: Sat Jul 14 02:50:11 2018 +0000
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering releng@fedoraproject.org
diff --git a/python37.spec b/python37.spec index baadcd0..ae36c6c 100644 --- a/python37.spec +++ b/python37.spec @@ -15,7 +15,7 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well Version: %{pybasever}.0 -Release: 2%{?dist} +Release: 3%{?dist} License: Python
@@ -1547,6 +1547,9 @@ CheckPython optimized # ======================================================
%changelog +* Sat Jul 14 2018 Fedora Release Engineering releng@fedoraproject.org - 3.7.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Thu Jul 12 2018 Igor Gnatenko ignatenkobrain@fedoraproject.org - 3.7.0-2 - Rebuild for new gdbm
commit 413194e7969723c201092a804589fb3a04da5cd0 Author: Igor Gnatenko ignatenkobrain@fedoraproject.org Date: Thu Jul 12 10:58:16 2018 +0200
Rebuild for new gdbm
Signed-off-by: Igor Gnatenko ignatenkobrain@fedoraproject.org
diff --git a/python37.spec b/python37.spec index c43b59e..baadcd0 100644 --- a/python37.spec +++ b/python37.spec @@ -15,7 +15,7 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well Version: %{pybasever}.0 -Release: 1%{?dist} +Release: 2%{?dist} License: Python
@@ -1547,6 +1547,9 @@ CheckPython optimized # ======================================================
%changelog +* Thu Jul 12 2018 Igor Gnatenko ignatenkobrain@fedoraproject.org - 3.7.0-2 +- Rebuild for new gdbm + * Wed Jun 27 2018 Miro Hronok mhroncok@redhat.com - 3.7.0-1 - Update to 3.7.0 final