]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
4 years agobpo-42914: add a pprint underscore_numbers option (GH-24864)
sblondon [Wed, 24 Mar 2021 08:23:20 +0000 (09:23 +0100)] 
bpo-42914: add a pprint underscore_numbers option (GH-24864)

pprint() gains a new boolean underscore_numbers kwarg to emit
integers with thousands separated by an underscore character
for improved readability (for example 1_000_000 instead of 1000000).

4 years agobpo-31861: Fix reference leak in builtin_anext_impl() (GH-25008)
Pablo Galindo [Wed, 24 Mar 2021 01:42:13 +0000 (01:42 +0000)] 
bpo-31861: Fix reference leak in builtin_anext_impl() (GH-25008)

4 years agobpo-43244: Remove the pyarena.h header (GH-25007)
Victor Stinner [Wed, 24 Mar 2021 01:23:01 +0000 (02:23 +0100)] 
bpo-43244: Remove the pyarena.h header (GH-25007)

Remove the pyarena.h header file with functions:

* PyArena_New()
* PyArena_Free()
* PyArena_Malloc()
* PyArena_AddPyObject()

These functions were undocumented, excluded from the limited C API,
and were only used internally by the compiler.

Add pycore_pyarena.h header. Rename functions:

* PyArena_New() => _PyArena_New()
* PyArena_Free() => _PyArena_Free()
* PyArena_Malloc() => _PyArena_Malloc()
* PyArena_AddPyObject() => _PyArena_AddPyObject()

4 years agobpo-31861: Fix possible crash in PyAnextAwaitable_New (GH-25005)
Pablo Galindo [Wed, 24 Mar 2021 00:30:02 +0000 (00:30 +0000)] 
bpo-31861: Fix possible crash in PyAnextAwaitable_New (GH-25005)

4 years agobpo-43244: Remove parser_interface.h header file (GH-25001)
Victor Stinner [Wed, 24 Mar 2021 00:29:09 +0000 (01:29 +0100)] 
bpo-43244: Remove parser_interface.h header file (GH-25001)

Remove parser functions using the "struct _mod" type, because the
AST C API was removed:

* PyParser_ASTFromFile()
* PyParser_ASTFromFileObject()
* PyParser_ASTFromFilename()
* PyParser_ASTFromString()
* PyParser_ASTFromStringObject()

These functions were undocumented and excluded from the limited C
API.

Add pycore_parser.h internal header file. Rename functions:

* PyParser_ASTFromFileObject() => _PyParser_ASTFromFile()
* PyParser_ASTFromStringObject() => _PyParser_ASTFromString()

These functions are no longer exported (replace PyAPI_FUNC() with
extern).

Remove also _PyPegen_run_parser_from_file() function. Update
test_peg_generator to use _PyPegen_run_parser_from_file_pointer()
instead.

4 years agobpo-43452: Document the PyType_Lookup optimizations in the What's New for 3.10 (GH...
Pablo Galindo [Wed, 24 Mar 2021 00:04:52 +0000 (00:04 +0000)] 
bpo-43452: Document the PyType_Lookup optimizations in the What's New for 3.10 (GH-24949)

4 years agobpo-31861: Complete the C-API docs for PyObject_GetAiter and PyAiter_Check (GH-25004)
Pablo Galindo [Tue, 23 Mar 2021 23:57:03 +0000 (23:57 +0000)] 
bpo-31861: Complete the C-API docs for PyObject_GetAiter and PyAiter_Check (GH-25004)

4 years agobpo-43244: Add pycore_compile.h header file (GH-25000)
Victor Stinner [Tue, 23 Mar 2021 23:51:50 +0000 (00:51 +0100)] 
bpo-43244: Add pycore_compile.h header file (GH-25000)

Remove the compiler functions using "struct _mod" type, because the
public AST C API was removed:

* PyAST_Compile()
* PyAST_CompileEx()
* PyAST_CompileObject()
* PyFuture_FromAST()
* PyFuture_FromASTObject()

These functions were undocumented and excluded from the limited C API.

Rename functions:

* PyAST_CompileObject() => _PyAST_Compile()
* PyFuture_FromASTObject() => _PyFuture_FromAST()

Moreover, _PyFuture_FromAST() is no longer exported (replace
PyAPI_FUNC() with extern). _PyAST_Compile() remains exported for
test_peg_generator.

Remove also compatibility functions:

* PyAST_Compile()
* PyAST_CompileEx()
* PyFuture_FromAST()

4 years agobpo-31861: Add aiter and anext to builtins (#23847)
Joshua Bronson [Tue, 23 Mar 2021 22:47:21 +0000 (18:47 -0400)] 
bpo-31861: Add aiter and anext to builtins (#23847)

Co-authored-by: jab <jab@users.noreply.github.com>
Co-authored-by: Daniel Pope <mauve@mauveweb.co.uk>
Co-authored-by: Justin Wang <justin39@gmail.com>
4 years agobpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933)
Victor Stinner [Tue, 23 Mar 2021 19:47:40 +0000 (20:47 +0100)] 
bpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933)

These functions were undocumented and excluded from the limited C
API.

Most names defined by these header files were not prefixed by "Py"
and so could create names conflicts. For example, Python-ast.h
defined a "Yield" macro which was conflict with the "Yield" name used
by the Windows <winbase.h> header.

Use the Python ast module instead.

* Move Include/asdl.h to Include/internal/pycore_asdl.h.
* Move Include/Python-ast.h to Include/internal/pycore_ast.h.
* Remove ast.h header file.
* pycore_symtable.h no longer includes Python-ast.h.

4 years agobpo-41718: Update runpy startup time What's New (GH-24998)
Victor Stinner [Tue, 23 Mar 2021 19:22:40 +0000 (20:22 +0100)] 
bpo-41718: Update runpy startup time What's New (GH-24998)

4 years agobpo-41718: runpy now imports pkgutil in functions (GH-24996)
Victor Stinner [Tue, 23 Mar 2021 18:22:57 +0000 (19:22 +0100)] 
bpo-41718: runpy now imports pkgutil in functions (GH-24996)

Reduce the number of modules imported by "python3 -m module".

The runpy module no longer imports at startup (in the module body),
but only in functions using it: _get_code_from_file() and run_path().

4 years agobpo-41718: subprocess imports grp and pwd on demand (GH-24987)
Victor Stinner [Tue, 23 Mar 2021 16:42:51 +0000 (17:42 +0100)] 
bpo-41718: subprocess imports grp and pwd on demand (GH-24987)

The shutil and subprocess modules now only import the grp and pwd
modules when they are needed, which is not the case by default in
subprocess.

4 years agoClarify attribute docs on types.ModuleType (GH-24974)
Brett Cannon [Tue, 23 Mar 2021 15:25:39 +0000 (08:25 -0700)] 
Clarify attribute docs on types.ModuleType (GH-24974)

4 years agobpo-41718: libregrtest avoids importing datetime (GH-24985)
Victor Stinner [Tue, 23 Mar 2021 00:40:31 +0000 (01:40 +0100)] 
bpo-41718: libregrtest avoids importing datetime (GH-24985)

* libregrtest reimplements datetime.timedelta.__str__()
* support.testresult only imports datetime if USE_XML is true.

4 years agobpo-41718: Disable support.testresult XML output by default (GH-24982)
Victor Stinner [Tue, 23 Mar 2021 00:11:31 +0000 (01:11 +0100)] 
bpo-41718: Disable support.testresult XML output by default (GH-24982)

RegressionTestResult.USE_XML must now be set to True to get the JUnit
XML output.

Reduce the number of imports when --junit-xml=FILE option is not
used: 153 => 144 (-9).

4 years agobpo-41718: libregrtest runtest avoids import_helper (GH-24983)
Victor Stinner [Tue, 23 Mar 2021 00:08:49 +0000 (01:08 +0100)] 
bpo-41718: libregrtest runtest avoids import_helper (GH-24983)

Inline import_helper.unload() in libregrtest.runtest to avoid one
import.

4 years agobpo-41718: Reduce libregrtest runtest imports (GH-24980)
Victor Stinner [Mon, 22 Mar 2021 23:17:05 +0000 (00:17 +0100)] 
bpo-41718: Reduce libregrtest runtest imports (GH-24980)

Move clear_caches() from libregrtest.refleak to libregrtest.utils to
avoid importing libregrtest.refleak when it's not needed.

clear_caches() now only calls re.purge() if 're' is in sys.modules.

4 years agobpo-41718: regrtest saved_test_environment avoids imports (GH-24934)
Victor Stinner [Mon, 22 Mar 2021 22:52:13 +0000 (23:52 +0100)] 
bpo-41718: regrtest saved_test_environment avoids imports (GH-24934)

Reduce the number of modules imported by libregrtest.

saved_test_environment no longer imports modules at startup, but try
to get them from sys.modules. If an module is missing, skip the test.
It also sets directly support.environment_altered.

runtest() now now two saved_test_environment instances: one before
importing the test module, one after importing it.

Remove imports from test.libregrtest.save_env:

* asyncio
* logging
* multiprocessing
* shutil
* sysconfig
* urllib.request
* warnings

When a test method imports a module (ex: warnings) and the test
has a side effect (ex: add a warnings filter), the side effect is not
detected, because the module was not imported when Python
enters the saved_test_environment context manager.

4 years agobpo-43555: Report the column offset for invalid line continuation character (GH-24939)
Pablo Galindo [Mon, 22 Mar 2021 17:28:11 +0000 (17:28 +0000)] 
bpo-43555: Report the column offset for invalid line continuation character (GH-24939)

4 years agobpo-43591: Fix error location in interactive mode for errors at the end of the line...
Pablo Galindo [Mon, 22 Mar 2021 16:24:39 +0000 (16:24 +0000)] 
bpo-43591: Fix error location in interactive mode for errors at the end of the line (GH-24973)

Co-authored-by: Erlend Egeberg Aasland
4 years agoRevert "bpo-40521: Make dtoa bigint free list per-interpreter (GH-24821)" (GH-24964)
Victor Stinner [Mon, 22 Mar 2021 10:58:59 +0000 (11:58 +0100)] 
Revert "bpo-40521: Make dtoa bigint free list per-interpreter (GH-24821)" (GH-24964)

This reverts commit 5bd1059184b154d339f1bd53d23c98b5bcf14c8c.

4 years agobpo-43575: Use PEP 590 vectorcall to speed up map() (GH-24955)
Dong-hee Na [Mon, 22 Mar 2021 10:01:14 +0000 (19:01 +0900)] 
bpo-43575: Use PEP 590 vectorcall to speed up map() (GH-24955)

4 years agobpo-43551: Fix PyImport_Import() for subinterpreters (GH-24929)
junyixie [Mon, 22 Mar 2021 09:47:10 +0000 (17:47 +0800)] 
bpo-43551: Fix PyImport_Import() for subinterpreters (GH-24929)

Avoid static variables.

4 years agobpo-35134: Add include/cpython/compile.h (GH-24922)
Hai Shi [Mon, 22 Mar 2021 08:32:11 +0000 (16:32 +0800)] 
bpo-35134: Add include/cpython/compile.h (GH-24922)

Move C API excluded from the limited C API from Include/compile.h
to a new Include/cpython/compile.h header file.

4 years agobpo-43420: Simple optimizations for Fraction's arithmetics (GH-24779)
Sergey B Kirpichev [Mon, 22 Mar 2021 02:30:55 +0000 (05:30 +0300)] 
bpo-43420: Simple optimizations for Fraction's arithmetics (GH-24779)

bpo-43420: Implement standard transformations in + - * / that can often reduce the size of intermediate integers needed. For rationals with large components, this can yield dramatic speed improvements, but for small rationals can run 10-20% slower, due to increased fixed overheads in the longer-winded code. If those slowdowns turn out to be a problem, see the PR discussion for low-level implementation tricks that could cut other fixed overheads.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
4 years agobpo-43569: Add test/test_importlib/namespacedata01 to TESTSUBDIRS (GH-24952)
Jason R. Coombs [Sun, 21 Mar 2021 17:26:45 +0000 (13:26 -0400)] 
bpo-43569: Add test/test_importlib/namespacedata01 to TESTSUBDIRS (GH-24952)

4 years agobpo-43422: Revert _decimal C API addition (GH-24960) 24519/head
Antoine Pitrou [Sun, 21 Mar 2021 16:27:54 +0000 (17:27 +0100)] 
bpo-43422: Revert _decimal C API addition (GH-24960)

Stefan Krah requested the reversal of these (unreleased) changes, quoting him:
> The capsule API does not meet my testing standards, since I've focused
on the upstream mpdecimal in the last couple of months.
> Additionally, I'd like to refine the API, perhaps together with the
Arrow community.

Automerge-Triggered-By: GH:pitrou
4 years agobpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback (GH-24957)
Christian Heimes [Sun, 21 Mar 2021 15:13:09 +0000 (16:13 +0100)] 
bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback (GH-24957)

OpenSSL copies the internal message callback from SSL_CTX->msg_callback to
SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback
to use the callback value of the new context.

PySSL_set_context() now resets the callback and _PySSL_msg_callback()
resets thread state in error path.

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-43542: Add heif/heic formats in mimetypes (GH-24917)
Ilya Stepin [Sat, 20 Mar 2021 23:06:27 +0000 (02:06 +0300)] 
bpo-43542: Add heif/heic formats in mimetypes (GH-24917)

* bpo-43542: Add heif/heic formats in mimetypes

Add HEIF and HEIC format to list of media types. It has IANA registration.

IANA: https://www.iana.org/assignments/media-types/image/heic
HEIF Github: https://github.com/nokiatech/heif

Co-authored-by: Gregory P. Smith <greg@krypto.org>
4 years agobpo-43571: Add IPPROTO_MPTCP macro (GH-24946)
Rui Cunha [Sat, 20 Mar 2021 22:04:56 +0000 (22:04 +0000)] 
bpo-43571: Add IPPROTO_MPTCP macro (GH-24946)

Add IPPROTO_MPTCP constant when defined in the system headers.

4 years agobpo-43517 (followup): Install additional test directory (GH-24950)
Antoine Pitrou [Sat, 20 Mar 2021 20:45:58 +0000 (21:45 +0100)] 
bpo-43517 (followup): Install additional test directory (GH-24950)

Should fix some CI failures on buildbots that test an installed version of Python.

Automerge-Triggered-By: GH:pitrou
4 years agobpo-43452: Micro-optimizations to PyType_Lookup (GH-24804)
Dino Viehland [Sat, 20 Mar 2021 19:12:05 +0000 (12:12 -0700)] 
bpo-43452: Micro-optimizations to PyType_Lookup (GH-24804)

The common case going through _PyType_Lookup is to have a cache hit. There are some small tweaks that can make this a little cheaper:

* The name field identity is used for a cache hit and is kept alive by the cache. So there's no need to read the hash code o the name - instead, the address can be used as the hash.

*  There's no need to check if the name is cachable on the lookup either, it probably is, and if it is, it'll be in the cache.

*  If we clear the version tag when invalidating a type then we don't actually need to check for a valid version tag bit.

4 years agobpo-43517: Fix false positive in detection of circular imports (#24895)
Antoine Pitrou [Sat, 20 Mar 2021 19:07:44 +0000 (20:07 +0100)] 
bpo-43517: Fix false positive in detection of circular imports (#24895)

4 years agobpo-43494: Make some minor changes to lnotab notes (GH-24861)
Skip Montanaro [Fri, 19 Mar 2021 23:10:54 +0000 (18:10 -0500)] 
bpo-43494: Make some minor changes to lnotab notes (GH-24861)

This cleanup makes no substantive changes.

4 years agoMention that code.co_lnotab is deprecated in what's new for 3.10. (#24902)
Mark Shannon [Fri, 19 Mar 2021 17:30:24 +0000 (17:30 +0000)] 
Mention that code.co_lnotab is deprecated in what's new for 3.10. (#24902)

4 years agobpo-43244: Remove symtable.h header file (GH-24910)
Victor Stinner [Fri, 19 Mar 2021 11:41:49 +0000 (12:41 +0100)] 
bpo-43244: Remove symtable.h header file (GH-24910)

Rename Include/symtable.h to to Include/internal/pycore_symtable.h,
don't export symbols anymore (replace PyAPI_FUNC and PyAPI_DATA with
extern) and rename functions:

* PyST_GetScope() to _PyST_GetScope()
* PySymtable_BuildObject() to _PySymtable_Build()
* PySymtable_Free() to _PySymtable_Free()

Remove PySymtable_Build(), Py_SymtableString() and
Py_SymtableStringObject() functions.

The Py_SymtableString() function was part the stable ABI by mistake
but it could not be used, since the symtable.h header file was
excluded from the limited C API.

The Python symtable module remains available and is unchanged.

4 years agobpo-43466: Add --with-openssl-rpath configure option (GH-24820)
Christian Heimes [Fri, 19 Mar 2021 09:29:25 +0000 (10:29 +0100)] 
bpo-43466: Add --with-openssl-rpath configure option (GH-24820)

4 years agoFix a typo in c-analyzer (GH-24468)
Ikko Ashimine [Fri, 19 Mar 2021 07:38:12 +0000 (16:38 +0900)] 
Fix a typo in c-analyzer (GH-24468)

4 years agobpo-41561: Add workaround for Ubuntu's custom security level (GH-24915)
Christian Heimes [Thu, 18 Mar 2021 22:06:50 +0000 (23:06 +0100)] 
bpo-41561: Add workaround for Ubuntu's custom security level (GH-24915)

Ubuntu 20.04 comes with a patched OpenSSL 1.1.1. Default security level
2 blocks TLS 1.0 and 1.1 connections. Regular OpenSSL 1.1.1 builds allow
TLS 1.0 and 1.1 on security level 2.

See:
See: https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1899878
See: https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1917625
Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-43521: Allow ast.unparse with empty sets and NaN (GH-24897)
Kodi Arfer [Thu, 18 Mar 2021 17:36:06 +0000 (13:36 -0400)] 
bpo-43521: Allow ast.unparse with empty sets and NaN (GH-24897)

Automerge-Triggered-By: GH:pablogsal
4 years agobpo-43244: Remove the PyAST_Validate() function (GH-24911)
Victor Stinner [Thu, 18 Mar 2021 13:57:49 +0000 (14:57 +0100)] 
bpo-43244: Remove the PyAST_Validate() function (GH-24911)

Remove the PyAST_Validate() function. It is no longer possible to
build a AST object (mod_ty type) with the public C API. The function
was already excluded from the limited C API (PEP 384).

Rename PyAST_Validate() function to _PyAST_Validate(), move it to the
internal C API, and don't export it anymore (replace PyAPI_FUNC with
extern).

The function was added in bpo-12575 by
the commit 832bfe2ebd5ecfa92031cd40c8b41835ba90487f.

4 years agobpo-43541: Fix PyEval_EvalCodeEx() regression (GH-24918)
Victor Stinner [Thu, 18 Mar 2021 13:51:24 +0000 (14:51 +0100)] 
bpo-43541: Fix PyEval_EvalCodeEx() regression (GH-24918)

* Remove an assertion which required CO_NEWLOCALS and CO_OPTIMIZED
  code flags. It is ok to call this function on a code with these
  flags set.
* Fix reference counting on builtins: remove Py_DECREF().
  Fix regression introduced in the
  commit 46496f9d12582bf11f4911ad0f23315d6f277907.

Add also a comment to document that _PyEval_BuiltinsFromGlobals()
returns a borrowed reference.

4 years agobpo-43244: Fix test_peg_generators on Windows (GH-24913)
Victor Stinner [Thu, 18 Mar 2021 08:54:13 +0000 (09:54 +0100)] 
bpo-43244: Fix test_peg_generators on Windows (GH-24913)

Don't redefine Py_DebugFlag, it's already defined in pydebug.h which
is included by Python.h

4 years agobpo-39342: Expose X509_V_FLAG_ALLOW_PROXY_CERTS in ssl module (GH-18011)
Chris Burr [Thu, 18 Mar 2021 08:24:01 +0000 (09:24 +0100)] 
bpo-39342: Expose X509_V_FLAG_ALLOW_PROXY_CERTS in ssl module (GH-18011)

Exposes the `X509_V_FLAG_ALLOW_PROXY_CERTS` constant as `ssl.VERIFY_ALLOW_PROXY_CERTS` to allow for proxy certificate validation as described in: https://www.openssl.org/docs/man1.1.1/man7/proxy-certificates.html

4 years agobpo-43244: Fix test_peg_generator for PyAST_Validate() (GH-24912)
Victor Stinner [Thu, 18 Mar 2021 01:46:06 +0000 (02:46 +0100)] 
bpo-43244: Fix test_peg_generator for PyAST_Validate() (GH-24912)

test_peg_generator now defines _Py_TEST_PEGEN macro when building C
code to not call PyAST_Validate() in Parser/pegen.c. Moreover, it
defines Py_BUILD_CORE_MODULE macro to get access to the internal
C API.

Remove "global_ast_state" from Python-ast.c when it's built by
test_peg_generator: always get the AST state from the current interpreter.

4 years agobpo-42128: Add 'missing :' syntax error message to match statements (GH-24733)
Pablo Galindo [Thu, 18 Mar 2021 01:03:11 +0000 (01:03 +0000)] 
bpo-42128: Add 'missing :' syntax error message to match statements (GH-24733)

4 years agobpo-43244: Add pycore_ast.h header file (GH-24908)
Victor Stinner [Wed, 17 Mar 2021 22:50:50 +0000 (23:50 +0100)] 
bpo-43244: Add pycore_ast.h header file (GH-24908)

Move _PyAST_GetDocString() and _PyAST_ExprAsUnicode() functions the
internal C API: from Include/ast.h to a new
Include/internal/pycore_ast.h header file. Don't export these
functions anymore: replace PyAPI_FUNC() with extern.

Remove also unused includes.

4 years agobpo-43244: Rename pycore_ast.h to pycore_ast_state.h (GH-24907)
Victor Stinner [Wed, 17 Mar 2021 22:11:03 +0000 (23:11 +0100)] 
bpo-43244: Rename pycore_ast.h to pycore_ast_state.h (GH-24907)

4 years agoRemove unnecessary imports in the grammar parser (GH-24904)
Elisha Hollander [Wed, 17 Mar 2021 22:07:17 +0000 (00:07 +0200)] 
Remove unnecessary imports in the grammar parser (GH-24904)

4 years agobpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)
Victor Stinner [Wed, 17 Mar 2021 20:46:53 +0000 (21:46 +0100)] 
bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)

Python no longer fails at startup with a fatal error if a command
line argument contains an invalid Unicode character.

The Py_DecodeLocale() function now escapes byte sequences which would
be decoded as Unicode characters outside the [U+0000; U+10ffff]
range.

Use MAX_UNICODE constant in unicodeobject.c.

4 years agoAdd PEP 626 to what's new in 3.10. (#24892)
Mark Shannon [Tue, 16 Mar 2021 13:43:58 +0000 (13:43 +0000)] 
Add PEP 626 to what's new in 3.10. (#24892)

4 years agobpo-43497: Emit SyntaxWarnings for assertions with tuple constants. (GH-24867)
tsukasa-au [Tue, 16 Mar 2021 11:14:41 +0000 (22:14 +1100)] 
bpo-43497: Emit SyntaxWarnings for assertions with tuple constants. (GH-24867)

* bpo-43497: Emit SyntaxWarnings for assertions with tuple constants.

Add a test that shows that a tuple constant (a tuple, where all of its
members are also compile-time constants) produces a SyntaxWarning. Then
fix this failure.

* Make SyntaxWarnings also work when "optimized".

* Split tests for SyntaxWarning to SyntaxError conversion

SyntaxWarnings emitted by the compiler when configured to be errors are
actually raised as SyntaxError exceptions.

Move these tests into their own method and add a test to ensure they are
raised. Previously we only tested that they were not raised for a
"valid" assertion statement.

4 years agobpo-43506: Doc: Update removal schedule for Py_UNICODE encoder APIs (GH-24885)
Inada Naoki [Tue, 16 Mar 2021 04:24:27 +0000 (13:24 +0900)] 
bpo-43506: Doc: Update removal schedule for Py_UNICODE encoder APIs (GH-24885)

See PEP 624.

4 years agobpo-41361: Optimized argument parsing for deque_rotate (GH-24796)
Dennis Sweeney [Tue, 16 Mar 2021 04:02:25 +0000 (00:02 -0400)] 
bpo-41361: Optimized argument parsing for deque_rotate (GH-24796)

4 years agoMinor updates to the vector demo (GH-24853)
Raymond Hettinger [Tue, 16 Mar 2021 02:53:58 +0000 (19:53 -0700)] 
Minor updates to the vector demo (GH-24853)

4 years agobpo-41933: Clarify wording for s * n in Common Sequence Operations (GH-22570)
Chavdar Yotov [Mon, 15 Mar 2021 22:50:49 +0000 (22:50 +0000)] 
bpo-41933: Clarify wording for s * n in Common Sequence Operations (GH-22570)

4 years agobpo-43285 Make ftplib not trust the PASV response. (GH-24838)
Gregory P. Smith [Mon, 15 Mar 2021 18:39:31 +0000 (11:39 -0700)] 
bpo-43285 Make ftplib not trust the PASV response. (GH-24838)

bpo-43285: Make ftplib not trust the PASV response.

The IPv4 address value returned from the server in response to the PASV command
should not be trusted.  This prevents a malicious FTP server from using the
response to probe IPv4 address and port combinations on the client network.

Instead of using the returned address, we use the IP address we're
already connected to.  This is the strategy other ftp clients adopted,
and matches the only strategy available for the modern IPv6 EPSV command
where the server response must return a port number and nothing else.

For the rare user who _wants_ this ugly behavior, set a `trust_server_pasv_ipv4_address`
attribute on your `ftplib.FTP` instance to True.

4 years agoFix typo in the word "spaghetti" (GH-24866)
Kazantcev Andrey [Mon, 15 Mar 2021 17:23:03 +0000 (20:23 +0300)] 
Fix typo in the word "spaghetti" (GH-24866)

Automerge-Triggered-By: GH:Mariatta
4 years agoMark POP_TOP at end of expression statement as artificial, to conform to PEP 626...
Mark Shannon [Mon, 15 Mar 2021 14:24:25 +0000 (14:24 +0000)] 
Mark POP_TOP at end of expression statement as artificial, to conform to PEP 626. (GH-24860)

4 years agobpo-43428: Improve documentation for importlib.metadata changes. (GH-24858)
Jason R. Coombs [Mon, 15 Mar 2021 02:20:49 +0000 (22:20 -0400)] 
bpo-43428: Improve documentation for importlib.metadata changes. (GH-24858)

* bpo-43428: Sync with importlib_metadata 3.7.3 (16ac3a95)

* Add 'versionadded' for importlib.metadata.packages_distributions

* Add section in what's new for Python 3.10 highlighting most salient changes and relevant backport.

4 years agobpo-43199: Briefly explain why no goto (GH-24852)
Terry Jan Reedy [Sun, 14 Mar 2021 22:12:04 +0000 (18:12 -0400)] 
bpo-43199: Briefly explain why no goto (GH-24852)

Answer "Why is there no goto?" in the Design and History FAQ.

4 years agobpo-29982: Add "ignore_cleanup_errors" param to tempfile.TemporaryDirectory() (GH...
CAM Gerlach [Sun, 14 Mar 2021 18:06:56 +0000 (13:06 -0500)] 
bpo-29982: Add "ignore_cleanup_errors" param to tempfile.TemporaryDirectory() (GH-24793)

4 years agobpo-39316: Make sure that attribute accesses and stores, including method calls,...
Mark Shannon [Sun, 14 Mar 2021 18:01:30 +0000 (18:01 +0000)] 
bpo-39316: Make sure that attribute accesses and stores, including method calls, conform to PEP 626. (GH-24859)

4 years agobpo-43410: Fix crash in the parser when producing syntax errors when reading from...
Pablo Galindo [Sun, 14 Mar 2021 03:38:40 +0000 (04:38 +0100)] 
bpo-43410: Fix crash in the parser when producing syntax errors when reading from stdin (GH-24763)

4 years agobpo-43245: Add keyword argument support to ChainMap.new_child() (GH-24788)
Kamil Turek [Sun, 14 Mar 2021 03:15:44 +0000 (04:15 +0100)] 
bpo-43245: Add keyword argument support to ChainMap.new_child() (GH-24788)

4 years agobpo-43439: Wrapt the tuple in the audit events for the gc module (GH-24836)
Pablo Galindo [Sun, 14 Mar 2021 03:04:47 +0000 (04:04 +0100)] 
bpo-43439: Wrapt the tuple in the audit events for the gc module (GH-24836)

4 years agoFix some minor errors in the docs (GH-24834)
Zackery Spytz [Sun, 14 Mar 2021 01:00:28 +0000 (18:00 -0700)] 
Fix some minor errors in the docs (GH-24834)

4 years agobpo-43427: Separte the method overview from the static method specifics. (GH-24787)
Raymond Hettinger [Sat, 13 Mar 2021 21:46:32 +0000 (13:46 -0800)] 
bpo-43427:  Separte the method overview from the static method specifics. (GH-24787)

4 years agobpo-43428: Sync with importlib_metadata 3.7. (GH-24782)
Jason R. Coombs [Sat, 13 Mar 2021 16:31:45 +0000 (11:31 -0500)] 
bpo-43428: Sync with importlib_metadata 3.7. (GH-24782)

* bpo-43428: Sync with importlib_metadata 3.7.2 (67234b6)

* Add blurb

* Reformat blurb to create separate paragraphs for each change included.

4 years agobpo-43444: Move sqlite3 MODULE_NAME from setup.py to module.h (GH-24801)
Erlend Egeberg Aasland [Sat, 13 Mar 2021 15:33:39 +0000 (16:33 +0100)] 
bpo-43444: Move sqlite3 MODULE_NAME from setup.py to module.h (GH-24801)

4 years agobpo-43441: Fix _PyType_ClearCache() for subinterpreters (GH-24822)
junyixie [Sat, 13 Mar 2021 13:38:36 +0000 (21:38 +0800)] 
bpo-43441: Fix _PyType_ClearCache() for subinterpreters (GH-24822)

_PyType_ClearCache() now only resets next_version_tag in the main interpreter.

Co-authored-by: Victor Stinner <vstinner@python.org>
4 years agobpo-40521: Make dtoa bigint free list per-interpreter (GH-24821)
junyixie [Sat, 13 Mar 2021 13:25:14 +0000 (21:25 +0800)] 
bpo-40521: Make dtoa bigint free list per-interpreter (GH-24821)

4 years agoUpdate link to Django's Context class. (#24805)
Mariusz Felisiak [Sat, 13 Mar 2021 12:26:11 +0000 (13:26 +0100)] 
Update link to Django's Context class. (#24805)

* Update link to Django's Context class.
* Update link to get-pip.py.

4 years agoUpdate client.py (GH-24827)
Géry Ogam [Sat, 13 Mar 2021 12:22:03 +0000 (13:22 +0100)] 
Update client.py (GH-24827)

4 years agobpo-27820: Fix AUTH LOGIN logic in smtplib.SMTP (GH-24118)
Pandu E POLUAN [Fri, 12 Mar 2021 23:25:49 +0000 (06:25 +0700)] 
bpo-27820: Fix AUTH LOGIN logic in smtplib.SMTP (GH-24118)

* Fix auth_login logic (bpo-27820)

* Also fix a longstanding bug in the SimSMTPChannel.found_terminator() method that causes inability to test
SMTP AUTH with initial_response_ok=False.

4 years agobpo-43356: Allow passing a signal number to interrupt_main() (GH-24755)
Antoine Pitrou [Thu, 11 Mar 2021 22:35:45 +0000 (23:35 +0100)] 
bpo-43356: Allow passing a signal number to interrupt_main() (GH-24755)

Also introduce a new C API ``PyErr_SetInterruptEx(int signum)``.

4 years agobpo-43423 Fix IndexError in subprocess _communicate function (GH-24777)
Chris Griffith [Thu, 11 Mar 2021 19:43:29 +0000 (13:43 -0600)] 
bpo-43423 Fix IndexError in subprocess _communicate function (GH-24777)

Check to make sure stdout and stderr are not empty before selecting an item from them in Windows subprocess._communicate.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
4 years agobpo-43311: Create GIL autoTSSkey ealier (GH-24819)
Victor Stinner [Wed, 10 Mar 2021 19:00:46 +0000 (20:00 +0100)] 
bpo-43311: Create GIL autoTSSkey ealier (GH-24819)

At Python startup, call _PyGILState_Init() before
PyInterpreterState_New() which calls _PyThreadState_GET(). When
Python is built using --with-experimental-isolated-subinterpreters,
_PyThreadState_GET() uses autoTSSkey.

4 years agobpo-43287: Use PEP 590 vectorcall to speed up filter() (GH-24611)
Dong-hee Na [Wed, 10 Mar 2021 16:39:52 +0000 (01:39 +0900)] 
bpo-43287: Use PEP 590 vectorcall to speed up filter() (GH-24611)

4 years agoFix error in documentation for ast.match_case (GH-24807)
Adrian Freund [Wed, 10 Mar 2021 15:58:31 +0000 (16:58 +0100)] 
Fix error in documentation for ast.match_case (GH-24807)

4 years agobpo-43406: Fix test_signal.test_stress_modifying_handlers() (GH-24815)
Victor Stinner [Wed, 10 Mar 2021 14:26:45 +0000 (15:26 +0100)] 
bpo-43406: Fix test_signal.test_stress_modifying_handlers() (GH-24815)

Fix a race condition of test_stress_modifying_handlers() of
test_signal: only raise signals while we are in the
catch_unraisable_exception() context manager.
Moreover, don't check if we received at least one
signal if at least one signal got ignored.

4 years agobpo-43456: Remove _xxsubinterpreters from sys.stdlib_module_names (GH-24814)
Victor Stinner [Wed, 10 Mar 2021 11:10:01 +0000 (12:10 +0100)] 
bpo-43456: Remove _xxsubinterpreters from sys.stdlib_module_names (GH-24814)

4 years agoFix typo in compile.c (GH-24812)
Ikko Ashimine [Wed, 10 Mar 2021 10:39:51 +0000 (19:39 +0900)] 
Fix typo in compile.c (GH-24812)

guranteed -> guaranteed

4 years agobpo-43445: Add frozen modules to sys.stdlib_module_names (GH-24798)
Victor Stinner [Wed, 10 Mar 2021 10:14:07 +0000 (11:14 +0100)] 
bpo-43445: Add frozen modules to sys.stdlib_module_names (GH-24798)

Add frozen modules to sys.stdlib_module_names. For example, add
"_frozen_importlib" and "_frozen_importlib_external" names.

Add "list_frozen" command to Programs/_testembed.

4 years agobpo-43439: Add audit hooks for gc functions (GH-24794)
Pablo Galindo [Wed, 10 Mar 2021 00:53:57 +0000 (00:53 +0000)] 
bpo-43439: Add audit hooks for gc functions (GH-24794)

4 years agobpo-43446: Fix markup in sqlite3 footnote (GH-24806)
Kamil Turek [Tue, 9 Mar 2021 23:41:41 +0000 (00:41 +0100)] 
bpo-43446: Fix markup in sqlite3 footnote (GH-24806)

4 years agobpo-43440 : Enable SQLite R*Tree support for windows builds (GH-24797)
Erlend Egeberg Aasland [Tue, 9 Mar 2021 20:59:44 +0000 (21:59 +0100)] 
bpo-43440 : Enable SQLite R*Tree support for windows builds (GH-24797)

4 years agobpo-3329: Fix typo in PyObjectArenaAllocator doc (GH-24795)
Victor Stinner [Tue, 9 Mar 2021 11:16:42 +0000 (12:16 +0100)] 
bpo-3329: Fix typo in PyObjectArenaAllocator doc (GH-24795)

4 years agobpo-43415: Fix typo on dataclasses.rst (#24789)
Guilherme Martins Crocetti [Mon, 8 Mar 2021 22:50:39 +0000 (19:50 -0300)] 
bpo-43415: Fix typo on dataclasses.rst (#24789)

4 years agobpo-37146: Move _PyEval_DeactivateOpCache() to the internal C API (GH-24786)
Victor Stinner [Mon, 8 Mar 2021 21:56:37 +0000 (22:56 +0100)] 
bpo-37146: Move _PyEval_DeactivateOpCache() to the internal C API (GH-24786)

Don't export the symbol anymore.

4 years agobpo-14678: Update zipimport to support importlib.invalidate_caches() (GH-24159)
Desmond Cheong [Mon, 8 Mar 2021 20:06:02 +0000 (04:06 +0800)] 
bpo-14678: Update zipimport to support importlib.invalidate_caches() (GH-24159)

Added an invalidate_caches() method to the zipimport.zipimporter class based on the implementation of importlib.FileFinder.invalidate_caches(). This was done by adding a get_files() method and an _archive_mtime attribute to zipimport.zipimporter to check for updates or cache invalidation whenever the cache of files and toc entry information in the zipimporter is accessed.

4 years agobpo-43353: Document that logging.getLevelName() accepts string representation of...
Mariusz Felisiak [Mon, 8 Mar 2021 11:16:20 +0000 (12:16 +0100)] 
bpo-43353: Document that logging.getLevelName() accepts string representation of logging level. (GH-24693)

[bpo-43353]()

Automerge-Triggered-By: GH:vsajip
4 years agobpo-43332: Buffer proxy connection setup packets before sending. (GH-24780)
Gregory P. Smith [Mon, 8 Mar 2021 07:35:13 +0000 (23:35 -0800)] 
bpo-43332: Buffer proxy connection setup packets before sending. (GH-24780)

We now buffer the CONNECT request + tunnel HTTP headers into a single
send call.  This prevents the OS from generating multiple network
packets for connection setup when not necessary, improving efficiency.

4 years agobpo-43319: Fixed the tutorial on venv about standard library (GH-24740)
cmhzc [Sun, 7 Mar 2021 09:08:50 +0000 (17:08 +0800)] 
bpo-43319: Fixed the tutorial on venv about standard library (GH-24740)

In the [official tutorial on virtual environment](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments)

> This will create the tutorial-env directory if it doesn’t exist, and also create directories inside it containing a copy of the Python interpreter, **the standard library**, and various supporting files.

According to the actual behavior of `venv` and [PEP 405](https://www.python.org/dev/peps/pep-0405/#id15)'s description about virtual environment, no standard library file is included in the virtual environment's directory.

Automerge-Triggered-By: GH:vsajip
4 years agobpo-43405: Fix DeprecationWarnings in test_unicode (GH-24754)
Zackery Spytz [Sun, 7 Mar 2021 06:12:35 +0000 (23:12 -0700)] 
bpo-43405: Fix DeprecationWarnings in test_unicode (GH-24754)

DeprecationWarnings were being raised in the test_encode_decimal()
and test_transform_decimal() methods after 91a639a0949.

4 years agobpo-43372: Use _freeze_importlib for regen-frozen. (GH-24759)
Neil Schemenauer [Sat, 6 Mar 2021 21:34:03 +0000 (13:34 -0800)] 
bpo-43372: Use _freeze_importlib for regen-frozen. (GH-24759)

This approach ensures the code matches the interpreter version.
Previously, PYTHON_FOR_REGEN was used to generate the code, which might
be wrong. The marshal format for code objects has changed with
bpo-42246, commit 877df851. Update the code and the expected code sizes
in ctypes test_frozentable.

4 years agoPut contextvars docs into the concurrency category (GH-24760)
Brett Cannon [Sat, 6 Mar 2021 16:25:54 +0000 (08:25 -0800)] 
Put contextvars docs into the concurrency category (GH-24760)

4 years agobpo-43407: Clarify comparisons of time.monotonic() et al results (GH-24757)
Alex Willmer [Sat, 6 Mar 2021 01:22:13 +0000 (01:22 +0000)] 
bpo-43407: Clarify comparisons of time.monotonic() et al results (GH-24757)

Previous wording implied that only the result of call N and N+1 could be
meaningfully compared, whereas comparing call N and N+M is fine.

4 years agoMake tracing info (bounds, and previous instruction offset) a bit more robust. (GH...
Mark Shannon [Fri, 5 Mar 2021 14:45:50 +0000 (14:45 +0000)] 
Make tracing info (bounds, and previous instruction offset) a bit more robust. (GH-24726)