2025-05-17 17:39:47 +00:00
committed by Git OBS Bridge
parent 4db7913729
commit 0a23865f82

View File

@@ -18,10 +18,10 @@ with _PyUnicode_DecodeUnicodeEscapeInternal().
Lib/test/test_codeccallbacks.py | 39 +++++++ Lib/test/test_codeccallbacks.py | 39 +++++++
Lib/test/test_codecs.py | 52 ++++++++-- Lib/test/test_codecs.py | 52 ++++++++--
Misc/NEWS.d/next/Security/2025-05-09-20-22-54.gh-issue-133767.kN2i3Q.rst | 2 Misc/NEWS.d/next/Security/2025-05-09-20-22-54.gh-issue-133767.kN2i3Q.rst | 2
Objects/bytesobject.c | 41 ++++--- Objects/bytesobject.c | 43 ++++----
Objects/unicodeobject.c | 46 +++++--- Objects/unicodeobject.c | 46 +++++---
Parser/string_parser.c | 28 +++-- Parser/string_parser.c | 28 +++--
8 files changed, 172 insertions(+), 57 deletions(-) 8 files changed, 173 insertions(+), 58 deletions(-)
Index: Python-3.12.10/Include/internal/pycore_bytesobject.h Index: Python-3.12.10/Include/internal/pycore_bytesobject.h
=================================================================== ===================================================================
@@ -133,7 +133,7 @@ Index: Python-3.12.10/Lib/test/test_codeccallbacks.py
Index: Python-3.12.10/Lib/test/test_codecs.py Index: Python-3.12.10/Lib/test/test_codecs.py
=================================================================== ===================================================================
--- Python-3.12.10.orig/Lib/test/test_codecs.py 2025-05-17 12:00:00.357214034 +0000 --- Python-3.12.10.orig/Lib/test/test_codecs.py 2025-05-17 12:00:00.357214034 +0000
+++ Python-3.12.10/Lib/test/test_codecs.py 2025-05-17 15:45:02.268254653 +0000 +++ Python-3.12.10/Lib/test/test_codecs.py 2025-05-17 17:39:19.493026974 +0000
@@ -1196,23 +1196,39 @@ @@ -1196,23 +1196,39 @@
check(br"[\1010]", b"[A0]") check(br"[\1010]", b"[A0]")
check(br"[\x41]", b"[A]") check(br"[\x41]", b"[A]")
@@ -151,7 +151,7 @@ Index: Python-3.12.10/Lib/test/test_codecs.py
check(b"\\" + b, b"\\" + b) check(b"\\" + b, b"\\" + b)
- with self.assertWarns(DeprecationWarning): - with self.assertWarns(DeprecationWarning):
+ with self.assertWarnsRegex(DeprecationWarning, + with self.assertWarnsRegex(DeprecationWarning,
+ r"invalid escape sequence '\\%c'" % (i-32)): + r"'\\%c' is an invalid escape sequence" % (i-32)):
check(b"\\" + b.upper(), b"\\" + b.upper()) check(b"\\" + b.upper(), b"\\" + b.upper())
- with self.assertWarns(DeprecationWarning): - with self.assertWarns(DeprecationWarning):
+ with self.assertWarnsRegex(DeprecationWarning, + with self.assertWarnsRegex(DeprecationWarning,
@@ -197,7 +197,7 @@ Index: Python-3.12.10/Lib/test/test_codecs.py
if b.upper() not in b'UN': if b.upper() not in b'UN':
- with self.assertWarns(DeprecationWarning): - with self.assertWarns(DeprecationWarning):
+ with self.assertWarnsRegex(DeprecationWarning, + with self.assertWarnsRegex(DeprecationWarning,
+ r"invalid escape sequence '\\%c'" % (i-32)): + r"'\\%c' is an invalid escape sequence" % (i-32)):
check(b"\\" + b.upper(), "\\" + chr(i-32)) check(b"\\" + b.upper(), "\\" + chr(i-32))
- with self.assertWarns(DeprecationWarning): - with self.assertWarns(DeprecationWarning):
+ with self.assertWarnsRegex(DeprecationWarning, + with self.assertWarnsRegex(DeprecationWarning,
@@ -235,7 +235,7 @@ Index: Python-3.12.10/Misc/NEWS.d/next/Security/2025-05-09-20-22-54.gh-issue-133
Index: Python-3.12.10/Objects/bytesobject.c Index: Python-3.12.10/Objects/bytesobject.c
=================================================================== ===================================================================
--- Python-3.12.10.orig/Objects/bytesobject.c 2025-04-08 11:35:47.000000000 +0000 --- Python-3.12.10.orig/Objects/bytesobject.c 2025-04-08 11:35:47.000000000 +0000
+++ Python-3.12.10/Objects/bytesobject.c 2025-05-17 12:09:18.592219783 +0000 +++ Python-3.12.10/Objects/bytesobject.c 2025-05-17 17:38:23.813947222 +0000
@@ -1048,10 +1048,11 @@ @@ -1048,10 +1048,11 @@
} }
@@ -310,16 +310,18 @@ Index: Python-3.12.10/Objects/bytesobject.c
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
- "invalid octal escape sequence '\\%.3s'", - "invalid octal escape sequence '\\%.3s'",
- first_invalid_escape) < 0) - first_invalid_escape) < 0)
+ "invalid octal escape sequence '\\%o'", + "'\\%o' is an invalid octal escape sequence. "
+ first_invalid_escape_char) < 0) + first_invalid_escape_char) < 0)
{ {
Py_DECREF(result); Py_DECREF(result);
return NULL; return NULL;
@@ -1187,7 +1192,7 @@ @@ -1186,8 +1191,8 @@
}
else { else {
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
"invalid escape sequence '\\%c'", - "invalid escape sequence '\\%c'",
- c) < 0) - c) < 0)
+ "'\\%c' is an invalid escape sequence. ",
+ first_invalid_escape_char) < 0) + first_invalid_escape_char) < 0)
{ {
Py_DECREF(result); Py_DECREF(result);