| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Fix a Python crash in test_lib2to3 when using Python built in debug mode: limit the recursion limit. The test_all_project_files() test of test_lib2to3 now uses the test.support.infinite_recursion() context manager when processing the infinite_recursion.py file to prevent a crash when Python is built in debug mode. The two test_all_project_files() tests now use subTest() and log the refactored/parsed filename (if test_lib2to3 is run in verbose mode).
Sorry, something went wrong.
|
I built Python in debug mode with clang: $ ./configure --with-pydebug CC=clang $ grep -- -O Makefile OPT= -g -O0 -Wall $ make clang uses -O0. Stack usage: $ ./python Python 3.11.0a4+ (heads/lib2to3_infinite:01e926a388, Jan 31 2022, 17:21:47) [Clang 13.0.0 (Fedora 13.0.0-3.fc35)] on linux >>> import _testcapi >>> def f(): yield _testcapi.stack_pointer() ... >>> _testcapi.stack_pointer() - next(f()) 9104 Without this change (current main branch, at commit 7685693), test_lib2to3 does crash :-( $ ./python -m test -u all test_lib2to3 -v (...) test_all_project_files (lib2to3.tests.test_all_fixers.Test_all) ... Fatal Python error: Segmentation fault Current thread 0x00007f455c394740 (most recent call first): File "/home/vstinner/python/main/Lib/lib2to3/pytree.py", line 845 in generate_matches File "/home/vstinner/python/main/Lib/lib2to3/pytree.py", line 785 in _recursive_matches File "/home/vstinner/python/main/Lib/lib2to3/pytree.py", line 786 in _recursive_matches (...) With this PR, it no longer crash: $ ./python -m test -u all test_lib2to3 -v (...) Tests result: SUCCESS |
Sorry, something went wrong.
|
Lib/lib2to3/tests/test_all_fixers.py: if the recursion limit is too low, self.refactor.refactor_file(filepath) raises RecursionError. If it's too high, Python does crash. I chose an absolute limite of 150 which is a compromise. By the way, test.support.infinite_recursion() could be enhanced to use _testinternalcapi.get_recursion_depth() to implement a relative limit, raher than an absolute limit, but that's a different issue ;-) The problem is that the function parameter is an absolute limit. |
Sorry, something went wrong.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
…1035) * bpo-46542: test_lib2to3 uses support.infinite_recursion() Fix a Python crash in test_lib2to3 when using Python built in debug mode: limit the recursion limit. The test_all_project_files() test of test_lib2to3 now uses the test.support.infinite_recursion() context manager when processing the infinite_recursion.py file to prevent a crash when Python is built in debug mode. The two test_all_project_files() tests now use subTest() and log the refactored/parsed filename (if test_lib2to3 is run in verbose mode). * Update Lib/lib2to3/tests/data/infinite_recursion.py Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit ee0ac32) Co-authored-by: Victor Stinner <vstinner@python.org>
|
GH-31036 is a backport of this pull request to the 3.10 branch. |
Sorry, something went wrong.
…1035) * bpo-46542: test_lib2to3 uses support.infinite_recursion() Fix a Python crash in test_lib2to3 when using Python built in debug mode: limit the recursion limit. The test_all_project_files() test of test_lib2to3 now uses the test.support.infinite_recursion() context manager when processing the infinite_recursion.py file to prevent a crash when Python is built in debug mode. The two test_all_project_files() tests now use subTest() and log the refactored/parsed filename (if test_lib2to3 is run in verbose mode). * Update Lib/lib2to3/tests/data/infinite_recursion.py Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit ee0ac32) Co-authored-by: Victor Stinner <vstinner@python.org>
|
GH-31037 is a backport of this pull request to the 3.9 branch. |
Sorry, something went wrong.
* bpo-46542: test_lib2to3 uses support.infinite_recursion() Fix a Python crash in test_lib2to3 when using Python built in debug mode: limit the recursion limit. The test_all_project_files() test of test_lib2to3 now uses the test.support.infinite_recursion() context manager when processing the infinite_recursion.py file to prevent a crash when Python is built in debug mode. The two test_all_project_files() tests now use subTest() and log the refactored/parsed filename (if test_lib2to3 is run in verbose mode). * Update Lib/lib2to3/tests/data/infinite_recursion.py Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit ee0ac32) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-46542: test_lib2to3 uses support.infinite_recursion() Fix a Python crash in test_lib2to3 when using Python built in debug mode: limit the recursion limit. The test_all_project_files() test of test_lib2to3 now uses the test.support.infinite_recursion() context manager when processing the infinite_recursion.py file to prevent a crash when Python is built in debug mode. The two test_all_project_files() tests now use subTest() and log the refactored/parsed filename (if test_lib2to3 is run in verbose mode). * Update Lib/lib2to3/tests/data/infinite_recursion.py Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit ee0ac32) Co-authored-by: Victor Stinner <vstinner@python.org>
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 FreeBSD Shared 3.9 has failed when building commit 3046386. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/all/#builders/151/builds/439 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Tests result: FAILURE then FAILURE == 405 tests OK. 10 slowest tests:
2 tests failed: 18 tests skipped: 2 re-run tests: Total duration: 44 min 42 sec Click to see traceback logsTraceback (most recent call last):
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/test/test_unicodedata.py", line 330, in test_normalization
testdata = open_urlresource(TESTDATAURL, encoding="utf-8",
http.client.IncompleteRead: IncompleteRead(0 bytes read)
Traceback (most recent call last):
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/urllib/request.py", line 1346, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
socket.gaierror: [Errno 8] Name does not resolve
Traceback (most recent call last):
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/test/test_unicodedata.py", line 336, in test_normalization
self.fail(f"Could not retrieve {TESTDATAURL}")
AssertionError: Could not retrieve http://www.pythontest.net/unicode/13.0.0/NormalizationTest.txt
Traceback (most recent call last):
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/test/test_smtpnet.py", line 59, in test_connect_default_port
server = smtplib.SMTP_SSL(self.testServer)
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/smtplib.py", line 1050, in __init__
SMTP.__init__(self, host, port, local_hostname, timeout,
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/smtplib.py", line 255, in __init__
(code, msg) = self.connect(host, port)
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/smtplib.py", line 343, in connect
(code, msg) = self.getreply()
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/smtplib.py", line 405, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
Traceback (most recent call last):
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/http/client.py", line 597, in _readinto_chunked
n = self._safe_readinto(mvb)
http.client.IncompleteRead: IncompleteRead(296 bytes read, 1795 more expected)
Traceback (most recent call last):
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/test/test_unicodedata.py", line 330, in test_normalization
testdata = open_urlresource(TESTDATAURL, encoding="utf-8",
urllib.error.URLError: <urlopen error [Errno 8] Name does not resolve>
Traceback (most recent call last):
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/test/test_smtpnet.py", line 52, in test_connect
server = smtplib.SMTP_SSL(self.testServer, self.remotePort)
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/smtplib.py", line 1050, in __init__
SMTP.__init__(self, host, port, local_hostname, timeout,
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/smtplib.py", line 255, in __init__
(code, msg) = self.connect(host, port)
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/smtplib.py", line 343, in connect
(code, msg) = self.getreply()
File "/usr/home/buildbot/python/3.9.koobs-freebsd-564d/build/Lib/smtplib.py", line 405, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
|
Sorry, something went wrong.
|
Looks like DNS is broken on the buildbot. Unlikely to be related to this PR. |
Sorry, something went wrong.
…1035) * bpo-46542: test_lib2to3 uses support.infinite_recursion() Fix a Python crash in test_lib2to3 when using Python built in debug mode: limit the recursion limit. The test_all_project_files() test of test_lib2to3 now uses the test.support.infinite_recursion() context manager when processing the infinite_recursion.py file to prevent a crash when Python is built in debug mode. The two test_all_project_files() tests now use subTest() and log the refactored/parsed filename (if test_lib2to3 is run in verbose mode). * Update Lib/lib2to3/tests/data/infinite_recursion.py Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit ee0ac32) Co-authored-by: Victor Stinner <vstinner@python.org>
| Back | FazBrowse Home | New Git URL |
Fix a Python crash in test_lib2to3 when using Python built in debug
mode: limit the recursion limit.
The test_all_project_files() test of test_lib2to3 now uses the
test.support.infinite_recursion() context manager when processing the
infinite_recursion.py file to prevent a crash when Python is built in
debug mode.
The two test_all_project_files() tests now use subTest() and log the
refactored/parsed filename (if test_lib2to3 is run in verbose mode).
https://bugs.python.org/issue46542