Commit graph

109892 commits

Author SHA1 Message Date
Mark Shannon adcd220556
bpo-40222: "Zero cost" exception handling (GH-25729)
"Zero cost" exception handling.

* Uses a lookup table to determine how to handle exceptions.
* Removes SETUP_FINALLY and POP_TOP block instructions, eliminating (most of) the runtime overhead of try statements.
* Reduces the size of the frame object by about 60%.
2021-05-07 15:19:19 +01:00
Senthil Kumaran b32c8e9795
Simple Enhancement. Add missing return statements in ftplib documentation. (GH-25968) 2021-05-07 07:08:47 -07:00
Erlend Egeberg Aasland 0988ed09b4
bpo-44047: Remove unused argument to _pysqlite_seterror (GH-25915) 2021-05-07 16:15:01 +03:00
Julien Palard a0cb2e4302
Doc: What's new in Python 3.11 (GH-25963) 2021-05-07 10:06:45 +02:00
Inada Naoki 9ad8f109ac
bpo-44029: Remove Py_UNICODE APIs (GH-25881)
Remove deprecated `Py_UNICODE` APIs: `PyUnicode_Encode`,
`PyUnicode_EncodeUTF7`, `PyUnicode_EncodeUTF8`,
`PyUnicode_EncodeUTF16`, `PyUnicode_EncodeUTF32`,
`PyUnicode_EncodeLatin1`, `PyUnicode_EncodeMBCS`,
`PyUnicode_EncodeDecimal`, `PyUnicode_EncodeRawUnicodeEscape`,
`PyUnicode_EncodeCharmap`, `PyUnicode_EncodeUnicodeEscape`,
`PyUnicode_TransformDecimalToASCII`, `PyUnicode_TranslateCharmap`,
`PyUnicodeEncodeError_Create`, `PyUnicodeTranslateError_Create`.

See :pep:`393` and :pep:`624` for reference.
2021-05-07 15:58:29 +09:00
Inada Naoki 4ebf4a6bfa
bpo-40943: Fix skipitem() didn't raise SystemError (GH-25937)
`convertitem()` raises `SystemError` when '#' is used without `PY_SSIZE_T_CLEAN`.
This commit makes `skipitem()` raise it too.
2021-05-07 11:56:48 +09:00
Scott Noyes ee8e7c2fa9
Fix minor grammar problems in dataclasses documentation (GH-25948)
Some missing words; some odd word choices.
2021-05-06 17:52:46 -04:00
Tal Einat 92ceb1c840
docs: clearly document that ":#X" string formatting results in "0X..." (GH-25941)
* clearly document that ":#X" string formatting results in "0X..."

* put back the "serial comma"
2021-05-06 12:27:29 -07:00
Stephen Rosen fb42725561
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>
2021-05-06 12:25:52 -07:00
Linus Groh 329a47f052
bpo-44059: Register the SerenityOS Browser in the webbrowser module (GH-25947)
Automerge-Triggered-By: GH:gpshead
2021-05-06 12:01:12 -07:00
Raymond Hettinger 55b78ce3c4
Eliminate duplicated calculations and unnecessary work for linear regression (GH-25922) 2021-05-06 07:43:13 -07:00
Christian Heimes e8525567dd
bpo-38820: Test with OpenSSL 3.0.0-alpha16 (GH-25942)
Also use new make target to install FIPS provider.
2021-05-06 16:30:12 +02:00
Dong-hee Na 698e9a8211
bpo-44017: Update test_contextlib_async not to emit DeprecationWarn (GH-25918) 2021-05-06 23:10:52 +09:00
Senthil Kumaran 985ac01637
bpo-43882 Remove the newline, and tab early. From query and fragments. (GH-25921) 2021-05-05 15:50:05 -07:00
Gen Xu 47895e31b6
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>
2021-05-05 15:42:41 -07:00
Gregory P. Smith da5c808fb5
bpo-36515: Disable unaligned memory access in _sha3 on ARM (GH-25927)
Contributed-By: Matthias Klose

Automerge-Triggered-By: GH:tiran
2021-05-05 13:55:33 -07:00
Alfred Perlstein 565a31804c
bpo-35753: Fix crash in doctest with unwrap-able functions (#22981)
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.
2021-05-05 19:33:17 +02:00
Petr Viktorin cf86996a8e
bpo-43795: Mark PyCodec_Unregister as a function, not data, in stable ABI (GH-25920) 2021-05-05 19:32:21 +02:00
Dong-hee Na f4013eba41
typing: format patch with make patchcheck (GH-25919) 2021-05-06 02:08:20 +09:00
Kevin Follstad 96d5c7038b
bpo-44040: Update broken link in pathlib source (GH-25905) 2021-05-05 10:08:26 +02:00
Brad Larsen 23362f8c30
Eliminate duplicated assignment in _randommodule.c (GH-25904) 2021-05-04 20:41:11 -07:00
Raymond Hettinger 6fdc4d37f3
bpo-40521: Convert deque freelist from global vars to instance vars (GH-25906) 2021-05-04 17:08:31 -07:00
karl ding 355bae8882
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.
2021-05-04 15:37:13 -05:00
Jean-Abou-Samra 09490298d4
Clarify rx parameter of compileall functions (#25857) 2021-05-04 21:37:39 +02:00
Raymond Hettinger 1add719516
Fix inconsistent fsum vs sum and fmean vs mean (GH-25898) 2021-05-04 11:27:28 -07:00
Ikko Ashimine 9ee8448243
Fix typo in ast.py (GH-25740)
parantheses -> parentheses
2021-05-04 06:18:58 -07:00
Erlend Egeberg Aasland b451bc8d7e
bpo-42686: Enable SQLite math functions in Windows build (#24053) 2021-05-04 14:47:44 +02:00
Roberto Hueso a0b9915a8b
bpo-32822: Add finally with return/break/continue to the tutorial (#25600)
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.
2021-05-04 14:36:01 +02:00
krisaoe 33d9bf298b
Fix error in Enum documentation example code that was referring to the wrong enum. (#25837) 2021-05-04 14:34:14 +02:00
Ken Jin 2f5baa1750
Add C-API tests (#25886) 2021-05-04 13:07:31 +02:00
Jelle Zijlstra b115579734
bpo-38352: Add to typing.__all__ (#25821)
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>
2021-05-04 11:29:49 +02:00
Jelle Zijlstra f6d7abc6e7
Copyedits to 3.10 What's New (#25787)
Co-authored-by: Dominic Davis-Foster <dominic@davis-foster.co.uk>
2021-05-04 11:19:23 +02:00
Terry Jan Reedy 3b200b2aa6
bpo-44025: Clarify when '_' is a keyword. (#25873)
In match statements, in case patterns and nowhere else.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-05-04 11:00:29 +02:00
Raymond Hettinger 70a071d9e1
bpo-40465: Remove random module features deprecated in 3.9 (GH-25874) 2021-05-04 10:55:40 +02:00
Jelle Zijlstra 87109f4d85
bpo-44001: improve Literal documentation (GH-25877) 2021-05-04 10:54:12 +02:00
Michael Felt 5017cde20e
bpo-43666: Lib/_aix_support.py routines may fail in a WPAR environment (GH-25095)
Since WPAR and LPAR both have a builddate for teh fileset bos.rte
The name of the fileset checked is modified.
To prevent a similiar situation (no builddate in ODM) a value
sufficient for pep425 activity if retrieved buildate is zero or NULL
Patch by M Felt.
2021-05-04 10:36:50 +02:00
Jürgen Gmach d4222ea6b0
update docstring for win_getpass to reflect code changes (GH-24967)
The code was updated in
0ec88b33d0
but the docstring was left untouched.

=> updated the docstring to reflect the code changes
2021-05-03 23:48:29 -07:00
Jelle Zijlstra 6fee0835cb
fix enum.property reference in docs (GH-25875) 2021-05-03 20:19:46 -07:00
Ethan Furman 652bcd9f9c
fix enum and backslash warnings (GH-25861)
- Enum warning in test_faulthandler
- backslash warning in test_ipaddress
2021-05-03 18:44:30 -07:00
dependabot[bot] d783ce789d
build(deps): bump actions/cache from v2.1.4 to v2.1.5 (#25773)
Bumps [actions/cache](https://github.com/actions/cache) from v2.1.4 to v2.1.5.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.4...1a9e2138d905efd099035b49d8b7a3888c653ca8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-04 03:09:51 +02:00
dependabot[bot] e68e3b7e53
build(deps): bump actions/upload-artifact from v2.2.2 to v2.2.3 (#25772)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from v2.2.2 to v2.2.3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2.2.2...ee69f02b3dfdecd58bb31b4d133da38ba6fe3700)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-04 03:09:34 +02:00
Pablo Galindo 9142088e74
bpo-43822: Prioritize tokenizer errors over custom syntax errors when raising parser exceptions (GH-25866) 2021-05-04 01:32:46 +01:00
Pablo Galindo 0aaf13a714
Correct the version of the first alpha in the README.rst (GH-25862) 2021-05-04 00:28:47 +01:00
Raymond Hettinger b05352e4c2
bpo-44018: random.seed() no longer mutates its inputs (GH-25856) 2021-05-03 16:11:35 -07:00
Pablo Galindo 2fc857a572
Update CI files to account for the master -> main rename (GH-25860) 2021-05-03 23:36:55 +01:00
Pablo Galindo bb3e0c240b
Python 3.11.0a0 2021-05-03 21:25:35 +01:00
Shreyan Avigyan d3b9134ebb
Remove Enum warnings from test_httpservers (GH-25844) 2021-05-03 20:27:47 +01:00
Dennis Sweeney 80a2a4ed7d
bpo-38530: Refactor and improve AttributeError suggestions (GH-25776)
- Make case-swaps half the cost of any other edit
- Refactor Levenshtein code to not use memory allocator, and to bail early on no match.
- Add comments to Levenshtein distance code
- Add test cases for Levenshtein distance behind a debug macro
- Set threshold to `(name_size + item_size + 3) * MOVE_COST / 6`.
  - Reasoning: similar to `difflib.SequenceMatcher.ratio()` >= 2/3:
```
"Multiset Jaccard similarity" >= 2/3
matching letters / total letters >= 2/3
(name_size - distance + item_size - distance) / (name_size + item_size) >= 2/3
1 - (2*distance) / (name_size + item_size) >= 2/3
1/3 >= (2*distance) / (name_size + item_size)
(name_size + item_size) / 6 >= distance
With rounding:
(name_size + item_size + 3) // 6 >= distance
```

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-05-03 16:47:27 +01:00
Christian Heimes c715b52421
bpo-43943: ssl tests: Increase server socket timeout, backlog, debugging (GH-25850)
Signed-off-by: Christian Heimes <christian@python.org>
2021-05-03 17:45:02 +02:00
Pablo Galindo 7719953b30
bpo-44011: Revert "New asyncio ssl implementation (GH-17975)" (GH-25848)
This reverts commit 5fb06edbbb and all
subsequent dependent commits.
2021-05-03 16:21:59 +01:00