Commit graph

26698 commits

Author SHA1 Message Date
Miss Islington (bot)
0ff487b8ab
bpo-44287: asyncio test_popen() uses longer timeout (GH-26832)
Fix asyncio test_popen() of test_windows_utils by using a longer
timeout. Use military grade battle-tested test.support.SHORT_TIMEOUT
timeout rather than a hardcoded timeout of 10 seconds: it's 30
seconds by default, but it is made longer on slow buildbots.

WaitForMultipleObjects() timeout argument is in milliseconds.
(cherry picked from commit be1cb3214d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-06-21 17:29:13 -07:00
Miss Islington (bot)
67b3a99953
bpo-44395: Fix MIMEPart.as_string to pass unixfrom properly (GH-26685)
(cherry picked from commit 30f7a77f35)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2021-06-21 07:27:42 -07:00
Miss Islington (bot)
175e264d36
bpo-44469: Fix tests for "async with" with bad object (GH-26817)
Test for execution of the body was null. It would pass
even if the code which should be skipped was executed.
(cherry picked from commit 5d2b3a0d68)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-06-21 00:54:04 -07:00
Pablo Galindo
0d0a9eaa82
[3.9] bpo-44409: Fix error location in tokenizer errors that happen during initialization (GH-26712). (GH-26723)
(cherry picked from commit 507ed6fa1d)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-06-14 18:07:51 +01:00
Miss Islington (bot)
6df926f1c4
bpo-43318: Fix a bug where pdb does not always echo cleared breakpoints (GH-24646) (GH-26675)
(cherry picked from commit 4cb6ba1432)

Co-authored-by: huzhaojie <hu.zj@foxmail.com>
2021-06-11 17:18:49 +01:00
Ethan Furman
e9726314df
[Enum] improve pickle support (#26666)
search all bases for a __reduce__ style method; if a __new__ method is
found first the enum will be made unpicklable
2021-06-11 01:26:32 -07:00
Miss Islington (bot)
304ec53b53
bpo-44356: [Enum] allow multiple data-type mixins if they are all the same (GH-26649) (GH-26652)
This enables, for example, two base Enums to both inherit from `str`, and then both be mixed into the same final Enum:

    class Str1Enum(str, Enum):
        GH- some behavior here

    class Str2Enum(str, Enum):
        GH- some more behavior here

    class FinalStrEnum(Str1Enum, Str2Enum):
        GH- this now works
(cherry picked from commit 8a4f0850d7)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2021-06-10 15:03:29 -07:00
Miss Islington (bot)
175ebc60d5
bpo-37022: Fix bug where pdb's do_p/do_pp commands swallow exceptions from repr (GH-18180) (GH-26651)
(cherry picked from commit 6544b2532d)

Co-authored-by: Daniel Hahler <git@thequod.de>
2021-06-10 22:24:03 +01:00
Batuhan Taskaya
87f502231c
[3.9] bpo-11105: reduce the recursion limit for tests. (GH-26605)
(cherry picked from commit e58d762c1f)

Co-authored-by: Batuhan Taskaya <batuhan@python.org>
2021-06-08 20:39:47 +03:00
Miss Islington (bot)
b3c50b29e1
bpo-38323: Skip SubprocessMultiLoopWatcherTest as they can hang the test suite (GH-26542)
(cherry picked from commit f171877ebe)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-06-04 16:59:55 -07:00
Batuhan Taskaya
de58b319af
[3.9] bpo-11105: Do not crash when compiling recursive ASTs (GH-20594) (GH-26522)
When compiling an AST object with a direct / indirect reference
cycles, on the conversion phase because of exceeding amount of
calls, a segfault was raised. This patch adds recursion guards to
places for preventing user inputs to not to crash AST but instead
raise a RecursionError..
(cherry picked from commit f3491242e4)

Co-authored-by: Batuhan Taskaya <batuhan@python.org>
2021-06-03 22:22:34 +01:00
Gregory P. Smith
5a8ddcc452
[3.9] bpo-43776: Remove list call from args in Popen repr (GH-25338) (GH-26510)
Removes the `list` call in the Popen `repr`.

Current implementation:

For cmd = `python --version`,  with `shell=True`.

```bash
<Popen: returncode: None args: ['p', 'y', 't', 'h', 'o', 'n', ' ', '-', '-',...>
```

For `shell=False` and args=`['python', '--version']`, the output is correct:

```bash
<Popen: returncode: None args: ['python', '--version']>
```

With the new changes the `repr`  yields:

For cmd = `python --version`,  with `shell=True`:

```bash
<Popen: returncode: None args: 'python --version'>
```

For `shell=False` and args=`['python', '--version']`, the output:

```bash
<Popen: returncode: None args: ['python', '--version']>
```

Automerge-Triggered-By: GH:gpshead.
(cherry picked from commit db0c5b786d)

Co-authored-by: M. Kocher <michael.kocher@me.com>

Co-authored-by: M. Kocher <michael.kocher@me.com>
2021-06-02 21:15:26 -07:00
Miss Islington (bot)
5df4abd6b0
bpo-44022: Improve the regression test. (GH-26503)
It wasn't actually detecting the regression due to the
assertion being too lenient.
(cherry picked from commit e60ab843cb)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2021-06-02 21:10:22 -07:00
Miss Islington (bot)
b9258b03b8
bpo-36160: Fix test_site so that it can run independently of other tests (GH-12131) (GH-26263)
(cherry picked from commit 1270ad6ec8)

Co-authored-by: native-api <vano@mail.mipt.ru>
2021-05-20 11:41:43 +01:00
Miss Islington (bot)
c87b81dcb2
bpo-43295: Fix error handling of datetime.strptime format string '%z' (GH-24627) (#25695)
Previously, `datetime.strptime` would match `'z'` with the format string `'%z'` (for UTC offsets), throwing an `IndexError` by erroneously trying to parse `'z'` as a timestamp. As a special case, `'%z'` matches the string `'Z'` which is equivalent to the offset `'+00:00'`, however this behavior is not defined for lowercase `'z'`.

This change ensures a `ValueError` is thrown when encountering the original example, as follows:

```
>>> from datetime import datetime
>>> datetime.strptime('z', '%z')
ValueError: time data 'z' does not match format '%z'
```

Automerge-Triggered-By: GH:pganssle
(cherry picked from commit 04f6fbb696)

Co-authored-by: Noor Michael <nsmichael31@gmail.com>

Co-authored-by: Noor Michael <nsmichael31@gmail.com>
2021-05-19 20:37:49 -04:00
Pablo Galindo
d4a9264ab8
[3.9] bpo-44168: Fix error message in the parser for keyword arguments for invalid expressions (GH-26210) (GH-26250)
(cherry picked from commit 33c0c90dea)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-05-19 19:26:59 +01:00
Irit Katriel
c05d8a6b67
bpo-25872: Add unit tests for linecache and threading (GH-25913) (GH-26211)
(cherry picked from commit 115dea9e26)

Co-authored-by: uniocto <serit142sa33go@gmail.com>
2021-05-18 15:25:38 +01:00
Antoine Pitrou
b30b25b266
[3.9] bpo-37788: Fix reference leak when Thread is never joined (GH-26103) (GH-26142)
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
2021-05-15 02:51:20 -07:00
Miss Islington (bot)
133013e8a1
bpo-28146: Fix a confusing error message in str.format() (GH-24213)
Automerge-Triggered-By: GH:pitrou
(cherry picked from commit 4aeee0b47b)

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
2021-05-13 14:35:30 -07:00
Ken Jin
9b90ce6850
[3.9] Revert "[3.9] bpo-38908: Fix issue when non runtime_protocol does not raise TypeError (GH-26067)" (GH-26077)
Reverts python/cpython#26075

Automerge-Triggered-By: GH:gvanrossum
2021-05-12 10:44:14 -07:00
Ken Jin
88136bbd05
[3.9] bpo-38908: Fix issue when non runtime_protocol does not raise TypeError (GH-26067) (GH-26075)
(cherry picked from commit c40486a)

Co-authored-by: Yurii Karabas 1998uriyyo@gmail.com

Automerge-Triggered-By: GH:gvanrossum
2021-05-12 10:04:43 -07:00
Miss Islington (bot)
1be9396061
bpo-25479: add unit test for __subclasshook__ in test_abc.py (GH-24034) (GH-26063)
Co-authored-by: Szymon Trapp
(cherry picked from commit 5010c044c7)

Co-authored-by: Karl Dubost <karl+github@la-grange.net>
2021-05-12 14:45:18 +01:00
Steve Dower
0cb9775a85
bpo-44061: Fix pkgutil.iter_modules regression when passed a pathlib.Path object (GH-25964) (GH-26052)
Co-authored-by: Miguel Brito <5544985+miguendes@users.noreply.github.com>
2021-05-12 11:48:50 +02:00
Erlend Egeberg Aasland
6c190b5ae5
[3.9] bpo-28528: Fix pdb.checkline() attribute error when 'curframe' is None (GH-25438) (GH-26053)
Co-authored-by: Thomas Kluyver <takowl@gmail.com>
(cherry picked from commit 8563a7052c)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>

Automerge-Triggered-By: GH:iritkatriel
2021-05-12 02:04:10 -07:00
Steve Dower
23822e2c65
bpo-44070: No longer eagerly makes import filenames absolute, except for extension modules (GH-26025) 2021-05-10 23:45:50 +01:00
Miss Islington (bot)
b391b9b925
bpo-43972: Set content-length to 0 for http.server.SimpleHTTPRequestHandler 301s (GH-25705)
* 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>
2021-05-06 12:50:54 -07:00
Miss Islington (bot)
ea93270366
bpo-44022: Fix http client infinite line reading (DoS) after a HTTP 100 Continue (GH-25916)
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>
2021-05-05 16:05:52 -07:00
Miss Islington (bot)
df99532a05
bpo-40297: Fix test_socket.CANTest.testSendFrame (GH-19548)
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>
2021-05-04 14:03:48 -07:00
Miss Islington (bot)
e733e9951d
bpo-44018: random.seed() no longer mutates its inputs (GH-25856) (GH-25864) 2021-05-03 16:36:14 -07:00
Senthil Kumaran
8a595744e6
[3.9] bpo-43882 Remove the newline, and tab early. From query and fragments. (#25853)
* Remove the newline, and tab early. From query and fragments.
2021-05-03 12:08:59 -07:00
Miss Islington (bot)
5374fbc314
bpo-36384: Leading zeros in IPv4 addresses are no longer tolerated (GH-25099) (GH-25815)
Reverts commit e653d4d8e8 and makes
parsing even more strict. Like socket.inet_pton() any leading zero
is now treated as invalid input.

Signed-off-by: Christian Heimes <christian@python.org>

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 60ce8f0be6)
2021-05-02 15:49:03 +02:00
Miss Islington (bot)
491fde0161
[3.9] bpo-43882 - urllib.parse should sanitize urls containing ASCII newline and tabs. (GH-25595) (GH-25725)
* bpo-43882 - urllib.parse should sanitize urls containing ASCII newline and tabs. (GH-25595)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 76cd81d603)
Co-authored-by: Senthil Kumaran <skumaran@gatech.edu>
2021-04-29 10:57:31 -07:00
Miss Islington (bot)
629ef0fb9c
bpo-43961: Fix test_logging.test_namer_rotator_inheritance() (GH-25684) (GH-25688)
Fix test_logging.test_namer_rotator_inheritance() on Windows: use
os.replace() rather than os.rename().
(cherry picked from commit fe52eb6219)

Co-authored-by: Victor Stinner <vstinner@python.org>

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-04-28 17:28:15 +02:00
Irit Katriel
2dc6b1789e
bpo-43960: test_pdb resets breakpoints to make tests deterministic (GH-25691) 2021-04-28 17:21:11 +02:00
Miss Islington (bot)
d0698c676c
bpo-42924: Fix incorrect copy in bytearray_repeat (GH-24208) (#24211)
Before, using the * operator to repeat a bytearray would copy data from the start of
the internal buffer (ob_bytes) and not from the start of the actual data (ob_start).
(cherry picked from commit 61d8c54f43)

Co-authored-by: Tobias Holl <TobiasHoll@users.noreply.github.com>
2021-04-26 21:39:51 +02:00
Miss Islington (bot)
04bcfe001c
bpo-43607: Fix urllib handling of Windows paths with \\?\ prefix (GH-25539)
(cherry picked from commit 3513d55a61)

Co-authored-by: Steve Dower <steve.dower@python.org>
2021-04-23 10:28:05 -07:00
Christian Heimes
e259a77f21
[3.9] bpo-43920: Make load_verify_locations(cadata) error message consistent (GH-25554) (GH-25555)
Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit b9ad88be03)

Co-authored-by: Christian Heimes <christian@python.org>
2021-04-23 14:23:35 +02:00
Christian Heimes
cdf0287979
[3.9] bpo-43522: Fix SSLContext.hostname_checks_common_name (GH-24899) (GH-25451)
Fix problem with ssl.SSLContext.hostname_checks_common_name. OpenSSL does not
copy hostflags from *struct SSL_CTX* to *struct SSL*.

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit b467d9a240)

Co-authored-by: Christian Heimes <christian@python.org>
2021-04-17 11:35:24 +02:00
Victor Stinner
e1903e11a3
bpo-43842: Fix race condition in test_logging SMTP test (GH-25436) (GH-25437)
Fix a race condition in the SMTP test of test_logging. Don't close a
file descriptor (socket) from a different thread while
asyncore.loop() is polling the file descriptor.

(cherry picked from commit 75ec103b3a)
2021-04-16 16:06:38 +02:00
Ethan Furman
6379924ecd
[3.9] bpo-42248: [Enum] ensure exceptions raised in `_missing_` are released (GH-25350). (GH-25370)
(cherry picked from commit 8c14f5a787)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2021-04-12 15:03:29 -07:00
Miss Islington (bot)
0983e01837
bpo-41561: Fix testing with OpenSSL 1.0.2 (GH-25355)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 3447750073)

Co-authored-by: Christian Heimes <christian@python.org>
2021-04-12 03:24:48 -07:00
Miss Islington (bot)
6ec2fb42f9
bpo-42967: coerce bytes separator to string in urllib.parse_qs(l) (GH-24818)
* coerce bytes separator to string

* Add news

* Update Misc/NEWS.d/next/Library/2021-03-11-00-31-41.bpo-42967.2PeQRw.rst
(cherry picked from commit b38601d496)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-04-11 06:49:35 -07:00
Miss Islington (bot)
54d89a33e0
bpo-43794: OpenSSL 3.0.0: set OP_IGNORE_UNEXPECTED_EOF by default (GH-25309)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 6f37ebc61e)

Co-authored-by: Christian Heimes <christian@python.org>
2021-04-09 09:21:54 -07:00
Miss Islington (bot)
4a5c101936
bpo-4379: Skip TLS 1.0/1.1 tests under OpenSSL 3.0.0 (GH-25304)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 5151d64200)

Co-authored-by: Christian Heimes <christian@python.org>
2021-04-09 07:08:32 -07:00
Miss Islington (bot)
b3e8722853
Fix broken test for MutableSet.pop() (GH-25209) (GH-25269) 2021-04-07 16:56:48 -07:00
Steve Dower
0af99b44ed
bpo-43105: Importlib now resolves relative paths when creating module spec objects from file locations (GH-25121) 2021-04-07 12:35:36 +01:00
Miss Islington (bot)
8a34a0793b
bpo-43176: Fix processing of empty dataclasses (GH-24484) (GH-25205)
When a dataclass inherits from an empty base, all immutability checks are omitted. This PR fixes this and adds tests for it.

Automerge-Triggered-By: GH:ericvsmith
(cherry picked from commit 376ffc6ac4)

Co-authored-by: Iurii Kemaev <6885137+hbq1@users.noreply.github.com>

Co-authored-by: Iurii Kemaev <6885137+hbq1@users.noreply.github.com>
2021-04-06 09:46:30 -04:00
Miss Islington (bot)
013c30e5fc
bpo-36470: Allow dataclasses.replace() to handle InitVars with default values (GH-20867) (GH-25200)
Co-Authored-By: Claudiu Popa <pcmanticore@gmail.com>

Automerge-Triggered-By: GH:ericvsmith
(cherry picked from commit 75220674c0)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2021-04-05 16:07:38 -04:00
Gregory P. Smith
c7b0feca25
[3.9] bpo-43710: Rollback the 3.9 bpo-42500 fix, it broke the ABI in 3.9.3 (#25179)
This reverts commit 8b795ab554.

It changed the PyThreadState structure size, breaking the ABI in 3.9.3.
2021-04-04 13:02:29 +02:00
Irit Katriel
7ad56e2545
[3.9] bpo-26053: Fix args echoed by pdb run command (GH-25149)
* bpo-26053: Fix args echoed by pdb run command (GH-22033)

(cherry picked from commit 652bfdee94)

* bpo-26053: Fix test_pdb.test_issue26053() (GH-25139)

(cherry picked from commit bd4ab8e739)
2021-04-02 13:16:55 +02:00