]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
4 years agobpo-42904: Change search order of typing.get_type_hints eval (#25632)
Ken Jin [Mon, 26 Apr 2021 17:31:21 +0000 (01:31 +0800)] 
bpo-42904: Change search order of typing.get_type_hints eval (#25632)

While surprising (searching globals before locals in one specific case), this is needed for backwards compatibility.

4 years agoAdd additional keyword-only tests. (GH-25633)
Eric V. Smith [Mon, 26 Apr 2021 17:14:28 +0000 (13:14 -0400)] 
Add additional keyword-only tests. (GH-25633)

4 years agoDoc: Fix the array.fromfile method doc (GH-22037)
Adorilson Bezerra [Mon, 26 Apr 2021 14:19:21 +0000 (11:19 -0300)] 
Doc: Fix the array.fromfile method doc (GH-22037)

The check about the f argument type was removed in this commit:
https://github.com/python/cpython/commit/2c94aa567e525c82041ad68a3174d8c3acbf37e2

Thanks for Pedro Arthur Duarte (pedroarthur.jedi at gmail.com) by the help with
this bug.

4 years agobpo-43466: Link with libz in PY_UNSUPPORTED_OPENSSL_BUILD path (GH-25587)
Christian Heimes [Mon, 26 Apr 2021 13:13:34 +0000 (15:13 +0200)] 
bpo-43466: Link with libz in PY_UNSUPPORTED_OPENSSL_BUILD path (GH-25587)

Some OpenSSL build flavors need libz for compression support.

4 years agobpo-18233: Add internal methods to access peer chain (GH-25467)
Christian Heimes [Mon, 26 Apr 2021 13:01:40 +0000 (15:01 +0200)] 
bpo-18233: Add internal methods to access peer chain (GH-25467)

The internal `_ssl._SSLSocket` object now provides methods to retrieve
the peer cert chain and verified cert chain as a list of Certificate
objects. Certificate objects have methods to convert the cert to a dict,
PEM, or DER (ASN.1).

These are private APIs for now. There is a slim chance to stabilize the
approach and provide a public API for 3.10. Otherwise I'll provide a
stable API in 3.11.

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-38820: Old OpenSSL 3.0.0 releases are in /old/3.0/ (GH-25624)
Christian Heimes [Mon, 26 Apr 2021 08:54:12 +0000 (10:54 +0200)] 
bpo-38820: Old OpenSSL 3.0.0 releases are in /old/3.0/ (GH-25624)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agoUpdate asyncio-subprocess.rst (GH-21680)
Gabriel R F [Mon, 26 Apr 2021 04:38:16 +0000 (01:38 -0300)] 
Update asyncio-subprocess.rst (GH-21680)

4 years agodocumentation: clarification about the function remove in os library (GH-19024)
Etienne Gautier [Mon, 26 Apr 2021 04:21:50 +0000 (06:21 +0200)] 
documentation: clarification about the function remove in os library (GH-19024)

4 years agoFix documentation typos of argparse exit_on_error (GH-22706)
Taneli Hukkinen [Mon, 26 Apr 2021 04:04:26 +0000 (06:04 +0200)] 
Fix documentation typos of argparse exit_on_error (GH-22706)

4 years agoQuick pydoc update to smtplib.py (GH-22292)
uy-rrodriguez [Mon, 26 Apr 2021 01:56:37 +0000 (02:56 +0100)] 
Quick pydoc update to smtplib.py (GH-22292)

Fixing minor mistake in the quotes around a couple of arguments for the constructor of the class `SMTP`, in smtplib.py.

4 years agoFix id of 'Internet Message Format' RFC in email doc (GH-24137)
Denis Laxalde [Mon, 26 Apr 2021 01:38:12 +0000 (03:38 +0200)] 
Fix id of 'Internet Message Format' RFC in email doc (GH-24137)

Previous ID (5233) refers to "Sieve Email Filtering: Subaddress
Extension". It seems that the actual reference should be "Internet
Message Format" RFC 5322 (https://tools.ietf.org/html/rfc5322).

(The typo probably comes from commit 29d1bc0842 in which the ID of
this RFC got updated from the obsolete 2822.)

Co-authored-by: Ambrose Chua <ambrose@hey.com>
4 years agoFix copy.Error casing in documentation GH-22004
Andre Delfino [Mon, 26 Apr 2021 01:22:28 +0000 (22:22 -0300)] 
Fix copy.Error casing in documentation GH-22004

4 years agoFix broken links and improve stand-alone tools list in FAQ GH-22124
Andre Delfino [Mon, 26 Apr 2021 01:10:05 +0000 (22:10 -0300)] 
Fix broken links and improve stand-alone tools list in FAQ GH-22124

4 years agoAdd keyword-only fields to dataclasses. (GH=25608)
Eric V. Smith [Mon, 26 Apr 2021 00:42:39 +0000 (20:42 -0400)] 
Add keyword-only fields to dataclasses. (GH=25608)

4 years agoRemove mention of dst parameter from description of os.lstat() (GH-24704)
Sergey Fedoseev [Sun, 25 Apr 2021 21:24:41 +0000 (02:24 +0500)] 
Remove mention of dst parameter from description of os.lstat() (GH-24704)

It looks like it was accidentally copy-pasted in
6fa7aada9bd3616e0beeb266e818497b2ec1c859.

4 years agoFix a typo in datamodel reference document (GH-24930)
Géry Ogam [Sun, 25 Apr 2021 21:13:19 +0000 (23:13 +0200)] 
Fix a typo in datamodel reference document (GH-24930)

4 years agobpo-38605: Update __future__ module doc as `annotations` is now "mandatory in 3.11...
Saiyang Gou [Sun, 25 Apr 2021 19:49:26 +0000 (12:49 -0700)] 
bpo-38605: Update __future__ module doc as `annotations` is now "mandatory in 3.11" (GH-25602)

4 years agofix typo in warning (#20620)
Allen [Sun, 25 Apr 2021 17:45:05 +0000 (13:45 -0400)] 
fix typo in warning (#20620)

* Add space after period to warning in _tzpath.py

Currently:
InvalidTZPathWarning: Invalid paths specified in PYTHONTZPATH environment variable.Paths should be absolute but found the following relative paths: ...

* Update _tzpath.py

4 years agoBaseHTTPRequestHandler, that path includes query (#25597)
Senthil Kumaran [Sun, 25 Apr 2021 17:08:29 +0000 (10:08 -0700)] 
BaseHTTPRequestHandler, that path includes query (#25597)

* Clarify, for BaseHTTPRequestHandler, that path includes query

Co-authored-by: David Jones <drj@pobox.com>
4 years agoSet the release for `__future__.annotations` to 3.11 (#25596)
Anthony Sottile [Sun, 25 Apr 2021 16:09:24 +0000 (09:09 -0700)] 
Set the release for `__future__.annotations` to 3.11 (#25596)

4 years agobpo-43534: Fix the turtle module working with multiple root windows (GH-25591)
Serhiy Storchaka [Sun, 25 Apr 2021 14:49:32 +0000 (17:49 +0300)] 
bpo-43534: Fix the turtle module working with multiple root windows (GH-25591)

4 years agobpo-38490: statistics: Add covariance, Pearson's correlation, and simple linear regre...
Tymoteusz Wołodźko [Sun, 25 Apr 2021 11:45:09 +0000 (13:45 +0200)] 
bpo-38490: statistics: Add covariance, Pearson's correlation, and simple linear regression (#16813)

Co-authored-by: Tymoteusz Wołodźko <twolodzko+gitkraken@gmail.com
4 years agobpo-39529: Deprecate creating new event loop in asyncio.get_event_loop() (GH-23554)
Serhiy Storchaka [Sun, 25 Apr 2021 10:40:44 +0000 (13:40 +0300)] 
bpo-39529: Deprecate creating new event loop in asyncio.get_event_loop() (GH-23554)

asyncio.get_event_loop() emits now a deprecation warning when it creates a new event loop.
In future releases it will became an alias of asyncio.get_running_loop().

4 years agobpo-42609: Check recursion depth in the AST validator and optimizer (GH-23744)
Serhiy Storchaka [Sun, 25 Apr 2021 10:38:00 +0000 (13:38 +0300)] 
bpo-42609: Check recursion depth in the AST validator and optimizer (GH-23744)

4 years agobpo-43534: Make dialogs in turtle.textinput() and turtle.numinput() transitient again...
Serhiy Storchaka [Sun, 25 Apr 2021 10:16:49 +0000 (13:16 +0300)] 
bpo-43534: Make dialogs in turtle.textinput() and turtle.numinput() transitient again (GH-24923)

4 years agobpo-43655: Tkinter and IDLE dialog windows are now recognized as dialogs by window...
Serhiy Storchaka [Sun, 25 Apr 2021 10:07:58 +0000 (13:07 +0300)] 
bpo-43655: Tkinter and IDLE dialog windows are now recognized as dialogs by window managers on macOS and X Window (#25187)

4 years agobpo-42737: annotations with complex targets no longer causes any runtime effects...
Batuhan Taskaya [Sun, 25 Apr 2021 02:31:20 +0000 (05:31 +0300)] 
bpo-42737: annotations with complex targets no longer causes any runtime effects (GH-23952)

4 years agobpo-43930: Update bundled pip to 21.1 and setuptools to 56.0.0 (GH-25576)
Stéphane Bidoul [Sat, 24 Apr 2021 16:21:50 +0000 (18:21 +0200)] 
bpo-43930: Update bundled pip to 21.1 and setuptools to 56.0.0 (GH-25576)

Update bundled pip to 21.1 and setuptools to 56.0.0

4 years agobpo-43780: Sync with importlib_metadata 3.10 (GH-25297)
Jason R. Coombs [Sat, 24 Apr 2021 14:13:51 +0000 (10:13 -0400)] 
bpo-43780: Sync with importlib_metadata 3.10 (GH-25297)

* bpo-43780: Sync with importlib_metadata 3.10.

* Add blurb

* Apply changes from importlib_metadata 3.10.1.

4 years agobpo-43921: also accept EOF in post-handshake auth test (GH-25574)
Christian Heimes [Sat, 24 Apr 2021 13:08:13 +0000 (15:08 +0200)] 
bpo-43921: also accept EOF in post-handshake auth test (GH-25574)

4 years agobpo-41282: Consistent message and filter warning in setup.py (GH-25571)
Christian Heimes [Sat, 24 Apr 2021 07:55:15 +0000 (09:55 +0200)] 
bpo-41282: Consistent message and filter warning in setup.py (GH-25571)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-37322: Fix ResourceWarning and exception handling in test (GH-25553)
Christian Heimes [Sat, 24 Apr 2021 07:17:54 +0000 (09:17 +0200)] 
bpo-37322: Fix ResourceWarning and exception handling in test (GH-25553)

Revert 73ea546, increase logging, and improve stability of test.

Handle all OSErrors in a single block. OSError also takes care of
SSLError and socket's connection errors.

Partly reverts commit fb7e750. The
threaded connection handler must not raise an unhandled exception.

4 years agobpo-31870: Fix test_get_server_certificate_timeout on Windows (GH-25570)
Christian Heimes [Sat, 24 Apr 2021 05:54:08 +0000 (07:54 +0200)] 
bpo-31870: Fix test_get_server_certificate_timeout on Windows (GH-25570)

Some OS do not support millisecond granularity in select(). Use 100ms
timeout and a server callback with sleep to emulate a slow server.

4 years agobpo-31870: Add a timeout parameter to ssl.get_server_certificate() (GH-22270)
Zackery Spytz [Sat, 24 Apr 2021 04:46:01 +0000 (22:46 -0600)] 
bpo-31870: Add a timeout parameter to ssl.get_server_certificate() (GH-22270)

4 years agobpo-38659: [Enum] do not check '_inverted_' during simple test (GH-25566)
Ethan Furman [Sat, 24 Apr 2021 02:08:22 +0000 (19:08 -0700)] 
bpo-38659: [Enum] do not check '_inverted_' during simple test (GH-25566)

Depending on usage, it's possible for Flag members to have the _inverted_ attribute when they are testing, while the Flag being testing against will not have that attribute on its members -- so skip that comparison.

4 years agoRestrict GITHUB_TOKEN permissions for the 'stale' workflow (GH-25564)
Brett Cannon [Fri, 23 Apr 2021 22:18:50 +0000 (15:18 -0700)] 
Restrict GITHUB_TOKEN permissions for the 'stale' workflow (GH-25564)

It should only need write-level permissions to pull requests.

4 years agobpo-30555: Fix WindowsConsoleIO fails in the presence of fd redirection (GH-1927)
Segev Finer [Fri, 23 Apr 2021 22:00:27 +0000 (01:00 +0300)] 
bpo-30555: Fix WindowsConsoleIO fails in the presence of fd redirection (GH-1927)

This works by not caching the handle and instead getting the handle from
the file descriptor each time, so that if the actual handle changes by
fd redirection closing/opening the console handle beneath our feet, we
will keep working correctly.

4 years agobop-43652: Update Tcl and Tk to 8.6.11 in Windows installer (GH-25170)
Terry Jan Reedy [Fri, 23 Apr 2021 21:40:42 +0000 (17:40 -0400)] 
bop-43652: Update Tcl and Tk to 8.6.11 in Windows installer (GH-25170)

4 years agoSilence find_module() DeprecationWarning on Windows tests (GH-25563)
Brett Cannon [Fri, 23 Apr 2021 21:40:18 +0000 (14:40 -0700)] 
Silence find_module() DeprecationWarning on Windows tests (GH-25563)

4 years agobpo-43907: add missing memoize call in pure python pickling of bytearray (GH-25501)
Carl Friedrich Bolz-Tereick [Fri, 23 Apr 2021 21:27:14 +0000 (23:27 +0200)] 
bpo-43907: add missing memoize call in pure python pickling of bytearray (GH-25501)

4 years agobpo-39950: add `pathlib.Path.hardlink_to()` method that supersedes `link_to()` (GH...
Barney Gale [Fri, 23 Apr 2021 20:48:52 +0000 (21:48 +0100)] 
bpo-39950: add `pathlib.Path.hardlink_to()` method that supersedes `link_to()` (GH-18909)

The argument order of `link_to()` is reversed compared to what one may expect, so:

    a.link_to(b)

Might be expected to create *a* as a link to *b*, in fact it creates *b* as a link to *a*, making it function more like a "link from". This doesn't match `symlink_to()` nor the documentation and doesn't seem to be the original author's intent.

This PR deprecates `link_to()` and introduces `hardlink_to()`, which has the same argument order as `symlink_to()`.

4 years agobpo-43921: ignore failing test_wrong_cert_tls13 on Windows (GH-25561)
Christian Heimes [Fri, 23 Apr 2021 18:03:25 +0000 (20:03 +0200)] 
bpo-43921: ignore failing test_wrong_cert_tls13 on Windows (GH-25561)

test_wrong_cert_tls13 sometimes fails on some Windows buildbots. Turn
failing test case into skipped test case until we have more time to
investigate.

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-43538: Add extra arguments to os.startfile (GH-25538)
Steve Dower [Fri, 23 Apr 2021 17:03:17 +0000 (18:03 +0100)] 
bpo-43538: Add extra arguments to os.startfile (GH-25538)

4 years agobpo-43607: Fix urllib handling of Windows paths with \\?\ prefix (GH-25539)
Steve Dower [Fri, 23 Apr 2021 17:02:47 +0000 (18:02 +0100)] 
bpo-43607: Fix urllib handling of Windows paths with \\?\ prefix (GH-25539)

4 years agobpo-35114: Make ssl.RAND_status() return a bool (GH-20063)
Zackery Spytz [Fri, 23 Apr 2021 16:07:37 +0000 (10:07 -0600)] 
bpo-35114: Make ssl.RAND_status() return a bool (GH-20063)

4 years agobpo-43914: Highlight invalid ranges in SyntaxErrors (#25525)
Pablo Galindo [Fri, 23 Apr 2021 13:27:05 +0000 (14:27 +0100)] 
bpo-43914: Highlight invalid ranges in SyntaxErrors (#25525)

To improve the user experience understanding what part of the error messages associated with SyntaxErrors is wrong, we can highlight the whole error range and not only place the caret at the first character. In this way:

>>> foo(x, z for z in range(10), t, w)
  File "<stdin>", line 1
    foo(x, z for z in range(10), t, w)
           ^
SyntaxError: Generator expression must be parenthesized

becomes

>>> foo(x, z for z in range(10), t, w)
  File "<stdin>", line 1
    foo(x, z for z in range(10), t, w)
           ^^^^^^^^^^^^^^^^^^^^
SyntaxError: Generator expression must be parenthesized

4 years agobpo-43868: Remove PyOS_ReadlineFunctionPointer from the stable ABI list (GH-25442)
Petr Viktorin [Fri, 23 Apr 2021 12:23:38 +0000 (14:23 +0200)] 
bpo-43868: Remove PyOS_ReadlineFunctionPointer from the stable ABI list (GH-25442)

The inclusion of PyOS_ReadlineFunctionPointer in python3dll.c was a mistake.

According to PEP 384:
> functions expecting FILE* are not part of the ABI, to avoid depending
> on a specific version of the Microsoft C runtime DLL on Windows.

https://bugs.python.org/issue43868

4 years agobpo-38820: Test with OpenSSL 3.0.0-alpha15 (GH-25537)
Christian Heimes [Fri, 23 Apr 2021 12:19:21 +0000 (14:19 +0200)] 
bpo-38820: Test with OpenSSL 3.0.0-alpha15 (GH-25537)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-43795: PEP-652: Clean up the stable ABI/limited API (GH-25482)
Petr Viktorin [Fri, 23 Apr 2021 12:17:58 +0000 (14:17 +0200)] 
bpo-43795: PEP-652: Clean up the stable ABI/limited API (GH-25482)

- `_Py_EncodeLocaleRaw`, which is private by name, undocumented,
  and wasn't exported in `python3.dll`, is moved to a private header.
- `_Py_HashSecret_Initialized`, again private by name, undocumented,
  and not exported in `python3.dll`, is excluded with `Py_LIMITED_API`.
- `PyMarshal_*` and `PyMember_*One` functions, declared in private headers and
  not exported in `python3.dll`, are removed from `Doc/data/stable_abi.dat`.
- `PyMem_Calloc` which *was* exported in `python3dll.c`, is moved to public
  headers where it joins its other `PyMem_*` friends.

Only the last change is documented in the blurb; others are not user-visible.
(Nothing uses `Doc/data/stable_abi.dat` yet.)

https://bugs.python.org/issue43795

4 years agobpo-43795: PEP-652: Simplify headers for easier static analysis (GH-25483)
Petr Viktorin [Fri, 23 Apr 2021 12:14:00 +0000 (14:14 +0200)] 
bpo-43795: PEP-652: Simplify headers for easier static analysis (GH-25483)

As part of the PEP-652 implementation, I'll tighten the CI check
for functions/data defined with `Py_LIMITED_API`.

Discussion in https://discuss.python.org/t/pep-652-maintaining-the-stable-abi/6986
suggests that parsing C headers is OK (though personally I'd rather generate it...),
but writing a full C parser is a monumental task and adding an existing one as a
dependency brings too many vendoring/bootstraping issues.

So, for the check I'll use a "simple" regex on preprocessor output, and adapt
the few trivial places where the regex won't work.

- Keep declarations in the limited API to one item per line
- Make it possible to override `_Py_NO_RETURN`, so the annotation can be
  removed from preprocessor output.

https://bugs.python.org/issue43795

4 years agobpo-41282: (PEP 632) Deprecate distutils.sysconfig (partial implementation of the...
Lumír 'Frenzy' Balhar [Fri, 23 Apr 2021 12:02:41 +0000 (14:02 +0200)] 
bpo-41282: (PEP 632) Deprecate distutils.sysconfig (partial implementation of the PEP) (GH-23142)

This change:
* merges `distutils.sysconfig` into `sysconfig` while keeping the original functionality and
* marks `distutils.sysconfig` as deprecated

https://bugs.python.org/issue41282

4 years agobpo-43920: Make load_verify_locations(cadata) error message consistent (GH-25554)
Christian Heimes [Fri, 23 Apr 2021 11:51:40 +0000 (13:51 +0200)] 
bpo-43920: Make load_verify_locations(cadata) error message consistent (GH-25554)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-43852: Improve tuple creation in sqlite3 (GH-25421)
Erlend Egeberg Aasland [Fri, 23 Apr 2021 11:21:08 +0000 (13:21 +0200)] 
bpo-43852: Improve tuple creation in sqlite3 (GH-25421)

4 years agobpo-37363: Add audit events to the `http.client` module (GH-21321)
Saiyang Gou [Fri, 23 Apr 2021 10:19:08 +0000 (03:19 -0700)] 
bpo-37363: Add audit events to the `http.client` module (GH-21321)

Add audit events to the `http.client` module

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
4 years agobpo-37751: Document codecs.lookup() change in What's New in Python 3.9 (GH-23096)
Hai Shi [Fri, 23 Apr 2021 09:10:43 +0000 (17:10 +0800)] 
bpo-37751: Document codecs.lookup() change in What's New in Python 3.9 (GH-23096)

4 years agoAdd more tests. Fix code excerpt. (GH-25549)
Raymond Hettinger [Fri, 23 Apr 2021 03:02:46 +0000 (20:02 -0700)] 
Add more tests.  Fix code excerpt. (GH-25549)

4 years agoReformat idlelib colorizer (GH-25479)
E-Paine [Fri, 23 Apr 2021 01:21:53 +0000 (02:21 +0100)] 
Reformat idlelib colorizer (GH-25479)

Also replace if-then and and-or with conditional expressions.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
4 years agobpo-43917: Fix pure python equivalent for classmethod (GH-25544)
Raymond Hettinger [Fri, 23 Apr 2021 00:53:36 +0000 (17:53 -0700)] 
bpo-43917: Fix pure python equivalent for classmethod (GH-25544)

Reported by Yahor Harunovich.

4 years agobpo-39572: Address typo in CHANGELOG. (GH-24999)
Simon Charette [Fri, 23 Apr 2021 00:35:11 +0000 (20:35 -0400)] 
bpo-39572: Address typo in CHANGELOG. (GH-24999)

4 years agobpo-38222: Check specifically for a drive, not just a colon (GH-25540)
Steve Dower [Thu, 22 Apr 2021 23:30:37 +0000 (00:30 +0100)] 
bpo-38222: Check specifically for a drive, not just a colon (GH-25540)

4 years agobpo-35306: Avoid raising OSError from pathlib.Path.exists when passed an invalid...
Steve Dower [Thu, 22 Apr 2021 20:04:44 +0000 (21:04 +0100)] 
bpo-35306: Avoid raising OSError from pathlib.Path.exists when passed an invalid filename (GH-25529)

4 years agobpo-43915: Add PCbuild/blurb.bat to simplify Windows contributors (GH-25528)
Steve Dower [Thu, 22 Apr 2021 19:45:47 +0000 (20:45 +0100)] 
bpo-43915: Add PCbuild/blurb.bat to simplify Windows contributors (GH-25528)

4 years agobpo-38822: Fixed os.stat failing on inaccessible directories. (GH-25527)
Steve Dower [Thu, 22 Apr 2021 19:45:02 +0000 (20:45 +0100)] 
bpo-38822: Fixed os.stat failing on inaccessible directories. (GH-25527)

It would just fail if the path was inaccessible and had a trailing slash. It should fall back to the parent directory's metadata.

4 years agobpo-43284: Update platform.win32_ver to use _syscmd_ver instead of sys.getwindowsvers...
Shreyan Avigyan [Thu, 22 Apr 2021 16:43:37 +0000 (22:13 +0530)] 
bpo-43284: Update platform.win32_ver to use _syscmd_ver instead of sys.getwindowsversion() (GH-25500)

The sys module uses the kernel32.dll version number, which can vary from the "actual" Windows version.
Since the best option for getting the version is WMI (which is expensive), we switch back to launching cmd.exe (which is also expensive, but a lot less code on our part).
sys.getwindowsversion() is not updated to avoid launching executables from that module.

4 years agobpo-43475: Fix worst case collision behavior for NaN instances (GH-25493)
Raymond Hettinger [Thu, 22 Apr 2021 15:34:57 +0000 (08:34 -0700)] 
bpo-43475:  Fix worst case collision behavior for NaN instances (GH-25493)

4 years agoFix typo in the documentation (GH-24703)
Alperen Serkan Aksöz [Thu, 22 Apr 2021 14:36:05 +0000 (17:36 +0300)] 
Fix typo in the documentation (GH-24703)

Missing multiply symbol added

Automerge-Triggered-By: GH:merwok
4 years agobpo-28724: Doc: Move socket.send_fds and socket.recv_fds docs to right section (GH...
Saiyang Gou [Thu, 22 Apr 2021 04:08:46 +0000 (21:08 -0700)] 
bpo-28724: Doc: Move socket.send_fds and socket.recv_fds docs to right section (GH-22608)

4 years agobpo-38659: Properly re-intialize module variables in test_enum (GH-25516)
Ammar Askar [Thu, 22 Apr 2021 03:22:58 +0000 (23:22 -0400)] 
bpo-38659: Properly re-intialize module variables in test_enum (GH-25516)

Previously TestIntEnumConvert and TestStrEnumConvert would end up
converting the module level variables from their regular int form
to a `test.test_enum.X` instance after _convert would run. This
meant that after a single test ran, the next set of _convert
functions would be operating on the enum instances rather than
ints. This would cause some tests such as the one involving format
to fail when running under a mode that repeatedly runs test such
as the refleak finder.

4 years agobpo-26227: Fixes decoding of host names on Windows from ANSI instead of UTF-8 (GH...
Steve Dower [Wed, 21 Apr 2021 23:18:20 +0000 (00:18 +0100)] 
bpo-26227: Fixes decoding of host names on Windows from ANSI instead of UTF-8 (GH-25510)

4 years agobpo-40137: Add pycore_moduleobject.h internal header (GH-25507)
Victor Stinner [Wed, 21 Apr 2021 22:52:52 +0000 (00:52 +0200)] 
bpo-40137: Add pycore_moduleobject.h internal header (GH-25507)

Add pycore_moduleobject.h internal header file with static inline
functions to access module members:

* _PyModule_GetDict()
* _PyModule_GetDef()
* _PyModule_GetState()

These functions don't check at runtime if their argument has a valid
type and can be inlined even if Python is not built with LTO.

_PyType_GetModuleByDef() uses _PyModule_GetDef().

Replace PyModule_GetState() with _PyModule_GetState() in the
extension modules, considered as performance sensitive:

* _abc
* _functools
* _operator
* _pickle
* _queue
* _random
* _sre
* _struct
* _thread
* _winapi
* array
* posix

The following extensions are now built with the Py_BUILD_CORE_MODULE
macro defined, to be able to use the internal pycore_moduleobject.h
header: _abc, array, _operator, _queue, _sre, _struct.

4 years agobpo-43756: Add new audit event for new arguments added to glob.glob (GH-25239)
Saiyang Gou [Wed, 21 Apr 2021 22:42:55 +0000 (15:42 -0700)] 
bpo-43756: Add new audit event for new arguments added to glob.glob (GH-25239)

4 years agobpo-43472: Ensure PyInterpreterState_New audit events are raised when called through...
Steve Dower [Wed, 21 Apr 2021 22:34:29 +0000 (23:34 +0100)] 
bpo-43472: Ensure PyInterpreterState_New audit events are raised when called through _xxsubinterpreters module (GH-25506)

4 years agobpo-40137: Move state lookups out of the critical path (GH-25492)
Raymond Hettinger [Wed, 21 Apr 2021 22:22:22 +0000 (15:22 -0700)] 
bpo-40137: Move state lookups out of the critical path (GH-25492)

4 years agobpo-40137: Optimize _PyType_GetModuleByDef() loop (GH-25505)
Victor Stinner [Wed, 21 Apr 2021 22:10:16 +0000 (00:10 +0200)] 
bpo-40137: Optimize _PyType_GetModuleByDef() loop (GH-25505)

PyType_Ready() now ensures that a type MRO cannot be empty.

_PyType_GetModuleByDef() no longer checks "i < PyTuple_GET_SIZE(mro)"
at the first loop iteration to optimize the most common case, when
the argument is the defining class.

4 years agobpo-40137: _PyType_GetModuleByDef() doesn't check tp_flags (GH-25504)
Victor Stinner [Wed, 21 Apr 2021 21:36:26 +0000 (23:36 +0200)] 
bpo-40137: _PyType_GetModuleByDef() doesn't check tp_flags (GH-25504)

_PyType_GetModuleByDef() no longer checks if types are heap types.

_PyType_GetModuleByDef() must only be called on a heap type created
by PyType_FromModuleAndSpec() or on its subclasses.
type_ready_mro() ensures that a static type cannot inherit from a
heap type.

4 years agodoc: Sync some missing 3.10 changes with the What's New (GH-25503)
Batuhan Taskaya [Wed, 21 Apr 2021 20:44:27 +0000 (23:44 +0300)] 
doc: Sync some missing 3.10 changes with the What's New (GH-25503)

Automerge-Triggered-By: GH:isidentical
4 years agoFix typo in whatsnew/3.10.rst (GH-25498)
JunWei Song [Wed, 21 Apr 2021 17:34:05 +0000 (01:34 +0800)] 
Fix typo in whatsnew/3.10.rst (GH-25498)

4 years agobpo-38659: [Enum] add _simple_enum decorator (GH-25497)
Ethan Furman [Wed, 21 Apr 2021 17:20:44 +0000 (10:20 -0700)] 
bpo-38659: [Enum] add _simple_enum decorator (GH-25497)

add:

* `_simple_enum` decorator to transform a normal class into an enum
* `_test_simple_enum` function to compare
* `_old_convert_` to enable checking `_convert_` generated enums

`_simple_enum` takes a normal class and converts it into an enum:

    @simple_enum(Enum)
    class Color:
        RED = 1
        GREEN = 2
        BLUE = 3

`_old_convert_` works much like` _convert_` does, using the original logic:

    # in a test file
    import socket, enum
    CheckedAddressFamily = enum._old_convert_(
            enum.IntEnum, 'AddressFamily', 'socket',
            lambda C: C.isupper() and C.startswith('AF_'),
            source=_socket,
            )

`_test_simple_enum` takes a traditional enum and a simple enum and
compares the two:

    # in the REPL or the same module as Color
    class CheckedColor(Enum):
        RED = 1
        GREEN = 2
        BLUE = 3

    _test_simple_enum(CheckedColor, Color)

    _test_simple_enum(CheckedAddressFamily, socket.AddressFamily)

Any important differences will raise a TypeError

4 years agobpo-43859: Improve the error message for IndentationError exceptions (GH-25431)
Pablo Galindo [Wed, 21 Apr 2021 14:28:21 +0000 (15:28 +0100)] 
bpo-43859: Improve the error message for IndentationError exceptions (GH-25431)

4 years agobpo-38605: Revert making 'from __future__ import annotations' the default (GH-25490)
Pablo Galindo [Wed, 21 Apr 2021 11:41:19 +0000 (12:41 +0100)] 
bpo-38605: Revert making 'from __future__ import annotations' the default (GH-25490)

This reverts commits 044a1048ca93d466965afc027b91a5a9eb9ce23c and 1be456ae9d53bb1cba2b24fc86175c282d1c2169, adapting the code to changes that happened after it.

4 years agoUpdate Sphinx directive for super from function to class (GH-25489)
Géry Ogam [Tue, 20 Apr 2021 18:58:02 +0000 (20:58 +0200)] 
Update Sphinx directive for super from function to class (GH-25489)

4 years agobpo-43888: Reduce coverage collection timeout to 1h40m in GHA (GH-25471)
Sviatoslav Sydorenko [Tue, 20 Apr 2021 17:22:26 +0000 (19:22 +0200)] 
bpo-43888: Reduce coverage collection timeout to 1h40m in GHA (GH-25471)

Ref:

Signed-off-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
4 years agodocs: clarify what patterns Path.glob accepts (GH-25486)
Ned Batchelder [Tue, 20 Apr 2021 16:45:45 +0000 (12:45 -0400)] 
docs: clarify what patterns Path.glob accepts (GH-25486)

Automerge-Triggered-By: GH:Yhg1s
4 years agobpo-43799: Also define SSLv3_method() (GH-25481)
Christian Heimes [Tue, 20 Apr 2021 16:10:10 +0000 (18:10 +0200)] 
bpo-43799: Also define SSLv3_method() (GH-25481)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agoDocument that random.gauss is normal distribution (GH-24935)
Joonas Paalasmaa [Tue, 20 Apr 2021 14:33:54 +0000 (17:33 +0300)] 
Document that random.gauss is normal distribution (GH-24935)

4 years agoImprove the error message for choices(population, 10) (GH-25267)
Raymond Hettinger [Tue, 20 Apr 2021 03:29:48 +0000 (20:29 -0700)] 
Improve the error message for choices(population, 10) (GH-25267)

4 years agoRevert "bpo-38659: [Enum] add _simple_enum decorator (GH-25285)" (GH-25476)
Ethan Furman [Tue, 20 Apr 2021 02:12:24 +0000 (19:12 -0700)] 
Revert "bpo-38659: [Enum] add _simple_enum decorator (GH-25285)" (GH-25476)

This reverts commit dbac8f40e81eb0a29dc833e6409a1abf47467da6.

4 years agobpo-38659: [Enum] add _simple_enum decorator (GH-25285)
Ethan Furman [Tue, 20 Apr 2021 01:04:53 +0000 (18:04 -0700)] 
bpo-38659: [Enum] add _simple_enum decorator (GH-25285)

add:

_simple_enum decorator to transform a normal class into an enum
_test_simple_enum function to compare
_old_convert_ to enable checking _convert_ generated enums
_simple_enum takes a normal class and converts it into an enum:

@simple_enum(Enum)
class Color:
    RED = 1
    GREEN = 2
    BLUE = 3

_old_convert_ works much like _convert_ does, using the original logic:

# in a test file
import socket, enum
CheckedAddressFamily = enum._old_convert_(
        enum.IntEnum, 'AddressFamily', 'socket',
        lambda C: C.isupper() and C.startswith('AF_'),
        source=_socket,
        )

test_simple_enum takes a traditional enum and a simple enum and
compares the two:

# in the REPL or the same module as Color
class CheckedColor(Enum):
    RED = 1
    GREEN = 2
    BLUE = 3

_test_simple_enum(CheckedColor, Color)

_test_simple_enum(CheckedAddressFamily, socket.AddressFamily)

Any important differences will raise a TypeError

4 years agobpo-25460: Surround suggestions by quotes (GH-25473)
Pablo Galindo [Mon, 19 Apr 2021 22:35:53 +0000 (23:35 +0100)] 
bpo-25460: Surround suggestions by quotes (GH-25473)

4 years agoAdd doctests (GH-25474)
Raymond Hettinger [Mon, 19 Apr 2021 21:12:36 +0000 (14:12 -0700)] 
Add doctests (GH-25474)

4 years agobpo-43837: Reverse order of precedence table to show tightly binding operators first...
Ammar Askar [Mon, 19 Apr 2021 15:22:03 +0000 (11:22 -0400)] 
bpo-43837: Reverse order of precedence table to show tightly binding operators first (GH-25469)

4 years agobpo-40849: Expose X509_V_FLAG_PARTIAL_CHAIN ssl flag (GH-20463)
l0x [Mon, 19 Apr 2021 11:51:18 +0000 (13:51 +0200)] 
bpo-40849: Expose X509_V_FLAG_PARTIAL_CHAIN ssl flag (GH-20463)

This short PR exposes an openssl flag that  wasn't exposed. I've also updated to doc to reflect the change. It's heavily inspired by 990fcaac3c428569697f62a80fd95ab4d4b93151.

4 years agobpo-43669: More test_ssl cleanups (GH-25470)
Christian Heimes [Mon, 19 Apr 2021 06:31:29 +0000 (08:31 +0200)] 
bpo-43669: More test_ssl cleanups (GH-25470)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-43880: Show DeprecationWarnings for deprecated ssl module features (GH-25455)
Christian Heimes [Mon, 19 Apr 2021 05:27:10 +0000 (07:27 +0200)] 
bpo-43880: Show DeprecationWarnings for deprecated ssl module features (GH-25455)

* ssl.OP_NO_SSLv2
* ssl.OP_NO_SSLv3
* ssl.OP_NO_TLSv1
* ssl.OP_NO_TLSv1_1
* ssl.OP_NO_TLSv1_2
* ssl.OP_NO_TLSv1_3
* ssl.PROTOCOL_SSLv2
* ssl.PROTOCOL_SSLv3
* ssl.PROTOCOL_SSLv23 (alias for PROTOCOL_TLS)
* ssl.PROTOCOL_TLS
* ssl.PROTOCOL_TLSv1
* ssl.PROTOCOL_TLSv1_1
* ssl.PROTOCOL_TLSv1_2
* ssl.TLSVersion.SSLv3
* ssl.TLSVersion.TLSv1
* ssl.TLSVersion.TLSv1_1
* ssl.wrap_socket()
* ssl.RAND_pseudo_bytes()
* ssl.RAND_egd() (already removed since it's not supported by OpenSSL 1.1.1)
* ssl.SSLContext() without a protocol argument
* ssl.match_hostname()
* hashlib.pbkdf2_hmac() (pure Python implementation, fast OpenSSL
  function will stay)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-42854: Use SSL_read/write_ex() (GH-25468)
Christian Heimes [Mon, 19 Apr 2021 04:55:30 +0000 (06:55 +0200)] 
bpo-42854: Use SSL_read/write_ex() (GH-25468)

The ssl module now uses ``SSL_read_ex`` and ``SSL_write_ex``
internally. The functions support reading and writing of data larger
than 2 GB. Writing zero-length data no longer fails with a protocol
violation error.

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-36076: Add SNI support to ssl.get_server_certificate. (GH-16820)
juhovh [Sun, 18 Apr 2021 11:11:48 +0000 (21:11 +1000)] 
bpo-36076: Add SNI support to ssl.get_server_certificate. (GH-16820)

Many servers in the cloud environment require SNI to be used during the
SSL/TLS handshake, therefore it is not possible to fetch their certificates
using the ssl.get_server_certificate interface.

This change adds an additional optional hostname argument that can be used to
set the SNI. Note that it is intentionally a separate argument instead of
using the host part of the addr tuple, because one might want to explicitly
fetch the default certificate or fetch a certificate from a specific IP
address with the specified SNI hostname. A separate argument also works better
for backwards compatibility.

Automerge-Triggered-By: GH:tiran
4 years agobpo-43641: Stop stating that TLS 1.2 is the most modern version in docs (GH-25041)
Illia Volochii [Sun, 18 Apr 2021 07:10:53 +0000 (10:10 +0300)] 
bpo-43641: Stop stating that TLS 1.2 is the most modern version in docs (GH-25041)

Automerge-Triggered-By: GH:tiran
4 years agobpo-43362: Fix invalid free and return check in _sha3 module (GH-25463)
Christian Heimes [Sun, 18 Apr 2021 06:39:39 +0000 (08:39 +0200)] 
bpo-43362: Fix invalid free and return check in _sha3 module (GH-25463)

Commit 93d50a6a8d0c5d332c11aef267e66573a09765ac / GH-21855 changed the
order of variable definitions, which introduced a potential invalid free
bug. Py_buffer object is now initialized earlier and the result of
Keccak initialize is verified.

Co-authored-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Christian Heimes <christian@python.org>
Co-authored-by: Alex Henrie <alexhenrie24@gmail.com>
4 years agoFix type group capture in the PEG highlight tool (GH-25464)
Pablo Galindo [Sat, 17 Apr 2021 23:18:13 +0000 (00:18 +0100)] 
Fix type group capture in the PEG highlight tool (GH-25464)

4 years agobpo-38530: Cover more error paths in error suggestion functions (GH-25462)
Pablo Galindo [Sat, 17 Apr 2021 22:28:45 +0000 (23:28 +0100)] 
bpo-38530: Cover more error paths in error suggestion functions (GH-25462)