`shutil.unpack_archive()` tries to read the whole file into memory, making no use of any kind of smaller buffer. Process crashes for really large files: I.e. archive: ~1.7G, unpacked: ~10G. Before the crash it can easily take away all available RAM on smaller systems. Had to pull the code form `zipfile.Zipfile.extractall()` to fix this
Automerge-Triggered-By: GH:gpshead
(cherry picked from commit f32c7950e0)
Co-authored-by: Igor Bolshakov <ibolsch@gmail.com>
It was always meant to be released for parallelization.
This now matches the other similar code in the module.
Thanks michaelforney for noticing!
(cherry picked from commit c10392e7dd)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Automerge-Triggered-By: GH:gpshead
These are passed and called as PyCFunction, however they are defined here without the (ignored) args parameter.
This works fine in some C compilers, but fails in webassembly or anything else that has strict function pointer call type checking.
(cherry picked from commit ab383eb6f0)
Co-authored-by: Joe Marshall <joe.marshall@nottingham.ac.uk>
Co-authored-by: Joe Marshall <joe.marshall@nottingham.ac.uk>
When a Thread is not joined after it has stopped, its lock may remain in the _shutdown_locks set until interpreter shutdown. If many threads are created this way, the _shutdown_locks set could therefore grow endlessly. To avoid such a situation, purge expired locks each time a new one is added or removed..
(cherry picked from commit c10c2ec7a0)
Co-authored-by: Antoine Pitrou <antoine@python.org>
Automerge-Triggered-By: GH:pitrou
Should be "Subprocess Protocol instances" not "Datagram Protocol instances"
(cherry picked from commit 2918846a4f)
Co-authored-by: kudavid <67070184+kudavid@users.noreply.github.com>
Co-authored-by: kudavid <67070184+kudavid@users.noreply.github.com>
The previous example did not fully showcase the interest of using gather.
Here the example showcases "the result is an aggregate list of returned values".
(cherry picked from commit 56b8ea65d2)
Co-authored-by: josephernest <nouvellecollection@gmail.com>
Co-authored-by: josephernest <nouvellecollection@gmail.com>
The patch from [bpo-44074]() does not account for a possibly non-English locale and blindly greps for "HEAD branch" in a possibly localized text.
Automerge-Triggered-By: GH:pitrou
(cherry picked from commit 1aa3530314)
Co-authored-by: Antoine Pitrou <antoine@python.org>
Import HTTPError from urllib.error instead of urllib.request.
(cherry picked from commit 5fedf71439)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
* Doc: http.server: directory is not a class attribute, but an argument.
(cherry picked from commit d1b81574ed)
Co-authored-by: Julien Palard <julien@palard.fr>
Co-authored-by: Julien Palard <julien@palard.fr>
Some missing words; some odd word choices.
(cherry picked from commit ee8e7c2fa9)
Co-authored-by: Scott Noyes <snoyes@gmail.com>
Co-authored-by: Scott Noyes <snoyes@gmail.com>
* clearly document that ":GH-X" string formatting results in "0X..."
* put back the "serial comma"
(cherry picked from commit 92ceb1c840)
Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com>
* Set content-length for simple http server 301s
When http.server.SimpleHTTPRequestHandler sends a 301 (Moved
Permanently) due to a missing file, it does not set a Content-Length
of 0. Unfortunately, certain clients can be left waiting for the
connection to be closed in this circumstance, even though no body
will be sent. At time of writing, both curl and Firefox demonstrate
this behavior.
* Test Content-Length on simple http server redirect
When serving a redirect, the SimpleHTTPRequestHandler will now send
`Content-Length: 0`. Several tests for http.server already cover
various behaviors and checks including redirection. This change only
adds one check for the expected Content-Length on the simplest case
for a redirect.
* Add news entry for SimpleHTTPRequestHandler fix
* Clarify the specific kind of 301
Co-authored-by: Senthil Kumaran <skumaran@gatech.edu>
(cherry picked from commit fb42725561)
Co-authored-by: Stephen Rosen <sirosen@globus.org>
Contributed-By: Matthias Klose
Automerge-Triggered-By: GH:tiran
(cherry picked from commit da5c808fb5)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Fixes http.client potential denial of service where it could get stuck reading lines from a malicious server after a 100 Continue response.
Co-authored-by: Gregory P. Smith <greg@krypto.org>
(cherry picked from commit 47895e31b6)
Co-authored-by: Gen Xu <xgbarry@gmail.com>
The address tuple for CAN_RAW no longer returns the address family
after the introduction of CAN ISO-TP support in a30f6d45ac. However,
updating test_socket.CANTest.testSendFrame was missed as part of the
change, so the test incorrectly attempts to index past the last tuple
item to retrieve the address family.
This removes the now-redundant check for equality against socket.AF_CAN,
as the tuple will not contain the address family.
(cherry picked from commit 355bae8882)
Co-authored-by: karl ding <karlding@users.noreply.github.com>