]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
4 years agobpo-43682: @staticmethod inherits attributes (GH-25268)
Victor Stinner [Fri, 9 Apr 2021 15:51:22 +0000 (17:51 +0200)] 
bpo-43682: @staticmethod inherits attributes (GH-25268)

Static methods (@staticmethod) and class methods (@classmethod) now
inherit the method attributes (__module__, __name__, __qualname__,
__doc__, __annotations__) and have a new __wrapped__ attribute.

Changes:

* Add a repr() method to staticmethod and classmethod types.
* Add tests on the @classmethod decorator.

4 years agobpo-43788: Generate version specific _ssl_data.h (GH-25300)
Christian Heimes [Fri, 9 Apr 2021 15:02:00 +0000 (17:02 +0200)] 
bpo-43788: Generate version specific _ssl_data.h (GH-25300)

Signed-off-by: Christian Heimes <christian@python.org>
Automerge-Triggered-By: GH:tiran
4 years agobpo-4379: Skip TLS 1.0/1.1 tests under OpenSSL 3.0.0 (GH-25304)
Christian Heimes [Fri, 9 Apr 2021 13:43:06 +0000 (15:43 +0200)] 
bpo-4379: Skip TLS 1.0/1.1 tests under OpenSSL 3.0.0 (GH-25304)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-43789: OpenSSL 3.0.0 Don't call passwd callback again in error case (GH-25303)
Christian Heimes [Fri, 9 Apr 2021 13:23:38 +0000 (15:23 +0200)] 
bpo-43789: OpenSSL 3.0.0 Don't call passwd callback again in error case (GH-25303)

4 years agobpo-43774: Document the Python Build System (GH-25302)
Victor Stinner [Fri, 9 Apr 2021 12:35:10 +0000 (14:35 +0200)] 
bpo-43774: Document the Python Build System (GH-25302)

* Elaborate PGO and LTO documentaton.
* Document MAINCC, PURIFY and LINKCC variables.

4 years agobpo-43774: Doc job of Azure Pipelines uses Doc/requirements.txt (GH-25296)
Victor Stinner [Fri, 9 Apr 2021 10:36:47 +0000 (12:36 +0200)] 
bpo-43774: Doc job of Azure Pipelines uses Doc/requirements.txt (GH-25296)

Don't hardcode the Sphinx version but use Doc/requirements.txt.

4 years agoSimplify _PyPegen_fill_token in pegen.c (GH-25295)
Pablo Galindo [Fri, 9 Apr 2021 00:32:25 +0000 (01:32 +0100)] 
Simplify _PyPegen_fill_token in pegen.c (GH-25295)

4 years agoSanitize macros and debug functions in pegen.c (GH-25291)
Pablo Galindo [Fri, 9 Apr 2021 00:17:31 +0000 (01:17 +0100)] 
Sanitize macros and debug functions in pegen.c (GH-25291)

4 years agobpo-43774: Enhance configure documentation (GH-25293)
Victor Stinner [Thu, 8 Apr 2021 23:58:20 +0000 (01:58 +0200)] 
bpo-43774: Enhance configure documentation (GH-25293)

4 years agoBreak down some complex functions in pegen.c for readability (GH-25292)
Pablo Galindo [Thu, 8 Apr 2021 23:48:53 +0000 (00:48 +0100)] 
Break down some complex functions in pegen.c for readability (GH-25292)

4 years agoFix possible refleak involving _PyArena_AddPyObject (GH-25289)
Erlend Egeberg Aasland [Thu, 8 Apr 2021 23:05:44 +0000 (01:05 +0200)] 
Fix possible refleak involving _PyArena_AddPyObject (GH-25289)

4 years agobpo-39702: Remove dotted_name from decorator documentation (GH-25234)
Saiyang Gou [Thu, 8 Apr 2021 22:34:09 +0000 (15:34 -0700)] 
bpo-39702: Remove dotted_name from decorator documentation (GH-25234)

4 years agobpo-43778: Fix Sphinx glossary_search extension (GH-25286)
Victor Stinner [Thu, 8 Apr 2021 22:07:01 +0000 (00:07 +0200)] 
bpo-43778: Fix Sphinx glossary_search extension (GH-25286)

Create the _static/ directory if it doesn't exist.

Add also constants for the static directory and the JSON filename.

4 years agobpo-43774: Document configure options (GH-25283)
Victor Stinner [Thu, 8 Apr 2021 20:32:21 +0000 (22:32 +0200)] 
bpo-43774: Document configure options (GH-25283)

Add Doc/using/configure.rst documentation to document configure,
preprocessor, compiler and linker options.

Add a new section about the "Python debug build".

4 years agobpo-43764: Fix `__match_args__` generation logic for dataclasses (GH-25284)
Brandt Bucher [Thu, 8 Apr 2021 19:54:34 +0000 (12:54 -0700)] 
bpo-43764: Fix `__match_args__` generation logic for dataclasses (GH-25284)

4 years agobpo-43760: Streamline dispatch sequence for machines without computed gotos. (GH...
Mark Shannon [Thu, 8 Apr 2021 10:22:55 +0000 (11:22 +0100)] 
bpo-43760: Streamline dispatch sequence for machines without computed gotos. (GH-25244)

* Do fetch and decode at end of opcode then jump directly to switch.
  Should allow compilers that don't support computed-gotos, specifically MSVC,
  to generate better code.

4 years agobpo-43770: _PyTypes_Init() inits _PyAnextAwaitable_Type (GH-25266)
Victor Stinner [Thu, 8 Apr 2021 07:58:15 +0000 (09:58 +0200)] 
bpo-43770: _PyTypes_Init() inits _PyAnextAwaitable_Type (GH-25266)

* Rename PyAnextAwaitable_Type to _PyAnextAwaitable_Type.
* Expose the type in the internal C API.

4 years agoFix broken test for MutableSet.pop() (GH-25209)
Stepan Sindelar [Wed, 7 Apr 2021 23:31:55 +0000 (01:31 +0200)] 
Fix broken test for MutableSet.pop() (GH-25209)

Changes the test to not assert concrete result of pop, but just that it
was an item from the set, and that the set shrunk by one.

4 years agobpo-39899: os.path.expanduser(): don't guess other Windows users' home directories...
Barney Gale [Wed, 7 Apr 2021 22:50:13 +0000 (23:50 +0100)] 
bpo-39899: os.path.expanduser(): don't guess other Windows users' home directories if the basename of the current user's home directory doesn't match their username. (GH-18841)

This makes `ntpath.expanduser()` match `pathlib.Path.expanduser()` in this regard, and is more in line with `posixpath.expanduser()`'s cautious approach.

Also remove the near-duplicate implementation of `expanduser()` in pathlib, and by doing so fix a bug where KeyError could be raised when expanding another user's home directory.

4 years agobpo-43770: _PyTypes_Init() inits more static types (GH-25265)
Victor Stinner [Wed, 7 Apr 2021 22:47:55 +0000 (00:47 +0200)] 
bpo-43770: _PyTypes_Init() inits more static types (GH-25265)

4 years agobpo-43770: Sort types in _PyTypes_Init() (GH-25263)
Victor Stinner [Wed, 7 Apr 2021 22:12:38 +0000 (00:12 +0200)] 
bpo-43770: Sort types in _PyTypes_Init() (GH-25263)

4 years agobpo-42923: Fix _Py_DumpExtensionModules() for NULL sysdict (GH-25262)
Victor Stinner [Wed, 7 Apr 2021 21:12:45 +0000 (23:12 +0200)] 
bpo-42923: Fix _Py_DumpExtensionModules() for NULL sysdict (GH-25262)

Fix Py_FatalError() is called before interp->sysdict is set.

4 years agobpo-43244: Rename pycore_ast.h functions to _PyAST_xxx() (GH-25252)
Victor Stinner [Wed, 7 Apr 2021 19:34:22 +0000 (21:34 +0200)] 
bpo-43244: Rename pycore_ast.h functions to _PyAST_xxx() (GH-25252)

Rename AST functions of pycore_ast.h to use the "_PyAST_" prefix.
Remove macros creating aliases without prefix. For example, Module()
becomes _PyAST_Module(). Update Grammar/python.gram to use
_PyAST_xxx() functions.

4 years agobpo-36540: Improve doc of function definition regarding positional-only arguments...
Saiyang Gou [Wed, 7 Apr 2021 19:06:43 +0000 (12:06 -0700)] 
bpo-36540: Improve doc of function definition regarding positional-only arguments (GH-25235)

4 years agobpo-39659: Route calls from pathlib.Path to os.getcwd() via the path accessor (GH...
Barney Gale [Wed, 7 Apr 2021 16:31:49 +0000 (17:31 +0100)] 
bpo-39659: Route calls from pathlib.Path to os.getcwd() via the path accessor (GH-18834)

4 years agobpo-42999: Expand and clarify pathlib.Path.link_to() documentation. (GH-24294)
Barney Gale [Wed, 7 Apr 2021 15:56:32 +0000 (16:56 +0100)] 
bpo-42999: Expand and clarify pathlib.Path.link_to() documentation. (GH-24294)

4 years agobpo-39906: Add follow_symlinks parameter to pathlib.Path.stat() and chmod() (GH-18864)
Barney Gale [Wed, 7 Apr 2021 15:53:39 +0000 (16:53 +0100)] 
bpo-39906: Add follow_symlinks parameter to pathlib.Path.stat() and chmod() (GH-18864)

4 years agobpo-43495 : Push missing frame block in compile.c (GH-24865)
tomKPZ [Wed, 7 Apr 2021 14:43:45 +0000 (07:43 -0700)] 
bpo-43495 : Push missing frame block in compile.c (GH-24865)

4 years agoImprove CDN purge script (GH-25251)
Steve Dower [Wed, 7 Apr 2021 12:14:00 +0000 (13:14 +0100)] 
Improve CDN purge script (GH-25251)

4 years agobpo-43075: Fix ReDoS in urllib AbstractBasicAuthHandler (GH-24391)
Yeting Li [Wed, 7 Apr 2021 11:27:41 +0000 (19:27 +0800)] 
bpo-43075: Fix ReDoS in urllib AbstractBasicAuthHandler (GH-24391)

Fix Regular Expression Denial of Service (ReDoS) vulnerability in
urllib.request.AbstractBasicAuthHandler. The ReDoS-vulnerable regex
has quadratic worst-case complexity and it allows cause a denial of
service when identifying crafted invalid RFCs. This ReDoS issue is on
the client side and needs remote attackers to control the HTTP server.

4 years agobpo-43244: Remove Yield macro from pycore_ast.h (GH-25243)
Victor Stinner [Wed, 7 Apr 2021 11:01:09 +0000 (13:01 +0200)] 
bpo-43244: Remove Yield macro from pycore_ast.h (GH-25243)

* pycore_ast.h no longer defines the Yield macro.
* Fix a compiler warning on Windows: "warning C4005: 'Yield': macro
  redefinition".
* Python-ast.c now defines directly functions with their real
  _Py_xxx() name, rather than xxx().
* Remove "#undef Yield" in C files including pycore_ast.h.

4 years agoCorrect micro release number and add a couple of asserts. (GH-25224)
Mark Shannon [Wed, 7 Apr 2021 09:52:07 +0000 (10:52 +0100)] 
Correct micro release number and add a couple of asserts. (GH-25224)

4 years agobpo-38605: Update "Future statements" docs since PEP 563 is always enabled (GH-25236)
Saiyang Gou [Wed, 7 Apr 2021 05:02:20 +0000 (22:02 -0700)] 
bpo-38605: Update "Future statements" docs since PEP 563 is always enabled (GH-25236)

Update documentation section for "Future statements" to reflect that `from __future__ import annotations` is on by default, and no features require using the future statement now.

4 years agobpo-40038: pathlib: remove partial support for preserving accessor when modifying...
Barney Gale [Wed, 7 Apr 2021 00:26:37 +0000 (01:26 +0100)] 
bpo-40038: pathlib: remove partial support for preserving accessor when modifying a path (GH-19342)

4 years agobpo-39895: Move `pathlib.Path.touch()` implementation into the path accessor. (GH...
Barney Gale [Wed, 7 Apr 2021 00:25:37 +0000 (01:25 +0100)] 
bpo-39895: Move `pathlib.Path.touch()` implementation into the path accessor. (GH-18838)

4 years agobpo-43105: Importlib now resolves relative paths when creating module spec objects...
Steve Dower [Wed, 7 Apr 2021 00:02:07 +0000 (01:02 +0100)] 
bpo-43105: Importlib now resolves relative paths when creating module spec objects from file locations (GH-25121)

4 years agobpo-39924: handle missing os functions more consistently in pathlib (GH-19220)
Barney Gale [Tue, 6 Apr 2021 23:01:22 +0000 (00:01 +0100)] 
bpo-39924: handle missing os functions more consistently in pathlib (GH-19220)

4 years agobpo-43567: Improved generated code refresh on Windows (GH-25120)
Steve Dower [Tue, 6 Apr 2021 22:54:43 +0000 (23:54 +0100)] 
bpo-43567: Improved generated code refresh on Windows (GH-25120)

Generated files are now refreshed automatically on regular build, or may be forcibly regenerated by calling `build.bat --regen`.

4 years agobpo-43755: Update docs to reflect that lambda is not allowed in `comp_if` since 3...
Saiyang Gou [Tue, 6 Apr 2021 22:15:37 +0000 (15:15 -0700)] 
bpo-43755: Update docs to reflect that lambda is not allowed in `comp_if` since 3.9 (GH-25231)

4 years agobump the bytecode magic number (GH-25225)
Dennis Sweeney [Tue, 6 Apr 2021 17:44:50 +0000 (13:44 -0400)] 
bump the bytecode magic number (GH-25225)

4 years agoUpdate pattern matching docs for changes to the PEP (#25185)
Ken Jin [Tue, 6 Apr 2021 16:03:00 +0000 (00:03 +0800)] 
Update pattern matching docs for changes to the PEP (#25185)

See:
- https://github.com/python/peps/pull/1909 (__match_args__ must be a tuple)
- https://github.com/python/peps/pull/1908 (allow keyword patterns for int(x) etc.)

4 years agobpo-42135: Deprecate implementations of find_module() and find_loader() (GH-25169)
Brett Cannon [Tue, 6 Apr 2021 15:56:57 +0000 (08:56 -0700)] 
bpo-42135: Deprecate implementations of find_module() and find_loader() (GH-25169)

4 years agobpo-41870: Update What's News 3.10 about vectorcall (#25219)
Dong-hee Na [Tue, 6 Apr 2021 15:43:59 +0000 (00:43 +0900)] 
bpo-41870: Update What's News 3.10 about vectorcall (#25219)

* bpo-41870: Update What's News 3.10 about vectorcall

* update

* Update Doc/whatsnew/3.10.rst

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
4 years agoFix blurb for bpo-43176. (GH-25215)
Eric V. Smith [Tue, 6 Apr 2021 14:08:18 +0000 (10:08 -0400)] 
Fix blurb for bpo-43176. (GH-25215)

4 years agobpo-41111: Don't build xxlimited with Py_TRACE_REFS macro (GH-25180)
Hai Shi [Tue, 6 Apr 2021 12:55:13 +0000 (20:55 +0800)] 
bpo-41111: Don't build xxlimited with Py_TRACE_REFS macro (GH-25180)

4 years agobpo-43745: Actually updates Windows release to OpenSSL 1.1.1k. (GH-25213)
Steve Dower [Tue, 6 Apr 2021 12:08:30 +0000 (13:08 +0100)] 
bpo-43745: Actually updates Windows release to OpenSSL 1.1.1k. (GH-25213)

Earlier releases were mislabelled and included 1.1.1i again.
The tag/directory name is updated to ensure that builds get the fresh bits. However, the openssl-bin-1.1.1k tag in the repository has been forcibly updated, so fresh builds will be fine even without this change.

4 years agobpo-43683: Handle generator entry in bytecode (GH-25138)
Mark Shannon [Tue, 6 Apr 2021 10:48:59 +0000 (11:48 +0100)] 
bpo-43683: Handle generator entry in bytecode (GH-25138)

* Handle check for sending None to starting generator and coroutine into bytecode.

* Document new bytecode and make it fail gracefully if mis-compiled.

4 years agobpo-43651: PEP 597: Fix pdeps used locale encoding (GH-25204)
Inada Naoki [Tue, 6 Apr 2021 08:02:54 +0000 (17:02 +0900)] 
bpo-43651: PEP 597: Fix pdeps used locale encoding (GH-25204)

4 years agobpo-17305: Link to the third-party idna package. (GH-25208)
Gregory P. Smith [Tue, 6 Apr 2021 07:55:45 +0000 (00:55 -0700)] 
bpo-17305: Link to the third-party idna package. (GH-25208)

So long as we don't have idna2008 in the standard library, we should at least point people to the third-party solution.

4 years agobpo-43176: Fix processing of empty dataclasses (GH-24484)
Iurii Kemaev [Tue, 6 Apr 2021 05:14:01 +0000 (06:14 +0100)] 
bpo-43176: Fix processing of empty dataclasses (GH-24484)

When a dataclass inherits from an empty base, all immutability checks are omitted. This PR fixes this and adds tests for it.

Automerge-Triggered-By: GH:ericvsmith
4 years agobpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25190)
Inada Naoki [Tue, 6 Apr 2021 04:02:22 +0000 (13:02 +0900)] 
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25190)

* Fix test_lzma
* Fix test_mailbox
* Fix test_mimetypes
* Fix test_posix

4 years agobpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25189)
Inada Naoki [Tue, 6 Apr 2021 02:18:41 +0000 (11:18 +0900)] 
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25189)

* Fix _sitebuiltins
* Fix test_inspect
* Fix test_interpreters
* Fix test_io
* Fix test_iter
* Fix test_json
* Fix test_linecache
* Fix test_lltrace
* Fix test_logging
* Fix logging

4 years agobpo-42128: __match_args__ can't be a list anymore (GH-25203)
Brandt Bucher [Tue, 6 Apr 2021 02:17:08 +0000 (19:17 -0700)] 
bpo-42128: __match_args__ can't be a list anymore (GH-25203)

4 years agobpo-43651: Fix EncodingWarning in sysconfig (GH-25192)
Inada Naoki [Tue, 6 Apr 2021 01:01:11 +0000 (10:01 +0900)] 
bpo-43651: Fix EncodingWarning in sysconfig (GH-25192)

4 years agobpo-20503: Show how isinstance() works with ABC registered classes. (GH-25175)
Raymond Hettinger [Mon, 5 Apr 2021 19:48:24 +0000 (12:48 -0700)] 
bpo-20503: Show how isinstance() works with ABC registered classes. (GH-25175)

4 years agobpo-36470: Allow dataclasses.replace() to handle InitVars with default values (GH...
Zackery Spytz [Mon, 5 Apr 2021 19:41:01 +0000 (13:41 -0600)] 
bpo-36470: Allow dataclasses.replace() to handle InitVars with default values (GH-20867)

Co-Authored-By: Claudiu Popa <pcmanticore@gmail.com>
Automerge-Triggered-By: GH:ericvsmith
4 years agobpo-43087: Fix error in ctypes "Incomplete Types" doc (GH-24404)
Zackery Spytz [Mon, 5 Apr 2021 19:21:00 +0000 (13:21 -0600)] 
bpo-43087: Fix error in ctypes "Incomplete Types" doc (GH-24404)

The previous "Fundamental data types" section says a c_char_p must be bytes (or None).

4 years agoFix typo in turtledemo.two_canvases. (GH-25194)
Terry Jan Reedy [Mon, 5 Apr 2021 17:19:13 +0000 (13:19 -0400)] 
Fix typo in turtledemo.two_canvases. (GH-25194)

4 years agoPost 3.10.0a7
Pablo Galindo [Mon, 5 Apr 2021 17:04:54 +0000 (18:04 +0100)] 
Post 3.10.0a7

4 years agoPython 3.10.0a7 v3.10.0a7
Pablo Galindo [Mon, 5 Apr 2021 16:38:40 +0000 (17:38 +0100)] 
Python 3.10.0a7

4 years agoFix the "make suspicious" check on the pprint docs (GH-25193)
Pablo Galindo [Mon, 5 Apr 2021 16:38:10 +0000 (17:38 +0100)] 
Fix the "make suspicious" check on the pprint docs (GH-25193)

4 years agobpo-43084: Return bool instead of int from curses.window.enclose() (GH-24398)
Serhiy Storchaka [Mon, 5 Apr 2021 13:50:24 +0000 (16:50 +0300)] 
bpo-43084: Return bool instead of int from curses.window.enclose() (GH-24398)

4 years agobpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25181)
Inada Naoki [Mon, 5 Apr 2021 04:11:23 +0000 (13:11 +0900)] 
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25181)

* Fix test_shutil
* Fix test_imp
* Fix test_import
* Fix test_importlib

4 years agobpo-43651: PEP 597: Fix EncodingWarning in test_filecmp (GH-25159)
Inada Naoki [Mon, 5 Apr 2021 03:32:35 +0000 (12:32 +0900)] 
bpo-43651: PEP 597: Fix EncodingWarning in test_filecmp (GH-25159)

4 years agobpo-43651: PEP 597: Fix test_email (GH-25158)
Inada Naoki [Mon, 5 Apr 2021 03:30:12 +0000 (12:30 +0900)] 
bpo-43651: PEP 597: Fix test_email (GH-25158)

4 years agobpo-41370: Add note about ForwardRefs and PEP585 generic types in docs (#25183)
Ken Jin [Sun, 4 Apr 2021 15:14:44 +0000 (23:14 +0800)] 
bpo-41370: Add note about ForwardRefs and PEP585 generic types in docs (#25183)

4 years agobpo-24160: Fix test_pdb refleaks failure (GH-25182)
Irit Katriel [Sun, 4 Apr 2021 15:04:53 +0000 (16:04 +0100)] 
bpo-24160: Fix test_pdb refleaks failure (GH-25182)

4 years agobpo-27129: Update magic numbers and bootstrapping for GH-25069 (GH-25172)
Dennis Sweeney [Sun, 4 Apr 2021 08:33:22 +0000 (04:33 -0400)] 
bpo-27129: Update magic numbers and bootstrapping for GH-25069 (GH-25172)

* Update magic numbers and bootstrapping for GH-25069

* add blurb

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
4 years agobpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25171)
Inada Naoki [Sun, 4 Apr 2021 08:01:10 +0000 (17:01 +0900)] 
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25171)

* Fix test_float
* Fix _osx_support
* Fix test_fstring
* Fix test_gc
* Fix test_gzip
* Fix test_hashlib
* Fix unrelated whitespace issue

Co-authored-by: Ned Deily <nad@python.org>
4 years agobpo-43325: Add FAQ entry for identity tests (GH-25168)
Raymond Hettinger [Sun, 4 Apr 2021 02:54:49 +0000 (19:54 -0700)] 
bpo-43325: Add FAQ entry for identity tests (GH-25168)

4 years agobpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25145)
Inada Naoki [Sun, 4 Apr 2021 00:01:23 +0000 (09:01 +0900)] 
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25145)

* test_asyncio
* test_bz2
* test_math
* test_cmath
* test_cmd_line
* test_cmd_line_script
* test_compile
* test_contextlib
* test_profile
* ctypes/test/test_find
* test_multiprocessing
* test_configparser
* test_csv
* test_dbm_dumb
* test_decimal
* test_difflib
* os.fdopen() calls io.text_encoding() to emit EncodingWarning for right place.

4 years agobpo-43720: Update import-related stdlib deprecation messages to say they will be...
Brett Cannon [Sat, 3 Apr 2021 22:31:15 +0000 (15:31 -0700)] 
bpo-43720: Update import-related stdlib deprecation messages to say they will be removed in Python 3.12 (GH-25167)

4 years agoReplace broken example code with correct simpler code. (GH-25162)
Raymond Hettinger [Sat, 3 Apr 2021 20:09:01 +0000 (13:09 -0700)] 
Replace broken example code with correct simpler code. (GH-25162)

The open() was missing 'w' to indicate it was in a write-mode.
Even then, the open().close() operation was distracting because
it is an unusual way to "touch" as file.  Using os.remove()
instead is simpler and less distracting.

4 years agoAdd more tests for the descriptor tutorial (GH-25164)
Raymond Hettinger [Sat, 3 Apr 2021 20:07:52 +0000 (13:07 -0700)] 
Add more tests for the descriptor tutorial (GH-25164)

4 years agobpo-43705: Document that SyntaxError's offsets are 1-indexed (GH-25153)
Ammar Askar [Fri, 2 Apr 2021 21:25:31 +0000 (17:25 -0400)] 
bpo-43705: Document that SyntaxError's offsets are 1-indexed (GH-25153)

Changed the inline mentions of the attributes into a proper attribute list like `SystemExit` has.

Automerge-Triggered-By: GH:gvanrossum
4 years agobpo-43672: raise ImportWarning when calling find_loader() (GH-25119)
Brett Cannon [Fri, 2 Apr 2021 19:35:32 +0000 (12:35 -0700)] 
bpo-43672: raise ImportWarning when calling find_loader() (GH-25119)

4 years agobpo-24160: Fix breakpoints persistence across multiple pdb sessions (GH-21989)
Irit Katriel [Fri, 2 Apr 2021 16:15:21 +0000 (17:15 +0100)] 
bpo-24160: Fix breakpoints persistence across multiple pdb sessions (GH-21989)

4 years agobpo-31956: Add start and stop parameters to array.index() (GH-25059)
Zackery Spytz [Fri, 2 Apr 2021 15:28:35 +0000 (09:28 -0600)] 
bpo-31956: Add start and stop parameters to array.index() (GH-25059)

Co-Authored-By: Anders Lorentsen <Phaqui@gmail.com>
4 years agobpo-41111: xxlimited.c defines Py_LIMITED_API (GH-25151)
Victor Stinner [Fri, 2 Apr 2021 14:48:11 +0000 (16:48 +0200)] 
bpo-41111: xxlimited.c defines Py_LIMITED_API (GH-25151)

xxlimited.c and xxlimited_35.c now define the Py_LIMITED_API macro,
rather than having to do it in the build recipe.

Co-authored-by: Hai Shi <shihai1992@gmail.com>
4 years agobpo-43688: Support "make regen-limited-abi" in debug mode (GH-25133)
Victor Stinner [Fri, 2 Apr 2021 14:46:08 +0000 (16:46 +0200)] 
bpo-43688: Support "make regen-limited-abi" in debug mode (GH-25133)

4 years agobpo-43688: Support the limited C API in debug mode (GH-25131)
Victor Stinner [Fri, 2 Apr 2021 13:45:37 +0000 (15:45 +0200)] 
bpo-43688: Support the limited C API in debug mode (GH-25131)

The limited C API is now supported if Python is built in debug mode
(if the Py_DEBUG macro is defined). In the limited C API, the
Py_INCREF() and Py_DECREF() functions are now implemented as opaque
function calls, rather than accessing directly the PyObject.ob_refcnt
member, if Python is built in debug mode and the Py_LIMITED_API macro
targets Python 3.10 or newer. It became possible to support the
limited C API in debug mode because the PyObject structure is the
same in release and debug mode since Python 3.8 (see bpo-36465).

The limited C API is still not supported in the --with-trace-refs
special build (Py_TRACE_REFS macro).

4 years agobpo-43687: Py_Initialize() creates singletons earlier (GH-25147)
Victor Stinner [Fri, 2 Apr 2021 13:28:13 +0000 (15:28 +0200)] 
bpo-43687: Py_Initialize() creates singletons earlier (GH-25147)

Reorganize pycore_interp_init() to initialize singletons before the
the first PyType_Ready() call. Fix an issue when Python is configured
using --without-doc-strings.

4 years agoDocument PyCode_Addr2Line function. (GH-25111)
Mark Shannon [Fri, 2 Apr 2021 12:24:57 +0000 (13:24 +0100)] 
Document PyCode_Addr2Line function. (GH-25111)

* Document PyCode_Addr2Line function.

* Clarify when to use PEP 626 line iterators.

4 years agobpo-43510: Fix emitting EncodingWarning from _io module. (GH-25146)
Inada Naoki [Fri, 2 Apr 2021 08:38:59 +0000 (17:38 +0900)] 
bpo-43510: Fix emitting EncodingWarning from _io module. (GH-25146)

I forget to check PyErr_WarnEx() return value. But it will fail when -Werror is used.

4 years agobpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25142)
Inada Naoki [Fri, 2 Apr 2021 03:53:46 +0000 (12:53 +0900)] 
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25142)

* test__xxsubinterpreters
* test_builtin
* test_doctest
* test_exceptions
* test_opcodes
* test_support
* test_argparse
* test_baseexception
* test_bdb
* test_bool
* test_asdl_parser

4 years agobpo-43700: Replace Zulip badge with Discourse badge (GH-25141)
Erlend Egeberg Aasland [Fri, 2 Apr 2021 03:30:40 +0000 (05:30 +0200)] 
bpo-43700: Replace Zulip badge with Discourse badge (GH-25141)

Automerge-Triggered-By: GH:zware
4 years agobpo-43651: Fix test_compileall with PEP 597 (GH-25128)
Inada Naoki [Fri, 2 Apr 2021 00:01:57 +0000 (09:01 +0900)] 
bpo-43651: Fix test_compileall with PEP 597 (GH-25128)

4 years agobpo-43651: Fix EncodingWarning in lib2to3/pgen2/pgen.py (GH-25127)
Inada Naoki [Thu, 1 Apr 2021 23:59:15 +0000 (08:59 +0900)] 
bpo-43651: Fix EncodingWarning in lib2to3/pgen2/pgen.py (GH-25127)

4 years agobpo-43651: Fix EncodingWarning in test_warnings (GH-25126)
Inada Naoki [Thu, 1 Apr 2021 23:57:05 +0000 (08:57 +0900)] 
bpo-43651: Fix EncodingWarning in test_warnings (GH-25126)

4 years agobpo-26053: Fix test_pdb.test_issue26053() (GH-25139)
Irit Katriel [Thu, 1 Apr 2021 19:05:51 +0000 (20:05 +0100)] 
bpo-26053: Fix test_pdb.test_issue26053() (GH-25139)

4 years agobpo-43677: Fix a minor error in Doc/howto/descriptor.rst (#25123)
Zackery Spytz [Thu, 1 Apr 2021 17:03:33 +0000 (11:03 -0600)] 
bpo-43677: Fix a minor error in Doc/howto/descriptor.rst (#25123)

It should be PyMethod_Type, not Py_MethodType.

4 years agobpo-26053: Fix args echoed by pdb run command (#22033)
Irit Katriel [Thu, 1 Apr 2021 15:25:59 +0000 (16:25 +0100)] 
bpo-26053: Fix args echoed by pdb run command (#22033)

4 years agobpo-27129: Use instruction offsets, not byte offsets, in bytecode and internally...
Mark Shannon [Thu, 1 Apr 2021 15:00:31 +0000 (16:00 +0100)] 
bpo-27129: Use instruction offsets, not byte offsets, in bytecode and internally. (GH-25069)

* Use instruction offset, rather than bytecode offset. Streamlines interpreter dispatch a bit, and removes most EXTENDED_ARGs for jumps.

* Change some uses of PyCode_Addr2Line to PyFrame_GetLineNumber

4 years agobpo-43688: Fix Py_LIMITED_API version of xxlimited (GH-25135)
Victor Stinner [Thu, 1 Apr 2021 13:09:33 +0000 (15:09 +0200)] 
bpo-43688: Fix Py_LIMITED_API version of xxlimited (GH-25135)

xxlimited targets Python 3.10, not Python 3.16: fix the hexadecimal
version number used in the Py_LIMITED_API macro.

4 years agobpo-43690: stable_abi.py no longer parses macros (GH-25136)
Victor Stinner [Thu, 1 Apr 2021 12:13:42 +0000 (14:13 +0200)] 
bpo-43690: stable_abi.py no longer parses macros (GH-25136)

The stable_abi.py script no longer parse macros. Macro targets can be
static inline functions which are not part of the stable ABI, only
part of the limited C API.

Run "make regen-limited-abi" to exclude PyType_HasFeature from
Doc/data/stable_abi.dat.

4 years agobpo-43688: Run make regen-limited-abi (GH-25134)
Victor Stinner [Thu, 1 Apr 2021 09:29:46 +0000 (11:29 +0200)] 
bpo-43688: Run make regen-limited-abi (GH-25134)

4 years agoFix typos in 3.10 "What's new" (GH-25104)
Don Kirkby [Thu, 1 Apr 2021 06:00:30 +0000 (23:00 -0700)] 
Fix typos in 3.10 "What's new" (GH-25104)

4 years agoWhen printing stats, move radix tree info to its own section. (GH-25125)
Tim Peters [Thu, 1 Apr 2021 03:46:31 +0000 (22:46 -0500)] 
When printing stats, move radix tree info to its own section. (GH-25125)

When printing stats, move radix tree info to its own section.
Restore that the breakdown of bytes in arenas exactly accounts for the total of arena bytes allocated.
Add an assert so that invariant doesn't break again.

4 years agobpo-43651: Fix EncodingWarning in test_io (GH-25097)
Inada Naoki [Thu, 1 Apr 2021 02:25:04 +0000 (11:25 +0900)] 
bpo-43651: Fix EncodingWarning in test_io (GH-25097)

4 years agobpo-43651: Fix EncodingWarning in test_file and test_file_eintr (GH-25109)
Inada Naoki [Thu, 1 Apr 2021 02:23:03 +0000 (11:23 +0900)] 
bpo-43651: Fix EncodingWarning in test_file and test_file_eintr (GH-25109)