Update to Python 3.13.0a5

This commit is contained in:
Miro Hrončok 2024-03-13 01:35:58 +01:00
commit 0697d12bda
7 changed files with 17 additions and 213 deletions

View file

@ -30,7 +30,7 @@ Co-authored-by: Lumír Balhar <frenzy.madness@gmail.com>
3 files changed, 72 insertions(+), 4 deletions(-)
diff --git a/Lib/site.py b/Lib/site.py
index 0631f3f611..2ed7b683a0 100644
index 2aee63e24c..00855f437c 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -395,8 +395,15 @@ def getsitepackages(prefixes=None):
@ -130,10 +130,10 @@ index 07ab27c7fb..d3e22762bf 100644
# On Windows we want to substitute 'lib' for schemes rather
# than the native value (without modifying vars, in case it
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
index bb87bf00dc..0717f44cb0 100644
index c8315bbc8b..5a18592d8f 100644
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -115,8 +115,19 @@ def test_get_path(self):
@@ -117,8 +117,19 @@ def test_get_path(self):
for scheme in _INSTALL_SCHEMES:
for name in _INSTALL_SCHEMES[scheme]:
expected = _INSTALL_SCHEMES[scheme][name].format(**config_vars)
@ -154,7 +154,7 @@ index bb87bf00dc..0717f44cb0 100644
os.path.normpath(expected),
)
@@ -349,7 +360,7 @@ def test_get_config_h_filename(self):
@@ -351,7 +362,7 @@ def test_get_config_h_filename(self):
self.assertTrue(os.path.isfile(config_h), config_h)
def test_get_scheme_names(self):
@ -163,7 +163,7 @@ index bb87bf00dc..0717f44cb0 100644
if HAS_USER_BASE:
wanted.extend(['nt_user', 'osx_framework_user', 'posix_user'])
self.assertEqual(get_scheme_names(), tuple(sorted(wanted)))
@@ -361,6 +372,8 @@ def test_symlink(self): # Issue 7880
@@ -363,6 +374,8 @@ def test_symlink(self): # Issue 7880
cmd = "-c", "import sysconfig; print(sysconfig.get_platform())"
self.assertEqual(py.call_real(*cmd), py.call_link(*cmd))

View file

@ -16,7 +16,7 @@ https://github.com/GrahamDumpleton/mod_wsgi/issues/730
2 files changed, 11 insertions(+), 53 deletions(-)
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 1ab223b81e..727b2b0c43 100644
index 3b5c37c948..ad070237d0 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -1169,39 +1169,6 @@ def noop(): pass
@ -60,10 +60,10 @@ index 1ab223b81e..727b2b0c43 100644
code = """if 1:
import atexit
diff --git a/Lib/threading.py b/Lib/threading.py
index b6ff00acad..0447c3ee54 100644
index ec89550d6b..46b222a6a3 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -1652,32 +1652,23 @@ def _shutdown():
@@ -1642,32 +1642,23 @@ def _shutdown():
global _SHUTTING_DOWN
_SHUTTING_DOWN = True

View file

@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Fri, 19 Jan 2024 12:00:18 +0100
Subject: [PATCH] 00418: Don't generate sbom in make regen-all
The script and make target, modified in Python 3.13.0a4,
assumes the presence of expat and _decimal/libmpdec libraries, resulting in an
error and failed build when not found.
Reported upstream: https://github.com/python/cpython/issues/115663
---
Makefile.pre.in | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 8252e6631c..3f4a89ad07 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1625,10 +1625,11 @@ regen-unicodedata:
regen-all: regen-cases regen-typeslots \
regen-token regen-ast regen-keyword regen-sre regen-frozen \
regen-pegen-metaparser regen-pegen regen-test-frozenmain \
- regen-test-levenshtein regen-global-objects regen-sbom regen-jit
+ regen-test-levenshtein regen-global-objects regen-jit
@echo
@echo "Note: make regen-stdlib-module-names, make regen-limited-abi, "
- @echo "make regen-configure and make regen-unicodedata should be run manually"
+ @echo "make regen-configure, make regen-unicodedata and make regen-sbom "
+ @echo "should be run manually"
############################################################################
# Special rules for object files

View file

@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Victor Stinner <vstinner@python.org>
Date: Mon, 19 Feb 2024 13:20:46 +0100
Subject: [PATCH] 00420: gh-114626: Add again _PyCFunctionFastWithKeywords name
(GH-115561)
Keep the old private _PyCFunctionFastWithKeywords name (Python 3.7)
as an alias to the new public name PyCFunctionFastWithKeywords
(Python 3.13a4).
_PyCFunctionWithKeywords doesn't exist in Python 3.13a3, whereas
_PyCFunctionFastWithKeywords was removed in Python 3.13a4.
---
Include/methodobject.h | 2 +-
.../next/C API/2024-02-16-15-56-53.gh-issue-114626.ie2esA.rst | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
create mode 100644 Misc/NEWS.d/next/C API/2024-02-16-15-56-53.gh-issue-114626.ie2esA.rst
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 452f891a7a..39272815b1 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -31,7 +31,7 @@ typedef PyObject *(*PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *,
// Note that the underscore-prefixed names were documented in public docs;
// people may be using them.
typedef PyCFunctionFast _PyCFunctionFast;
-typedef PyCFunctionWithKeywords _PyCFunctionWithKeywords;
+typedef PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords;
// Cast an function to the PyCFunction type to use it with PyMethodDef.
//
diff --git a/Misc/NEWS.d/next/C API/2024-02-16-15-56-53.gh-issue-114626.ie2esA.rst b/Misc/NEWS.d/next/C API/2024-02-16-15-56-53.gh-issue-114626.ie2esA.rst
new file mode 100644
index 0000000000..763f4cee6d
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2024-02-16-15-56-53.gh-issue-114626.ie2esA.rst
@@ -0,0 +1,4 @@
+Add again ``_PyCFunctionFastWithKeywords`` name, removed in Python 3.13
+alpha 4 by mistake. Keep the old private ``_PyCFunctionFastWithKeywords``
+name (Python 3.7) as an alias to the new public name
+``PyCFunctionFastWithKeywords`` (Python 3.13a4). Patch by Victor Stinner.

View file

@ -1,105 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sam Gross <colesbury@gmail.com>
Date: Tue, 20 Feb 2024 15:18:44 -0500
Subject: [PATCH] 00421: gh-115733: Fix crash involving exhausted list iterator
(#115740)
---
Lib/test/list_tests.py | 5 +++++
.../2024-02-20-18-49-02.gh-issue-115733.51Zb85.rst | 1 +
Objects/listobject.c | 10 +++++-----
Python/bytecodes.c | 3 ++-
Python/executor_cases.c.h | 1 +
Python/generated_cases.c.h | 2 +-
6 files changed, 15 insertions(+), 7 deletions(-)
create mode 100644 Misc/NEWS.d/next/Core and Builtins/2024-02-20-18-49-02.gh-issue-115733.51Zb85.rst
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py
index d9ab21d494..26118e14bb 100644
--- a/Lib/test/list_tests.py
+++ b/Lib/test/list_tests.py
@@ -562,3 +562,8 @@ def test_exhausted_iterator(self):
self.assertEqual(list(exhit), [])
self.assertEqual(list(empit), [9])
self.assertEqual(a, self.type2test([1, 2, 3, 9]))
+
+ # gh-115733: Crash when iterating over exhausted iterator
+ exhit = iter(self.type2test([1, 2, 3]))
+ for _ in exhit:
+ next(exhit, 1)
diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-02-20-18-49-02.gh-issue-115733.51Zb85.rst b/Misc/NEWS.d/next/Core and Builtins/2024-02-20-18-49-02.gh-issue-115733.51Zb85.rst
new file mode 100644
index 0000000000..5cbb292065
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2024-02-20-18-49-02.gh-issue-115733.51Zb85.rst
@@ -0,0 +1 @@
+Fix crash when calling ``next()`` on exhausted list iterators.
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 96182a4230..7917b80824 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -3537,13 +3537,13 @@ listreviter_next(PyObject *self)
{
listreviterobject *it = (listreviterobject *)self;
assert(it != NULL);
+ Py_ssize_t index = LOAD_SSIZE(it->it_index);
+ if (index < 0) {
+ return NULL;
+ }
+
PyListObject *seq = it->it_seq;
assert(PyList_Check(seq));
-
- Py_ssize_t index = LOAD_SSIZE(it->it_index);
- if (index < 0) {
- return NULL;
- }
PyObject *item = list_get_item_ref(seq, index);
if (item != NULL) {
STORE_SSIZE(it->it_index, index - 1);
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 6822e772e9..228d4c2f7a 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -2606,7 +2606,7 @@ dummy_func(
assert(Py_TYPE(iter) == &PyListIter_Type);
STAT_INC(FOR_ITER, hit);
PyListObject *seq = it->it_seq;
- if ((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) {
+ if (seq == NULL || (size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) {
it->it_index = -1;
#ifndef Py_GIL_DISABLED
if (seq != NULL) {
@@ -2627,6 +2627,7 @@ dummy_func(
_PyListIterObject *it = (_PyListIterObject *)iter;
assert(Py_TYPE(iter) == &PyListIter_Type);
PyListObject *seq = it->it_seq;
+ DEOPT_IF(seq == NULL);
DEOPT_IF((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq));
}
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 11e2a1fe85..bb0033514e 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -2201,6 +2201,7 @@
_PyListIterObject *it = (_PyListIterObject *)iter;
assert(Py_TYPE(iter) == &PyListIter_Type);
PyListObject *seq = it->it_seq;
+ if (seq == NULL) goto deoptimize;
if ((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) goto deoptimize;
break;
}
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 6c19adc60c..094fe0336d 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -2541,7 +2541,7 @@
assert(Py_TYPE(iter) == &PyListIter_Type);
STAT_INC(FOR_ITER, hit);
PyListObject *seq = it->it_seq;
- if ((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) {
+ if (seq == NULL || (size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) {
it->it_index = -1;
#ifndef Py_GIL_DISABLED
if (seq != NULL) {

View file

@ -14,10 +14,10 @@ URL: https://www.python.org/
# WARNING When rebasing to a new Python version,
# remember to update the python3-docs package as well
%global general_version %{pybasever}.0
%global prerel a4
%global prerel a5
%global upstream_version %{general_version}%{?prerel}
Version: %{general_version}%{?prerel:~%{prerel}}
Release: 2%{?dist}
Release: 1%{?dist}
License: Python-2.0.1
@ -385,30 +385,6 @@ Patch251: 00251-change-user-install-location.patch
# https://github.com/GrahamDumpleton/mod_wsgi/issues/730
Patch371: 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch
# 00418 # 00835b95549d7107cb998a663631c22494db8529
# Don't generate sbom in make regen-all
#
# The script and make target, modified in Python 3.13.0a4,
# assumes the presence of expat and _decimal/libmpdec libraries, resulting in an
# error and failed build when not found.
# Reported upstream: https://github.com/python/cpython/issues/115663
Patch418: 00418-don-t-generate-sbom-in-make-regen-all.patch
# 00420 # 9493f930d1e64ecb947d77548ed9993bfb7cd7f0
# gh-114626: Add again _PyCFunctionFastWithKeywords name (GH-115561)
#
# Keep the old private _PyCFunctionFastWithKeywords name (Python 3.7)
# as an alias to the new public name PyCFunctionFastWithKeywords
# (Python 3.13a4).
#
# _PyCFunctionWithKeywords doesn't exist in Python 3.13a3, whereas
# _PyCFunctionFastWithKeywords was removed in Python 3.13a4.
Patch420: 00420-gh-114626-add-again-_pycfunctionfastwithkeywords-name-gh-115561.patch
# 00421 # 11c050c0763b7e67e783c1433e38dcc65070c60c
# gh-115733: Fix crash involving exhausted list iterator (#115740)
Patch421: 00421-gh-115733-fix-crash-involving-exhausted-list-iterator-115740.patch
# (New patches go here ^^^)
#
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
@ -1570,8 +1546,10 @@ CheckPython freethreading
%{dynload_dir}/_testcapi.%{1}.so\
%{dynload_dir}/_testclinic.%{1}.so\
%{dynload_dir}/_testclinic_limited.%{1}.so\
%{dynload_dir}/_testexternalinspection.%{1}.so\
%{dynload_dir}/_testimportmultiple.%{1}.so\
%{dynload_dir}/_testinternalcapi.%{1}.so\
%{dynload_dir}/_testlimitedcapi.%{1}.so\
%{dynload_dir}/_testmultiphase.%{1}.so\
%{dynload_dir}/_testsinglephase.%{1}.so\
%{dynload_dir}/_xxinterpchannels.%{1}.so\
@ -1692,6 +1670,9 @@ CheckPython freethreading
# ======================================================
%changelog
* Wed Mar 13 2024 Miro Hrončok <mhroncok@redhat.com> - 3.13.0~a5-1
- Update to Python 3.13.0a5
* Wed Feb 21 2024 Karolina Surma <ksurma@redhat.com> - 3.13.0~a4-2
- Fix crash involving exhausted list iterator

View file

@ -1,2 +1,2 @@
SHA512 (Python-3.13.0a4.tar.xz) = f0dccc822ba000e8a50853d62698975d35382b981b62091e25ad6a6e0669e4e517c880e884644b508172de38226006ec11ddc649d9271320e728c0cd6c0b4dcc
SHA512 (Python-3.13.0a4.tar.xz.asc) = 261c0b23f84301f8b2aa4e8ea32995ea64a74a48dabc595028af71466915df93c118e699c939d7e4372d4575c59221743cb5ae21a936cc41241bdbafb9fab6c3
SHA512 (Python-3.13.0a5.tar.xz) = 7238d6792ac35f4cf9c701f7a69ed37de13efe0ba676f26a9b01a15ded1f8f070be295be6fc70b29153e9f2216224438d46500570b5d64641347cf2ccc66b556
SHA512 (Python-3.13.0a5.tar.xz.asc) = 9cb4235afcde912904a2c3a728d83db45947cbda5ae1efae742f6045d1744008fefe67ed4b667f58194d81b2f341f3718841eb06ffad9a2f2fb5357cb1a373f4