Commit graph

24413 commits

Author SHA1 Message Date
Miss Islington (bot)
03dc951316
gh-95280: Fix test_get_ciphers on systems without RSA key exchange (GH-95282) (GH-95323)
(cherry picked from commit 565403038b)

Co-authored-by: Christian Heimes <christian@python.org>
2022-07-29 17:20:06 +02:00
Łukasz Langa
017080f0fa
[3.9] gh-94208: Add more TLS version/protocol checks for FreeBSD (GH-94347) (GH-95312)
Three test cases were failing on FreeBSD with latest OpenSSL.
(cherry picked from commit 1bc86c2625)

Co-authored-by: Christian Heimes <christian@python.org>
2022-07-27 23:43:02 +02:00
Miss Islington (bot)
cd0a59f1fa
gh-94821: Fix autobind of empty unix domain address (GH-94826) (GH-94875)
When binding a unix socket to an empty address on Linux, the socket is
automatically bound to an available address in the abstract namespace.

    >>> s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    >>> s.bind("")
    >>> s.getsockname()
    b'\x0075499'

Since python 3.9, the socket is bound to the one address:

    >>> s.getsockname()
    b'\x00'

And trying to bind multiple sockets will fail with:

    Traceback (most recent call last):
      File "/home/nsoffer/src/cpython/Lib/test/test_socket.py", line 5553, in testAutobind
        s2.bind("")
    OSError: [Errno 98] Address already in use

Added 2 tests:
- Auto binding empty address on Linux
- Failing to bind an empty address on other platforms

Fixes f6b3a07b7d (bpo-44493: Add missing terminated NUL in sockaddr_un's length (GH-26866)
(cherry picked from commit c22f134211)

Co-authored-by: Nir Soffer <nsoffer@redhat.com>
2022-07-26 12:07:41 +02:00
Łukasz Langa
eff4aa5409
[3.9] gh-90355: Add isolated flag if currently isolated (GH-92857) (GH-94570)
Co-authored-by: Carter Dodd <carter.dodd@gmail.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit c8556bcf6c)
2022-07-05 18:06:57 +02:00
Miss Islington (bot)
66f4593280
gh-91172: Create a workflow for verifying bundled pip and setuptools (GH-31885) (GH-94123)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
(cherry picked from commit d36954b7ea)

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2022-06-22 15:58:16 +02:00
Miss Islington (bot)
defaa2b19a
gh-87389: Fix an open redirection vulnerability in http.server. (GH-93879) (GH-94093)
Fix an open redirection vulnerability in the `http.server` module when
an URI path starts with `//` that could produce a 301 Location header
with a misleading target.  Vulnerability discovered, and logic fix
proposed, by Hamza Avvan (@hamzaavvan).

Test and comments authored by Gregory P. Smith [Google].
(cherry picked from commit 4abab6b603)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-06-22 10:42:02 +02:00
Miss Islington (bot)
893adbf001
gh-91810: Fix regression with writing an XML declaration with encoding='unicode' (GH-93426) (GH-93791)
Suppress writing an XML declaration in open files in ElementTree.write()
with encoding='unicode' and xml_declaration=None.

If file patch is passed to ElementTree.write() with encoding='unicode',
always open a new file in UTF-8.
(cherry picked from commit d7db9dc3cc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-16 12:16:30 +02:00
Miss Islington (bot)
95c9c2b9cb
gh-93065: Fix HAMT to iterate correctly over 7-level deep trees (GH-93066) (#93147)
Also while there, clarify a few things about why we reduce the hash to 32 bits.

Co-authored-by: Eli Libman <eli@hyro.ai>
Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>

(cherry picked from commit c1f5c903a7)
2022-05-24 10:52:49 +02:00
Miss Islington (bot)
9f7cdb2cf7
bpo-45393: help() on operator precedence has misleading entries (GH-31246) (GH-92967)
(cherry picked from commit fb082c2fc5)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2022-05-19 17:33:09 +02:00
Łukasz Langa
6de2ca5339
Python 3.9.13 2022-05-17 13:12:56 +02:00
Jelle Zijlstra
f82b32410b
[3.9] gh-92112: Fix crash triggered by an evil custom mro() (GH-92113) (GH-92372)
(cherry picked from commit 85354ed78c)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
2022-05-16 18:47:35 +02:00
Marek Suscak
518b238967
[3.9] bpo-34480: fix bug where match variable is used prior to being defined (GH-17643) (GH-32256)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-05-16 18:19:04 +02:00
Miss Islington (bot)
1699a5ee13
Check result of utc_to_seconds and skip fold probe in pure Python (GH-91582) (GH-92748)
The `utc_to_seconds` call can fail, here's a minimal reproducer on
Linux:

TZ=UTC python -c "from datetime import *; datetime.fromtimestamp(253402300799 + 1)"

The old behavior still raised an error in a similar way, but only
because subsequent calculations happened to fail as well. Better to fail
fast.

This also refactors the tests to split out the `fromtimestamp` and
`utcfromtimestamp` tests, and to get us closer to the actual desired
limits of the functions. As part of this, we also changed the way we
detect platforms where the same limits don't necessarily apply (e.g.
Windows).

As part of refactoring the tests to hit this condition explicitly (even
though the user-facing behvior doesn't change in any way we plan to
guarantee), I noticed that there was a difference in the places that
`datetime.utcfromtimestamp` fails in the C and pure Python versions, which
was fixed by skipping the "probe for fold" logic for UTC specifically —
since UTC doesn't have any folds or gaps, we were never going to find a
fold value anyway. This should prevent some failures in the pure python
`utcfromtimestamp` method on timestamps close to 0001-01-01.

There are two separate news entries for this because one is a
potentially user-facing change, the other is an internal code
correctness change that, if anything, changes some error messages. The
two happen to be coupled because of the test refactoring, but they are
probably best thought of as independent changes.

Fixes GH-91581
(cherry picked from commit 83c0247d47)

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2022-05-16 17:33:01 +02:00
Miss Islington (bot)
14d05942ea
gh-92530: Fix an issue that occurred after interrupting threading.Condition.notify (GH-92534) (GH-92831)
If Condition.notify() was interrupted just after it released the waiter lock,
but before removing it from the queue, the following calls of notify() failed
with RuntimeError: cannot release un-acquired lock.
(cherry picked from commit 70af994fee)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-16 17:25:31 +02:00
Dennis Sweeney
801f77119d
[3.9] gh-92311: Let frame_setlineno jump over listcomps (#92740) 2022-05-12 17:41:34 -04:00
Miss Islington (bot)
65d2dfd5c2
bpo-42627: Fix incorrect parsing of Windows registry proxy settings (GH-26307)
(cherry picked from commit b69297ea23)

Co-authored-by: 狂男风 <CrazyBoyFeng@Live.com>
2022-05-11 11:42:10 -07:00
Miss Islington (bot)
bfc88d3418
[3.9] gh-91810: ElementTree: Use text file's encoding by default in XML declaration (GH-91903) (GH-92665)
ElementTree method write() and function tostring() now use the text file's
encoding ("UTF-8" if not available) instead of locale encoding in XML
declaration when encoding="unicode" is specified.
(cherry picked from commit 707839b0fe)


Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

Automerge-Triggered-By: GH:serhiy-storchaka
2022-05-11 10:40:05 -07:00
Miss Islington (bot)
b7a87861de
bpo-13553: Document tkinter.Tk args (GH-4786)
(cherry picked from commit c56e2bb994)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2022-05-09 21:20:37 -07:00
Itai Steinherz
1fb25a96ae
bpo-46785: Fix race condition between os.stat() and unlink on Windows (GH-31858)
* [3.9] bpo-46785: Fix race condition between os.stat() and unlink on Windows (GH-31858).
(cherry picked from commit 39e6b8ae6a)

Co-authored-by: Itai Steinherz <itaisteinherz@gmail.com>
2022-05-09 23:42:59 +01:00
Miss Islington (bot)
03aa75221b
bpo-38056: overhaul Error Handlers section in codecs documentation (GH-15732)
* Some handlers were wrongly described as text-encoding only, but actually they can also be used in text-decoding.
* Add more description to each handler.
* Add two REPL examples.
* Add indexes for Error Handler's name.

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 5bc2390229)

Co-authored-by: Ma Lin <animalize@users.noreply.github.com>
2022-05-08 20:20:07 -07:00
Miss Islington (bot)
8e523c1151
[3.10] gh-90622: Do not spawn ProcessPool workers on demand via fork method. (GH-91598) (GH-92497) (#92499)
Do not spawn ProcessPool workers on demand when they spawn via fork.

This avoids potential deadlocks in the child processes due to forking from
a multithreaded process..
(cherry picked from commit ebb37fc3fd)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
(cherry picked from commit b795376a62)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-05-08 11:22:36 -07:00
Miss Islington (bot)
08907ad687
Fix use of the default role in a news entry. (GH-92500)
(cherry picked from commit 8883172893)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-05-08 10:55:44 -07:00
Dong-hee Na
480234488c
[3.9] gh-92448: Update the documentation builder to render the GitHub issue. (GH-92449). (GH-92458) 2022-05-08 22:21:05 +09:00
Miss Islington (bot)
df48bd926e
NEWS: Reorder items by section (GH-92373)
They caused duplicated sections.
(cherry picked from commit 9b491ae04c)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2022-05-05 22:20:09 -07:00
Erlend Egeberg Aasland
7d17a7b352
[3.9] gh-80254: Disallow recursive usage of cursors in sqlite3 converters (#92278)
* [3.9] gh-80254: Disallow recursive usage of cursors in `sqlite3` converters

(cherry picked from commit c908dc5b47)

Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

* Fix ref leak in pysqlite_cursor_iternext

* Explicitly free resources at test tearDown()
2022-05-05 12:47:58 -07:00
Miss Islington (bot)
f84c51eb7a
gh-92036: Fix gc_fini_untrack() (GH-92037)
Fix a crash in subinterpreters related to the garbage collector. When
a subinterpreter is deleted, untrack all objects tracked by its GC.
To prevent a crash in deallocator functions expecting objects to be
tracked by the GC, leak a strong reference to these objects on
purpose, so they are never deleted and their deallocator functions
are not called.
(cherry picked from commit 14243369b5)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-05-04 03:25:33 -07:00
Miss Islington (bot)
524d2750e3
bpo-47029: Fix BrokenPipeError in multiprocessing.Queue at garbage collection and explicit close (GH-31913)
(cherry picked from commit dfb1b9da8a)

Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
2022-05-03 17:18:20 -07:00
Miss Islington (bot)
4ede781045
bpo-29890: Test IPv*Interface construction with tuple argument (GH-30862)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit b295a92c50)

Co-authored-by: Humbled Drugman <humbled.drugman@gmail.com>
2022-05-03 11:18:42 -07:00
Miss Islington (bot)
020f5c47d8
bpo-46415: Use f-string for ValueError in ipaddress.ip_{address,network,interface} helper functions (GH-30642)
`IPv*Network` and `IPv*Interface` constructors accept a 2-tuple of
(address description, netmask) as the address parameter.
When the tuple-based address is used errors are not propagated
correctly through the `ipaddress.ip_*` helper because of the %-formatting now expecting several arguments:

	In [7]: ipaddress.ip_network(("192.168.100.0", "fooo"))
        ...
	TypeError: not all arguments converted during string formatting

Compared to:

	In [8]: ipaddress.IPv4Network(("192.168.100.0", "foo"))
        ...
	NetmaskValueError: 'foo' is not a valid netmask

Use an f-string to make sure the error is always properly formatted.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 52dc9c3066)

Co-authored-by: Thomas Cellerier <thomascellerier@gmail.com>
2022-05-03 05:34:50 -07:00
Serhiy Storchaka
1b1c79c566
[3.9] gh-91583: AC: Fix regression for functions with defining_class (GH-91739) (GH-92080)
Argument Clinic now generates the same efficient code as before
adding the defining_class parameter.
(cherry picked from commit a055dac0b4)
2022-05-03 11:54:06 +03:00
Miss Islington (bot)
51b885a38a
bpo-46787: Fix ProcessPoolExecutor exception memory leak (GH-31408) (GH-31408)
Do not store `ProcessPoolExecutor` work item exception traceback that prevents
exception frame locals from being garbage collected.
(cherry picked from commit 9c204b148f)

Co-authored-by: themylogin <themylogin@gmail.com>
2022-05-02 15:51:20 -07:00
Miss Islington (bot)
d113674b3e
gh-91783: Document security considerations for shutil.unpack_archive (GH-91844)
(cherry picked from commit 4b297a9ffd)

Co-authored-by: Sam Ezeh <sam.z.ezeh@gmail.com>
2022-05-02 10:36:05 -07:00
Miss Islington (bot)
206f416bd0
bpo-36819: Fix crashes in built-in encoders with weird error handlers (GH-28593)
If the error handler returns position less or equal than the starting
position of non-encodable characters, most of built-in encoders didn't
properly re-size the output buffer. This led to out-of-bounds writes,
and segfaults.
(cherry picked from commit 18b07d773e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-02 02:59:40 -07:00
Serhiy Storchaka
54f06aeb74
[3.9] gh-92049: Forbid pickling constants re._constants.SUCCESS etc (GH-92070) (GH-92073) (GH-92102)
Previously, pickling did not fail, but the result could not be unpickled.
(cherry picked from commit 6d0d547033)
(cherry picked from commit e8ff3c92f6)
2022-05-01 13:01:56 +03:00
Miss Islington (bot)
3d0a5f73f5
bpo-43323: Fix UnicodeEncodeError in the email module (GH-32137)
It was raised if the charset itself contains characters not encodable
in UTF-8 (in particular \udcxx characters representing non-decodable
bytes in the source).
(cherry picked from commit e91dee87ed)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-04-30 05:31:37 -07:00
Miss Islington (bot)
36de20d0f9
bpo-26792: Improve docstrings of runpy module run_functions (GH-30729)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 117836f123)

Co-authored-by: Humbled Drugman <humbled.drugman@gmail.com>
2022-04-29 11:46:47 -07:00
Miss Islington (bot)
fa87c362e1
gh-91832: Add 'required' attr to argparse.Action repr (GH-91841)
GH- Adding 'required' to names in Lib.argparse.Action

gh-91832:
Added 'required' to the list `names` in `Lib.argparse.Action`.
Changed constant strings that test the Action object.

Automerge-Triggered-By: GH:merwok
(cherry picked from commit 4ed3900041)

Co-authored-by: Abhigyan Bose <abhigyandeepbose@gmail.com>
2022-04-28 08:19:07 -07:00
Miss Islington (bot)
081e95165e
Fix missing f prefix on f-strings (GH-91910)
(cherry picked from commit f882d33778)

Co-authored-by: Alexander Shadchin <alexandr.shadchin@gmail.com>
2022-04-27 00:01:11 -07:00
Ezio Melotti
38be31e61e
[3.9] gh-91888: add a :gh: role to the documentation (GH-91889) (#91935)
* gh-91888: Add a :gh: role to the documentation (GH-91889).

* [3.9] gh-91888: add a `:gh:` role to the documentation (GH-91889)

* Add a new :gh:`...` role for GitHub issues.

* Fix a GitHub id to use the :gh: role.

* Add Misc/NEWS entry.

* Refactoring and rephrasing.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>.
(cherry picked from commit f7641a2ffe)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-04-26 03:16:24 +02:00
Miss Islington (bot)
42a158b627
gh-91547: Remove "Undocumented modules" page (GH-91682)
(cherry picked from commit 254aaa7981)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-04-22 16:33:38 -07:00
Miss Islington (bot)
537dabc869
[3.9] gh-91575: Update case-insensitive matching in re to the latest Unicode version (GH-91580). (GH-91661) (GH-91837)
(cherry picked from commit 1c2fcebf3c)
(cherry picked from commit 1748816e80)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-04-22 22:02:56 +03:00
Miss Islington (bot)
76ff68666f
[3.9] gh-91700: Validate the group number in conditional expression in RE (GH-91702) (GH-91831) (GH-91836)
In expression (?(group)...) an appropriate re.error is now
raised if the group number refers to not defined group.

Previously it raised RuntimeError: invalid SRE code.
(cherry picked from commit 48ec61a89a)
(cherry picked from commit 080781cd49)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-04-22 22:02:20 +03:00
Miss Islington (bot)
97d14e1dfb
[3.9] gh-90568: Fix exception type for \N with a named sequence in RE (GH-91665) (GH-91830) (GH-91834)
re.error is now raised instead of TypeError.
(cherry picked from commit 6ccfa31421)
(cherry picked from commit 9c18d783c3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-04-22 21:34:31 +03:00
Miss Islington (bot)
1fce689c2a
bpo-40859: Update Windows build to use xz-5.2.5 (GH-20622)
Co-authored-by: Ma Lin <animalize@users.noreply.github.com>
(cherry picked from commit 73af4b0264)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-04-20 14:46:14 -07:00
Miss Islington (bot)
56c2d08097
gh-91734: Fix ossaudio support on Solaris (GH-91735)
(cherry picked from commit 4420faf273)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2022-04-20 04:09:01 -07:00
Oleg Iarygin
312e16fb7b
[3.9] gh-91118: Fix docstrings that do not honor --without-doc-strings (GH-31769) (#91664)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit a573cb2fec)
2022-04-19 12:58:34 -07:00
Miss Islington (bot)
cb3c85d40d
[3.10] gh-91676 gh-91260 unittest.IsolatedAsyncioTestCase no longer leaks its executor (GH-91680)
For things like test_asyncio.test_thread this was causing frequent
"environment modified by test" errors as the executor threads had not
always stopped running after the test was over.
(cherry picked from commit 61570ae0bc)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-04-19 09:40:52 -07:00
Gregory P. Smith
2a43afdba9
[3.9] [3.10] gh-91607: Fix several test_concurrent_futures tests to actually test what they claim (GH-91600) (GH-91612) (#91617)
* Fix test_concurrent_futures to actually test what it says.

Many ProcessPoolExecutor based tests were ignoring the mp_context
and using the default instead.  This meant we lacked proper test
coverage of all of them.

Also removes the old _prime_executor() worker delay seeding code
as it appears to have no point and causes 20-30 seconds extra
latency on this already long test.  It also interfered with some
of the refactoring to fix the above to not needlessly create their
own executor when setUp has already created an appropriate one.

* Don't import the name from multiprocessing directly to avoid confusion.

(cherry picked from commit 7fa3a5a219)
(cherry picked from commit 9a458934f7)
2022-04-16 22:47:41 -07:00
Miss Islington (bot)
c171d757f3
gh-91595: fix the comparison of character and integer by using ord() (GH-91596)
* fix the comparison of character and integer by using ord()

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 9300b6d729)

Co-authored-by: Yu Liu <yuki.liu@utexas.edu>
2022-04-16 07:57:07 -07:00
Miss Islington (bot)
514162b835
gh-82849: revise intro to os.path.rst (GH-32232)
* revise the first paragraph of docs for os.path
* add a mention of `os.PathLike` protocol
* remove warnings rendered irrelevant by :pep:`383` and :pep:`529`

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 468314cc8b)

Co-authored-by: Jack DeVries <jdevries3133@gmail.com>
2022-04-15 21:42:20 -07:00