Commit graph

49930 commits

Author SHA1 Message Date
Miss Islington (bot)
5f90abaa78
[3.11] gh-122133: Authenticate socket connection for socket.socketpair() fallback (GH-122134) (#122426)
Authenticate socket connection for `socket.socketpair()` fallback when the platform does not have a native `socketpair` C API.  We authenticate in-process using `getsocketname` and `getpeername` (thanks to Nathaniel J Smith for that suggestion).

(cherry picked from commit 78df1043db)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-07-30 14:43:45 +02:00
Łukasz Langa
d542a9be51
[3.11] gh-121957: Emit audit events for python -i and python -m asyncio (GH-122118) 2024-07-22 13:44:55 +02:00
Steve Dower
35c799d791
[3.11] gh-118486: Support mkdir(mode=0o700) on Windows (GH-118488) (GH-118739) 2024-05-24 02:13:18 +02:00
Serhiy Storchaka
4762b36540
[3.11] gh-118643: Fix AttributeError in the email module (GH-119099) (#119393)
Fix regression introduced in gh-100884: AttributeError when re-fold a long
address list.

Also fix more cases of incorrect encoding of the address separator in the
address list missed in gh-100884.
(cherry picked from commit 858b9e85fc)
2024-05-23 13:09:03 +01:00
Petr Viktorin
ba431579ef
[3.11] gh-113171: gh-65056: Fix "private" (non-global) IP address ranges (GH-113179) (GH-113186) (GH-118177) (#118227) 2024-04-25 13:45:48 +01:00
Grigoriev Semyon
3bc0d2b851
[3.11] gh-109120: Fix syntax error in handlinh of incorrect star expressions… (#117464)
gh-109120: Fix syntax error in handlinh of incorrect star expressions (#117444)

(cherry picked from commit c97d3af239)
2024-04-03 11:37:39 +01:00
Pablo Galindo
cd12e6c779 Merge remote-tracking branch 'upstream/3.11' into 3.11 2024-04-02 14:38:17 +01:00
Miss Islington (bot)
38bcbb22f9
[3.11] gh-115538: Use pathlib to compare prefixes in test_venv (GH-117076)
gh-115538: Use pathlib to compare prefixes in test_venv (GH-117076)
(cherry picked from commit 52f5b7f9e0)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2024-04-02 13:31:08 +00:00
Pablo Galindo
de54cf5be3 Python 3.11.9 2024-04-02 09:25:04 +01:00
Miss Islington (bot)
54ee038615
[3.11] [3.12] gh-117347: Fix test_clinic side effects (GH-117363) (GH-117365) (#117366)
[3.12] gh-117347: Fix test_clinic side effects (GH-117363) (GH-117365)

gh-117347: Fix test_clinic side effects (GH-117363)

Save/restore converters in ClinicWholeFileTest and
ClinicExternalTest.

(cherry picked from commit c80d13838d)

Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit 35b6c4a4da)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-03-29 11:21:56 +00:00
Miss Islington (bot)
01ab43c08a
[3.11] gh-117110: Fix subclasses of typing.Any with custom constructors (GH-117111) (#117358)
gh-117110: Fix subclasses of typing.Any with custom constructors (GH-117111)
(cherry picked from commit 8eec7ed714)

Co-authored-by: 傅立业(Chris Fu) <17433201@qq.com>
2024-03-29 00:38:13 +00:00
Victor Stinner
8bbb12169f
[3.11] gh-114331: Skip decimal test_maxcontext_exact_arith on s390x (#117326) (#117331)
gh-114331: Skip decimal test_maxcontext_exact_arith on s390x (#117326)

Add test.support.skip_on_s390x decorator.

(cherry picked from commit 6702d2bf6e)
2024-03-28 17:53:43 +00:00
Miss Islington (bot)
c703b7b54f
[3.11] gh-117178: Recover lazy loading of self-referential modules (GH-117179) (#117320)
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
2024-03-28 11:17:10 +00:00
Miss Islington (bot)
370a7f1e4a
[3.11] gh-104242: Enable test_is_char_device_true in pathlib test on all platform (GH-116983) (GH-117277) (GH-117280)
(cherry picked from commit 17a82a1d16)
(cherry picked from commit af1b0e9440)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2024-03-27 08:57:08 +00:00
Miss Islington (bot)
3d853a4ee4
[3.11] [3.12] gh-115538: Use isolate mode when running venv test_multiproces… (GH-117264) (#117265)
[3.12] gh-115538: Use isolate mode when running venv test_multiproces… (GH-117264)

[3.12] gh-115538: Use isolate mode when running venv test_multiprocessing_recursion() (GH-117116)
(cherry picked from commit 4ec347760f)

(cherry picked from commit ca0793980b)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-03-26 17:13:23 +00:00
Miss Islington (bot)
2d932361a8
[3.11] gh-66543: Fix mimetype.guess_type() (GH-117217) (GH-117257)
Fix parsing of the following corner cases:

* URLs with only a host name
* URLs containing a fragment
* URLs containing a query
* filenames with only a UNC sharepoint on Windows

(cherry picked from commit 9654daf793)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2024-03-26 11:46:28 +00:00
Miss Islington (bot)
1112e01da1
[3.11] gh-83845: Add tests for operator module (GH-115883) (#117254)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
2024-03-26 09:50:40 +00:00
Miss Islington (bot)
04b26eeb14
[3.11] [3.12] gh-83434: Sync libregrtest and test_regrtest with the main branch (GH-117250) (#117251)
[3.12] gh-83434: Sync libregrtest and test_regrtest with the main branch (GH-117250)

* gh-115122: Add --bisect option to regrtest (GH-115123)

* test.bisect_cmd now exit with code 0 on success, and code 1 on
  failure. Before, it was the opposite.
* test.bisect_cmd now runs the test worker process with
  -X faulthandler.
* regrtest RunTests: Add create_python_cmd() and bisect_cmd()
  methods.

(cherry picked from commit 1e5719a663)

* gh-115720: Show number of leaks in huntrleaks progress reports (GH-115726)

Instead of showing a dot for each iteration, show:
- '.' for zero (on negative) leaks
- number of leaks for 1-9
- 'X' if there are more leaks

This allows more rapid iteration: when bisecting, I don't need
to wait for the final report to see if the test still leaks.

Also, show the full result if there are any non-zero entries.
This shows negative entries, for the unfortunate cases where
a reference is created and cleaned up in different runs.

Test *failure* is still determined by the existing heuristic.

(cherry picked from commit af5f9d682c)

* gh-83434: Disable XML in regrtest when -R option is used (GH-117232)

(cherry picked from commit d52bdfb19f)

---------

(cherry picked from commit 477ef9015c)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-03-26 08:18:10 +00:00
Miss Islington (bot)
2f8d3a17d9
[3.11] gh-117187: Fix XML tests for vanilla Expat <2.6.0 (GH-117203) (GH-117245)
gh-117187: Fix XML tests for vanilla Expat <2.6.0 (GH-117203)

This fixes XML unittest fallout from the https://github.com/python/cpython/issues/115398 security fix.  When configured using `--with-system-expat` on systems with older pre 2.6.0 versions of libexpat, our unittests were failing.

* sax|etree: Simplify Expat version guard where simplifiable

Idea by Matěj Cepl

* sax|etree: Fix reparse deferral tests for vanilla Expat <2.6.0

This *does not fix* the case of distros with an older version of libexpat with the 2.6.0 feature backported as a security fix.  (Ubuntu is a known example of this with its libexpat1 2.5.0-2ubunutu0.1 package)
(cherry picked from commit 9f74e86c78)

Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2024-03-26 02:08:28 +00:00
Serhiy Storchaka
6261322e26
[3.11] gh-91227: Ignore ERROR_PORT_UNREACHABLE in proactor recvfrom() (GH-32011) (GH-117210)
(cherry picked from commit f11d0d8be8)

Co-authored-by: Erik Soma <stillusingirc@gmail.com>
2024-03-25 10:34:25 +00:00
Miss Islington (bot)
de43ce11cc
[3.11] [docs] Fix typo in docstring and add example to logging cookbook. (GH-117157) (GH-117158)
(cherry picked from commit 00baaa21de)
2024-03-23 10:19:14 +00:00
Serhiy Storchaka
0d82047645
[3.11] gh-117084: Fix ZIP file extraction for directory entry names with backslashes on Windows (GH-117129) (GH-117162) (GH-117165)
(cherry picked from commit f3fee231d3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 567ab3bd15)
2024-03-22 19:24:27 +00:00
Miss Islington (bot)
8440125460
[3.11] gh-117127: glob tests: Reopen dir_fd to pick up directory changes (GH-117128) (GH-117149)
gh-117127: glob tests: Reopen dir_fd to pick up directory changes (GH-117128)
(cherry picked from commit 42ae924d27)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-03-22 10:21:53 +00:00
infohash
51da1ddefc
[3.11] gh-75988: Fix issues with autospec ignoring wrapped object (GH-115223) (#117124)
gh-75988: Fix issues with autospec ignoring wrapped object (#115223)

* set default return value of functional types as _mock_return_value

* added test of wrapping child attributes

* added backward compatibility with explicit return

* added docs on the order of precedence

* added test to check default return_value

(cherry picked from commit 735fc2cbbc)
2024-03-22 09:48:41 +00:00
Miss Islington (bot)
0ec8561574
[3.11] gh-117061: Fix test_posix.test_sched_setaffinity() on RHEL9 (GH-117126) (#117138)
gh-117061: Fix test_posix.test_sched_setaffinity() on RHEL9 (GH-117126)

On RHEL9, sched_setaffinity(0, []) does not fail.
(cherry picked from commit 50f9b0b1e0)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-03-21 22:37:16 +00:00
jkriegshauser
23a1c9f422
[3.11] gh-116773: Fix overlapped memory corruption crash (GH-116774) (#117077)
Manual backport of gh-116774.
2024-03-20 13:10:32 -07:00
David Röthlisberger
b517fd5e16
[3.11] gh-116957: configparser: Do post-process values after DuplicateOptionError (GH-116958) (GH-117012)
If you catch DuplicateOptionError / DuplicateSectionError when reading a
config file (the intention is to skip invalid config files) and then
attempt to use the ConfigParser instance, any values it *had* read
successfully so far, were stored as a list instead of string! Later
`get` calls would raise "AttributeError: 'list' object has no attribute
'find'" from somewhere deep in the interpolation code.

(cherry picked from commit b1bc37597f)
2024-03-19 18:19:04 +01:00
Victor Stinner
c7b01e3c32
[3.11] gh-90872: Fix subprocess.Popen.wait() for negative timeout (#116989) (#117003)
gh-90872: Fix subprocess.Popen.wait() for negative timeout (#116989)

On Windows, subprocess.Popen.wait() no longer calls
WaitForSingleObject() with a negative timeout: pass 0 ms if the
timeout is negative.

(cherry picked from commit 27cf3ed00c)
2024-03-19 14:21:42 +00:00
Miss Islington (bot)
299b6d06e8
[3.11] gh-105866: fix dataclass with slots=True, weakref_slot=True (GH-105870) (GH-116979)
(cherry picked from commit a22d05f04c)

Co-authored-by: Aviel Boag <avboag@gmail.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-03-19 11:57:45 +01:00
Miss Islington (bot)
3b4cd48d29
[3.11] gh-90535: Fix support of interval>1 in logging.TimedRotatingFileHandler (GH-116220) (GH-116893)
Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.
(cherry picked from commit 269051d20e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-03-18 19:47:53 +02:00
Kushal Das
a93974d452
[3.11] gh-116831: Fixes tests for c extension in WASI for Python 3.11 (GH-116831) (#116933)
gh-116831: Fixes tests for c extension in WASI

We can skip the C extension based tests under WASI.
2024-03-18 07:03:01 +01:00
Miss Islington (bot)
02497b7ac2
[3.11] gh-116484: Fix collisions between Checkbutton and ttk.Checkbutton default names (GH-116495) (GH-116902)
Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.
(cherry picked from commit c61cb507c1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-03-16 11:58:10 +00:00
Miss Islington (bot)
eddfdb3e50
[3.11] gh-116764: Fix regressions in urllib.parse.parse_qsl() (GH-116801) (GH-116895)
* Restore support of None and other false values.
* Raise TypeError for non-zero integers and non-empty sequences.

The regressions were introduced in gh-74668
(bdba8ef42b).
(cherry picked from commit 1069a462f6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-03-16 11:04:31 +00:00
Nikita Sobolev
d16519ab7b
[3.11] gh-116858: Add @cpython_only to several tests in test_cmd_line (GH-116859) (#116890) 2024-03-16 09:29:11 +00:00
Jason R. Coombs
8acd6ca521
[3.11] gh-116811: Ensure MetadataPathFinder.invalidate_caches is reachable when delegated through PathFinder. (GH-116812) (#116865)
* Make MetadataPathFinder a proper classmethod.

* In PathFinder.invalidate_caches, also invoke MetadataPathFinder.invalidate_caches.

* Add blurb
(cherry picked from commit 5f52d20a93)
2024-03-15 09:59:32 -04:00
Miss Islington (bot)
eaefa0b1f7
[3.11] gh-90095: Ignore empty lines and comments in .pdbrc (GH-116834) (#116855)
gh-90095: Ignore empty lines and comments in `.pdbrc` (GH-116834)
(cherry picked from commit a50cf6c3d7)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-03-15 09:55:44 +00:00
Miss Islington (bot)
c42e709e5a
[3.11] gh-116785: Fix direct invocation of test_inspect (GH-116787) (#116795)
gh-116785: Fix direct invocation of `test_inspect` (GH-116787)
(cherry picked from commit 66fb613d90)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-03-14 10:25:48 +00:00
Brett Cannon
3cc24f1000
[3.11] GH-115979: update test_importlib to work under WASI SDK 21 (GH-116754) (GH-116762)
(cherry picked from commit 61733a2fb9)
2024-03-13 21:55:29 +00:00
Victor Stinner
f292b0724e
[3.11] gh-106687: _ssl: use uint64_t for SSL options (#106700) (#116665)
gh-106687: _ssl: use uint64_t for SSL options (#106700)

SSL_CTX_get_options() uses uint64_t for options:
https://www.openssl.org/docs/man3.1/man3/SSL_CTX_get_options.html

Fix this compiler warning on Windows with MSC:

    conversion from 'uint64_t' to 'long', possible loss of data

(cherry picked from commit ad95c7253a)
2024-03-13 17:49:30 +01:00
Miss Islington (bot)
cde47e222e
[3.11] gh-110918: Fix side effects of regrtest test_match_tests() (GH-116718) (#116727)
gh-110918: Fix side effects of regrtest test_match_tests() (GH-116718)

test_match_tests now saves and restores patterns.

Add get_match_tests() function to libregrtest.filter.

Previously, running test_regrtest multiple times in a row only ran
tests once: "./python -m test test_regrtest -R 3:3.
(cherry picked from commit 612f1ec988)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-03-13 14:35:59 +00:00
Serhiy Storchaka
4a73637966
[3.11] gh-116401: Fix blocking os.fwalk() and shutil.rmtree() on opening a named pipe (GH-116421) (GH-116717)
(cherry picked from commit aa7bcf284f)
2024-03-13 10:03:17 +00:00
Miss Islington (bot)
5bd350709d
[3.11] gh-116491: Improve test_win32_ver (GH-116506) (#116709)
gh-116491: Improve `test_win32_ver` (GH-116506)
(cherry picked from commit ee0dbbc045)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-03-13 07:37:01 +00:00
Miss Islington (bot)
7e8578ce9d
[3.11] gh-115264: Fix test_functools with -00 mode (GH-115276) (#116706)
gh-115264: Fix `test_functools` with `-00` mode (GH-115276)
(cherry picked from commit 27df81d564)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-03-13 07:05:41 +00:00
Jason R. Coombs
21a259eba5
[3.11] gh-116307: Proper fix for 'mod' leaking across importlib tests… (#116694)
[3.11] gh-116307: Proper fix for 'mod' leaking across importlib tests (GH-116680)
(cherry picked from commit a254807761)


gh-116307: Create a new import helper 'isolated modules' and use that instead of 'Clean Import' to ensure that tests from importlib_resources don't leave modules in sys.modules.
2024-03-13 00:35:00 +00:00
Miss Islington (bot)
a01621aeb4
[3.11] gh-116682: stdout may be empty in test_cancel_futures_wait_false (GH-116683) (#116693)
If the `shutdown()` call happens before the worker thread starts executing
the task, then nothing will be printed to stdout.
(cherry picked from commit 7d1abe9502)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-03-13 00:29:03 +00:00
Tian Gao
b17d34796e
[3.11] gh-90095: Make .pdbrc work properly and add some reasonable te… (#116660)
[3.11] gh-90095: Make .pdbrc work properly and add some reasonable tests (GH-110496)
(cherry picked from commit 44f9a84b67)
2024-03-12 16:58:40 +00:00
Miss Islington (bot)
5562a09821
[3.11] gh-116600: [Enum] fix global Flag repr (GH-116615) (#116630)
* and fix global flag repr

(cherry picked from commit 06e29a224f)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-03-11 17:36:15 -07:00
Miss Islington (bot)
88ed804ae7
[3.11] gh-71052: Use raise_signal in ThreadSignals.test_signals (GH-116423) (#116617)
gh-71052: Use `raise_signal` in `ThreadSignals.test_signals` (GH-116423)

Use `raise_signal` rather than `kill` in `ThreadSignals.test_signals`
(cherry picked from commit 34920f3691)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2024-03-11 21:01:13 +00:00
Petr Viktorin
d78117981a
[3.11] gh-115421: List all test/ subdirs in Makefile, and test them (GH-115813)
This backports:
- GH-115813
- GH-115422

Unlike on the main branch, new directories are added to the end,
so they're a bit easier to patch out if a redistributor needs to do so.

On main & 3.12, there's a special case for `idlelib/idle_test`; on
3.11 TESTSUBDIRS has several more entries that are not in `test/`.
This backport ignores all of them (including idlelib).
(The alternative would be list them, as additions to TEST_HOME_DIR.
But that's probably too invasive; people might split stdlib up in
surprising ways.)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-03-11 12:02:05 +01:00
Miss Islington (bot)
707ce1f0a7
[3.11] gh-88352: Make TimedRotatingFileHandler tests more stable (GH-116409) (GH-116586)
The tests failed (with less than 1% probability) if for example the file
was created at 11:46:03.999, but the record was emitted at 11:46:04.001,
with atTime=11:46:04, which caused an unexpected rollover. Ensure that the
tests are always run within the range of the same whole second.

Also share code between test_rollover_at_midnight and test_rollover_at_weekday.
(cherry picked from commit d8712fa0c7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-03-11 12:49:48 +02:00