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>
This was left out of the 3.12 backport for three related issues:
- gh-107219 (which adds `self.call_queue._writer.close()` to `_ExecutorManagerThread` in `concurrent.futures`)
- gh-109370 (which changes this to be only called on Windows)
- gh-109047 (which moves the call to `multiprocessing.Queue`'s `_terminate_broken`)
Without this change, ProcessPoolExecutor sometimes hangs on Windows
when a worker process is terminated.
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
The iterator returned by ElementTree.iterparse() may hold on to a file
descriptor. The reference cycle prevented prompt clean-up of the file
descriptor if the returned iterator was not exhausted.
(cherry picked from commit ce01ab536f)
Co-authored-by: Sam Gross <colesbury@gmail.com>
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>
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: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
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>
The terminal CR -> NL mapping setting should be inherited in cbreak mode as OSes do not specify altering it as part of their stty cbreak mode definition.
(cherry picked from commit fd49e22670)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
* Fix writing the retrieved binary file to stdout.
* Add a newline after writing warnings to stderr.
* Fix a TypeError if the netrc file doesn't contain a host/default entry.
* Improve the usage message.
(cherry picked from commit 42d72b23dd)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-108303: Move all doctest related files and tests to `Lib/test/test_doctest/` (GH-112109)
(cherry picked from commit 9c93350f58)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Brett Cannon <brett@python.org>
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>
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>
Prefix 'dict' with 'o', 'g', or 'l' for 'object', 'global', or 'local'.
Suffix 'object' with '_'.
(cherry picked from commit 6f4b242a03)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-104522: Fix OSError raised when run a subprocess (GH-114195)
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: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Robert O'Shea <PurityLake@users.noreply.github.com>
Instead of checking if a directory does not exist and thereafter
creating it, directly call os.makedirs() with the exist_ok=True.
(cherry picked from commit 78fcde039a)
Co-authored-by: buermarc <44375277+buermarc@users.noreply.github.com>
Tkinter is a fact, not necessarily a feature.
Reorganize editor key bindings in a logical order
and remove those that do not work, at least on Windows.
Improve shell bindings list.
(cherry picked from commit 4a32275389)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This matches Firefox format. Edge double-spaces non-simple
lists but I think it looks worse.
(cherry picked from commit e07a400c31)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
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>
The substantive change is on line 577/593. Rest is header/footer stuff ignored when displaying.
(cherry picked from commit 7a24ecc953)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
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>
gh-101225: Increase the socket backlog when creating a multiprocessing.connection.Listener (GH-113567)
Increase the backlog for multiprocessing.connection.Listener` objects created
by `multiprocessing.manager` and `multiprocessing.resource_sharer` to
significantly reduce the risk of getting a connection refused error when creating
a `multiprocessing.connection.Connection` to them.
(cherry picked from commit c7d59bd8cf)
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
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.
---------
(cherry picked from commit dd56b57483)
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: Mark Dickinson <dickinsm@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
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>
test_configdialog.HighPageTest.test_highlight_target_text_mouse fails
if a line of the Highlight tab text sample is not visible. If so, bbox()
in click_char() returns None and the unpacking iteration fails.
This occurred on a Devuan Linux system. Fix by moving the
'see character' call inside click_char, just before the bbox call.
Also, reduce the click_char calls to just one per tag name and
replace the other nested function with a dict comprehension.
(cherry picked from commit c4992f4106)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
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>
(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>
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>