gh-142315: Don't pass the "real path" of Pdb script target to system functions (GH-142371)
* Pick target depending on preconditions
* Clarify the news fragment
* Add test capturing missed expectation.
* Add more idiomatic safe realpath helper
* Restore logic where existance and directoriness are checked on realpath.
* Link GH issue to test.
* Extract a function to check the target. Remove the _safe_realpath, now no longer needed.
* Extract method for replacing sys_path, and isolate realpath usage there.
* Revert "Extract method for replacing sys_path, and isolate realpath usage there."
This reverts commit 855aac3d28.
* Restore _safe_realpath.
---------
(cherry picked from commit d716e3b2dd)
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
gh-142554: avoid `divmod` crashes due to bad `_pylong.int_divmod` (GH-142673)
(cherry picked from commit 4e4163676a)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
If there are many untracked tuples, the GC will run too often, resulting
in poor performance. The fix is to include untracked tuples in the
"long lived" object count. The number of frozen objects is also now
included since the free-threaded GC must scan those too.
(cherry picked from commit e38967ed60)
gh-142353: Isolate tests from personal GNU Readline init files (GH-142370)
Isolate tests from personal Readline init files using `INPUTRC=/dev/null` trick.
(cherry picked from commit f564654bae)
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-142556: fix crash when a task gets re-registered during finalization in `asyncio` (GH-142565)
(cherry picked from commit 42d2bedb87)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
GH-139436: Remove PDF and CHM from IDLE HelpSource (GH-140418)
(cherry picked from commit c5825ff4c9)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-142489: Increase ssl_handshake_timeout in asyncio tests (GH-142523)
Replace SHORT_TIMEOUT with LONG_TIMEOUT for very slow CIs.
And add the HANDSHAKE_TIMEOUT constant.
(cherry picked from commit dc3ece2bc0)
Co-authored-by: Victor Stinner <vstinner@python.org>
For optional arguments with required=True, the ArgumentDefaultsHelpFormatter
would always add a " (default: None)" to the end of the help text.
Since that's a bit misleading, it is removed with this commit.
(cherry picked from commit 1adb17b1a2)
Co-authored-by: Fabian Henze <32638720+henzef@users.noreply.github.com>
Co-authored-by: Ivo Bellin Salarin <nilleb@users.noreply.github.com>
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
Co-authored-by: Ivo Bellin Salarin <ivo@nilleb.com>
gh-140125: Increase object recursion depth for `test_json` from 200k to 500k (GH-142226)
(cherry picked from commit e3539e99e3)
Co-authored-by: Zanie Blue <contact@zanie.dev>
Co-authored-by: Victor Stinner <vstinner@python.org>
Support groups preceded by positional arguments or followed or intermixed
with other optional arguments. Support empty groups.
(cherry picked from commit 1db9f56bff)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (GH-142008)
RDM: This fixes a subtle folding error that showed up when a token exactly filled a line and was followed by whitespace and a token with no folding whitespace that was longer than a line. In this particular circumstance the whitespace after the first token got pushed on to the next line, and then stolen to go in front of the next unfoldable token...leaving a completely empty line in the line buffer. That line got turned in to a newline, which is RFC illegal, and the newish security check caught it. The fix is to just delete that empty line from the buffer.
(cherry picked from commit 07eff899d8)
Co-authored-by: Paresh Joshi <rahulj9223@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
The previous test_spawn_doesnt_hang test had a few problems:
* It would cause ENV CHANGED failures if other tests were running
concurrently due to stty changes
* Typing while the test was running could cause it to fail
(cherry picked from commit c0c65141b3)
Co-authored-by: Sam Gross <colesbury@gmail.com>
The CGI server on Windows could consume the amount of memory specified
in the Content-Length header of the request even if the client does not
send such much data. Now it reads the POST request body by chunks,
therefore the memory consumption is proportional to the amount of sent
data.
(cherry picked from commit 4172644d78)
Difference from the original commit: the default in 3.14 is to use
the simpler original protocol (except for filenames with newlines).
Co-authored-by: Petr Viktorin <encukou@gmail.com>
gh-129483: Make `TestLocalTimeDisambiguation`'s time format locale independent (GH-142193)
* Change to update %c to the exact time format.
---------
(cherry picked from commit 8392095bf9)
Co-authored-by: Kir Chou <148194051+gkirchou@users.noreply.github.com>
Co-authored-by: Kir Chou <note351@hotmail.com>
This fixes a regression introduced in gh-140558. The interpreter would
crash if we inserted a non `str` key into a split table that matches an
existing key.
(cherry picked from commit 547d8daf78)
Co-authored-by: Sam Gross <colesbury@gmail.com>
gh-142145: Remove quadratic behavior in node ID cache clearing (GH-142146)
* Remove quadratic behavior in node ID cache clearing
* Add news fragment
---------
(cherry picked from commit 08d8e18ad8)
Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Jacob Walls <38668450+jacobtylerwalls@users.noreply.github.com>
gh-59000: Fix pdb breakpoint resolution for class methods when module not imported (GH-141949)
(cherry picked from commit 5e58548ebe)
Co-authored-by: LloydZ <35182391+cocolato@users.noreply.github.com>
Reading a specially prepared small Plist file could cause OOM because file's
read(n) preallocates a bytes object for reading the specified amount of
data. Now plistlib reads large data by chunks, therefore the upper limit of
consumed memory is proportional to the size of the input file.
(cherry picked from commit 694922cf40)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
The CGI server on Windows could consume the amount of memory specified
in the Content-Length header of the request even if the client does not
send such much data. Now it reads the POST request body by chunks,
so that the memory consumption is proportional to the amount of sent
data.