]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
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)

4 years agoSmall changes to the section about SyntaxErrors in the 3.10 What's New document ...
Pablo Galindo [Sat, 17 Apr 2021 21:41:46 +0000 (22:41 +0100)] 
Small changes to the section about SyntaxErrors in the 3.10 What's New document (GH-25461)

4 years agobpo-37630: Do not skip the sha3 tests in case of missing builtin sha3 module (GH...
stratakis [Sat, 17 Apr 2021 21:27:07 +0000 (23:27 +0200)] 
bpo-37630: Do not skip the sha3 tests in case of missing builtin sha3 module (GH-20986)

Since we can use now the sha3 and shake algorithms from OpenSSL, we shouldn't
skip the tests in case the builtin algorithm was not compiled or removed.

4 years agobpo-38530: Include builtins in NameError suggestions (GH-25460)
Pablo Galindo [Sat, 17 Apr 2021 21:26:54 +0000 (22:26 +0100)] 
bpo-38530: Include builtins in NameError suggestions (GH-25460)

4 years agobpo-42333: Port _ssl extension to multiphase initialization (PEP 489) (GH-23253)
Christian Heimes [Sat, 17 Apr 2021 18:06:38 +0000 (20:06 +0200)] 
bpo-42333: Port _ssl extension to multiphase initialization (PEP 489) (GH-23253)

- Introduce sslmodule_slots
- Introduce sslmodulestate
- Use sslmodulestate
- Get rid of PyState_FindModule
- Move new structs and helpers to header file
- Use macros to access state
- Keep a strong ref to socket type

4 years agoFix typo in a dataclasses comment. (GH-25454)
Eric V. Smith [Sat, 17 Apr 2021 13:53:24 +0000 (09:53 -0400)] 
Fix typo in a dataclasses comment. (GH-25454)

4 years agobpo-43669: Remove OpenSSL 0.9 to 1.1.0 specific documentation (GH-25453)
Christian Heimes [Sat, 17 Apr 2021 13:49:50 +0000 (15:49 +0200)] 
bpo-43669: Remove OpenSSL 0.9 to 1.1.0 specific documentation (GH-25453)

4 years agoFix a typo in subprocess documentation (GH-25426)
andrei kulakov [Sat, 17 Apr 2021 09:59:18 +0000 (05:59 -0400)] 
Fix a typo in subprocess documentation (GH-25426)

Fix a typo per conversation with vstinner on IRC: in posix => on posix.

4 years agobpo-43669: PEP 644: Require OpenSSL 1.1.1 or newer (GH-23014)
Christian Heimes [Sat, 17 Apr 2021 09:36:35 +0000 (11:36 +0200)] 
bpo-43669: PEP 644: Require OpenSSL 1.1.1 or newer (GH-23014)

- Remove HAVE_X509_VERIFY_PARAM_SET1_HOST check
- Update hashopenssl to require OpenSSL 1.1.1
- multissltests only OpenSSL > 1.1.0
- ALPN is always supported
- SNI is always supported
- Remove deprecated NPN code. Python wrappers are no-op.
- ECDH is always supported
- Remove OPENSSL_VERSION_1_1 macro
- Remove locking callbacks
- Drop PY_OPENSSL_1_1_API macro
- Drop HAVE_SSL_CTX_CLEAR_OPTIONS macro
- SSL_CTRL_GET_MAX_PROTO_VERSION is always defined now
- security level is always available now
- get_num_tickets is available with TLS 1.3
- X509_V_ERR MISMATCH is always available now
- Always set SSL_MODE_RELEASE_BUFFERS
- X509_V_FLAG_TRUSTED_FIRST is always available
- get_ciphers is always supported
- SSL_CTX_set_keylog_callback is always available
- Update Modules/Setup with static link example
- Mention PEP in whatsnew
- Drop 1.0.2 and 1.1.0 from GHA tests

4 years agobpo-43522: Fix SSLContext.hostname_checks_common_name (GH-24899)
Christian Heimes [Sat, 17 Apr 2021 08:07:19 +0000 (10:07 +0200)] 
bpo-43522: Fix SSLContext.hostname_checks_common_name (GH-24899)

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>
4 years agoFix typo in exceptions.rst (GH-25434)
Ikko Ashimine [Sat, 17 Apr 2021 06:32:53 +0000 (15:32 +0900)] 
Fix typo in exceptions.rst (GH-25434)

attemps -> attempts

4 years agobpo-43856: Add a versionadded directive to the importlib.metadata docs (GH-25445)
Zackery Spytz [Fri, 16 Apr 2021 23:13:38 +0000 (17:13 -0600)] 
bpo-43856: Add a versionadded directive to the importlib.metadata docs (GH-25445)

Use a versionadded directive to generate the text "New in version
3.8." (to match with the documentation of other modules).

Automerge-Triggered-By: GH:jaraco
4 years agobpo-43867: multiprocessing Server catchs SystemExit (GH-25441)
Victor Stinner [Fri, 16 Apr 2021 17:42:34 +0000 (19:42 +0200)] 
bpo-43867: multiprocessing Server catchs SystemExit (GH-25441)

The multiprocessing Server class now explicitly catchs SystemExit and
closes the client connection in this case. It happens when the
Server.serve_client() method reachs the end of file (EOF).

4 years agobpo-43862: Enhance -W cmdline option documentation (GH-25439)
Victor Stinner [Fri, 16 Apr 2021 17:12:14 +0000 (19:12 +0200)] 
bpo-43862: Enhance -W cmdline option documentation (GH-25439)

The -W format is "action:message:category:module:lineno".

Update also the Python manual page.

4 years agobpo-38530: Match exactly AttributeError and NameError when offering suggestions ...
Pablo Galindo [Fri, 16 Apr 2021 16:12:03 +0000 (17:12 +0100)] 
bpo-38530: Match exactly AttributeError and NameError when offering suggestions (GH-25443)

4 years agobpo-38530: Properly extend UnboundLocalError from NameError (GH-25444)
Pablo Galindo [Fri, 16 Apr 2021 15:38:55 +0000 (16:38 +0100)] 
bpo-38530: Properly extend UnboundLocalError from NameError (GH-25444)

4 years agobpo-43843: libregrtest uses threading.excepthook (GH-25400)
Victor Stinner [Fri, 16 Apr 2021 12:33:10 +0000 (14:33 +0200)] 
bpo-43843: libregrtest uses threading.excepthook (GH-25400)

test.libregrtest now marks a test as ENV_CHANGED (altered the
execution environment) if a thread raises an exception but does not
catch it. It sets a hook on threading.excepthook. Use
--fail-env-changed option to mark the test as failed.

libregrtest regrtest_unraisable_hook() explicitly flushs
sys.stdout, sys.stderr and sys.__stderr__.

4 years agobpo-43842: Fix race condition in test_logging SMTP test (GH-25436)
Victor Stinner [Fri, 16 Apr 2021 12:32:01 +0000 (14:32 +0200)] 
bpo-43842: Fix race condition in test_logging SMTP test (GH-25436)

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.

4 years agobpo-43844: Fix PendingDeprecationWarning in test_lib2to3 (GH-25407)
Victor Stinner [Fri, 16 Apr 2021 09:27:00 +0000 (11:27 +0200)] 
bpo-43844: Fix PendingDeprecationWarning in test_lib2to3 (GH-25407)

4 years agobpo-41282: Fix distutils.utils.byte_compile() DeprecationWarning (GH-25406)
Victor Stinner [Fri, 16 Apr 2021 09:26:40 +0000 (11:26 +0200)] 
bpo-41282: Fix distutils.utils.byte_compile() DeprecationWarning (GH-25406)

* byte_compile() of distutils.utils no longer logs a
  DeprecationWarning
* test_distutils no longer logs a DeprecationWarning

4 years agobpo-40443: Remove unused imports (GH-25429)
Victor Stinner [Fri, 16 Apr 2021 09:26:06 +0000 (11:26 +0200)] 
bpo-40443: Remove unused imports (GH-25429)

* pyclbr no longer uses copy
* typing no longer uses ast

Issue discovered by pyflakes.

4 years agobpo-41323: compiler: Reuse tuple in constant tuple folding (GH-25419)
Inada Naoki [Fri, 16 Apr 2021 05:01:04 +0000 (14:01 +0900)] 
bpo-41323: compiler: Reuse tuple in constant tuple folding (GH-25419)

4 years agoImprove the section with SyntaxError message improvements to the What's New of 3...
Pablo Galindo [Fri, 16 Apr 2021 00:28:48 +0000 (01:28 +0100)] 
Improve the section with SyntaxError message improvements to the What's New of 3.10 (GH-25428)

4 years agobpo-43823: Fix location of one of the errors for invalid dictionary literals (GH...
Pablo Galindo [Thu, 15 Apr 2021 23:45:42 +0000 (00:45 +0100)] 
bpo-43823: Fix location of one of the errors for invalid dictionary literals (GH-25427)

4 years agobpo-43822: Improve syntax errors for missing commas (GH-25377)
Pablo Galindo [Thu, 15 Apr 2021 20:38:45 +0000 (21:38 +0100)] 
bpo-43822: Improve syntax errors for missing commas (GH-25377)

4 years agoUpdate ACKS (GH-25423)
Ethan Furman [Thu, 15 Apr 2021 14:55:46 +0000 (07:55 -0700)] 
Update ACKS (GH-25423)

* Add Arseny Boykov
* Add Matthias Urlichs

4 years agobpo-43744: [Enum] fix ``_is_private`` (GH-25349)
Ethan Furman [Thu, 15 Apr 2021 13:58:33 +0000 (06:58 -0700)] 
bpo-43744: [Enum] fix ``_is_private`` (GH-25349)

``_is_private`` now returns ``False`` instead of raising an exception when enum name matches beginning of class name
as used in a private variable

4 years ago[Enum] fix doc string (GH-25376)
Ethan Furman [Thu, 15 Apr 2021 13:49:54 +0000 (06:49 -0700)] 
[Enum] fix doc string (GH-25376)

4 years agobpo-43846: Use less stack for large literals and calls (GH-25403)
Mark Shannon [Thu, 15 Apr 2021 13:28:56 +0000 (14:28 +0100)] 
bpo-43846: Use less stack for large literals and calls (GH-25403)

* Modify compiler to reduce stack consumption for large expressions.

* Add more tests for stack usage.

* Add NEWS item.

* Raise SystemError for truly excessive stack use.

4 years agobpo-43823: Improve syntax errors for invalid dictionary literals (GH-25378)
Pablo Galindo [Thu, 15 Apr 2021 13:06:39 +0000 (14:06 +0100)] 
bpo-43823: Improve syntax errors for invalid dictionary literals (GH-25378)

4 years agobpo-37741: make importlib.metadata docs discoverable through a module directive....
Jason R. Coombs [Thu, 15 Apr 2021 00:56:21 +0000 (20:56 -0400)] 
bpo-37741: make importlib.metadata docs discoverable through a module directive. (GH-25415)

Automerge-Triggered-By: GH:jaraco
4 years agobpo-38530: Optimize the calculation of string sizes when offering suggestions (GH...
Pablo Galindo [Wed, 14 Apr 2021 23:03:43 +0000 (00:03 +0100)] 
bpo-38530: Optimize the calculation of string sizes when offering suggestions (GH-25412)

4 years agobpo-43296: Handle sqlite3_value_blob() errors (GH-24674)
Erlend Egeberg Aasland [Wed, 14 Apr 2021 21:09:11 +0000 (23:09 +0200)] 
bpo-43296: Handle sqlite3_value_blob() errors (GH-24674)

4 years agobpo-38530: Make sure that failing to generate suggestions on failure will not propaga...
Pablo Galindo [Wed, 14 Apr 2021 17:58:28 +0000 (18:58 +0100)] 
bpo-38530: Make sure that failing to generate suggestions on failure will not propagate exceptions (GH-25408)

4 years agoFix typo in 3.10's What's New documentation (GH-25409)
Zackery Spytz [Wed, 14 Apr 2021 16:16:11 +0000 (10:16 -0600)] 
Fix typo in 3.10's What's New documentation (GH-25409)

"occured" ->  "occurred"

4 years agobpo-41282: (PEP 632) Load install schemes from sysconfig (GH-24549)
Lumír 'Frenzy' Balhar [Wed, 14 Apr 2021 15:12:34 +0000 (17:12 +0200)] 
bpo-41282: (PEP 632) Load install schemes from sysconfig (GH-24549)

With this patch, `distutils.command.install.INSTALL_SCHEMES` are loaded from
`sysconfig._INSTALL_SCHEMES`.

The distutils module is deprecated and will be removed in 3.12 (PEP 632).
This change makes the `sysconfig._INSTALL_SCHEMES` the single point of truth
for install schemes while keeping `distutils.command.install.INSTALL_SCHEMES`
exactly the same. If we, during the transition to the sysconfig, change
something, this makes sure that it also propagates to distutils until the
module gets removed.

Moreover, as discussed [on Discourse], Linux distros need to patch
distutils/sysconfig to make sure the packages will land in proper locations.
This patch makes it easier because it leaves only one location where install
schemes are defined which is much easier to patch/adjust.

[on Discourse]: https://discuss.python.org/t/pep-632-deprecate-distutils-module/5134

The implementation is slightly different than the plan but I think it's the
easiest way how to do it and it also makes the downstream patch simple,
flexible and easy to maintain.

It's also necessary to implement this before setuptools starts bundling
the distutils module so the default install schemes stay in the standard library.

The removed code from sysconfig does not seem to have any negative effect
because, honestly, it seems that nothing actually uses the install schemes
from sysconfig at all. There were many big changes in these modules where
they were trying to include packaging in stdlib and then reverted that.
Also, the test of distutils install command does not count with the different
locations which is good evidence that the reason to have this piece of code
is no longer valid.

https://bugs.python.org/issue41282

4 years agobpo-43505: Explicitly initialize and shutdown sqlite3 (GH-25404)
Erlend Egeberg Aasland [Wed, 14 Apr 2021 14:50:16 +0000 (16:50 +0200)] 
bpo-43505: Explicitly initialize and shutdown sqlite3 (GH-25404)

4 years agobpo-41282: setup.py ignores distutils DeprecationWarning (GH-25405)
Victor Stinner [Wed, 14 Apr 2021 14:38:58 +0000 (16:38 +0200)] 
bpo-41282: setup.py ignores distutils DeprecationWarning (GH-25405)

4 years agobpo-43795: Sort PC/python3dll.c (GH-25312)
Petr Viktorin [Wed, 14 Apr 2021 14:38:30 +0000 (16:38 +0200)] 
bpo-43795: Sort PC/python3dll.c (GH-25312)

Each section is sorted to reduce diffs (review effort) when the file becomes generated.
Sort is done with key=str.lower to preserve most of the original order (underscored items first).

https://bugs.python.org/issue43795

4 years agobpo-38530: Offer suggestions on NameError (GH-25397)
Pablo Galindo [Wed, 14 Apr 2021 14:10:33 +0000 (15:10 +0100)] 
bpo-38530: Offer suggestions on NameError (GH-25397)

When printing NameError raised by the interpreter, PyErr_Display
will offer suggestions of simmilar variable names in the function that the exception
was raised from:

    >>> schwarzschild_black_hole = None
    >>> schwarschild_black_hole
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'schwarschild_black_hole' is not defined. Did you mean: schwarzschild_black_hole?

4 years agoFix typo in the What's New for 3.10 (GH-25396)
Pablo Galindo [Wed, 14 Apr 2021 13:16:47 +0000 (14:16 +0100)] 
Fix typo in the What's New for 3.10 (GH-25396)

4 years agobpo-20364: Improve sqlite3 placeholder docs (GH-25003)
Erlend Egeberg Aasland [Wed, 14 Apr 2021 12:28:55 +0000 (14:28 +0200)] 
bpo-20364: Improve sqlite3 placeholder docs (GH-25003)

4 years agobpo-43265: Improve sqlite3.Connection.backup error handling (GH-24586)
Erlend Egeberg Aasland [Wed, 14 Apr 2021 11:45:49 +0000 (13:45 +0200)] 
bpo-43265: Improve sqlite3.Connection.backup error handling (GH-24586)

4 years agobpo-43825: Fix deprecation warnings in test_cmd_line and test_collections (GH-25380)
Karthikeyan Singaravelan [Wed, 14 Apr 2021 11:45:22 +0000 (17:15 +0530)] 
bpo-43825: Fix deprecation warnings in test_cmd_line and test_collections (GH-25380)

* Fix deprecation warnings due to invalid escape sequences.
* Use self.assertEqual instead of deprecated self.assertEquals.

4 years agobpo-43752: Fix sqlite3 regression for zero-sized blobs with converters (GH-25228)
Erlend Egeberg Aasland [Wed, 14 Apr 2021 11:18:49 +0000 (13:18 +0200)] 
bpo-43752: Fix sqlite3 regression for zero-sized blobs with converters (GH-25228)

4 years agobpo-43712 : fileinput: Add encoding parameter (GH-25272)
Inada Naoki [Wed, 14 Apr 2021 05:12:58 +0000 (14:12 +0900)] 
bpo-43712 : fileinput: Add encoding parameter (GH-25272)

4 years agobpo-43777: Drop description of "pip search" command from tutorial (GH-25287)
Bob Kline [Wed, 14 Apr 2021 05:09:32 +0000 (01:09 -0400)] 
bpo-43777: Drop description of "pip search" command from tutorial (GH-25287)

4 years agobpo-38530: Offer suggestions on AttributeError (#16856)
Pablo Galindo [Wed, 14 Apr 2021 01:36:07 +0000 (02:36 +0100)] 
bpo-38530: Offer suggestions on AttributeError (#16856)

When printing AttributeError, PyErr_Display will offer suggestions of similar
attribute names in the object that the exception was raised from:

>>> collections.namedtoplo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you mean: namedtuple?

4 years agobpo-43680: Deprecate io.OpenWrapper (GH-25357)
Victor Stinner [Wed, 14 Apr 2021 01:24:33 +0000 (03:24 +0200)] 
bpo-43680: Deprecate io.OpenWrapper (GH-25357)

Deprecate io.OpenWrapper and _pyio.OpenWrapper: use io.open and
_pyio.open instead. Until Python 3.9, _pyio.open was not a static
method and builtins.open was set to OpenWrapper to not become a bound
method when set to a class variable. _io.open is a built-in function
whereas _pyio.open is a Python function. In Python 3.10, _pyio.open()
is now a static method, and builtins.open() is now io.open().

4 years agobpo-43080: pprint for dataclass instances (GH-24389)
Lewis Gaul [Tue, 13 Apr 2021 23:59:24 +0000 (00:59 +0100)] 
bpo-43080: pprint for dataclass instances (GH-24389)

* Added pprint support for dataclass instances which don't have a custom __repr__.

4 years agobpo-43785: Update bz2 document (GH-25351)
Inada Naoki [Tue, 13 Apr 2021 23:22:49 +0000 (08:22 +0900)] 
bpo-43785: Update bz2 document (GH-25351)

4 years agobpo-43811: Test multiple OpenSSL versions on GHA (GH-25360)
Christian Heimes [Tue, 13 Apr 2021 17:23:45 +0000 (19:23 +0200)] 
bpo-43811: Test multiple OpenSSL versions on GHA (GH-25360)

The new checks are only executed when one or more OpenSSL-related files are modified. The checks run a handful of networking and hashing test suites. All SSL checks are optional. This PR also introduces ccache to speed up compilation. In common cases it speeds up configure and compile time from about 90 seconds to less than 30 seconds.

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-43797: Handle correctly invalid assignments inside function calls and generators...
Pablo Galindo [Tue, 13 Apr 2021 16:51:21 +0000 (17:51 +0100)] 
bpo-43797: Handle correctly invalid assignments inside function calls and generators (GH-25390)

4 years agoDoc: Try to enhance wording on circular imports. (GH-24705)
Julien Palard [Tue, 13 Apr 2021 16:03:22 +0000 (18:03 +0200)] 
Doc: Try to enhance wording on circular imports. (GH-24705)