Commit graph

46773 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)
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
Ł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)
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)
bab6954482
[3.9] gh-77630: Change Charset to charset (GH-92439) (GH-92477)
(cherry picked from commit 8f29318079)


Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>

Automerge-Triggered-By: GH:serhiy-storchaka
2022-05-08 08:28:18 -07:00
Miss Islington (bot)
25352d7a75
Add source for character mappings (GH-92014) (#92388)
(cherry picked from commit d707d073be)

Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>

Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
2022-05-06 12:58:10 +02: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)
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)
a23e4722fd
bpo-46604: fix function name in ssl module docstring (GH-31064)
The function fetch_server_certificate is replaced by get_server_certificate in the module. I reflected the change in the module docstrings.

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

Co-authored-by: Kossi GLOKPOR <83467320+glk0@users.noreply.github.com>
2022-05-03 09:33:35 -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
Miss Islington (bot)
7e55730e3f
gh-92106: Add test that subscription works on arbitrary TypedDicts (GH-92176)
(cherry picked from commit 81fb3548be)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-02 18:05:49 -07: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
Thaddeus1499
e48da72647
[3.9] Remove effbot urls (GH-26308). (#92162)
(cherry picked from commit e9f66aedf4)

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
2022-05-02 12:22:05 -06:00
Miss Islington (bot)
1a7867fc0c
concurrent.futures: Fix typo in docstring (GH-92121)
(cherry picked from commit b11243e85e)

Co-authored-by: Yiannis Hadjicharalambous <hadjicharalambous.yiannis@gmail.com>
2022-05-02 09:25:45 -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
Serhiy Storchaka
993bb1632b
[3.9] gh-91810: Expand ElementTree.write() tests to use non-ASCII data (GH-91989). (GH-91994)
(cherry picked from commit f60b4c3d74)
2022-04-27 20:14:05 +03: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
Miss Islington (bot)
f4252dfb8e
gh-91914: Fix test_curses on non-UTF-8 locale (GH-91919)
(cherry picked from commit f41c16bf51)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-04-25 22:51:27 -07:00
Miss Islington (bot)
653a66668d
gh-91916: Fix test_runpy on non-UTF-8 locale (GH-91920)
If use a non-builtin codec, partially implemented in Python
(e.g. ISO-8859-15), a new RecursionError (with empty error message)
can be raised while handle a RecursionError.

Testing for error message was needed to distinguish
a recursion error from arbitrary RuntimeError. After introducing
RecursionError, it became unnecessary.
(cherry picked from commit a568585069)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-04-25 22:45:24 -07:00
Miss Islington (bot)
4165702ee8
RE: Add more tests for inline flag "x" and re.VERBOSE (GH-91854)
(cherry picked from commit 6b45076bd6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-04-23 03:16:50 -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)
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
Miss Islington (bot)
3b6072e7f5
gh-91231: multiprocessing BaseManager waits 1.0 second (GH-91701)
Shutting down a multiprocessing BaseManager now waits for 1 second until
the process completes, rather than 0.1 second, after the process is
terminated.
(cherry picked from commit a885f10325)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-04-19 08:29:57 -07:00
Miss Islington (bot)
63af7b3b11
Add more tests for group names and refs in RE (GH-91695)
(cherry picked from commit 74070085da)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-04-19 07:35:21 -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)
f3f5d4be7a
gh-90879: Fix missing parameter for put_nowait() (GH-91514)
(cherry picked from commit 0fc3517cf4)

Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
2022-04-14 02:23:15 -07:00
Miss Islington (bot)
0ab5e83ff7
gh-87497: Document that urllib.request sends headers in camel case (GH-24661)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 325d6f5035)

Co-authored-by: Alix Lourme <alix.lourme@gmail.com>
2022-04-13 19:45:56 -07:00
Miss Islington (bot)
a8d245a675
gh-88513: clarify shutil.copytree's dirs_exist_ok arg (GH-91434) (GH-91465)
* add a paragraph to document this kwarg in detail
* update docstring in the source accordingly
(cherry picked from commit f33e2c87a8)

Co-authored-by: Jack DeVries <jdevries3133@gmail.com>
2022-04-12 19:58:02 -07:00
Miss Islington (bot)
4cc4fe2789
[3.9] GH-89074: Fixed IsolatedAsyncioTestCase from throwing an exception on leaked tasks (GH-27765) (#91471)
(cherry picked from commit 2cb1a6806c)

Co-authored-by: Bar Harel <bar.harel@biocatch.com>
2022-04-11 23:14:43 -05:00