Skip to content

Commit 47c9f3a

Browse files
committed
Add workaround for PGO failures with Heroku-22's libexpat
1 parent ebd222f commit 47c9f3a

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

builds/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ RUN apt-get update --error-on=any \
1515
&& rm -rf /var/lib/apt/lists/*
1616

1717
WORKDIR /tmp
18-
COPY build_python_runtime.sh .
18+
COPY build_python_runtime.sh python-3.13-ubuntu-22.04-libexpat-workaround.patch .

builds/build_python_runtime.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ gpg --batch --verify python.tgz.asc python.tgz
9090
tar --extract --file python.tgz --strip-components=1 --directory "${SRC_DIR}"
9191
cd "${SRC_DIR}"
9292

93+
# Work around PGO profile test failures with Python 3.13 on Ubuntu 22.04, due to the tests
94+
# checking the raw libexpat version which doesn't account for Ubuntu backports:
95+
# https://github.com/heroku/heroku-buildpack-python/pull/1661#issuecomment-2405259352
96+
# https://github.com/python/cpython/issues/125067
97+
if [[ "${PYTHON_MAJOR_VERSION}" == "3.13" && "${STACK}" == "heroku-22" ]]; then
98+
patch -p1 </tmp/python-3.13-ubuntu-22.04-libexpat-workaround.patch
99+
fi
100+
93101
# Aim to keep this roughly consistent with the options used in the Python Docker images,
94102
# for maximum compatibility / most battle-tested build configuration:
95103
# https://github.com/docker-library/python
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
2+
index ebec9d8f18a..385735c1e18 100644
3+
--- a/Lib/test/test_xml_etree.py
4+
+++ b/Lib/test/test_xml_etree.py
5+
@@ -1504,9 +1504,11 @@ def test_simple_xml(self, chunk_size=None, flush=False):
6+
self.assert_event_tags(parser, [('end', 'root')])
7+
self.assertIsNone(parser.close())
8+
9+
+ @unittest.skip('Work around: https://github.com/python/cpython/issues/125067')
10+
def test_simple_xml_chunk_1(self):
11+
self.test_simple_xml(chunk_size=1, flush=True)
12+
13+
+ @unittest.skip('Work around: https://github.com/python/cpython/issues/125067')
14+
def test_simple_xml_chunk_5(self):
15+
self.test_simple_xml(chunk_size=5, flush=True)
16+
17+
@@ -1731,6 +1733,7 @@ def test_flush_reparse_deferral_enabled(self):
18+
19+
self.assert_event_tags(parser, [('end', 'doc')])
20+
21+
+ @unittest.skip('Work around: https://github.com/python/cpython/issues/125067')
22+
def test_flush_reparse_deferral_disabled(self):
23+
parser = ET.XMLPullParser(events=('start', 'end'))
24+

0 commit comments

Comments
 (0)