* Calling guess_all_extensions() with strict=False potentially
mutated types_map_inv.
* Mutating the result of guess_all_extensions() mutated types_map_inv.
(cherry picked from commit 97ea18eced)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Update test_sysconfig.test_user_similar() for the posix_user scheme:
"platlib" doesn't use sys.platlibdir.
(cherry picked from commit 49acac00c0)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
(cherry picked from commit b4b6342848)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* Use a private version of _PyType_GetQualName
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Fix regrtest second summary when using -w/--verbose2 command line
option: lists re-run tests in the second test summary.
(cherry picked from commit c4ea45d7d2)
Co-authored-by: Victor Stinner <vstinner@python.org>
It happened with fast range iterator when the calculated stop = start + step * len
was out of the C long range.
(cherry picked from commit 936f6a16b9)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 0635e201be)
Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
Remove code which duplicates the functionality of TextTestResult.
(cherry picked from commit 2b76a5322f)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
PyPy and potentially other implementations have different or no
contraints on the number of blocks that can be statically nested. move
the test that checks for this behaviour into a unit test and mark it as
CPython-only.
(cherry picked from commit eb263f9a35)
Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
Various date parsing utilities in the email module, such as
email.utils.parsedate(), are supposed to gracefully handle invalid
input, typically by raising an appropriate exception or by returning
None.
The internal email._parseaddr._parsedate_tz() helper used by some of
these date parsing routines tries to be robust against malformed input,
but unfortunately it can still crash ungracefully when a non-empty but
whitespace-only input is passed. This manifests as an unexpected
IndexError.
In practice, this can happen when parsing an email with only a newline
inside a ‘Date:’ header, which unfortunately happens occasionally in the
real world.
Here's a minimal example:
$ python
Python 3.9.6 (default, Jun 30 2021, 10:22:16)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import email.utils
>>> email.utils.parsedate('foo')
>>> email.utils.parsedate(' ')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.9/email/_parseaddr.py", line 176, in parsedate
t = parsedate_tz(data)
File "/usr/lib/python3.9/email/_parseaddr.py", line 50, in parsedate_tz
res = _parsedate_tz(data)
File "/usr/lib/python3.9/email/_parseaddr.py", line 72, in _parsedate_tz
if data[0].endswith(',') or data[0].lower() in _daynames:
IndexError: list index out of range
The fix is rather straight-forward: guard against empty lists, after
splitting on whitespace, but before accessing the first element.
(cherry picked from commit 989f6a3800)
Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
The code of the test was never executed because the test function
was unintentionally converted to a generator function.
(cherry picked from commit 585390fdd8)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Because setting non-empty _name affects behavior of other code.
In most cases __name__ can be derived from __origin__.__name__.
(cherry picked from commit 4ceec49559)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Additional improvements:
- messages which were compiled regular expressions aren't unpacked back into
strings for unmatched warnings;
- removed unnecessary "if tokens:" check (there's one before the for loop);
- took `endswith` calculation out of the for loop.
(cherry picked from commit 8cf07d3db3)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This is part of an investigation of a non-deterministic reference leak. While we're looking for the root cause, this is included temporarily so that CI doesn't fail on this particular issue. This enables it to find other regressions in the meantime, which would otherwise be shadowed by our known issue.
(cherry picked from commit 7bf28cbb4b)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
On non-Linux POSIX platforms, like FreeBSD or macOS,
the FD used to read a forked PTY may signal its exit not
by raising an error but by sending empty data to the read
syscall. This case wasn't handled, leading to hanging
`pty.spawn` calls.
Co-authored-by: Reilly Tucker Siemens <reilly@tuckersiemens.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 81ab8db235)
Co-authored-by: Zephyr Shannon <geoffpshannon@gmail.com>