Commit graph

29312 commits

Author SHA1 Message Date
Miss Islington (bot)
f8cba751e2
[3.11] gh-113280: Always close socket if SSLSocket creation failed (GH-114659) (GH-114996)
(cherry picked from commit 0ea366240b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2024-02-04 16:16:57 +00:00
Miss Islington (bot)
e846c88b37
[3.11] gh-114959: tarfile: do not ignore errors when extract a directory on top of a file (GH-114960) (GH-114964)
Also, add tests common to tarfile and zipfile.
(cherry picked from commit 96bce033c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-03 16:41:31 +00:00
Miss Islington (bot)
e3458aa431
[3.11] gh-105089: Fix test_create_directory_with_write test failure in AIX (GH-105228) (GH-114861)
(cherry picked from commit 4dbb198d27)

Co-authored-by: Ayappan Perumal <ayappap2@in.ibm.com>
2024-02-01 12:25:08 +00:00
Miss Islington (bot)
3982049a30
[3.11] gh-114737: Revert change to ElementTree.iterparse "root" attribute (GH-114755) (GH-114799)
Prior to gh-114269, the iterator returned by ElementTree.iterparse was
initialized with the root attribute as None. This restores the previous
behavior.
(cherry picked from commit 66f95ea6a6)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-01-31 12:03:08 +00:00
Miss Islington (bot)
3a3e8731a4
[3.11] gh-114100: Remove superfluous writing to fd 1 in test_pty (GH-114647) (GH-114656)
(cherry picked from commit 7a470541e2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-27 19:30:11 +02:00
Miss Islington (bot)
c09eae3e38
[3.11] gh-77749: Fix inconsistent behavior of non-ASCII handling in EmailPolicy.fold() (GH-6986) (GH-114607)
It now always encodes non-ASCII characters in headers if utf8 is false.

(cherry picked from commit 504334c7be)

Co-authored-by: Rito Takeuchi <licht-t@outlook.jp>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-26 18:30:50 +02:00
Miss Islington (bot)
8cff807ae4
gh-114561: Mark some tests in test_wincosoleio with requires_resource('console') decorator (GH-114565)
(cherry picked from commit 33ae9895d4)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-01-25 20:14:18 +00:00
Miss Islington (bot)
709f17b7cc
[3.11] gh-77465: Increase test coverage for the numbers module (GH-111738) (GH-114557)
(cherry picked from commit e721adf4bd)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-25 14:49:46 +00:00
Miss Islington (bot)
b39a314eda
[3.11] gh-113205: test_multiprocessing.test_terminate: Give tasks a chance to start (GH-114249) (GH-114517)
(cherry picked from commit ce75b4c26d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-24 07:26:58 +00:00
Miss Islington (bot)
5b12f7d2bd
[3.11] gh-114275: Skip doctests that use asyncio in test_pdb for WASI builds (GH-114309) (#114438)
gh-114275: Skip doctests that use `asyncio` in `test_pdb` for WASI builds (GH-114309)
(cherry picked from commit efb81a60f5)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-01-22 18:02:16 +01:00
Miss Islington (bot)
804037ee4a
[3.11] gh-111803: Make test_deep_nesting from test_plistlib more strict (GH-114026) (GH-114407)
It is no longer silently passed if RecursionError was raised for low
recursion depth.
(cherry picked from commit db1c18eb62)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-22 15:31:21 +00:00
Serhiy Storchaka
a0f30b04fe
[3.11] gh-102512: Turn _DummyThread into _MainThread after os.fork() called from a foreign thread (GH-113261) (GH-114431)
Always set a _MainThread as a main thread after os.fork() is called from
a thread started not by the threading module.

A new _MainThread was already set as a new main thread after fork if
threading.current_thread() was not called for a foreign thread before fork.
Now, if it was called before fork, the implicitly created _DummyThread will
be turned into _MainThread after fork.

It fixes, in particularly, an incompatibility of _DummyThread with
the threading shutdown logic which relies on the main thread
having tstate_lock.

(cherry picked from commit 49785b06de)

Co-authored-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2024-01-22 15:00:33 +00:00
Jérome Perrin
20f7cf2c7f
[3.11] gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH-113359) (#114118) 2024-01-19 20:35:57 +00:00
Nikita Sobolev
a4ad7a0ac5
[3.11] gh-108303: Move all doctest related files and tests to Lib/test/test_doctest/ (GH-112109) (#114313)
gh-108303: Move all doctest related files and tests to `Lib/test/test_doctest/` (GH-112109)
2024-01-19 16:12:48 +01:00
Miss Islington (bot)
569182c4ad
[3.11] gh-113205: test_multiprocessing.test_terminate: Shorter sleep for threadpools (GH-114186) (GH-114223)
Threads can't be forced to terminate (without potentially corrupting too much
state), so the  expected behaviour of `ThreadPool.terminate` is to wait for
the currently executing tasks to finish.

Use shorter sleep time for threadpools, so if a task manages to start, the test
doesn't block for long.

(cherry picked from commit c1db960608)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-01-18 13:49:26 +01:00
Miss Islington (bot)
363dddba14
[3.11] gh-104522: Fix test_subprocess failure when build Python in the root home directory (GH-114236) (GH-114245)
EPERM is raised when setreuid() fails.
EACCES is set in execve() when the test user has not access to sys.executable.
(cherry picked from commit 311d1e2701)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-18 13:19:18 +01:00
Serhiy Storchaka
2c9872428e
[3.11] gh-104522: Fix OSError raised when run a subprocess (GH-114195) (GH-114243)
Only set filename to cwd if it was caused by failed chdir(cwd).

_fork_exec() now returns "noexec:chdir" for failed chdir(cwd).

(cherry picked from commit e2c097ebde)

Co-authored-by: Robert O'Shea <PurityLake@users.noreply.github.com>
2024-01-18 11:32:57 +00:00
Miss Islington (bot)
99a7bdc646
[3.11] gh-70835: Clarify error message for CSV file opened with wrong newline (GH-113786) (GH-113906)
Based on patch by SilentGhost.
(cherry picked from commit 568d220993)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-17 15:06:39 +01:00
Miss Islington (bot)
76d0c4b688
[3.11] gh-104282: Fix null pointer dereference in lzma._decode_filter_properties (GH-104283) (GH-114182)
(cherry picked from commit 0154405350)

Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
2024-01-17 13:30:29 +00:00
Miss Islington (bot)
21ab20b3a7
[3.11] gh-113659: Skip hidden .pth files (GH-113660) (GH-114144)
Skip .pth files with names starting with a dot or hidden file attribute.
(cherry picked from commit 74208ed0c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-16 18:56:31 +00:00
Miss Islington (bot)
ddc9e34c53
[3.11] gh-114107: test.pythoninfo logs Windows Developer Mode (GH-114121) (#114128)
gh-114107: test.pythoninfo logs Windows Developer Mode (GH-114121)

Also, don't skip the whole collect_windows() if ctypes is missing.

Log also ctypes.windll.shell32.IsUserAnAdmin().
(cherry picked from commit c77f552ec0)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-01-16 16:43:50 +00:00
Alois Klink
0d12a64eaf
[3.11] gh-95649: Document that asyncio contains uvloop code (GH-107536) (#114045)
Some of the asyncio SSL changes in GH-31275 [1] were taken from
v0.16.0 of the uvloop project [2]. In order to comply with the MIT
license, we need to just need to document the copyright information.

[1]: https://github.com/python/cpython/pull/31275
[2]: https://github.com/MagicStack/uvloop/tree/v0.16.0

(cherry picked from commit dce30c9cbc)
2024-01-14 02:14:51 +00:00
Mark Dickinson
41edd37160
[3.11] gh-114014: Update fractions.Fraction()'s rational parsing regex (GH-114015) (#114025)
Fix a bug in the regex used for parsing a string input to the `fractions.Fraction` constructor. That bug led to an inconsistent exception message being given for some inputs.

---------

Co-authored-by: Crowthebird <78076854+thatbirdguythatuknownot@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-01-13 13:22:31 -05:00
Miss Islington (bot)
64d8f39a12
[3.11] gh-113027: Fix test_variable_tzname in test_email (GH-113821) (GH-113832)
Determine the support of the Kyiv timezone by checking the result of
astimezone() which uses the system tz database and not the one
populated by zoneinfo.
(cherry picked from commit 931d7e052e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-12 11:59:23 +00:00
Steve Dower
186c021688
gh-81489: Use Unicode APIs for mmap tagname on Windows (GH-14133)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-01-11 23:04:36 +00:00
Miss Islington (bot)
d15e1ac828
gh-87868: Sort and remove duplicates in getenvironment() (GH-102731)
(cherry picked from commit c31be58da8)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-01-11 22:27:12 +00:00
Miss Islington (bot)
a956e510f6
[3.11] gh-109858: Protect zipfile from "quoted-overlap" zipbomb (GH-110016) (GH-113913)
Raise BadZipFile when try to read an entry that overlaps with other entry or
central directory.
(cherry picked from commit 66363b9a7b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-11 11:24:47 +02:00
Miss Islington (bot)
435e891b32
[3.11] gh-113594: Fix UnicodeEncodeError in TokenList.fold() (GH-113730) (GH-113908)
It occurred when try to re-encode an unknown-8bit part combined with non-unknown-8bit part.
(cherry picked from commit e9d5b6ea2d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-10 13:24:17 +00:00
Miss Islington (bot)
73573352fc
[3.11] gh-74678: Increase base64 test coverage (GH-21913) (GH-113810)
Ensure the character y is disallowed within an Ascii85 5-tuple.

(cherry picked from commit 802d4954f1)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Lee Cannon <leecannon@leecannon.xyz>
2024-01-08 11:16:06 +00:00
Miss Islington (bot)
4db8d3be49
[3.11] gh-80109: Fix io.TextIOWrapper dropping the internal buffer during write() (GH-22535) (GH-113809)
io.TextIOWrapper was dropping the internal decoding buffer
during read() and write() calls.
(cherry picked from commit 73c9326563)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2024-01-08 10:47:50 +00:00
Miss Islington (bot)
456e2ecdd2
[3.11] gh-113538: Don't error in stream reader protocol callback when task is cancelled (GH-113690) (#113714)
(cherry picked from commit 4681a5271a)

Co-authored-by: Guido van Rossum <guido@python.org>
2024-01-04 20:39:52 +00:00
Miss Islington (bot)
93e9381e1c
[3.11] gh-113628: Fix test_site test with long stdlib paths (GH-113640) (#113672)
gh-113628: Fix test_site test with long stdlib paths (GH-113640)
(cherry picked from commit 5dc79e3d7f)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
2024-01-03 01:02:14 +00:00
Miss Islington (bot)
1c381ec4ed
[3.11] gh-113602: Bail out when the parser tries to override existing errors (GH-113607) (#113653)
gh-113602: Bail out when the parser tries to override existing errors (GH-113607)
(cherry picked from commit 9ed36d533a)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-01-02 13:22:39 +00:00
Miss Islington (bot)
54927cd21a
[3.11] bpo-26791: Update shutil.move() to provide the same symlink move behavior as the mv shell when moving a symlink into a directory that is the target of the symlink (GH-21759) (GH-113518)
(cherry picked from commit c66b577d9f)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>
2023-12-27 19:03:45 +02:00
Serhiy Storchaka
f1951900f1
[3.11] bpo-36959: Fix error messages for invalid ISO format string in _strptime() (GH-13408) (GH-113499)
Previously some error messages complained about incompatible
combinations of directives that are not contained in the format string.

(cherry picked from commit 4b2c3e8e43)

Co-authored-by: Gordon P. Hemsley <me@gphemsley.org>
2023-12-26 20:09:41 +00:00
Miss Islington (bot)
1cc594d571
[3.11] bpo-37013: Fix the error handling in socket.if_indextoname() (GH-13503) (GH-112598)
* Fix a crash when pass UINT_MAX.
* Fix an integer overflow on 64-bit non-Windows platforms.
(cherry picked from commit 0daf555c6f)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2023-12-25 20:55:27 +02:00
Miss Islington (bot)
1162d29f5b
[3.11] gh-76785: Make test.test_interpreters executable (GH-112982) (GH-113470) (GH-113473)
This is so that we can run python -m test.test_interpreters. As such it
backports that aspect of commit 86a77f4e1a,
where it is implemented by a package __main__.py.
(cherry picked from commit bdad5c367f)

Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
2023-12-25 18:46:44 +00:00
Miss Islington (bot)
88cc19b530
[3.11] gh-113440: Ignore the "ver" command failure with exit code 0xc0000142 (GH-113435) (GH-113452)
(cherry picked from commit 53330f1677)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-24 10:47:54 +00:00
Miss Islington (bot)
d04ca4ccd7
[3.11] gh-113421: Fix multiprocessing logger for "%(filename)s" (GH-113423) (GH-113451)
(cherry picked from commit ce77ee5035)

Co-authored-by: Xu Song <xusong.vip@gmail.com>
2023-12-24 10:22:34 +00:00
Miss Islington (bot)
336d445934
[3.11] gh-113028: Correctly memoize str in pickle when escapes added (GH-113436) (GH-113449)
This fixes a divergence between the Python and C implementations of pickle
for protocol 0, such that it pickle.py fails to re-use the first pickled
representation of strings involving characters that have to be escaped.
(cherry picked from commit 08398631a0)

Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
2023-12-24 10:01:53 +00:00
Miss Islington (bot)
b60bddbde2
[3.11] gh-112559: Avoid unnecessary conversion attempts to enum_klass in signal.py (GH-113040) (#113444)
gh-112559: Avoid unnecessary conversion attempts to enum_klass in signal.py (GH-113040)
(cherry picked from commit 050783cb37)

Co-authored-by: Yilei Yang <yileiyang@google.com>
2023-12-23 18:09:46 -08:00
Miss Islington (bot)
9000b8a713
[3.11] gh-109989: Fix test_c_locale_coercion when PYTHONIOENCODING is set (GH-113378) (#113399)
gh-109989: Fix test_c_locale_coercion when PYTHONIOENCODING is set (GH-113378)

* gh-109989: Fix test_c_locale_coercion when PYTHONIOENCODING is set

This fixes the existing tests when PYTHONIOENCODING is
set by unsetting PYTHONIOENCODING.

Also add a test that explicitly checks what happens
when PYTHONIOENCODING is set.

(cherry picked from commit 5f665e99e0)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-12-23 21:58:18 +01:00
Serhiy Storchaka
fe2b4dd3c0
[3.11] gh-81682: Fix test failures when CPython is built without docstrings (GH-113410) (GH-113430)
(cherry picked from commit 4e5b27e6a3)
2023-12-23 11:38:07 +00:00
Miss Islington (bot)
80b2bad2c2
[3.11] gh-113188: Fix shutil.copymode() and shutil.copystat() on Windows (GH-113285) (GH-113426)
Previously they worked differenly if dst is a symbolic link:
they modified the permission bits of dst itself rather than the file
it points to if follow_symlinks is true or src is not a symbolic link,
and did nothing if follow_symlinks is false and src is a symbolic link.
(cherry picked from commit c7874bb56f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-23 12:53:48 +02:00
Miss Islington (bot)
e59ad5796e
[3.11] gh-113384: Skip test_freeze for framework builds on macOS (GH-113390) (#113396)
gh-113384: Skip test_freeze for framework builds on macOS (GH-113390)
(cherry picked from commit bee627c1e2)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2023-12-22 12:07:07 +01:00
Miss Islington (bot)
9cbe4738bc
[3.11] GH-113214: Fix SSLProto exception handling in SSL-over-SSL scenarios (GH-113334) (#113340)
When wrapped, `_SSLProtocolTransport._force_close(exc)` is called just like in the unwrapped scenario `_SelectorTransport._force_close(exc)` or `_ProactorBasePipeTransport._force_close(exc)` would be called, except here the exception needs to be passed through the `SSLProtocol._abort()` method, which didn't accept an exception object.

This commit ensures that this path works, in the same way that the uvloop implementation of SSLProto passes on the exception (on which the current implementation of SSLProto is based).

(cherry picked from commit 1ff0238594)

Co-authored-by: Martijn Pieters <mj@zopatista.com>
2023-12-20 16:51:51 -08:00
Miss Islington (bot)
44bdb6d55c
[3.11] gh-113199: Make read1() and readline() of HTTPResponse close IO after reading all data (GH-113200) (GH-113260)
(cherry picked from commit 41336a72b9)

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2023-12-18 20:34:15 +00:00
Miss Islington (bot)
6ff7c1311f
[3.11] gh-61648: Detect line numbers of properties in doctests (GH-113161) (GH-113165)
(cherry picked from commit 8f8f0f97e1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-15 13:38:45 +00:00
Serhiy Storchaka
d4234937a1
[3.11] gh-112716: Fix SystemError when __builtins__ is not a dict (GH-112770) (GH-113105)
It was raised in two cases:
* in the import statement when looking up __import__
* in pickling some builtin type when looking up built-ins iter, getattr, etc.

(cherry picked from commit 1161c14e8c)
2023-12-14 12:59:33 +00:00
Miss Islington (bot)
08ff6fa23d
[3.11] gh-113090: Fix test.support.os_support.can_chmod() on Windows (GH-113091) (GH-113100)
(cherry picked from commit c6e953be12)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-14 14:01:01 +02:00