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

2 years agogh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and replace...
Irit Katriel [Sat, 17 Jun 2023 16:00:16 +0000 (17:00 +0100)] 
gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and replace by their new versions (#105865)

2 years agoCI: Bump macOS build to use OpenSSL v3.0 (#105538)
Erlend E. Aasland [Fri, 16 Jun 2023 19:00:37 +0000 (21:00 +0200)] 
CI: Bump macOS build to use OpenSSL v3.0 (#105538)

2 years agoGH-105840: Fix assertion failures when specializing calls with too many __defaults__...
Brandt Bucher [Fri, 16 Jun 2023 18:01:15 +0000 (11:01 -0700)] 
GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105847)

2 years agogh-105678: document SET_FUNCTION_ATTRIBUTE (#105843)
Carl Meyer [Fri, 16 Jun 2023 17:36:59 +0000 (12:36 -0500)] 
gh-105678: document SET_FUNCTION_ATTRIBUTE (#105843)

2 years agogh-104799: PEP 695 backward compatibility for ast.unparse (#105846)
Jelle Zijlstra [Fri, 16 Jun 2023 16:31:23 +0000 (09:31 -0700)] 
gh-104799: PEP 695 backward compatibility for ast.unparse (#105846)

2 years agogh-105834: Add tests for calling `issubclass()` between two protocols (#105835)
Alex Waygood [Fri, 16 Jun 2023 15:47:55 +0000 (16:47 +0100)] 
gh-105834: Add tests for calling `issubclass()` between two protocols (#105835)

Some parts of the implementation of `typing.Protocol` had poor test coverage

2 years agoCI: Remove docs build from Azure Pipelines (#105823)
Hugo van Kemenade [Fri, 16 Jun 2023 11:04:34 +0000 (14:04 +0300)] 
CI: Remove docs build from Azure Pipelines (#105823)

2 years agogh-105844: Consistently use 'minor version' for X.Y versions (#105851)
Erlend E. Aasland [Fri, 16 Jun 2023 08:41:47 +0000 (10:41 +0200)] 
gh-105844: Consistently use 'minor version' for X.Y versions (#105851)

2 years agoFix inaccuracies in "Assorted Topics" section of "Defining Extension Types" tutorial...
chgnrdv [Fri, 16 Jun 2023 07:10:59 +0000 (10:10 +0300)] 
Fix inaccuracies in "Assorted Topics" section of "Defining Extension Types" tutorial (#104969)

2 years agogh-105433: Add `pickle` tests for PEP695 (#105443)
Nikita Sobolev [Fri, 16 Jun 2023 00:58:40 +0000 (03:58 +0300)] 
gh-105433: Add `pickle` tests for PEP695 (#105443)

2 years agobpo-44530: Document the change in MAKE_FUNCTION behavior (#93189)
Alex Doe [Fri, 16 Jun 2023 00:04:57 +0000 (18:04 -0600)] 
bpo-44530: Document the change in MAKE_FUNCTION behavior (#93189)

* bpo-44530: Document the change in MAKE_FUNCTION behavior

Fixes dis module documentation for MAKE_FUNCTION due to https://github.com/python/cpython/commit/2f180ce2cb6e6a7e3c517495e0f4873d6aaf5f2f (bpo-44530, released as part of 3.11) removes the qualified name at TOS

2 years agoGH-103124: Multiline statement support for pdb (GH-103125)
Tian Gao [Thu, 15 Jun 2023 23:34:42 +0000 (16:34 -0700)] 
GH-103124: Multiline statement support for pdb (GH-103125)

2 years agoGH-105588: Add missing error checks to some obj2ast_* converters (GH-105589)
Brandt Bucher [Thu, 15 Jun 2023 22:45:13 +0000 (15:45 -0700)] 
GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589)

2 years agogh-105831: Fix NEWS blurb from gh-105828 (#105833)
Lysandros Nikolaou [Thu, 15 Jun 2023 17:10:33 +0000 (19:10 +0200)] 
gh-105831: Fix NEWS blurb from gh-105828 (#105833)

2 years agogh-105820: Fix tok_mode expression buffer in file & readline tokenizer (#105828)
Lysandros Nikolaou [Thu, 15 Jun 2023 16:21:24 +0000 (18:21 +0200)] 
gh-105820: Fix tok_mode expression buffer in file & readline tokenizer (#105828)

2 years agogh-105751, test_ctypes: Remove disabled tests (#105826)
Victor Stinner [Thu, 15 Jun 2023 12:22:01 +0000 (14:22 +0200)] 
gh-105751, test_ctypes: Remove disabled tests (#105826)

* The following tests were disabled since the initial ctypes commit
  in 2006, commit babddfca758abe34ff12023f63b18d745fae7ca9:

  * Callbacks.test_char_p()
  * DeletePointerTestCase.test_X()
  * NumberTestCase.test_perf()
  * StructureTestCase.test_subclass_creation()
  * Tests.test_X() of test_byteswap

* NumberTestCase.test_bool_from_address() was disabled in 2007 by
  commit 5dc4fe09b7648f9801558e766b21a3d3b2dcad3b.
* Remove check_perf() and run_test() of test_numbers.

2 years agogh-105821: Use a raw f-string in test_httpservers.py (#105822)
Pablo Galindo Salgado [Thu, 15 Jun 2023 10:48:01 +0000 (11:48 +0100)] 
gh-105821: Use a raw f-string in test_httpservers.py (#105822)

Use a raw f-string in test_httpservers.py

2 years agogh-105751: Remove platform usage in test_ctypes (#105819)
Victor Stinner [Thu, 15 Jun 2023 09:44:54 +0000 (11:44 +0200)] 
gh-105751: Remove platform usage in test_ctypes (#105819)

The MACHINE variable is no longer used in test_structures.

2 years agogh-105751: Reenable disable test_ctypes tests (#105818)
Victor Stinner [Thu, 15 Jun 2023 09:36:41 +0000 (11:36 +0200)] 
gh-105751: Reenable disable test_ctypes tests (#105818)

Reenable 3 tests:

* test_overflow()
* test_basic_wstrings()
* test_toolong()

2 years agogh-105751: Remove dead code in test_ctypes (#105817)
Victor Stinner [Thu, 15 Jun 2023 09:31:09 +0000 (11:31 +0200)] 
gh-105751: Remove dead code in test_ctypes (#105817)

* Remove "except: print(tp); raise" debug code.
* Remove unused NoNullHandle() function.
* Remove commented code.

2 years agoMore reorganisation of the typing docs (#105787)
Alex Waygood [Thu, 15 Jun 2023 05:52:18 +0000 (06:52 +0100)] 
More reorganisation of the typing docs (#105787)

2 years agoImprove docs for `typing.dataclass_transform` (#105792)
Alex Waygood [Thu, 15 Jun 2023 05:51:42 +0000 (06:51 +0100)] 
Improve docs for `typing.dataclass_transform` (#105792)

2 years agoGH-89812: Churn `pathlib.Path` test methods (#105807)
Barney Gale [Thu, 15 Jun 2023 01:31:30 +0000 (02:31 +0100)] 
GH-89812: Churn `pathlib.Path` test methods (#105807)

Re-arrange `pathlib.Path` test methods in source code. No other changes.

The test methods are arranged in two groups. The first group checks
`stat()`, `open()`, `iterdir()`, `readlink()`, and derived methods like
`exists()`, `read_text()`, `glob()` and `resolve()`. The second group
checks all other `Path` methods. To minimise the diff I've maintained the
method order within groups where possible.

This patch prepares the ground for a new `_AbstractPath` class, which will
support methods in the first group above. By churning the test methods
here, subsequent patches will be easier to review and less likely to break
things.

2 years agogh-105800: Issue SyntaxWarning in f-strings for invalid escape sequences (#105801)
Pablo Galindo Salgado [Thu, 15 Jun 2023 00:08:12 +0000 (01:08 +0100)] 
gh-105800: Issue SyntaxWarning in f-strings for invalid escape sequences (#105801)

2 years agogh-105751: Cleanup test_ctypes imports (#105803)
Victor Stinner [Wed, 14 Jun 2023 23:31:45 +0000 (01:31 +0200)] 
gh-105751: Cleanup test_ctypes imports (#105803)

* Move imports at top level and sort imports.
* Replace c_buffer() with create_string_buffer(): c_buffer is a
  deprecated alias.
* PEP 8: Add empty lines for readability between imports and classes.

2 years agogh-105481: add HAS_JUMP flag to opcode metadata (#105791)
Irit Katriel [Wed, 14 Jun 2023 23:14:22 +0000 (00:14 +0100)] 
gh-105481: add HAS_JUMP flag to opcode metadata (#105791)

2 years agogh-105751: test_ctypes avoids the operator module (GH-105797)
Victor Stinner [Wed, 14 Jun 2023 21:29:05 +0000 (23:29 +0200)] 
gh-105751: test_ctypes avoids the operator module (GH-105797)

* Replace operator.delitem(obj, index) with "del obj[index]".
* Replace operator.setitem(obj, index, value) with
  "obj[index] = value".
* Replace delattr(obj, "attr) with "del obj.attr".
* Replace grc() with sys.getrefcount() for readability.

2 years agogh-105751: test_ctypes: Remove @need_symbol decorator (GH-105798)
Victor Stinner [Wed, 14 Jun 2023 20:56:01 +0000 (22:56 +0200)] 
gh-105751: test_ctypes: Remove @need_symbol decorator (GH-105798)

Remove the @need_symbol('...') decorator of test.test_ctypes since
requested symbols are now always always available in ctypes.

Use the @unittest.skipUnless() decorator directly for the two types
only available on Windows:

* ctypes.WINFUNCTYPE
* ctypes.oledll

2 years agogh-104909: Implement conditional stack effects for macros (#105748)
Guido van Rossum [Wed, 14 Jun 2023 20:50:48 +0000 (13:50 -0700)] 
gh-104909: Implement conditional stack effects for macros (#105748)

2 years agogh-75905: Remove test_xmlrpc_net: skipped since 2017 (#105796)
Victor Stinner [Wed, 14 Jun 2023 19:26:34 +0000 (21:26 +0200)] 
gh-75905: Remove test_xmlrpc_net: skipped since 2017 (#105796)

test_xmlrpc_net was skipped since 2017:
commit 73ffd3f2036179ed54591ef0455e5ba5694ae5bd.

The public buildbot.python.org server has no XML-RPC interface
anymore, and no replacement server was found in 6 years.

2 years agogh-105481: Fix types and a bug for pseudos (#105788)
Guido van Rossum [Wed, 14 Jun 2023 17:06:50 +0000 (10:06 -0700)] 
gh-105481: Fix types and a bug for pseudos (#105788)

2 years agoUpdate DSL docs for cases generator (#105753)
Guido van Rossum [Wed, 14 Jun 2023 15:19:24 +0000 (08:19 -0700)] 
Update DSL docs for cases generator (#105753)

* Clarify things around goto error/ERROR_IF a bit
* Remove docs for super-instructions
* Add pseudo; fix heading markup

2 years agoGH-77273: Better bytecodes for f-strings (GH-6132)
Mark Shannon [Wed, 14 Jun 2023 15:15:08 +0000 (16:15 +0100)] 
GH-77273: Better bytecodes for f-strings (GH-6132)

2 years agoxmlrpc.client uses datetime.datetime.isoformat() (#105741)
Victor Stinner [Wed, 14 Jun 2023 15:00:40 +0000 (17:00 +0200)] 
xmlrpc.client uses datetime.datetime.isoformat() (#105741)

Reimplement _iso8601_format() using the datetime isoformat() method.
Ignore the timezone.

Co-Authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2 years agogh-105570: Deprecate unusual ways of creating empty TypedDicts (#105780)
Alex Waygood [Wed, 14 Jun 2023 14:58:41 +0000 (15:58 +0100)] 
gh-105570: Deprecate unusual ways of creating empty TypedDicts (#105780)

Deprecate two methods of creating typing.TypedDict classes with 0 fields using the functional syntax: `TD = TypedDict("TD")` and `TD = TypedDict("TD", None)`. Both will be disallowed in Python 3.15. To create a TypedDict class with 0 fields, either use `class TD(TypedDict): pass` or `TD = TypedDict("TD", {})`.

2 years agogh-105196: Fix indentations of section headings in C API docs (#105672)
TATHAGATA ROY [Wed, 14 Jun 2023 14:21:30 +0000 (19:51 +0530)] 
gh-105196: Fix indentations of section headings in C API docs (#105672)

2 years agoTyping docs: move the deprecated stuff below the non-deprecated stuff (#105781)
Alex Waygood [Wed, 14 Jun 2023 14:19:27 +0000 (15:19 +0100)] 
Typing docs: move the deprecated stuff below the non-deprecated stuff (#105781)

2 years agoGH-100987: Allow objects other than code objects as the "executable" of an internal...
Mark Shannon [Wed, 14 Jun 2023 12:46:37 +0000 (13:46 +0100)] 
GH-100987: Allow objects other than code objects as the "executable" of an internal frame. (GH-105727)

* Add table describing possible executable classes for out-of-process debuggers.

* Remove shim code object creation code as it is no longer needed.

* Make lltrace a bit more robust w.r.t. non-standard frames.

2 years agogh-105566: Deprecate unusual ways of creating `typing.NamedTuple` classes (#105609)
Alex Waygood [Wed, 14 Jun 2023 12:38:49 +0000 (13:38 +0100)] 
gh-105566: Deprecate unusual ways of creating `typing.NamedTuple` classes (#105609)

Deprecate creating a typing.NamedTuple class using keyword arguments to denote the fields (`NT = NamedTuple("NT", x=int, y=str)`). This will be disallowed in Python 3.15. Use the class-based syntax or the functional syntax instead.

Two methods of creating `NamedTuple` classes with 0 fields using the functional syntax are also deprecated, and will be disallowed in Python 3.15: `NT = NamedTuple("NT")` and `NT = NamedTuple("NT", None)`. To create a `NamedTuple` class with 0 fields, either use `class NT(NamedTuple): pass` or `NT = NamedTuple("NT", [])`.

2 years agogh-104873: Add typing.get_protocol_members and typing.is_protocol (#104878)
Jelle Zijlstra [Wed, 14 Jun 2023 12:35:06 +0000 (05:35 -0700)] 
gh-104873: Add typing.get_protocol_members and typing.is_protocol (#104878)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-102541: Hide traceback in help prompt (gh-102614)
Kirill Podoprigora [Wed, 14 Jun 2023 12:17:12 +0000 (15:17 +0300)] 
gh-102541: Hide traceback in help prompt (gh-102614)

2 years agogdb libpython.py: Remove compatibility code (#105739)
Victor Stinner [Wed, 14 Jun 2023 10:30:22 +0000 (12:30 +0200)] 
gdb libpython.py: Remove compatibility code (#105739)

Remove compatibility code for Python 2 and early Python 3 versions.

* Remove os_fsencode() reimplementation: use os.fsencode() directly.
  os.fsencode() was added to Python 3.2.
* Remove references to Python 2 and "Python 3": just say "Python".
* Remove outdated u'' string format: use '' instead.

2 years agogh-105745: Fix open method of webbrowser.Konqueror (#105746)
Nikita Sobolev [Wed, 14 Jun 2023 10:29:16 +0000 (13:29 +0300)] 
gh-105745: Fix open method of webbrowser.Konqueror (#105746)

2 years agogh-105687: Remove deprecated objects from `re` module (#105688)
Nikita Sobolev [Wed, 14 Jun 2023 10:26:20 +0000 (13:26 +0300)] 
gh-105687: Remove deprecated objects from `re` module (#105688)

2 years ago_ctypes callbacks.c uses _Py_COMP_DIAG_IGNORE_DEPR_DECLS (#105732)
Victor Stinner [Wed, 14 Jun 2023 10:12:25 +0000 (12:12 +0200)] 
_ctypes callbacks.c uses _Py_COMP_DIAG_IGNORE_DEPR_DECLS (#105732)

Replace #pragma with _Py_COMP_DIAG_PUSH,
_Py_COMP_DIAG_IGNORE_DEPR_DECLS and _Py_COMP_DIAG_POP to ease Python
maintenance. Also add a comment explaining why callbacks.c ignores a
deprecation warning.

2 years agotarfile: Fix positional-only syntax in docs (GH-105770)
Jelle Zijlstra [Wed, 14 Jun 2023 07:26:48 +0000 (00:26 -0700)] 
tarfile: Fix positional-only syntax in docs (GH-105770)

The syntax used in the current docs (a / before any args) is invalid.

I think the right approach is for the arguments to arbitrary
filter functions to be treated as positional-only, meaning that users
can supply filter functions with any names for the argument. tarfile.py
only calls the filter function with positional arguments.

2 years agogh-105587: Remove assertion from `_PyStaticObject_CheckRefcnt` (#105638)
Eddie Elizondo [Wed, 14 Jun 2023 04:33:32 +0000 (00:33 -0400)] 
gh-105587: Remove assertion from `_PyStaticObject_CheckRefcnt` (#105638)