]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
3 years agogh-91217: deprecate uu (GH-92009)
Brett Cannon [Thu, 28 Apr 2022 03:26:33 +0000 (20:26 -0700)] 
gh-91217: deprecate uu (GH-92009)

Automerge-Triggered-By: GH:brettcannon
3 years agoAdd note that headers added via urllib.request.add_header are added to redirected...
Ashwin Ramaswami [Wed, 27 Apr 2022 22:25:03 +0000 (18:25 -0400)] 
Add note that headers added via urllib.request.add_header are added to redirected requests (#30708)

3 years agogh-84459: Make wording more specific for Path.replace (GH-91853)
slateny [Wed, 27 Apr 2022 22:03:03 +0000 (15:03 -0700)] 
gh-84459: Make wording more specific for Path.replace (GH-91853)

#84459

3 years agoCorrect method name typo (#91970)
Simon de Vlieger [Wed, 27 Apr 2022 21:28:56 +0000 (23:28 +0200)] 
Correct method name typo (#91970)

3 years agogh-87999: Change warning type for numeric literal followed by keyword (GH-91980)
Serhiy Storchaka [Wed, 27 Apr 2022 17:15:14 +0000 (20:15 +0300)] 
gh-87999: Change warning type for numeric literal followed by keyword (GH-91980)

The warning emitted by the Python parser for a numeric literal
immediately followed by keyword has been changed from deprecation
warning to syntax warning.

3 years agogh-91810: Expand ElementTree.write() tests to use non-ASCII data (GH-91989)
Serhiy Storchaka [Wed, 27 Apr 2022 16:16:20 +0000 (19:16 +0300)] 
gh-91810: Expand ElementTree.write() tests to use non-ASCII data (GH-91989)

3 years agogh-91498: socket: Add TCP_CONNECTION_INFO on macOS (#69256)
David CARLIER [Wed, 27 Apr 2022 12:47:17 +0000 (13:47 +0100)] 
gh-91498: socket: Add TCP_CONNECTION_INFO on macOS (#69256)

Fixes GH-91498

3 years agogh-91719: Mark pycore_opcode.h as generated in .gitattributes (#91976)
Dennis Sweeney [Wed, 27 Apr 2022 10:45:40 +0000 (06:45 -0400)] 
gh-91719: Mark pycore_opcode.h as generated in .gitattributes (#91976)

3 years agogh-91320: Add _Py_reinterpret_cast() macro (#91959)
Victor Stinner [Wed, 27 Apr 2022 08:40:57 +0000 (10:40 +0200)] 
gh-91320: Add _Py_reinterpret_cast() macro (#91959)

Fix C++ compiler warnings about "old-style cast"
(g++ -Wold-style-cast) in the Python C API.  Use C++
reinterpret_cast<> and static_cast<> casts when the Python C API is
used in C++.

Example of fixed warning:

    Include/object.h:107:43: error: use of old-style cast to
    ‘PyObject*’ {aka ‘struct _object*’} [-Werror=old-style-cast]
    #define _PyObject_CAST(op) ((PyObject*)(op))

Add _Py_reinterpret_cast() and _Py_static_cast() macros.

3 years agoFix missing `f` prefix on f-strings (GH-91910)
Alexander Shadchin [Wed, 27 Apr 2022 06:30:54 +0000 (09:30 +0300)] 
Fix missing `f` prefix on f-strings (GH-91910)

3 years agogh-68966: Deprecate the mailcap module (#91951)
Victor Stinner [Tue, 26 Apr 2022 20:43:50 +0000 (22:43 +0200)] 
gh-68966: Deprecate the mailcap module (#91951)

3 years agobpo-21761: Clarify __file__/__cached__ in import reference (GH-31565)
slateny [Tue, 26 Apr 2022 19:12:02 +0000 (12:12 -0700)] 
bpo-21761: Clarify __file__/__cached__ in import reference (GH-31565)

Automerge-Triggered-By: GH:brettcannon
3 years agogh-91870: Remove unsupported SRE opcode CALL (GH-91872)
Serhiy Storchaka [Tue, 26 Apr 2022 18:07:25 +0000 (21:07 +0300)] 
gh-91870: Remove unsupported SRE opcode CALL (GH-91872)

It was initially added to support atomic groups, but that
support was never fully implemented, and CALL was only left
in the compiler, but not interpreter and parser.

ATOMIC_GROUP is now used to support atomic groups.

3 years agogh-91217: deprecate telnetlib (GH-91958)
Brett Cannon [Tue, 26 Apr 2022 17:45:08 +0000 (10:45 -0700)] 
gh-91217: deprecate telnetlib (GH-91958)

3 years agogh-91917: Fix test_zipfile on non-UTF-8 locale (GH-91921)
Serhiy Storchaka [Tue, 26 Apr 2022 05:01:33 +0000 (08:01 +0300)] 
gh-91917: Fix test_zipfile on non-UTF-8 locale (GH-91921)

Skip the extraction test if file names are not encodable.

3 years agogh-91916: Fix test_runpy on non-UTF-8 locale (GH-91920)
Serhiy Storchaka [Tue, 26 Apr 2022 05:00:47 +0000 (08:00 +0300)] 
gh-91916: Fix test_runpy on non-UTF-8 locale (GH-91920)

If use a non-builtin codec, partially implemented in Python
(e.g. ISO-8859-15), a new RecursionError (with empty error message)
can be raised while handle a RecursionError.

Testing for error message was needed to distinguish
a recursion error from arbitrary RuntimeError. After introducing
RecursionError, it became unnecessary.

3 years agogh-91914: Fix test_curses on non-UTF-8 locale (GH-91919)
Serhiy Storchaka [Tue, 26 Apr 2022 04:59:56 +0000 (07:59 +0300)] 
gh-91914: Fix test_curses on non-UTF-8 locale (GH-91919)

3 years agogh-91915: Fix test_netrc on non-UTF-8 locale (GH-91918)
Serhiy Storchaka [Tue, 26 Apr 2022 04:58:41 +0000 (07:58 +0300)] 
gh-91915: Fix test_netrc on non-UTF-8 locale (GH-91918)

3 years agogh-91860: Add typing.dataclass_transform (PEP 681) (#91861)
Jelle Zijlstra [Tue, 26 Apr 2022 03:30:25 +0000 (20:30 -0700)] 
gh-91860: Add typing.dataclass_transform (PEP 681) (#91861)

Copied from typing-extensions (python/typing#1054, python/typing#1120).

Documentation is intentionally omitted, so we can focus on getting the
runtime part in before the feature freeze.

3 years agogh-91217: deprecate sunau (GH-91866)
Brett Cannon [Mon, 25 Apr 2022 23:26:43 +0000 (16:26 -0700)] 
gh-91217: deprecate sunau (GH-91866)

3 years agogh-91401: Add a failsafe way to disable vfork. (#91490)
Gregory P. Smith [Mon, 25 Apr 2022 23:19:39 +0000 (16:19 -0700)] 
gh-91401: Add a failsafe way to disable vfork. (#91490)

Just in case there is ever an issue with _posixsubprocess's use of
vfork() due to the complexity of using it properly and potential
directions that Linux platforms where it defaults to on could take, this
adds a failsafe so that users can disable its use entirely by setting
a global flag.

No known reason to disable it exists. But it'd be a shame to encounter
one and not be able to use CPython without patching and rebuilding it.

See the linked issue for some discussion on reasoning.

Also documents the existing way to disable posix_spawn.

3 years agobpo-46907: Update Windows installer to SQLite 3.38.2 (GH-32147)
Mariusz Felisiak [Mon, 25 Apr 2022 22:33:45 +0000 (00:33 +0200)] 
bpo-46907: Update Windows installer to SQLite 3.38.2 (GH-32147)

3 years agogh-91719: Add pycore_opcode.h internal header file (#91906)
Victor Stinner [Mon, 25 Apr 2022 22:14:30 +0000 (00:14 +0200)] 
gh-91719: Add pycore_opcode.h internal header file (#91906)

Move the following API from Include/opcode.h (public C API) to a new
Include/internal/pycore_opcode.h header file (internal C API):

* EXTRA_CASES
* _PyOpcode_Caches
* _PyOpcode_Deopt
* _PyOpcode_Jump
* _PyOpcode_OpName
* _PyOpcode_RelativeJump

3 years agogh-64783: Fix signal.NSIG value on FreeBSD (#91929)
Victor Stinner [Mon, 25 Apr 2022 22:13:31 +0000 (00:13 +0200)] 
gh-64783: Fix signal.NSIG value on FreeBSD (#91929)

Fix signal.NSIG value on FreeBSD to accept signal numbers greater
than 32, like signal.SIGRTMIN and signal.SIGRTMAX.

* Add Py_NSIG constant.
* Add pycore_signal.h internal header file.
* _Py_Sigset_Converter() now includes the range of valid signals in
  the error message.

3 years agogh-89653: PEP 670: Functions don't cast pointers (#91697)
Victor Stinner [Mon, 25 Apr 2022 22:11:34 +0000 (00:11 +0200)] 
gh-89653: PEP 670: Functions don't cast pointers (#91697)

In the limited C API version 3.11 and newer, the following functions
no longer cast their object pointer argument with _PyObject_CAST() or
_PyObject_CAST_CONST():

* Py_REFCNT(), Py_TYPE(), Py_SIZE()
* Py_SET_REFCNT(), Py_SET_TYPE(), Py_SET_SIZE()
* Py_IS_TYPE()
* Py_INCREF(), Py_DECREF()
* Py_XINCREF(), Py_XDECREF()
* Py_NewRef(), Py_XNewRef()
* PyObject_TypeCheck()
* PyType_Check()
* PyType_CheckExact()

Split Py_DECREF() implementation in 3 versions to make the code more
readable.

Update the xxlimited.c extension, which uses the limited C API
version 3.11, to pass PyObject* to these functions.

3 years agogh-91880: add try/except around `signal.signal` (#91881)
David Hewitt [Mon, 25 Apr 2022 15:56:20 +0000 (16:56 +0100)] 
gh-91880: add try/except around `signal.signal` (#91881)

Fixes gh-91880.

3 years agogh-91904: Fix setting envvar PYTHONREGRTEST_UNICODE_GUARD (GH-91905)
Serhiy Storchaka [Mon, 25 Apr 2022 14:35:14 +0000 (17:35 +0300)] 
gh-91904: Fix setting envvar PYTHONREGRTEST_UNICODE_GUARD (GH-91905)

It always failed on non-UTF-8 locale and prevented running regrtests.

3 years agogh-90633: Improve error and docs for typing.assert_never (#91720)
Jelle Zijlstra [Mon, 25 Apr 2022 13:40:18 +0000 (06:40 -0700)] 
gh-90633: Improve error and docs for typing.assert_never (#91720)

Closes #90633

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
3 years agogh-84461: Include _emscripten_info in pythoninfo output (GH-91907)
Christian Heimes [Mon, 25 Apr 2022 10:58:25 +0000 (13:58 +0300)] 
gh-84461: Include _emscripten_info in pythoninfo output (GH-91907)

3 years agogh-91888: add a `:gh:` role to the documentation (#91889)
Ezio Melotti [Mon, 25 Apr 2022 10:05:54 +0000 (12:05 +0200)] 
gh-91888: add a `:gh:` role to the documentation (#91889)

* Add a new :gh:`...` role for GitHub issues.

* Fix a GitHub id to use the :gh: role.

* Add Misc/NEWS entry.

* Refactoring and rephrasing.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
3 years agoRewrite audio.py to jive with image.py (#91886)
Barry Warsaw [Sun, 24 Apr 2022 22:50:07 +0000 (15:50 -0700)] 
Rewrite audio.py to jive with image.py (#91886)

Similar to the rewrite of email/mime/image.py and associated test after the
deprecation of imghdr.py, thisrewrites email/mime/audio.py and associated
tests after the deprecation of sndhdr.py.

Closes #91885

3 years agogh-91821: Make decimal test succeed consistently (#91825)
Jelle Zijlstra [Sun, 24 Apr 2022 22:02:57 +0000 (15:02 -0700)] 
gh-91821: Make decimal test succeed consistently (#91825)

The test relies on precision being set to 9, but some ways of
invoking this test leave it set to 28 instead. I don't know
exactly how it happens, but setting the precision directly should
make the behavior consistent.

3 years agogh-91491: What's New in 3.11 section for typing PEPs (#91721)
Jelle Zijlstra [Sun, 24 Apr 2022 21:13:15 +0000 (14:13 -0700)] 
gh-91491: What's New in 3.11 section for typing PEPs (#91721)

Other aspects of typing aren't covered yet; I'll do that in a
separate PR.

3 years agoSimplify testing the warning filename (GH-91868)
Serhiy Storchaka [Sun, 24 Apr 2022 07:23:59 +0000 (10:23 +0300)] 
Simplify testing the warning filename (GH-91868)

The context manager result has the "filename" attribute.

3 years agogh-91230: Concise catch_warnings with simplefilter (#91435)
Zac Hatfield-Dodds [Sun, 24 Apr 2022 00:55:22 +0000 (17:55 -0700)] 
gh-91230: Concise catch_warnings with simplefilter (#91435)

3 years agogh-91217: deprecate spwd (#91846)
Brett Cannon [Sat, 23 Apr 2022 21:48:17 +0000 (14:48 -0700)] 
gh-91217: deprecate spwd (#91846)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
3 years agoRE: Pre-split the list of opcode names (GH-91859)
Serhiy Storchaka [Sat, 23 Apr 2022 15:49:23 +0000 (18:49 +0300)] 
RE: Pre-split the list of opcode names (GH-91859)

1. It makes them interned.
2. It allows to add comments to individual opcodes.

3 years agogh-84461: Add --enable-wasm-pthreads and more file systems (GH-91820)
Christian Heimes [Sat, 23 Apr 2022 12:59:33 +0000 (15:59 +0300)] 
gh-84461: Add --enable-wasm-pthreads and more file systems (GH-91820)

3 years agogh-91308: Simplify parsing inline flag "x" (verbose) (GH-91855)
Serhiy Storchaka [Sat, 23 Apr 2022 09:50:42 +0000 (12:50 +0300)] 
gh-91308: Simplify parsing inline flag "x" (verbose) (GH-91855)

3 years agoRE: Add more tests for inline flag "x" and re.VERBOSE (GH-91854)
Serhiy Storchaka [Sat, 23 Apr 2022 09:49:06 +0000 (12:49 +0300)] 
RE: Add more tests for inline flag "x" and re.VERBOSE (GH-91854)

3 years agogh-84461: Add sys._emscripten_info, improve docs and build (gh-91781)
Christian Heimes [Sat, 23 Apr 2022 07:52:16 +0000 (10:52 +0300)] 
gh-84461: Add sys._emscripten_info, improve docs and build (gh-91781)

3 years agogh-88116: Enhance the inspect frame APIs to use the extended position information...
Pablo Galindo Salgado [Sat, 23 Apr 2022 02:16:48 +0000 (03:16 +0100)] 
gh-88116: Enhance the inspect frame APIs to use the extended position information (GH-91531)

3 years agogh-85864: Mark positional-only args in io docs (#91683)
slateny [Sat, 23 Apr 2022 00:30:52 +0000 (17:30 -0700)] 
gh-85864: Mark positional-only args in io docs (#91683)

3 years agogh-91547: Remove "Undocumented modules" page (#91682)
Shantanu [Fri, 22 Apr 2022 23:01:52 +0000 (16:01 -0700)] 
gh-91547: Remove "Undocumented modules" page (#91682)

3 years agogh-91217: deprecate-sndhdr (#91806)
Brett Cannon [Fri, 22 Apr 2022 22:48:03 +0000 (15:48 -0700)] 
gh-91217: deprecate-sndhdr (#91806)

Also inline necessary functionality from `sndhdr` into `email.mime.audio` for `MIMEAudio`.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
3 years agobpo-46720: Add support for path-like objects to multiprocessing.set_executable for...
Géry Ogam [Fri, 22 Apr 2022 22:47:09 +0000 (00:47 +0200)] 
bpo-46720: Add support for path-like objects to multiprocessing.set_executable for Windows (GH-31279)

This bring the API to be on a par with Unix-like systems.

3 years agogh-91575: Add a script for generating data for case-insensitive matching in re (GH...
Serhiy Storchaka [Fri, 22 Apr 2022 18:37:46 +0000 (21:37 +0300)] 
gh-91575: Add a script for generating data for case-insensitive matching in re (GH-91660)

Also test that all extra cases are in BMP.

3 years agogh-91700: Validate the group number in conditional expression in RE (GH-91702)
Serhiy Storchaka [Fri, 22 Apr 2022 16:53:10 +0000 (19:53 +0300)] 
gh-91700: Validate the group number in conditional expression in RE (GH-91702)

In expression (?(group)...) an appropriate re.error is now
raised if the group number refers to not defined group.

Previously it raised RuntimeError: invalid SRE code.

3 years agogh-90568: Fix exception type for \N with a named sequence in RE (GH-91665)
Serhiy Storchaka [Fri, 22 Apr 2022 15:35:28 +0000 (18:35 +0300)] 
gh-90568: Fix exception type for \N with a named sequence in RE (GH-91665)

re.error is now raised instead of TypeError.

3 years agogh-89279: In ceval.c, redefine some macros for speed (#32387)
Guido van Rossum [Fri, 22 Apr 2022 14:46:26 +0000 (07:46 -0700)] 
gh-89279: In ceval.c, redefine some macros for speed (#32387)

Macros Py_DECREF, Py_XDECREF, Py_IS_TYPE, _Py_atomic_load_32bit_impl
and _Py_DECREF_SPECIALIZED are redefined as macros
that completely replace the inline functions of the same name.
These three came out in the top four of functions that (in MSVC)
somehow weren't inlined.

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
3 years agogh-91764: Mark version typing.Unpack and LiteralString were added in (#91817)
Dominic Davis-Foster [Fri, 22 Apr 2022 14:28:39 +0000 (15:28 +0100)] 
gh-91764: Mark version typing.Unpack and LiteralString were added in (#91817)

Closes GH-91764

3 years agogh-89653: PEP 670: Amend docs (GH-91813)
Erlend Egeberg Aasland [Fri, 22 Apr 2022 12:59:18 +0000 (14:59 +0200)] 
gh-89653: PEP 670: Amend docs (GH-91813)

3 years agogh-80527: Deprecate PEP 623 Unicode functions (#91801)
Victor Stinner [Fri, 22 Apr 2022 11:05:36 +0000 (13:05 +0200)] 
gh-80527: Deprecate PEP 623 Unicode functions (#91801)

Deprecate functions:

* PyUnicode_AS_DATA()
* PyUnicode_AS_UNICODE()
* PyUnicode_GET_DATA_SIZE()
* PyUnicode_GET_SIZE()

Previously, these functions were macros and so it wasn't possible to
decorate them with Py_DEPRECATED().

3 years agoDocs: Clarify availability of PyOS_CheckStack (GH-91816)
Petr Viktorin [Fri, 22 Apr 2022 10:44:43 +0000 (12:44 +0200)] 
Docs: Clarify availability of PyOS_CheckStack (GH-91816)

3 years agogh-91291: Accept attributes as keyword arguments in decimal.localcontext (#32242)
Sam Ezeh [Fri, 22 Apr 2022 04:27:15 +0000 (05:27 +0100)] 
gh-91291: Accept attributes as keyword arguments in decimal.localcontext (#32242)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agobpo-43224: Implement pickling of TypeVarTuples (#32119)
Matthew Rahtz [Fri, 22 Apr 2022 04:22:53 +0000 (05:22 +0100)] 
bpo-43224: Implement pickling of TypeVarTuples (#32119)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agogh-91217: deprecate-pipes (GH-91779)
Brett Cannon [Fri, 22 Apr 2022 02:28:34 +0000 (19:28 -0700)] 
gh-91217: deprecate-pipes (GH-91779)

3 years agogh-69093: Add indexing and slicing support to sqlite3.Blob (#91599)
Erlend Egeberg Aasland [Fri, 22 Apr 2022 01:45:16 +0000 (03:45 +0200)] 
gh-69093: Add indexing and slicing support to sqlite3.Blob (#91599)

Authored-by: Aviv Palivoda <palaviv@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@innova.no>
3 years agogh-91156: Use `locale.getencoding()` instead of getpreferredencoding (GH-91732)
Inada Naoki [Fri, 22 Apr 2022 01:39:24 +0000 (10:39 +0900)] 
gh-91156: Use `locale.getencoding()` instead of getpreferredencoding (GH-91732)

Co-authored-by: Victor Stinner <vstinner@python.org>
3 years agogh-89653: Add assertions to unicodeobject.h functions (#91800)
Victor Stinner [Thu, 21 Apr 2022 21:26:25 +0000 (23:26 +0200)] 
gh-89653: Add assertions to unicodeobject.h functions (#91800)

3 years agogh-89653: PEP 670: Convert unicodeobject.h macros to functions (#91799)
Victor Stinner [Thu, 21 Apr 2022 21:07:13 +0000 (23:07 +0200)] 
gh-89653: PEP 670: Convert unicodeobject.h macros to functions (#91799)

Convert unicodeobject.h macros to static inline functions:

* PyUnicode_AS_DATA()
* PyUnicode_AS_UNICODE()
* PyUnicode_GET_DATA_SIZE()
* PyUnicode_GET_SIZE()

Static inline functions are wrapped by macros which casts arguments
with _PyObject_CAST() to prevent introducing new compiler warnings
when passing "const PyObject*".

3 years agogh-89373: _Py_Dealloc() checks tp_dealloc exception (#32357)
Victor Stinner [Thu, 21 Apr 2022 21:04:01 +0000 (23:04 +0200)] 
gh-89373: _Py_Dealloc() checks tp_dealloc exception (#32357)

If Python is built in debug mode, _Py_Dealloc() now ensures that the
tp_dealloc function leaves the current exception unchanged.

3 years agogh-79315: Add Include/cpython/pythread.h header (#91798)
Victor Stinner [Thu, 21 Apr 2022 21:00:42 +0000 (23:00 +0200)] 
gh-79315: Add Include/cpython/pythread.h header (#91798)

3 years agogh-79315: Add Include/cpython/modsupport.h header (#91797)
Victor Stinner [Thu, 21 Apr 2022 21:00:26 +0000 (23:00 +0200)] 
gh-79315: Add Include/cpython/modsupport.h header (#91797)

3 years agogh-89653: PEP 670: Group deprecated API in unicodeobject.h (#91796)
Victor Stinner [Thu, 21 Apr 2022 20:44:23 +0000 (22:44 +0200)] 
gh-89653: PEP 670: Group deprecated API in unicodeobject.h (#91796)

3 years agogh-91768: C API no longer use "const PyObject*" type (#91769)
Victor Stinner [Thu, 21 Apr 2022 20:07:19 +0000 (22:07 +0200)] 
gh-91768: C API no longer use "const PyObject*" type (#91769)

Py_REFCNT(), Py_TYPE(), Py_SIZE() and Py_IS_TYPE() functions argument
type is now "PyObject*", rather than "const PyObject*".

* Replace also "const PyObject*" with "PyObject*" in functions:

  * _Py_strhex_impl()
  * _Py_strhex_with_sep()
  * _Py_strhex_bytes_with_sep()

* Remove _PyObject_CAST_CONST() and _PyVarObject_CAST_CONST() macros.
* Py_IS_TYPE() can now use Py_TYPE() in its implementation.

3 years agogh-89653: PEP 670: Convert unicodeobject.h macros to functions (#91773)
Victor Stinner [Thu, 21 Apr 2022 19:53:18 +0000 (21:53 +0200)] 
gh-89653: PEP 670: Convert unicodeobject.h macros to functions (#91773)

Convert unicodeobject.h macros to static inline functions:

* PyUnicode_MAX_CHAR_VALUE()
* PyUnicode_READ()
* PyUnicode_READY()
* PyUnicode_READ_CHAR()
* PyUnicode_WRITE()

Move PyUnicode_READY() after _PyUnicode_Ready(), since it uses
_PyUnicode_Ready().

Static inline functions are wrapped by macros which casts arguments
with _PyObject_CAST() and casts 'kind' arguments to "unsigned int" to
prevent introducing new compiler warnings when passing "const
PyObject*".

3 years agoGH-91719: Make MSVC generate somewhat faster switch code (#91718)
Guido van Rossum [Thu, 21 Apr 2022 18:53:57 +0000 (11:53 -0700)] 
GH-91719: Make MSVC generate somewhat faster switch code (#91718)

Apparently a switch on an 8-bit quantity where all cases are
present generates a more efficient jump (doing only one indexed
memory load instead of two).

So we make opcode and use_tracing uint8_t, and generate a macro
full of extra `case NNN:` lines for all unused opcodes.

See https://github.com/faster-cpython/ideas/issues/321#issuecomment-1103263673

3 years agoGH-88116: Document that PyCodeNew is dangerous, and make PyCode_NewEmpty less dangero...
Mark Shannon [Thu, 21 Apr 2022 18:08:36 +0000 (19:08 +0100)] 
GH-88116: Document that PyCodeNew is dangerous, and make PyCode_NewEmpty less dangerous. (GH-91790)

3 years agoGH-88756: Update docs for PEP 523 eval function type. (GH-91788)
Mark Shannon [Thu, 21 Apr 2022 17:14:01 +0000 (18:14 +0100)] 
GH-88756: Update docs for PEP 523 eval function type. (GH-91788)

3 years agobpo-47169: Export PyOS_CheckStack on Windows (GH-32414)
Petr Viktorin [Thu, 21 Apr 2022 16:03:25 +0000 (18:03 +0200)] 
bpo-47169: Export PyOS_CheckStack on Windows (GH-32414)

3 years agoGH-88116: Use a compact format to represent end line and column offsets. (GH-91666)
Mark Shannon [Thu, 21 Apr 2022 15:10:37 +0000 (16:10 +0100)] 
GH-88116: Use a compact format to represent end line and column offsets. (GH-91666)

* Stores all location info in linetable to conform to PEP 626.

* Remove column table from code objects.

* Remove end-line table from code objects.

* Document new location table format

3 years agogh-89653: PEP 670: Convert tuple macros to functions (#91786)
Victor Stinner [Thu, 21 Apr 2022 14:52:54 +0000 (16:52 +0200)] 
gh-89653: PEP 670: Convert tuple macros to functions (#91786)

Convert macros to static inline functions:

* PyTuple_GET_SIZE()
* PyTuple_SET_ITEM()
* PyList_GET_SIZE()
* PyList_SET_ITEM()

Add a macro converting arguments to PyTupleObject*, PyListObject* or
PyObject* to prevent emitting new compiler warnings.

According to PEP 670, PyTuple_GET_ITEM() and PyList_GET_ITEM() are
left as macros.

3 years agogh-91782: Define static_assert() macro on FreeBSD (#91787)
Victor Stinner [Thu, 21 Apr 2022 14:40:34 +0000 (16:40 +0200)] 
gh-91782: Define static_assert() macro on FreeBSD (#91787)

On FreeBSD, if the static_assert() macro is not defined, define it in
Python until <sys/cdefs.h> supports C11:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255290

3 years agogh-89653: PEP 670: Convert PyWeakref_GET_OBJECT() to function (#91785)
Victor Stinner [Thu, 21 Apr 2022 14:01:47 +0000 (16:01 +0200)] 
gh-89653: PEP 670: Convert PyWeakref_GET_OBJECT() to function (#91785)

Convert the PyWeakref_GET_OBJECT() macro to a static inline function.
Add an assertion to check the argument with PyWeakref_Check(). Add a
macro converting the argument to PyObject* to prevent emitting new
compiler warning.

3 years agogh-91636: Don't clear required fields of function objects (GH-91651)
Dennis Sweeney [Thu, 21 Apr 2022 06:06:35 +0000 (02:06 -0400)] 
gh-91636: Don't clear required fields of function objects (GH-91651)

3 years agobpo-42066: CookieJar cookies should not be sorted (GH-22745)
Iman Kermani [Thu, 21 Apr 2022 01:45:24 +0000 (06:15 +0430)] 
bpo-42066: CookieJar cookies should not be sorted (GH-22745)

3 years agogh-90623: signal.raise_signal() calls PyErr_CheckSignals() (#91756)
Victor Stinner [Thu, 21 Apr 2022 01:14:57 +0000 (03:14 +0200)] 
gh-90623: signal.raise_signal() calls PyErr_CheckSignals() (#91756)

signal.raise_signal() and os.kill() now call PyErr_CheckSignals() to
check immediately for pending signals.

3 years agoRevert "gh-85567: Register a cleanup function to close files for FileType objects...
Victor Stinner [Thu, 21 Apr 2022 01:10:51 +0000 (03:10 +0200)] 
Revert "gh-85567: Register a cleanup function to close files for FileType objects in argparse (#32257)" (#91771)

This reverts commit 328dbc051f84bd5fdf61101bb4fa61d85f8b7feb.

3 years agogh-89653: PEP 670: Convert unicodeobject.h macros to functions (#91705)
Victor Stinner [Thu, 21 Apr 2022 00:51:17 +0000 (02:51 +0200)] 
gh-89653: PEP 670: Convert unicodeobject.h macros to functions (#91705)

Convert unicodeobject.h macros to static inline functions:

* PyUnicode_CHECK_INTERNED()
* PyUnicode_DATA(), _PyUnicode_COMPACT_DATA(),
  _PyUnicode_NONCOMPACT_DATA()
* PyUnicode_GET_LENGTH()
* PyUnicode_IS_ASCII()
* PyUnicode_IS_COMPACT()
* PyUnicode_IS_COMPACT_ASCII()
* PyUnicode_IS_READY()

Reorder functions to declare functions before their first usage.

Static inline functions are wrapped by macros which casts
arguments with _PyObject_CAST() to prevent introducing
new compiler warnings when passing "const PyObject*".

3 years agoMinor improvements to grammar and markup. (GH-91762)
Raymond Hettinger [Wed, 20 Apr 2022 21:02:47 +0000 (16:02 -0500)] 
Minor improvements to grammar and markup. (GH-91762)

3 years agoFix typo in GH Issue template (GH-91759)
Mariatta Wijaya [Wed, 20 Apr 2022 19:18:30 +0000 (12:18 -0700)] 
Fix typo in GH Issue template (GH-91759)

Typo in the word enhancement.

3 years agogh-91731: Replace Py_BUILD_ASSERT() with static_assert() (#91730)
Victor Stinner [Wed, 20 Apr 2022 17:26:40 +0000 (19:26 +0200)] 
gh-91731: Replace Py_BUILD_ASSERT() with static_assert() (#91730)

Python 3.11 now uses C11 standard which adds static_assert()
to <assert.h>.

* In pytime.c, replace Py_BUILD_ASSERT() with preprocessor checks on
  SIZEOF_TIME_T with #error.
* On macOS, py_mach_timebase_info() now accepts timebase members with
  the same size than _PyTime_t.
* py_get_monotonic_clock() now saturates GetTickCount64() to
  _PyTime_MAX: GetTickCount64() is unsigned, whereas _PyTime_t is
  signed.

3 years agobpo-23747: Enhance platform doc, document default behavior (GH-31462)
slateny [Wed, 20 Apr 2022 16:23:40 +0000 (09:23 -0700)] 
bpo-23747: Enhance platform doc, document default behavior (GH-31462)

3 years agoCast to (destructor) to fix compiler warnings (GH-91711)
Dennis Sweeney [Wed, 20 Apr 2022 15:15:45 +0000 (11:15 -0400)] 
Cast to (destructor) to fix compiler warnings (GH-91711)

3 years agobuild(deps): bump actions/upload-artifact from 2.3.1 to 3 (#32227)
dependabot[bot] [Wed, 20 Apr 2022 15:04:56 +0000 (08:04 -0700)] 
build(deps): bump actions/upload-artifact from 2.3.1 to 3 (#32227)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2.3.1 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2.3.1...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agobuild(deps): bump actions/cache from 2.1.7 to 3.0.1 (#32228)
dependabot[bot] [Wed, 20 Apr 2022 14:53:08 +0000 (07:53 -0700)] 
build(deps): bump actions/cache from 2.1.7 to 3.0.1 (#32228)

Bumps [actions/cache](https://github.com/actions/cache) from 2.1.7 to 3.0.1.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v2.1.7...v3.0.1)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agogh-91632: Fix generic_alias_iterator to be finalized at exit. (GH-91727)
Dong-hee Na [Wed, 20 Apr 2022 14:10:41 +0000 (23:10 +0900)] 
gh-91632: Fix generic_alias_iterator to be finalized at exit. (GH-91727)

3 years agogh-89770: [PEP-678] add exception notes to tutorial (GH-30441)
Irit Katriel [Wed, 20 Apr 2022 12:43:10 +0000 (13:43 +0100)] 
gh-89770: [PEP-678] add exception notes to tutorial (GH-30441)

3 years agogh-91731: Build Python with -std=c11 (#91733)
Victor Stinner [Wed, 20 Apr 2022 11:19:05 +0000 (13:19 +0200)] 
gh-91731: Build Python with -std=c11 (#91733)

Python is now built with "-std=c11" compiler option, rather than
"-std=c99".

3 years agogh-91734: Fix ossaudio support on Solaris (GH-91735)
Jakub Kulík [Wed, 20 Apr 2022 10:46:08 +0000 (12:46 +0200)] 
gh-91734: Fix ossaudio support on Solaris (GH-91735)

3 years agobpo-30718: Add information about text buffering (GH-32351)
slateny [Wed, 20 Apr 2022 08:24:53 +0000 (01:24 -0700)] 
bpo-30718: Add information about text buffering (GH-32351)

3 years agoClean-up the argparse docs quick links table (GH-91726)
Raymond Hettinger [Wed, 20 Apr 2022 06:21:54 +0000 (01:21 -0500)] 
Clean-up the argparse docs quick links table (GH-91726)

3 years agogh-91020: Add `PyBytes_Type.tp_alloc` for subclass (GH-91686)
Inada Naoki [Wed, 20 Apr 2022 05:06:29 +0000 (14:06 +0900)] 
gh-91020: Add `PyBytes_Type.tp_alloc` for subclass (GH-91686)

3 years agoAdd link to sys.path in os lib (#91679)
slateny [Wed, 20 Apr 2022 03:59:48 +0000 (20:59 -0700)] 
Add link to sys.path in os lib (#91679)

3 years agobuild(deps): bump actions/checkout from 2 to 3 (#32226)
dependabot[bot] [Wed, 20 Apr 2022 03:50:07 +0000 (20:50 -0700)] 
build(deps): bump actions/checkout from 2 to 3 (#32226)

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years agoFix awkward sentence in signal docs (#91508)
AJ Jordan [Wed, 20 Apr 2022 01:20:25 +0000 (21:20 -0400)] 
Fix awkward sentence in signal docs (#91508)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agobpo-46075: Store localhost cookies in CookieJar (#30108)
Nick [Tue, 19 Apr 2022 20:08:06 +0000 (20:08 +0000)] 
bpo-46075: Store localhost cookies in CookieJar (#30108)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agobuild(deps): bump actions/setup-python from 2 to 3 (#31630)
dependabot[bot] [Tue, 19 Apr 2022 20:03:58 +0000 (13:03 -0700)] 
build(deps): bump actions/setup-python from 2 to 3 (#31630)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 3.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agogh-90667: Add specializations of Py_DECREF when types are known (GH-30872)
Dennis Sweeney [Tue, 19 Apr 2022 18:02:19 +0000 (14:02 -0400)] 
gh-90667: Add specializations of Py_DECREF when types are known (GH-30872)