Update _get_hostport to always remove square brackets
from IPv6 addresses. Then add them if needed
in "CONNECT .." and "Host: ".
(cherry picked from commit 465db27cb9)
Co-authored-by: Derek Higgins <derekh@redhat.com>
ListSeparator should not be encoded. This could happen when a long line
pushes its separator to the next line, which would have been encoded.
(cherry picked from commit 09fab93c3d)
Co-authored-by: Thomas Weißschuh <thomas@t-8ch.de>
lseek() always returns 0 for character pseudo-devices like
`/dev/urandom` (for other non-regular files, e.g. `/dev/stdin`, it
always returns -1, to which CPython reacts by raising appropriate
exceptions). They are thus technically seekable despite not having seek
semantics.
When calling read() on e.g. an instance of `io.BufferedReader` that
wraps such a file, `BufferedReader` reads ahead, filling its buffer,
creating a discrepancy between the number of bytes read and the internal
`tell()` always returning 0, which previously resulted in e.g.
`BufferedReader.tell()` or `BufferedReader.seek()` being able to return
positions < 0 even though these are supposed to be always >= 0.
Invariably keep the return value non-negative by returning
max(former_return_value, 0) instead, and add some corresponding tests.
(cherry picked from commit 26800cf25a)
Co-authored-by: 6t8k <58048945+6t8k@users.noreply.github.com>
Since 2f3941d743 this function returns the
response string, rather than nothing.
(cherry picked from commit e88ebc1c40)
Co-authored-by: Matthew Hughes <34972397+matthewhughes934@users.noreply.github.com>
docs: Add glossary term references to shutil docs (GH-115559)
Add glossary term references to shutil docs
(cherry picked from commit 318f2190bc)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
gh-115392: Fix doctest reporting incorrect line numbers for decorated functions (GH-115440)
(cherry picked from commit bb791c7728)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Don't repeatedly say that keys and values are coerced into bytes.
(cherry picked from commit 81e140d10b)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
gh-115403: Remove extra colon after "Examples" in datetime documentation (GH-115452)
(cherry picked from commit 6755c4e0c8)
Co-authored-by: Stanislav Lyu <wallseat@gmail.com>
ftplib docs: `timeout` doesn't have to be a whole number (GH-115443)
(cherry picked from commit 3fd2ad8241)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-115405: add versionadded tag for co_qualname in code objects documentation (GH-115411)
(cherry picked from commit de07941729)
Co-authored-by: Christophe Papazian <114495376+christophe-papazian@users.noreply.github.com>
Update "Using Python on a Mac" (GH-115024)
(cherry picked from commit 0a6e1a4119)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
gh-115317: Rewrite changelog filter to use vanilla JavaScript (GH-115324)
(cherry picked from commit 341d7874f0)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
Immediate merits:
* eliminate complex workarounds for 'z' format support
(NOTE: mpdecimal recently added 'z' support, so this becomes
efficient in the long term.)
* fix 'z' format memory leak
* fix 'z' format applied to 'F'
* fix missing '#' format support
Suggested and prototyped by Stefan Krah.
Fixes gh-114563, gh-91060
(cherry picked from commit 72340d15cd)
Co-authored-by: John Belmonte <john@neggie.net>
Co-authored-by: Stefan Krah <skrah@bytereef.org>
Also ensure we always display a debug message or error for RC_INTERNAL_ERROR
(cherry picked from commit c39272e143)
Co-authored-by: Steve Dower <steve.dower@python.org>
* Class methods no longer have "method of builtins.type instance" note.
* Corresponding notes are now added for class and unbound methods.
* Method and function aliases now have references to the module or the
class where the origin was defined if it differs from the current.
* Bound methods are now listed in the static methods section.
* Methods of builtin classes are now supported as well as methods of
Python classes.
(cherry picked from commit 2939ad02be)
Setters for members with an unsigned integer type now support
the same range of valid values for objects that has a __index__()
method as for int.
Previously, Py_T_UINT, Py_T_ULONG and Py_T_ULLONG did not support
objects that has a __index__() method larger than LONG_MAX.
Py_T_ULLONG did not support negative ints. Now it supports them and
emits a RuntimeWarning.
(cherry picked from commit d9d6909697)
Trailing "**" no longer allows to match files and non-existing paths in
recursive glob().
(cherry picked from commit aeffc7f895)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b343)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>