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>
Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit 6692dc1ca9)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Added in bpo-41730 (GH-22186), the test apparently causes refleaks. The
test isn't worth hunting them down, so it's simply reverted.
This partially reverts commit 4a2d98a1e9.
(cherry picked from commit 8e8307d70b)
Co-authored-by: Zachary Ware <zach@python.org>
(cherry picked from commit 801497a115)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
The error string on VxWorks is "no such file or directory" for FileNotFoundError. That is, the 1st letter of the error string has lower case.
(cherry picked from commit b063b02eab)
Co-authored-by: pxinwr <peixing.xin@windriver.com>
Automerge-Triggered-By: GH:gpshead
A C function accessible by the default exception handler, but not by python code,
finds the existing name closest to the name causing a name or attribute error. For
such errors, call the default handler after capturing stderr and retrieve its message line.
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 092f9ddb5e)
Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
`convertitem()` raises `SystemError` when 'GH-' is used without `PY_SSIZE_T_CLEAN`.
This commit makes `skipitem()` raise it too.
(cherry picked from commit 4ebf4a6bfa)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
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>
* 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>
* 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>
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>
Contributed-By: Matthias Klose
Automerge-Triggered-By: GH:tiran
(cherry picked from commit da5c808fb5)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Ignore objects that inspect.unwrap throws due to
too many wrappers. This is a very rare case, however
it can easily be surfaced when a module under doctest
imports unitest.mock.call into its namespace.
We simply skip any object that throws this exception.
This should handle the majority of cases.
(cherry picked from commit 565a31804c)
Co-authored-by: Alfred Perlstein <alfred@fb.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>
This documents in the tutorial docs the behavior of a finally clause in
case it should re-raise an exception but contains a
return/break/continue statement.
(cherry picked from commit a0b9915a8b)
Co-authored-by: Roberto Hueso <robertohueso96@gmail.com>
In match statements, in case patterns and nowhere else.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 3b200b2aa6)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This adds IO, TextIO, BinaryIO, Match, and Pattern.
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit b115579734)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
The code was updated in
0ec88b33d0
but the docstring was left untouched.
=> updated the docstring to reflect the code changes
(cherry picked from commit d4222ea6b0)
Co-authored-by: Jürgen Gmach <juergen.gmach@googlemail.com>