Skip to content

Commit 56d47cc

Browse files
mceplbmwiedemann
authored andcommitted
Update python311 to version 3.11.8 / rev 29 via SR 1146838
https://build.opensuse.org/request/show/1146838 by user mcepl + anag+factory Forwarded request #1146787 from dgarcia - Add upstream patch libexpat260.patch, Fix tests for XMLPullParser with Expat 2.6.0, gh#python/cpython#115289
1 parent 227fd02 commit 56d47cc

File tree

5 files changed

+129
-0
lines changed

5 files changed

+129
-0
lines changed

packages/p/python311/.files

55 Bytes
Binary file not shown.

packages/p/python311/.rev

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,4 +1210,15 @@ C API
12101210
<comment></comment>
12111211
<requestid>1145179</requestid>
12121212
</revision>
1213+
<revision rev="29" vrev="2">
1214+
<srcmd5>0f79b579e281a83df88a376893377637</srcmd5>
1215+
<version>3.11.8</version>
1216+
<time>1708284172</time>
1217+
<user>anag+factory</user>
1218+
<comment>Forwarded request #1146787 from dgarcia
1219+
1220+
- Add upstream patch libexpat260.patch, Fix tests for XMLPullParser
1221+
with Expat 2.6.0, gh#python/cpython#115289</comment>
1222+
<requestid>1146838</requestid>
1223+
</revision>
12131224
</revisionlist>
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
From f2eebf3c38eae77765247791576b437ec25ccfe2 Mon Sep 17 00:00:00 2001
2+
From: Serhiy Storchaka <[email protected]>
3+
Date: Sun, 11 Feb 2024 12:08:39 +0200
4+
Subject: [PATCH] gh-115133: Fix tests for XMLPullParser with Expat 2.6.0
5+
(GH-115164)
6+
7+
Feeding the parser by too small chunks defers parsing to prevent
8+
CVE-2023-52425. Future versions of Expat may be more reactive.
9+
(cherry picked from commit 4a08e7b3431cd32a0daf22a33421cd3035343dc4)
10+
11+
Co-authored-by: Serhiy Storchaka <[email protected]>
12+
---
13+
Lib/test/test_xml_etree.py | 58 ++++++++++++-------
14+
...-02-08-14-21-28.gh-issue-115133.ycl4ko.rst | 2 +
15+
2 files changed, 38 insertions(+), 22 deletions(-)
16+
create mode 100644 Misc/NEWS.d/next/Library/2024-02-08-14-21-28.gh-issue-115133.ycl4ko.rst
17+
18+
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
19+
index 267982a8233c92..fa03f381fac92a 100644
20+
--- a/Lib/test/test_xml_etree.py
21+
+++ b/Lib/test/test_xml_etree.py
22+
@@ -13,6 +13,7 @@
23+
import operator
24+
import os
25+
import pickle
26+
+import pyexpat
27+
import sys
28+
import textwrap
29+
import types
30+
@@ -120,6 +121,10 @@
31+
</foo>
32+
"""
33+
34+
+fails_with_expat_2_6_0 = (unittest.expectedFailure
35+
+ if pyexpat.version_info >= (2, 6, 0) else
36+
+ lambda test: test)
37+
+
38+
def checkwarnings(*filters, quiet=False):
39+
def decorator(test):
40+
def newtest(*args, **kwargs):
41+
@@ -1400,28 +1405,37 @@ def assert_event_tags(self, parser, expected, max_events=None):
42+
self.assertEqual([(action, elem.tag) for action, elem in events],
43+
expected)
44+
45+
- def test_simple_xml(self):
46+
- for chunk_size in (None, 1, 5):
47+
- with self.subTest(chunk_size=chunk_size):
48+
- parser = ET.XMLPullParser()
49+
- self.assert_event_tags(parser, [])
50+
- self._feed(parser, "<!-- comment -->\n", chunk_size)
51+
- self.assert_event_tags(parser, [])
52+
- self._feed(parser,
53+
- "<root>\n <element key='value'>text</element",
54+
- chunk_size)
55+
- self.assert_event_tags(parser, [])
56+
- self._feed(parser, ">\n", chunk_size)
57+
- self.assert_event_tags(parser, [('end', 'element')])
58+
- self._feed(parser, "<element>text</element>tail\n", chunk_size)
59+
- self._feed(parser, "<empty-element/>\n", chunk_size)
60+
- self.assert_event_tags(parser, [
61+
- ('end', 'element'),
62+
- ('end', 'empty-element'),
63+
- ])
64+
- self._feed(parser, "</root>\n", chunk_size)
65+
- self.assert_event_tags(parser, [('end', 'root')])
66+
- self.assertIsNone(parser.close())
67+
+ def test_simple_xml(self, chunk_size=None):
68+
+ parser = ET.XMLPullParser()
69+
+ self.assert_event_tags(parser, [])
70+
+ self._feed(parser, "<!-- comment -->\n", chunk_size)
71+
+ self.assert_event_tags(parser, [])
72+
+ self._feed(parser,
73+
+ "<root>\n <element key='value'>text</element",
74+
+ chunk_size)
75+
+ self.assert_event_tags(parser, [])
76+
+ self._feed(parser, ">\n", chunk_size)
77+
+ self.assert_event_tags(parser, [('end', 'element')])
78+
+ self._feed(parser, "<element>text</element>tail\n", chunk_size)
79+
+ self._feed(parser, "<empty-element/>\n", chunk_size)
80+
+ self.assert_event_tags(parser, [
81+
+ ('end', 'element'),
82+
+ ('end', 'empty-element'),
83+
+ ])
84+
+ self._feed(parser, "</root>\n", chunk_size)
85+
+ self.assert_event_tags(parser, [('end', 'root')])
86+
+ self.assertIsNone(parser.close())
87+
+
88+
+ @fails_with_expat_2_6_0
89+
+ def test_simple_xml_chunk_1(self):
90+
+ self.test_simple_xml(chunk_size=1)
91+
+
92+
+ @fails_with_expat_2_6_0
93+
+ def test_simple_xml_chunk_5(self):
94+
+ self.test_simple_xml(chunk_size=5)
95+
+
96+
+ def test_simple_xml_chunk_22(self):
97+
+ self.test_simple_xml(chunk_size=22)
98+
99+
def test_feed_while_iterating(self):
100+
parser = ET.XMLPullParser()
101+
diff --git a/Misc/NEWS.d/next/Library/2024-02-08-14-21-28.gh-issue-115133.ycl4ko.rst b/Misc/NEWS.d/next/Library/2024-02-08-14-21-28.gh-issue-115133.ycl4ko.rst
102+
new file mode 100644
103+
index 00000000000000..6f1015235cc25d
104+
--- /dev/null
105+
+++ b/Misc/NEWS.d/next/Library/2024-02-08-14-21-28.gh-issue-115133.ycl4ko.rst
106+
@@ -0,0 +1,2 @@
107+
+Fix tests for :class:`~xml.etree.ElementTree.XMLPullParser` with Expat
108+
+2.6.0.

packages/p/python311/python311.changes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
-------------------------------------------------------------------
2+
Thu Feb 15 10:29:07 UTC 2024 - Daniel Garcia <[email protected]>
3+
4+
- Add upstream patch libexpat260.patch, Fix tests for XMLPullParser
5+
with Expat 2.6.0, gh#python/cpython#115289
6+
17
-------------------------------------------------------------------
28
Thu Feb 8 07:27:40 UTC 2024 - Daniel Garcia <[email protected]>
39

packages/p/python311/python311.spec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ Patch39: skip_if_buildbot-extend.patch
165165
# Detect email address parsing errors and return empty tuple to
166166
# indicate the parsing error (old API)
167167
Patch40: CVE-2023-27043-email-parsing-errors.patch
168+
# PATCH-FIX-UPSTREAM libexpat260.patch gh#python/cpython#115289
169+
# Fix tests for XMLPullParser with Expat 2.6.0
170+
Patch41: libexpat260.patch
168171
BuildRequires: autoconf-archive
169172
BuildRequires: automake
170173
BuildRequires: fdupes
@@ -425,6 +428,7 @@ other applications.
425428
%patch -P 36 -p1
426429
%patch -P 39 -p1
427430
%patch -P 40 -p1
431+
%patch -P 41 -p1
428432

429433
# drop Autoconf version requirement
430434
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac

0 commit comments

Comments
 (0)