]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agoGH-106214: Fix `test_opcache` to skip threaded tests on non-threaded platforms (GH... 106215/head
Hood Chatham [Wed, 28 Jun 2023 20:04:59 +0000 (13:04 -0700)] 
GH-106214: Fix `test_opcache` to skip threaded tests on non-threaded platforms (GH-106166)

This skips the test added in GH-105953 on threadless builds.

2 years agogh-104584: Emit macro expansions to opcode_metadata.h (#106163)
Guido van Rossum [Wed, 28 Jun 2023 18:28:07 +0000 (11:28 -0700)] 
gh-104584: Emit macro expansions to opcode_metadata.h (#106163)

This produces longer traces (superblocks?).

Also improved debug output (uop names are now printed instead of numeric opcodes). This would be simpler if the numeric opcode values were generated by generate_cases.py, but that's another project.

Refactored some code in generate_cases.py so the essential algorithm for cache effects is only run once. (Deciding which effects are used and what the total cache size is, regardless of what's used.)

2 years agogh-106197: Deduplicate tests in `test_buffer` (#106198)
Nikita Sobolev [Wed, 28 Jun 2023 14:43:41 +0000 (17:43 +0300)] 
gh-106197: Deduplicate tests in `test_buffer` (#106198)

2 years agogh-101100: Fix reference to `parse_args` in `optparse.rst` (#105265)
F3eQnxN3RriK [Wed, 28 Jun 2023 12:30:26 +0000 (21:30 +0900)] 
gh-101100: Fix reference to `parse_args` in `optparse.rst` (#105265)

2 years agogh-106200: Remove unused imports (#106201)
Nikita Sobolev [Wed, 28 Jun 2023 11:55:41 +0000 (14:55 +0300)] 
gh-106200: Remove unused imports (#106201)

2 years agogh-106118: Add O_CLOEXEC preprocessor guard (#106120)
Erlend E. Aasland [Wed, 28 Jun 2023 11:11:32 +0000 (13:11 +0200)] 
gh-106118: Add O_CLOEXEC preprocessor guard (#106120)

2 years agogh-101100: Fix reference to asynchronous methods (#106172)
F3eQnxN3RriK [Wed, 28 Jun 2023 10:43:11 +0000 (19:43 +0900)] 
gh-101100: Fix reference to asynchronous methods (#106172)

2 years agogh-105993: Add possible `None` return type to `asyncio.EventLoop.start_tls` docs...
Sam Bull [Wed, 28 Jun 2023 10:38:15 +0000 (11:38 +0100)] 
gh-105993: Add possible `None` return type to `asyncio.EventLoop.start_tls` docs (#105995)

2 years agogh-106162: fix test_array modifies warning filter (#106181)
Inada Naoki [Wed, 28 Jun 2023 07:50:36 +0000 (16:50 +0900)] 
gh-106162: fix test_array modifies warning filter (#106181)

2 years agoRefer to `TimeoutError` instead of `asyncio.TimeoutError` in `asyncio-task.rst` ...
lightdrk [Wed, 28 Jun 2023 05:21:38 +0000 (10:51 +0530)] 
Refer to `TimeoutError` instead of `asyncio.TimeoutError` in `asyncio-task.rst` (#106136)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agoFix c-analyzer for GCC: ignore LANG env var (#106173)
Victor Stinner [Wed, 28 Jun 2023 02:50:51 +0000 (04:50 +0200)] 
Fix c-analyzer for GCC: ignore LANG env var (#106173)

The c-analyzer doesn't support GCC localized messages, so just unset
the LANG environment variable.

2 years agoGH-104584: Fix test_capi.test_counter_optimizer() when run twice (#106171)
Victor Stinner [Wed, 28 Jun 2023 02:41:21 +0000 (04:41 +0200)] 
GH-104584: Fix test_capi.test_counter_optimizer() when run twice (#106171)

test_counter_optimizer() and test_long_loop() of test_capi now create
a new function at each call. Otherwise, the optimizer counters are
not the expected values when the test is run more than once.

2 years agogh-101634: regrtest reports decoding error as failed test (#106169)
Victor Stinner [Wed, 28 Jun 2023 02:26:52 +0000 (04:26 +0200)] 
gh-101634: regrtest reports decoding error as failed test (#106169)

When running the Python test suite with -jN option, if a worker stdout
cannot be decoded from the locale encoding report a failed testn so the
exitcode is non-zero.

2 years agogh-106168: PyTuple_SET_ITEM() now checks the index (#106164)
Victor Stinner [Wed, 28 Jun 2023 01:45:57 +0000 (03:45 +0200)] 
gh-106168: PyTuple_SET_ITEM() now checks the index (#106164)

PyTuple_SET_ITEM() and PyList_SET_ITEM() now check the index argument
with an assertion if Python is built in debug mode or is built with
assertions.

* list_extend() and _PyList_AppendTakeRef() now set the list size
  before calling PyList_SET_ITEM().
* PyStructSequence_GetItem() and PyStructSequence_SetItem() now check
  the index argument: must be lesser than REAL_SIZE(op).
* PyStructSequence_GET_ITEM() and PyStructSequence_SET_ITEM() are now
  aliases to PyStructSequence_GetItem() and
  PyStructSequence_SetItem().

2 years agoGH-106160: Fix test_gzip failing under WASI, which does not have zlib. (#106167)
T. Wouters [Wed, 28 Jun 2023 00:55:11 +0000 (02:55 +0200)] 
GH-106160: Fix test_gzip failing under WASI, which does not have zlib. (#106167)

Fix test_gzip's failure under WASI, which does not have zlib, by using
test.support.import_helper.import_module to import zlib. (gzip
unconditionally imports zlib, so this does not cause any new skips.)

2 years agogh-106084: Remove _PyObject_CallMethod() function (#106159)
Victor Stinner [Tue, 27 Jun 2023 23:34:37 +0000 (01:34 +0200)] 
gh-106084: Remove _PyObject_CallMethod() function (#106159)

Remove the following private functions from the public C API:

* _Py_CheckFunctionResult()
* _PyObject_CallMethod()
* _PyObject_CallMethodId()
* _PyObject_CallMethodIdNoArgs()
* _PyObject_CallMethodIdObjArgs()
* _PyObject_CallMethodIdOneArg()
* _PyObject_MakeTpCall()
* _PyObject_VectorcallMethodId()
* _PyStack_AsDict()

Move these functions to the internal C API (pycore_call.h).

No longer export the following functions:

* _PyObject_Call()
* _PyObject_CallMethod()
* _PyObject_CallMethodId()
* _PyObject_CallMethodIdObjArgs()
* _PyObject_Call_Prepend()
* _PyObject_FastCallDictTstate()
* _PyStack_AsDict()

The following functions are still exported for stdlib shared
extensions:

* _Py_CheckFunctionResult()
* _PyObject_MakeTpCall()

Mark the following internal functions as extern:

* _PyStack_UnpackDict()
* _PyStack_UnpackDict_Free()
* _PyStack_UnpackDict_FreeNoDecRef()

2 years agogh-104584: Change DEOPT_IF in uops executor (#106146)
Guido van Rossum [Tue, 27 Jun 2023 21:17:41 +0000 (14:17 -0700)] 
gh-104584: Change DEOPT_IF in uops executor (#106146)

This effectively reverts bb578a0, restoring the original DEOPT_IF() macro in ceval_macros.h, and redefining it in the Tier 2 interpreter. We can get rid of the PREDICTED() macros there as well!

2 years agogh-106149: move jump target resolution from optimizer to assembler (#106150)
Irit Katriel [Tue, 27 Jun 2023 19:24:58 +0000 (20:24 +0100)] 
gh-106149: move jump target resolution from optimizer to assembler (#106150)

2 years agoIDLE: Condense run.main threading.Thread start. (#106125)
Terry Jan Reedy [Tue, 27 Jun 2023 17:12:56 +0000 (13:12 -0400)] 
IDLE: Condense run.main threading.Thread start. (#106125)

Use daemon argument added in 3.3 and directly call .start.
Remove now unused 'sockthread' name.

2 years agogh-106140: Reorder some more fields to facilitate out-of-process inspection (#106148)
Pablo Galindo Salgado [Tue, 27 Jun 2023 16:09:15 +0000 (17:09 +0100)] 
gh-106140: Reorder some more fields to facilitate out-of-process inspection (#106148)

2 years agogh-106140: Reorder some fields to facilitate out-of-process inspection (#106143)
Pablo Galindo Salgado [Tue, 27 Jun 2023 15:26:53 +0000 (16:26 +0100)] 
gh-106140: Reorder some fields to facilitate out-of-process inspection (#106143)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2 years agogh-104584: Fix assert in DEOPT macro -- should fix buildbot (#106131)
Guido van Rossum [Tue, 27 Jun 2023 14:02:51 +0000 (07:02 -0700)] 
gh-104584: Fix assert in DEOPT macro -- should fix buildbot (#106131)

2 years agogh-104584: Add #line directives to executor_cases.c.h (#106126)
Guido van Rossum [Tue, 27 Jun 2023 13:56:39 +0000 (06:56 -0700)] 
gh-104584: Add #line directives to executor_cases.c.h (#106126)

2 years agogh-92788: Add docs for `ast.Module`, `ast.Expression`, and others (#101055)
Nikita Sobolev [Tue, 27 Jun 2023 13:43:49 +0000 (16:43 +0300)] 
gh-92788: Add docs for `ast.Module`, `ast.Expression`, and others (#101055)

2 years agoGH-105774: Clarify operation of normalize() (GH-106093)
Raymond Hettinger [Tue, 27 Jun 2023 04:12:22 +0000 (23:12 -0500)] 
GH-105774: Clarify operation of normalize() (GH-106093)

2 years agogh-106123: Modules/_sha3 appears to no longer be necessary (#106124)
Skip Montanaro [Tue, 27 Jun 2023 03:40:34 +0000 (22:40 -0500)] 
gh-106123: Modules/_sha3 appears to no longer be necessary (#106124)

2 years agogh-104584: Baby steps towards generating and executing traces (#105924)
Guido van Rossum [Tue, 27 Jun 2023 02:02:57 +0000 (19:02 -0700)] 
gh-104584: Baby steps towards generating and executing traces (#105924)

Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet -- this is infrastructure so we can experiment with optimizing passes. To enable it, pass ``-Xuops`` or set ``PYTHONUOPS=1``. To get debug output, set ``PYTHONUOPSDEBUG=N`` where ``N`` is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose).

All of this code is likely to change dramatically before the 3.13 feature freeze. But this is a first step.

2 years agoRevert "GH-96145: Add AttrDict to JSON module for use with object_hook (#96146)"...
Łukasz Langa [Mon, 26 Jun 2023 18:35:53 +0000 (18:35 +0000)] 
Revert "GH-96145: Add AttrDict to JSON module for use with object_hook (#96146)" (#105948)

This reverts commit 1f0eafa844bf5a380603d55e8d4b42d8c2a3439d.

2 years agogh-106107: document correct error that's raised when a mutable default value for...
Roderich Schupp [Mon, 26 Jun 2023 18:00:21 +0000 (20:00 +0200)] 
gh-106107: document correct error that's raised when a mutable default value for a field is detected (gh-106109)

2 years agoGH-105793: Add follow_symlinks argument to `pathlib.Path.is_dir()` and `is_file(...
Barney Gale [Mon, 26 Jun 2023 16:58:17 +0000 (17:58 +0100)] 
GH-105793: Add follow_symlinks argument to `pathlib.Path.is_dir()` and `is_file()` (GH-105794)

Brings `pathlib.Path.is_dir()` and `in line with `os.DirEntry.is_dir()`, which
will be important for implementing generic path walking and globbing.
Likewise `is_file()`.

2 years agogh-106111: Remove zipapp documentation on creating a Windows executable (#106112)
Paul Moore [Mon, 26 Jun 2023 16:14:20 +0000 (17:14 +0100)] 
gh-106111: Remove zipapp documentation on creating a Windows executable (#106112)

Remove zipapp documentation on creating a Windows executable

2 years agoUpdate test.support.interpreters to include missing RunFailedError import (#103841)
Bruce Eckel [Mon, 26 Jun 2023 15:30:20 +0000 (08:30 -0700)] 
Update test.support.interpreters to include missing RunFailedError import (#103841)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-106084: Remove _PyObject_RealIsInstance() function (#106106)
Victor Stinner [Mon, 26 Jun 2023 13:38:41 +0000 (15:38 +0200)] 
gh-106084: Remove _PyObject_RealIsInstance() function (#106106)

Remove the following functions from the public C API:

* _PyObject_RealIsInstance()
* _PyObject_RealIsSubclass()
* _Py_add_one_to_index_F()
* _Py_add_one_to_index_C()

Move _PyObject_RealIsInstance() and _PyObject_RealIsSubclass() to the
internal C API (pycore_abstract.h) and no longer export their symbols
(in libpython).

Make _Py_add_one_to_index_F() and _Py_add_one_to_index_C() functions
static: no longer export them.

2 years agogh-106084: Remove _PyObject_HasLen() function (#106103)
Victor Stinner [Mon, 26 Jun 2023 13:02:43 +0000 (15:02 +0200)] 
gh-106084: Remove _PyObject_HasLen() function (#106103)

Remove _PyObject_HasLen() and _PySequence_IterSearch() functions from
the public C API: move them to the internal C API
(pycore_abstract.h).

No longer export these symbols (in libpython).

Remove also unused pycore_initconfig.h include in typeobject.c.

2 years agogh-105927: Deprecate PyWeakref_GetObject() function (#106006)
Victor Stinner [Mon, 26 Jun 2023 10:10:53 +0000 (12:10 +0200)] 
gh-105927: Deprecate PyWeakref_GetObject() function (#106006)

Deprecate PyWeakref_GetObject() and PyWeakref_GET_OBJECT() functions.

2 years agogh-104527: zippapp will now avoid appending an archive to itself. (gh-106076)
Gabriel Venberg [Mon, 26 Jun 2023 09:09:08 +0000 (04:09 -0500)] 
gh-104527: zippapp will now avoid appending an archive to itself. (gh-106076)

zippapp will now avoid appending an archive to itself.

2 years agogh-106075: add `asyncio.taskgroups.__all__` to `asyncio.__all__` (#106090)
James Webber [Mon, 26 Jun 2023 07:54:03 +0000 (03:54 -0400)] 
gh-106075: add `asyncio.taskgroups.__all__` to `asyncio.__all__` (#106090)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agoImprove typing docs on the type of class objects (#106081)
Alex Waygood [Mon, 26 Jun 2023 07:13:48 +0000 (08:13 +0100)] 
Improve typing docs on the type of class objects (#106081)

2 years agogh-106084: Remove _PySequence_BytesToCharpArray() function (#106088)
Victor Stinner [Mon, 26 Jun 2023 06:30:59 +0000 (08:30 +0200)] 
gh-106084: Remove _PySequence_BytesToCharpArray() function (#106088)

Remove private _PySequence_BytesToCharpArray() and
_Py_FreeCharPArray() functions from the public C API: move these
functions from Objects/abstract.c to Modules/_posixsubprocess.c.

2 years agogh-106084: Remove old PyObject call aliases (#106085)
Victor Stinner [Mon, 26 Jun 2023 06:08:12 +0000 (08:08 +0200)] 
gh-106084: Remove old PyObject call aliases (#106085)

Remove old aliases which were kept backwards compatibility with
Python 3.8:

* _PyObject_CallMethodNoArgs()
* _PyObject_CallMethodOneArg()
* _PyObject_CallOneArg()
* _PyObject_FastCallDict()
* _PyObject_Vectorcall()
* _PyObject_VectorcallMethod()
* _PyVectorcall_Function()

Update code which used these aliases to use new names.

2 years agogh-106046: Improve error message from `os.fspath` if `__fspath__` is set to `None...
Alex Waygood [Sun, 25 Jun 2023 23:06:12 +0000 (00:06 +0100)] 
gh-106046: Improve error message from `os.fspath` if `__fspath__` is set to `None` (#106082)

2 years agoAdd end-of-file-fixer to pre-commit (#106065)
Hugo van Kemenade [Sun, 25 Jun 2023 10:44:23 +0000 (13:44 +0300)] 
Add end-of-file-fixer to pre-commit (#106065)

2 years agoDocs: add links to 'callable' term in sqlite3 docs (#106072)
Erlend E. Aasland [Sun, 25 Jun 2023 00:02:59 +0000 (02:02 +0200)] 
Docs: add links to 'callable' term in sqlite3 docs (#106072)

2 years agogh-106033: [docs] Improve C API GetItem & HasAttr notes. (#106047)
Gregory P. Smith [Sat, 24 Jun 2023 23:29:26 +0000 (16:29 -0700)] 
gh-106033: [docs] Improve C API GetItem & HasAttr notes. (#106047)

Use a note:: tag so that these dict and object API deficiencies show up clearly.

A caution:: tag was considered, but our current python docs rendering doesn't do much with that (no box or color change).  warning:: seemed too extreme.  note looks good.

2 years agoGH-104375: Use `versionchanged` to describe new arguments in pathlib docs (GH-104376)
Barney Gale [Sat, 24 Jun 2023 15:14:09 +0000 (16:14 +0100)] 
GH-104375: Use `versionchanged` to describe new arguments in pathlib docs (GH-104376)

2 years agogh-105987: Fix reference counting issue in `_asyncio._swap_current_task` (#105989)
chgnrdv [Sat, 24 Jun 2023 05:23:24 +0000 (08:23 +0300)] 
gh-105987: Fix reference counting issue in `_asyncio._swap_current_task` (#105989)

2 years agogh-102251: Disable non-rerunnable test in test_import (#106013)
Erlend E. Aasland [Fri, 23 Jun 2023 23:34:05 +0000 (01:34 +0200)] 
gh-102251: Disable non-rerunnable test in test_import (#106013)

2 years agoTyping docs: fix typo in annotating tuples comment (#106048)
Eamon Tracey [Fri, 23 Jun 2023 20:34:05 +0000 (16:34 -0400)] 
Typing docs: fix typo in annotating tuples comment (#106048)

2 years agogh-105730: support more callables in ExceptionGroup.split() and subgroup() (#106035)
Irit Katriel [Fri, 23 Jun 2023 18:47:47 +0000 (19:47 +0100)] 
gh-105730: support more callables in ExceptionGroup.split() and subgroup() (#106035)

2 years agogh-106033: Get rid of new occurrences of PyDict_GetItem and PyObject_HasAttr (GH...
Serhiy Storchaka [Fri, 23 Jun 2023 17:10:32 +0000 (20:10 +0300)] 
gh-106033: Get rid of new occurrences of PyDict_GetItem and PyObject_HasAttr (GH-106034)

These functions are broken by design because they discard any exceptions raised
inside, including MemoryError and KeyboardInterrupt.  They should not be
used in new code.

2 years agogh-105063: Disable test_peg_generator.TestCParser bco. ref leaks (#106024)
Erlend E. Aasland [Fri, 23 Jun 2023 17:04:17 +0000 (19:04 +0200)] 
gh-105063: Disable test_peg_generator.TestCParser bco. ref leaks (#106024)

Since gh-104798 (Use setuptools in peg-generator and reenable
tests), the TestCParser test case has been producing ref leaks.

2 years agogh-106030: Miscellaneous fixes in Python/suggestions.c (GH-106031)
Serhiy Storchaka [Fri, 23 Jun 2023 16:53:27 +0000 (19:53 +0300)] 
gh-106030: Miscellaneous fixes in Python/suggestions.c (GH-106031)

* PyDict_GetItem() and PyObject_HasAttr() suppress arbitrary errors and
  should not be used.
* PyUnicode_CompareWithASCIIString() only works if the second argument
  is ASCII string.
* Refleak in get_suggestions_for_name_error.
* Use of borrowed pointer after possible freeing (self).
* Add some missing error checks.

2 years agogh-105974: Revert unintentional behaviour change for protocols with non-callable...
Alex Waygood [Fri, 23 Jun 2023 14:59:25 +0000 (15:59 +0100)] 
gh-105974: Revert unintentional behaviour change for protocols with non-callable members and custom `__subclasshook__` methods (#105976)

2 years agoTyping docs: improve the guidance on annotating tuples (#106021)
Alex Waygood [Fri, 23 Jun 2023 14:33:20 +0000 (15:33 +0100)] 
Typing docs: improve the guidance on annotating tuples (#106021)

2 years agogh-85136: Remove disabled remote IMAP tests (#106022)
Erlend E. Aasland [Fri, 23 Jun 2023 13:39:50 +0000 (15:39 +0200)] 
gh-85136: Remove disabled remote IMAP tests (#106022)

Tests had been disabled since Jun 12, 2020 (gh-20836).

2 years agoGH-106012: Fix monitoring of static code objects (GH-106017)
Mark Shannon [Fri, 23 Jun 2023 12:18:29 +0000 (13:18 +0100)] 
GH-106012: Fix monitoring of static code objects (GH-106017)

2 years agoDocs: Avoid a DeprecationWarning in `pyspecific.py` when running with Sphinx >=6...
Alex Waygood [Fri, 23 Jun 2023 07:58:45 +0000 (08:58 +0100)] 
Docs: Avoid a DeprecationWarning in `pyspecific.py` when running with Sphinx >=6.1 (#105886)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-105927: Remove _PyWeakref_GetWeakrefCount() (#106007)
Victor Stinner [Fri, 23 Jun 2023 03:00:56 +0000 (05:00 +0200)] 
gh-105927: Remove _PyWeakref_GetWeakrefCount() (#106007)

Remove _PyWeakref_GetWeakrefCount() and _PyWeakref_ClearRef() from
the public C API: move them to the internal C API.

Refactor also _weakref_getweakrefs() code to make it more readable.

2 years agogh-105927: _ssl GET_SOCKET() uses _PyWeakref_GET_REF() (#106002)
Victor Stinner [Fri, 23 Jun 2023 01:02:02 +0000 (03:02 +0200)] 
gh-105927: _ssl GET_SOCKET() uses _PyWeakref_GET_REF() (#106002)

2 years agogh-105927: PyImport_AddModule() uses _PyWeakref_GET_REF() (#106001)
Victor Stinner [Thu, 22 Jun 2023 23:23:08 +0000 (01:23 +0200)] 
gh-105927: PyImport_AddModule() uses _PyWeakref_GET_REF() (#106001)

It now raises an exception if sys.modules doesn't hold a strong
reference to the module.

Elaborate the comment explaining why a weak reference is used to
create a borrowed reference.

2 years agogh-105922: Use PyImport_AddModuleRef() function (#105999)
Victor Stinner [Thu, 22 Jun 2023 22:04:39 +0000 (00:04 +0200)] 
gh-105922: Use PyImport_AddModuleRef() function (#105999)

Replace PyImport_AddModuleObject() + Py_XNewRef() with
PyImport_AddModuleRef() to get directly a strong reference.

2 years agoTest specialization's thread-safety (GH-105953)
Brandt Bucher [Thu, 22 Jun 2023 22:02:38 +0000 (15:02 -0700)] 
Test specialization's thread-safety (GH-105953)

2 years agogh-105979: Fix exception handling in `unmarshal_frozen_code` (`Python/import.c`)...
chgnrdv [Thu, 22 Jun 2023 21:30:19 +0000 (00:30 +0300)] 
gh-105979: Fix exception handling in `unmarshal_frozen_code` (`Python/import.c`) (#105980)

2 years agogh-105927: Avoid calling PyWeakref_GET_OBJECT() (#105997)
Victor Stinner [Thu, 22 Jun 2023 20:31:31 +0000 (22:31 +0200)] 
gh-105927: Avoid calling PyWeakref_GET_OBJECT() (#105997)

* Replace PyWeakref_GET_OBJECT() with _PyWeakref_GET_REF().
* _sqlite/blob.c now holds a strong reference to the blob object
  while calling close_blob().
* _xidregistry_find_type() now holds a strong reference to registered
  while using it.

2 years agogh-105927: Add _PyWeakref_IS_DEAD() function (#105992)
Victor Stinner [Thu, 22 Jun 2023 19:56:44 +0000 (21:56 +0200)] 
gh-105927: Add _PyWeakref_IS_DEAD() function (#105992)

* Add _PyWeakref_IS_DEAD() internal function.
* Modify is_dead_weakref() of Modules/_weakref.c and
  _pysqlite_drop_unused_cursor_references() to replace
  PyWeakref_GET_OBJECT() with _PyWeakref_IS_DEAD().
* Replace "int i" with "Py_ssize_t i" to iterate on cursors
  in _pysqlite_drop_unused_cursor_references().

2 years agogh-101538: Add experimental wasi-threads build (#101537)
YAMAMOTO Takashi [Thu, 22 Jun 2023 18:26:10 +0000 (03:26 +0900)] 
gh-101538: Add experimental wasi-threads build (#101537)

Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-98931: Add custom error messages to invalid import/from with multiple targets...
Pablo Galindo Salgado [Thu, 22 Jun 2023 15:56:40 +0000 (16:56 +0100)] 
gh-98931: Add custom error messages to invalid import/from with multiple targets (#105985)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agoGH-89812: Add `pathlib.UnsupportedOperation` (GH-105926)
Barney Gale [Thu, 22 Jun 2023 13:35:51 +0000 (14:35 +0100)] 
GH-89812: Add `pathlib.UnsupportedOperation` (GH-105926)

This new exception type is raised instead of `NotImplementedError` when
a path operation is not supported. It can be raised from `Path.readlink()`,
`symlink_to()`, `hardlink_to()`, `owner()` and `group()`. In a future
version of pathlib, it will be raised by `AbstractPath` for these methods
and others, such as `AbstractPath.mkdir()` and `unlink()`.

2 years agoGH-91095: Specialize calls to normal Python classes. (GH-99331)
Mark Shannon [Thu, 22 Jun 2023 08:48:19 +0000 (09:48 +0100)] 
GH-91095: Specialize calls to normal Python classes. (GH-99331)

2 years agogh-105481: refactor instr flag related code into a new InstructionFlags class (#105950)
Irit Katriel [Wed, 21 Jun 2023 23:14:43 +0000 (00:14 +0100)] 
gh-105481: refactor instr flag related code into a new InstructionFlags class (#105950)

2 years agogh-104212: Explain how to port imp.load_source() (#105978)
Victor Stinner [Wed, 21 Jun 2023 22:18:31 +0000 (00:18 +0200)] 
gh-104212: Explain how to port imp.load_source() (#105978)

Explain how to port removed imp.load_source() to importlib in What's
New in Python 3.12.

2 years agogh-84436: update docs on Py_None/Py_True/Py_False/Py_Ellipsis becoming immortal ...
Irit Katriel [Wed, 21 Jun 2023 20:13:25 +0000 (21:13 +0100)] 
gh-84436: update docs on Py_None/Py_True/Py_False/Py_Ellipsis becoming immortal (#105195)

2 years agogh-105927: finalize_modules_clear_weaklist() uses _PyWeakref_GET_REF() (#105971)
Victor Stinner [Wed, 21 Jun 2023 19:50:20 +0000 (21:50 +0200)] 
gh-105927: finalize_modules_clear_weaklist() uses _PyWeakref_GET_REF() (#105971)

finalize_modules_clear_weaklist() now holds a strong reference to the
module longer than before: replace PyWeakref_GET_OBJECT() with
_PyWeakref_GET_REF().

2 years agogh-105927: type_from_ref() uses _PyWeakref_GET_REF() (#105963)
Victor Stinner [Wed, 21 Jun 2023 14:35:58 +0000 (16:35 +0200)] 
gh-105927: type_from_ref() uses _PyWeakref_GET_REF() (#105963)

type_from_ref() now returns a strong reference to the type, instead
of a borrowed reference: replace PyWeakref_GET_OBJECT() with
_PyWeakref_GET_REF().

2 years agogh-105927: Fix test_weakref_capi() refleak (#105966)
Victor Stinner [Wed, 21 Jun 2023 14:35:41 +0000 (16:35 +0200)] 
gh-105927: Fix test_weakref_capi() refleak (#105966)

Test PyWeakref_GetRef(NULL) and  PyWeakref_GetObject(NULL).

2 years agogh-105927: _ctypes use PyWeakref_GetRef() (#105964)
Victor Stinner [Wed, 21 Jun 2023 14:34:27 +0000 (16:34 +0200)] 
gh-105927: _ctypes use PyWeakref_GetRef() (#105964)

Rename PyDict_GetItemProxy() to _PyDict_GetItemProxy() and mark it as
static. _PyDict_GetItemProxy() now returns a strong reference,
instead of a borrowed reference: replace PyWeakref_GET_OBJECT() with
_PyWeakref_GET_REF().

2 years agogh-105927: _ssl uses _PyWeakref_GET_REF() (#105965)
Victor Stinner [Wed, 21 Jun 2023 14:33:32 +0000 (16:33 +0200)] 
gh-105927: _ssl uses _PyWeakref_GET_REF() (#105965)

2 years agostdtypes.rst: remove a period (#105959)
Mathieu Dupuy [Wed, 21 Jun 2023 14:21:37 +0000 (16:21 +0200)] 
stdtypes.rst: remove a period (#105959)

2 years agogh-105927: _abc and _thread use PyWeakref_GetRef() (#105961)
Victor Stinner [Wed, 21 Jun 2023 13:44:25 +0000 (15:44 +0200)] 
gh-105927: _abc and _thread use PyWeakref_GetRef() (#105961)

Hold a strong reference on the object, rather than using a borrowed reference:
replace PyWeakref_GET_OBJECT() with PyWeakref_GetRef() and
_PyWeakref_GET_REF().

Remove assert(PyWeakref_CheckRef(localweakref)) since it's already
tested by _PyWeakref_GET_REF().

2 years agoUse CSV-separated outputs @ get-changed-files @ CI (#105151)
Sviatoslav Sydorenko [Wed, 21 Jun 2023 10:42:59 +0000 (12:42 +0200)] 
Use CSV-separated outputs @ get-changed-files @ CI (#105151)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-105927: Add PyWeakref_GetRef() function (#105932)
Victor Stinner [Wed, 21 Jun 2023 09:40:09 +0000 (11:40 +0200)] 
gh-105927: Add PyWeakref_GetRef() function (#105932)

Add tests on PyWeakref_NewRef(), PyWeakref_GetObject(),
PyWeakref_GET_OBJECT() and PyWeakref_GetRef().

2 years agoAdd Py_TYPE() to Doc/data/refcounts.dat (#105949)
Victor Stinner [Tue, 20 Jun 2023 21:57:54 +0000 (23:57 +0200)] 
Add Py_TYPE() to Doc/data/refcounts.dat (#105949)

2 years agogh-105915: Fix SyntaxWarning becoming a SyntaxError with -We in test_fstring (#105943)
Lysandros Nikolaou [Tue, 20 Jun 2023 14:13:07 +0000 (16:13 +0200)] 
gh-105915: Fix SyntaxWarning becoming a SyntaxError with -We in test_fstring (#105943)

2 years agogh-105915: Add 'r' prefix to not emit SyntaxWarning in test_fstring (#105940)
Lysandros Nikolaou [Tue, 20 Jun 2023 12:49:00 +0000 (14:49 +0200)] 
gh-105915: Add 'r' prefix to not emit SyntaxWarning in test_fstring (#105940)

Co-authored-by: @sunmy2019
2 years agogh-105938: Emit a SyntaxWarning for escaped braces in an f-string (#105939)
Lysandros Nikolaou [Tue, 20 Jun 2023 12:38:46 +0000 (14:38 +0200)] 
gh-105938: Emit a SyntaxWarning for escaped braces in an f-string (#105939)

2 years agomake regen-stdlib-module-names rejects test modules (#105921)
Victor Stinner [Tue, 20 Jun 2023 08:12:44 +0000 (10:12 +0200)] 
make regen-stdlib-module-names rejects test modules (#105921)

Make sure that sys.stdlib_module_names doesn't contain test modules.

2 years agogh-105927: Add _PyWeakref_GET_REF() internal function (#105929)
Victor Stinner [Tue, 20 Jun 2023 06:52:40 +0000 (08:52 +0200)] 
gh-105927: Add _PyWeakref_GET_REF() internal function (#105929)

Add new pycore_weakref.h internal header file.

2 years agogh-105922: Add PyImport_AddModuleRef() function (#105923)
Victor Stinner [Tue, 20 Jun 2023 06:48:14 +0000 (08:48 +0200)] 
gh-105922: Add PyImport_AddModuleRef() function (#105923)

* Add tests on PyImport_AddModuleRef(), PyImport_AddModule() and
  PyImport_AddModuleObject().
* pythonrun.c: Replace Py_XNewRef(PyImport_AddModule(name)) with
  PyImport_AddModuleRef(name).

2 years agogh-105927: Refactor weakrefobject.c (#105928)
Victor Stinner [Mon, 19 Jun 2023 23:31:17 +0000 (01:31 +0200)] 
gh-105927: Refactor weakrefobject.c (#105928)

* Rename proxy_checkref() to proxy_check_ref().
* proxy_check_ref() now checks the object, not the proxy.
* Most functions take PyObject* instead of PyWeakReference*.
* Remove redundant calls to PyWeakref_GET_OBJECT().

2 years agogh-105922: Refactor PyRun_InteractiveOneObjectEx() (#105925)
Victor Stinner [Mon, 19 Jun 2023 22:55:23 +0000 (00:55 +0200)] 
gh-105922: Refactor PyRun_InteractiveOneObjectEx() (#105925)

Refactor PyRun_InteractiveOneObjectEx(), _PyRun_SimpleFileObject()
and PyRun_SimpleStringFlags():

* Keep a strong reference to the __main__ module while using its
  dictionary (PyModule_GetDict()). Use PyImport_AddModule() with
  Py_XNewRef().
* Declare variables closer to where they are defined.
* Rename variables to use name longer than 1 character.
* Add pyrun_one_parse_ast() sub-function.

2 years agogh-105481: generate _specializations and _specialized_instructions from bytecodes...
Irit Katriel [Mon, 19 Jun 2023 22:47:04 +0000 (23:47 +0100)] 
gh-105481: generate _specializations and _specialized_instructions from bytecodes.c (#105913)

2 years agogh-105908: fix `barry_as_FLUFL` future import (#105909)
Crowthebird [Mon, 19 Jun 2023 21:50:57 +0000 (05:50 +0800)] 
gh-105908: fix `barry_as_FLUFL` future import (#105909)

2 years agoGH-105808: Fix a regression introduced in GH-101251 (#105910)
T. Wouters [Mon, 19 Jun 2023 17:09:04 +0000 (19:09 +0200)] 
GH-105808: Fix a regression introduced in GH-101251 (#105910)

Fix a regression introduced in pythonGH-101251, causing GzipFile.flush() to
not flush the compressor (nor pass along the zip_mode argument).

2 years agogh-104212: Explain how to port imp code to importlib (#105905)
Victor Stinner [Mon, 19 Jun 2023 14:13:11 +0000 (16:13 +0200)] 
gh-104212: Explain how to port imp code to importlib (#105905)

2 years agogh-71299: Fix __all__ in tokenize (#105907)
Lysandros Nikolaou [Mon, 19 Jun 2023 11:31:57 +0000 (13:31 +0200)] 
gh-71299: Fix __all__ in tokenize (#105907)

Co-authored-by: Unit03
2 years agoGH-104584: Assorted fixes for the optimizer API. (GH-105683)
Mark Shannon [Mon, 19 Jun 2023 09:32:20 +0000 (10:32 +0100)] 
GH-104584: Assorted fixes for the optimizer API. (GH-105683)

* Add test for long loops

* Clear ENTER_EXECUTOR when deopting code objects.

2 years agotyping docs: Improve the intro to each section (#105901)
Alex Waygood [Sun, 18 Jun 2023 23:54:29 +0000 (00:54 +0100)] 
typing docs: Improve the intro to each section (#105901)

2 years agogh-105875: Require SQLite 3.15.2 or newer (#105876)
Erlend E. Aasland [Sun, 18 Jun 2023 22:29:08 +0000 (00:29 +0200)] 
gh-105875: Require SQLite 3.15.2 or newer (#105876)

SQLite 3.15.2 was released 2016-11-28.

2 years agoDocs: move sphinx-lint to pre-commit (#105750)
Hugo van Kemenade [Sun, 18 Jun 2023 11:52:05 +0000 (14:52 +0300)] 
Docs: move sphinx-lint to pre-commit (#105750)

2 years agogh-105844: Use devguide terminology to denote versions (#105882)
Erlend E. Aasland [Sun, 18 Jun 2023 10:25:23 +0000 (12:25 +0200)] 
gh-105844: Use devguide terminology to denote versions (#105882)