[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.
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>
* 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>
There now may be multiple carets pointing at a token
rather than just a character. Fix the sentence about
possible causes.
(cherry picked from commit 3e45030076)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
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>
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>
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>
gh-116576: Fix `Tools/scripts/sortperf.py` sorting the same list (GH-116577)
(cherry picked from commit 4704e55a71)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
GH-116218 Docs: Add availability information for the 'resource' module (GH-116256)
Add availability data to 'resource' module Docs
(cherry picked from commit 03f86b1b62)
Co-authored-by: Kerim Kabirov <39376984+Privat33r-dev@users.noreply.github.com>
(cherry picked from commit 601f3a7b33)
Co-authored-by: Nicolas A. Oyarzabal <79150521+nicky-eng@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
gh-116447: Fix possible UB in `arraymodule` and `getargs` (GH-116459)
(cherry picked from commit fdb2d90a27)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Fix some test_multiprocessing flakiness.
Potentially introduced by https://github.com/python/cpython/pull/25845
not joining that thread likely leads to recently observed "environment
changed" logically passing but overall failing tests seen on some
buildbots similar to:
```
1 test altered the execution environment (env changed):
test.test_multiprocessing_fork.test_processes
2 re-run tests:
test.test_multiprocessing_fork.test_processes
test.test_multiprocessing_forkserver.test_processes
```
(cherry picked from commit ea1803e608)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Allow controlling Expat >=2.6.0 reparse deferral (CVE-2023-52425) by adding five new methods:
- `xml.etree.ElementTree.XMLParser.flush`
- `xml.etree.ElementTree.XMLPullParser.flush`
- `xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`
- `xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`
- `xml.sax.expatreader.ExpatParser.flush`
Based on the "flush" idea from #115138 (comment) .
- Please treat as a security fix related to CVE-2023-52425.
(cherry picked from commit 6a95676)
(cherry picked from commit 73807eb)
(cherry picked from commit eda2963)
---------
Includes code suggested-by: Snild Dolkow <snild@sony.com>
and by core dev Serhiy Storchaka.
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Amend wording after gh-116019 was merged.
(cherry picked from commit e205c5cd8f)
Co-authored-by: Kerim Kabirov <39376984+Privat33r-dev@users.noreply.github.com>
urllib.parse functions parse_qs() and parse_qsl() now support bytes
arguments containing raw and percent-encoded non-ASCII data.
(cherry picked from commit bdba8ef42b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-116325: Raise `SyntaxError` rather than `IndexError` on ForwardRef with empty string arg (GH-116341)
(cherry picked from commit a29998a06b)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Remove sentence in Tools/c-analyzer/README referring to deleted
ignore-globals.txt.
(cherry picked from commit 88b5c665ee)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-115320: Refactor `get_hash_info` in `sysmodule.c` not to swallow errors (GH-115321)
(cherry picked from commit 207030f552)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Kerim Kabirov <39376984+Privat33r-dev@users.noreply.github.com>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
gh-116281: Remove wrong '\' from '\*' in some doc signatures (#116282)
(cherry picked from commit 4859ecb860)
Co-authored-by: HarryLHW 123lhw321@gmail.com
Improve algorithm for computing which rolled-over log files to delete
in logging.TimedRotatingFileHandler. It is now reliable for handlers
without namer and with arbitrary deterministic namer that leaves
the datetime part in the file name unmodified.
(cherry picked from commit 87faec28c7)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>