]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
3 years agoImprove grouper() recipe to demonstrate all forms of zip() (GH-30837)
Raymond Hettinger [Sun, 23 Jan 2022 20:31:10 +0000 (14:31 -0600)] 
Improve grouper() recipe to demonstrate all forms of zip() (GH-30837)

3 years agobpo-41403: Improve error message for invalid mock target (GH-30833)
Irit Katriel [Sun, 23 Jan 2022 18:42:41 +0000 (18:42 +0000)] 
bpo-41403: Improve error message for invalid mock target (GH-30833)

3 years agobpo-46471: Use single byte singletons (GH-30781)
Kumar Aditya [Sun, 23 Jan 2022 17:45:39 +0000 (23:15 +0530)] 
bpo-46471: Use single byte singletons (GH-30781)

3 years agobpo-46103: Fix inspect.getmembers to only get __bases__ from class (GH-30147)
Weipeng Hong [Sun, 23 Jan 2022 17:40:38 +0000 (01:40 +0800)] 
bpo-46103: Fix inspect.getmembers to only get __bases__ from class (GH-30147)

3 years agobpo-46481: Implement vectorcall for weakref.ref.__call__ method. (GH-30820)
Dong-hee Na [Sun, 23 Jan 2022 15:39:45 +0000 (00:39 +0900)] 
bpo-46481: Implement vectorcall for weakref.ref.__call__ method. (GH-30820)

3 years agobpo-46483: change `PurePath.__class_getitem__` to return `GenericAlias` (GH-30822)
Nikita Sobolev [Sun, 23 Jan 2022 14:48:43 +0000 (17:48 +0300)] 
bpo-46483: change `PurePath.__class_getitem__` to return `GenericAlias` (GH-30822)

3 years agobpo-46406: Faster single digit int division. (#30626)
Gregory P. Smith [Sun, 23 Jan 2022 10:00:41 +0000 (02:00 -0800)] 
bpo-46406: Faster single digit int division. (#30626)

* bpo-46406: Faster single digit int division.

This expresses the algorithm in a more basic manner resulting in better
instruction generation by todays compilers.

See https://mail.python.org/archives/list/python-dev@python.org/thread/ZICIMX5VFCX4IOFH5NUPVHCUJCQ4Q7QM/#NEUNFZU3TQU4CPTYZNF3WCN7DOJBBTK5

3 years agobpo-29882: Fix portability bug introduced in GH-30774 (#30794)
Mark Dickinson [Sun, 23 Jan 2022 09:59:34 +0000 (09:59 +0000)] 
bpo-29882: Fix portability bug introduced in GH-30774 (#30794)

3 years agobpo-46474: Avoid REDoS in EntryPoint.pattern (sync with importlib_metadata 4.10.1...
Jason R. Coombs [Sun, 23 Jan 2022 04:00:23 +0000 (23:00 -0500)] 
bpo-46474: Avoid REDoS in EntryPoint.pattern (sync with importlib_metadata 4.10.1) (GH-30803)

3 years agobpo-45382: test.pythoninfo logs more Windows versions (GH-30817)
Victor Stinner [Sun, 23 Jan 2022 03:03:43 +0000 (04:03 +0100)] 
bpo-45382: test.pythoninfo logs more Windows versions (GH-30817)

Add the following info to test.pythoninfo:

* windows.ver: output of the shell "ver" command
* windows.version and windows.version_caption: output of the
  "wmic os get Caption,Version /value" command.

3 years agoThis localization technique is no longer cost effective. (GH-30818)
Raymond Hettinger [Sun, 23 Jan 2022 02:52:55 +0000 (20:52 -0600)] 
This localization technique is no longer cost effective. (GH-30818)

3 years agobpo-46474: Apply changes from importlib_metadata 4.10.0 (GH-30802)
Jason R. Coombs [Sun, 23 Jan 2022 02:39:00 +0000 (21:39 -0500)] 
bpo-46474: Apply changes from importlib_metadata 4.10.0 (GH-30802)

3 years agobpo-46425: Partially revert "bpo-46425: fix direct invocation of `test_importlib...
Jason R. Coombs [Sun, 23 Jan 2022 02:38:26 +0000 (21:38 -0500)] 
bpo-46425: Partially revert "bpo-46425: fix direct invocation of `test_importlib` (GH-30682)" (GH-30799)

This reverts commit 57316c52bae5d6420f5067f3891ec328deb97305 for files pertaining to importlib.metadata and importlib.resources.

3 years agobpo-46477: [Enum] ensure Flag subclasses have correct bitwise methods (GH-30816)
Ethan Furman [Sun, 23 Jan 2022 02:27:52 +0000 (18:27 -0800)] 
bpo-46477: [Enum] ensure Flag subclasses have correct bitwise methods (GH-30816)

3 years agobpo-46417: _PyList_Fini() clears indexerr (GH-30815)
Victor Stinner [Sun, 23 Jan 2022 01:20:44 +0000 (02:20 +0100)] 
bpo-46417: _PyList_Fini() clears indexerr (GH-30815)

_PyList_Fini() now clears the 'indexerr' error message.

3 years agoMinor code rearrangement to group related methods together. (GH-30813)
Raymond Hettinger [Sun, 23 Jan 2022 00:47:22 +0000 (18:47 -0600)] 
Minor code rearrangement to group related methods together. (GH-30813)

* Make example more focused with math.prod()
* Move comparison tests to the multiset operations section

3 years agobpo-46417: Fix _PyStaticType_Dealloc() (GH-30810)
Victor Stinner [Sat, 22 Jan 2022 23:32:05 +0000 (00:32 +0100)] 
bpo-46417: Fix _PyStaticType_Dealloc() (GH-30810)

_PyStaticType_Dealloc() now only calls PyObject_ClearWeakRefs()
if the call is not going to fail.

3 years agobpo-46417: Clear symtable identifiers at exit (GH-30809)
Victor Stinner [Sat, 22 Jan 2022 23:06:56 +0000 (00:06 +0100)] 
bpo-46417: Clear symtable identifiers at exit (GH-30809)

Add _PySymtable_Fini() function, called by finalize_interp_clear().

Update test_cmd_line.test_showrefcount() to tolerate negative
reference count.

3 years agobpo-41682: Skip unstable test_asyncio sendfile test on Windows (GH-30801)
Nikita Sobolev [Sat, 22 Jan 2022 22:52:26 +0000 (01:52 +0300)] 
bpo-41682: Skip unstable test_asyncio sendfile test on Windows (GH-30801)

3 years agobpo-46417: Clear _io module static objects at exit (GH-30807)
Victor Stinner [Sat, 22 Jan 2022 22:22:20 +0000 (23:22 +0100)] 
bpo-46417: Clear _io module static objects at exit (GH-30807)

Add _PyIO_Fini() function, called by finalize_interp_clear(). It
clears static objects used by the _io extension module.

3 years agobpo-46417: Clear Unicode static types at exit (GH-30806)
Victor Stinner [Sat, 22 Jan 2022 21:55:39 +0000 (22:55 +0100)] 
bpo-46417: Clear Unicode static types at exit (GH-30806)

Add _PyUnicode_FiniTypes() function, called by
finalize_interp_types(). It clears these static types:

* EncodingMapType
* PyFieldNameIter_Type
* PyFormatterIter_Type

_PyStaticType_Dealloc() now does nothing if tp_subclasses
is not NULL.

3 years agobpo-46417: Py_Finalize() clears static exceptioins (GH-30805)
Victor Stinner [Sat, 22 Jan 2022 21:31:44 +0000 (22:31 +0100)] 
bpo-46417: Py_Finalize() clears static exceptioins (GH-30805)

The Py_Finalize() function now clears exceptions implemented as
static types.

Add _PyExc_FiniTypes() function, called by _PyExc_Fini().

3 years agobpo-46417: Factorize _PyExc_InitTypes() code (GH-30804)
Victor Stinner [Sat, 22 Jan 2022 20:48:56 +0000 (21:48 +0100)] 
bpo-46417: Factorize _PyExc_InitTypes() code (GH-30804)

Add 'static_exceptions' list to factorize code between
_PyExc_InitTypes() and _PyBuiltins_AddExceptions().

_PyExc_InitTypes() does nothing if it's not the main interpreter.

Sort exceptions in Lib/test/exception_hierarchy.txt.

3 years agobpo-46126: Disable 'descriptions' when running tests internally. (GH-30194)
Jason R. Coombs [Sat, 22 Jan 2022 18:49:38 +0000 (13:49 -0500)] 
bpo-46126: Disable 'descriptions' when running tests internally. (GH-30194)

3 years agobpo-46417: _PyTypes_FiniTypes() clears object and type (GH-30798)
Victor Stinner [Sat, 22 Jan 2022 18:31:24 +0000 (19:31 +0100)] 
bpo-46417: _PyTypes_FiniTypes() clears object and type (GH-30798)

3 years agobpo-45200: GHA Address Sanitizer skips 3 slowest tests (GH-30797)
Victor Stinner [Sat, 22 Jan 2022 18:15:37 +0000 (19:15 +0100)] 
bpo-45200: GHA Address Sanitizer skips 3 slowest tests (GH-30797)

Skip the 3 slowest tests of the Address Sanitizer CI of GitHub
Actions:

* test_tools
* test_peg_generator
* test_concurrent_futures

These tests take between 5 and 20 minutes on this CI which makes this
CI job the slowest. Making this CI job faster makes the whole Python
workflow faster. These tests are run on all others CIs.

Example of Address Sanitizer output:

    10 slowest tests:
    - test_peg_generator: 17 min 33 sec
    - test_tools: 8 min 27 sec
    - test_concurrent_futures: 5 min 24 sec
    - test_zipfile: 2 min 41 sec
    - test_compileall: 2 min 21 sec
    - test_asyncio: 2 min 17 sec
    - test_gdb: 1 min 43 sec
    - test_weakref: 1 min 35 sec
    - test_pickle: 1 min 18 sec
    - test_subprocess: 1 min 12 sec

Moreover, test_concurrent_futures also seems to be affected by
bpo-45200 bug: libasan dead lock in pthread_create().

3 years agobpo-46417: Cleanup typeobject.c code (GH-30795)
Victor Stinner [Sat, 22 Jan 2022 17:56:11 +0000 (18:56 +0100)] 
bpo-46417: Cleanup typeobject.c code (GH-30795)

* Add comment to recurse_down_subclasses() explaining why it's safe
  to use a borrowed reference to tp_subclasses.
* remove_all_subclasses() no longer accept NULL cases
* type_set_bases() now relies on the fact that new_bases is not NULL.
* type_dealloc_common() avoids PyErr_Fetch/PyErr_Restore if tp_bases
  is NULL.
* remove_all_subclasses() makes sure that no exception is raised.
* Don't test at runtime if tp_mro only contains types: rely on
  _PyType_CAST() assertion for that.
* _PyStaticType_Dealloc() no longer clears tp_subclasses which is
  already NULL.
* mro_hierarchy() avoids calling _PyType_GetSubclasses() if
  tp_subclasses is NULL.

Coding style:

* Use Py_NewRef().
* Add braces and move variable declarations to the first variable
  assignement.
* Rename a few variables and parameters to use better names.

3 years agobpo-46417: Clear more static types (GH-30796)
Victor Stinner [Sat, 22 Jan 2022 17:55:48 +0000 (18:55 +0100)] 
bpo-46417: Clear more static types (GH-30796)

* Move PyContext static types into object.c static_types list.
* Rename PyContextTokenMissing_Type to _PyContextTokenMissing_Type
  and declare it in pycore_context.h.
* _PyHamtItems types are no long exported: replace PyAPI_DATA() with
  extern.

3 years agobpo-46425: fix direct invocation of `test_fileutils` and `test_zoneinfo` (GH-30792)
Nikita Sobolev [Sat, 22 Jan 2022 16:05:43 +0000 (19:05 +0300)] 
bpo-46425: fix direct invocation of `test_fileutils` and `test_zoneinfo` (GH-30792)

3 years agobpo-46425: fix direct invocation of `test_importlib` (GH-30682)
Nikita Sobolev [Sat, 22 Jan 2022 16:05:05 +0000 (19:05 +0300)] 
bpo-46425: fix direct invocation of `test_importlib` (GH-30682)

3 years agobpo-46425: use absolute imports in `test_sqlite3` (GH-30676)
Nikita Sobolev [Sat, 22 Jan 2022 16:03:56 +0000 (19:03 +0300)] 
bpo-46425: use absolute imports in `test_sqlite3` (GH-30676)

3 years agobpo-46425: fix direct invocation of `test_traceback` (GH-30746)
Nikita Sobolev [Sat, 22 Jan 2022 16:03:13 +0000 (19:03 +0300)] 
bpo-46425: fix direct invocation of `test_traceback` (GH-30746)

3 years agobpo-46417: remove_subclass() clears tp_subclasses (GH-30793)
Victor Stinner [Sat, 22 Jan 2022 15:53:30 +0000 (16:53 +0100)] 
bpo-46417: remove_subclass() clears tp_subclasses (GH-30793)

The remove_subclass() function now deletes the dictionary when
removing the last subclass (if the dictionary becomes empty) to save
memory: set PyTypeObject.tp_subclasses to NULL. remove_subclass() is
called when a type is deallocated.

_PyType_GetSubclasses() no longer holds a reference to tp_subclasses:
its loop cannot modify tp_subclasses.

3 years agobpo-46417: Fix race condition on setting type __bases__ (GH-30788)
Victor Stinner [Sat, 22 Jan 2022 14:08:42 +0000 (15:08 +0100)] 
bpo-46417: Fix race condition on setting type __bases__ (GH-30788)

Fix a race condition on setting a type __bases__ attribute: the
internal function add_subclass() now gets the
PyTypeObject.tp_subclasses member after calling PyWeakref_NewRef()
which can trigger a garbage collection which can indirectly modify
PyTypeObject.tp_subclasses.

3 years agobpo-46468: document that "-m http.server" defaults to port 8000 (GH-30776)
Jelle Zijlstra [Sat, 22 Jan 2022 12:31:15 +0000 (04:31 -0800)] 
bpo-46468: document that "-m http.server" defaults to port 8000 (GH-30776)

Code link:
https://github.com/python/cpython/blob/70c16468deee9390e34322d32fda57df6e0f46bb/Lib/http/server.py#L1270

It's been this way since at least 3.4.

Also improved some wording in the same section.

3 years agobpo-46469: Make asyncio generic classes return GenericAlias (GH-30777)
Kumar Aditya [Sat, 22 Jan 2022 11:28:53 +0000 (16:58 +0530)] 
bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777)

* bpo-46469: Make asyncio generic classes return GenericAlias

* ðŸ“œðŸ¤– Added by blurb_it.

* Update Misc/NEWS.d/next/Library/2022-01-22-05-05-08.bpo-46469.plUab5.rst

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agofix DeprecationWarning when running asyncio tests (GH-30486)
Kumar Aditya [Sat, 22 Jan 2022 11:20:10 +0000 (16:50 +0530)] 
fix DeprecationWarning when running asyncio tests (GH-30486)

3 years agobpo-46460: remove duplicated `versionchanged` from `dis.rst` (GH-30752)
Nikita Sobolev [Sat, 22 Jan 2022 11:15:58 +0000 (14:15 +0300)] 
bpo-46460: remove duplicated `versionchanged` from `dis.rst` (GH-30752)

3 years agobpo-46425: fix direct invocation of `asyncio` tests (#30725)
Nikita Sobolev [Sat, 22 Jan 2022 11:06:27 +0000 (14:06 +0300)] 
bpo-46425: fix direct invocation of `asyncio` tests (#30725)

3 years agobpo-46249: Move set lastrowid out of the sqlite3 query loop (GH-30489)
Erlend Egeberg Aasland [Sat, 22 Jan 2022 09:40:22 +0000 (10:40 +0100)] 
bpo-46249: Move set lastrowid out of the sqlite3 query loop (GH-30489)

3 years agobpo-46442: improve and rename testExceptionCleanupNames (GH-30758)
Yellow Dusk [Sat, 22 Jan 2022 07:09:34 +0000 (23:09 -0800)] 
bpo-46442: improve and rename testExceptionCleanupNames (GH-30758)

The test tested that explicitly deleting the local variable bound to the exception
did not cause problems, but it did not test what it actually claimed to test, i.e.
that the variable is deleted automatically.

3 years agoImprove the Windows release build scripts (GH-30771)
Steve Dower [Sat, 22 Jan 2022 01:13:16 +0000 (01:13 +0000)] 
Improve the Windows release build scripts (GH-30771)

Update to windows-2022 image
Promote queue variables to parameters for better UI
Structure build steps using parameters instead of conditions for simpler status display

3 years agobpo-29882: _Py_popcount32() doesn't need 64x64 multiply (GH-30774)
Victor Stinner [Fri, 21 Jan 2022 23:54:42 +0000 (00:54 +0100)] 
bpo-29882: _Py_popcount32() doesn't need 64x64 multiply (GH-30774)

32x32 bits multiply is enough for _Py_popcount32().

3 years agobpo-46417: Use _PyType_CAST() in Objects directory (GH-30764)
Victor Stinner [Fri, 21 Jan 2022 22:33:43 +0000 (23:33 +0100)] 
bpo-46417: Use _PyType_CAST() in Objects directory (GH-30764)

3 years agobpo-46417: Use _PyType_CAST() in Python directory (GH-30769)
Victor Stinner [Fri, 21 Jan 2022 22:30:17 +0000 (23:30 +0100)] 
bpo-46417: Use _PyType_CAST() in Python directory (GH-30769)

3 years agobpo-46417: Add _PyType_GetSubclasses() function (GH-30761)
Victor Stinner [Fri, 21 Jan 2022 22:29:10 +0000 (23:29 +0100)] 
bpo-46417: Add _PyType_GetSubclasses() function (GH-30761)

Add a new _PyType_GetSubclasses() function to get type's subclasses.

_PyType_GetSubclasses(type) returns a list which holds strong
refererences to subclasses. It is safer than iterating on
type->tp_subclasses which yields weak references and can be modified
in the loop.

_PyType_GetSubclasses(type) now holds a reference to the tp_subclasses
dict while creating the list of subclasses.

set_collection_flag_recursive() of _abc.c now uses
_PyType_GetSubclasses().

3 years agobpo-46463: Fixes escape4chm.py script used when building the CHM documentation file...
Steve Dower [Fri, 21 Jan 2022 21:51:15 +0000 (21:51 +0000)] 
bpo-46463: Fixes escape4chm.py script used when building the CHM documentation file (GH-30768)

3 years agobpo-46445: Cover multiple inheritance of `TypedDict` in `test_typing` (GH-30719)
Nikita Sobolev [Fri, 21 Jan 2022 21:38:23 +0000 (00:38 +0300)] 
bpo-46445: Cover multiple inheritance of `TypedDict` in `test_typing` (GH-30719)

3 years agobpo-43118: Fix bug in inspect.signature around 'base.__text_signature__' (GH-30285)
Weipeng Hong [Fri, 21 Jan 2022 21:24:33 +0000 (05:24 +0800)] 
bpo-43118: Fix bug in inspect.signature around 'base.__text_signature__' (GH-30285)

3 years agobpo-46124: Update zoneinfo to rely on importlib.resources traversable API. (GH-30190)
Jason R. Coombs [Fri, 21 Jan 2022 21:18:31 +0000 (16:18 -0500)] 
bpo-46124: Update zoneinfo to rely on importlib.resources traversable API. (GH-30190)

Automerge-Triggered-By: GH:jaraco
3 years agoUpdate generated files list and add `diff=generated` attribute (GH-30745)
Erlend Egeberg Aasland [Fri, 21 Jan 2022 20:59:45 +0000 (21:59 +0100)] 
Update generated files list and add `diff=generated` attribute (GH-30745)

As a side effect, the list of generated files is relocated after the language aware diff settings.

Closes python/core-workflow#425

Automerge-Triggered-By: GH:zware
3 years agobpo-46417: Add _PyType_CAST() macro (GH-30760)
Victor Stinner [Fri, 21 Jan 2022 20:39:01 +0000 (21:39 +0100)] 
bpo-46417: Add _PyType_CAST() macro (GH-30760)

In debug mode, the macro makes sure that its argument is a type using
an assertion.

3 years agobpo-46434: Handle missing docstrings in pdb help (GH-30705)
Tom Sparrow [Fri, 21 Jan 2022 17:00:48 +0000 (17:00 +0000)] 
bpo-46434: Handle missing docstrings in pdb help (GH-30705)

3 years agobpo-46417: Add missing types of _PyTypes_InitTypes() (GH-30749)
Victor Stinner [Fri, 21 Jan 2022 16:53:13 +0000 (17:53 +0100)] 
bpo-46417: Add missing types of _PyTypes_InitTypes() (GH-30749)

Add types removed by mistake by the commit adding
_PyTypes_FiniTypes().

Move also PyBool_Type at the end, since it depends on PyLong_Type.

PyBytes_Type and PyUnicode_Type no longer depend explicitly on
PyBaseObject_Type: it's the default of PyType_Ready().

3 years agobpo-46417: Revert remove_subclass() change (GH-30750) 30753/head
Victor Stinner [Fri, 21 Jan 2022 15:45:14 +0000 (16:45 +0100)] 
bpo-46417: Revert remove_subclass() change (GH-30750)

remove_subclass() doesn't clear the tp_subclasses dict if the dict
becomes empty.

3 years agobpo-46417: Py_Finalize() clears static types (GH-30743)
Victor Stinner [Fri, 21 Jan 2022 12:06:34 +0000 (13:06 +0100)] 
bpo-46417: Py_Finalize() clears static types (GH-30743)

Add _PyTypes_FiniTypes() best-effort function to clear static types:
don't deallocate a type if it still has subclasses.

remove_subclass() now sets tp_subclasses to NULL when removing the
last subclass.

3 years agobpo-46417: Call _PyDebug_PrintTotalRefs() later (GH-30744)
Victor Stinner [Fri, 21 Jan 2022 12:05:26 +0000 (13:05 +0100)] 
bpo-46417: Call _PyDebug_PrintTotalRefs() later (GH-30744)

"python -X showrefcount" now shows the total reference count after
clearing and destroyed the main Python interpreter. Previously, it
was shown before.

Py_FinalizeEx() now calls _PyDebug_PrintTotalRefs() after
finalize_interp_delete().

3 years agobpo-46426: Improve tests for the dir_fd argument (GH-30668)
Serhiy Storchaka [Fri, 21 Jan 2022 07:54:50 +0000 (09:54 +0200)] 
bpo-46426: Improve tests for the dir_fd argument (GH-30668)

Ensure that directory file descriptors refer to directories different
from the current directory, and that src_dir_fd and dst_dir_fd refer
to different directories.

Add context manager open_dir_fd() in test.support.os_helper.

3 years agobpo-30512: Add CAN Socket support for NetBSD (GH-30066)
Thomas Klausner [Fri, 21 Jan 2022 07:44:05 +0000 (08:44 +0100)] 
bpo-30512: Add CAN Socket support for NetBSD (GH-30066)

3 years agobpo-21987: Fix TarFile.getmember getting a dir with a trailing slash (GH-30283)
andrei kulakov [Fri, 21 Jan 2022 07:40:32 +0000 (02:40 -0500)] 
bpo-21987: Fix TarFile.getmember getting a dir with a trailing slash (GH-30283)

3 years agobpo-46425: Fix direct invocation of `test_contextlib` (GH-30681)
Nikita Sobolev [Fri, 21 Jan 2022 07:36:19 +0000 (10:36 +0300)] 
bpo-46425: Fix direct invocation of `test_contextlib` (GH-30681)

3 years agobpo-46417: signal uses PyStructSequence_NewType() (GH-30735)
Victor Stinner [Fri, 21 Jan 2022 03:02:38 +0000 (04:02 +0100)] 
bpo-46417: signal uses PyStructSequence_NewType() (GH-30735)

The signal module now creates its struct_siginfo type as a heap type
using PyStructSequence_NewType(), rather than using a static type.

Add 'siginfo_type' member to the global signal_state_t structure.

3 years agobpo-46417: _curses uses PyStructSequence_NewType() (GH-30736)
Victor Stinner [Fri, 21 Jan 2022 02:30:20 +0000 (03:30 +0100)] 
bpo-46417: _curses uses PyStructSequence_NewType() (GH-30736)

The _curses module now creates its ncurses_version type as a heap
type using PyStructSequence_NewType(), rather than using a static
type.

* Move _PyStructSequence_FiniType() definition to pycore_structseq.h.
* test.pythoninfo: log curses.ncurses_version.

3 years agobpo-46417: time module uses PyStructSequence_NewType() (GH-30734)
Victor Stinner [Fri, 21 Jan 2022 01:52:43 +0000 (02:52 +0100)] 
bpo-46417: time module uses PyStructSequence_NewType() (GH-30734)

The time module now creates its struct_time type as a heap
type using PyStructSequence_NewType(), rather than using a static
type.

* Add a module state to the time module: add traverse, clear and free
  functions.
* Use PyModule_AddType().
* Remove the 'initialized' variable.

3 years agobpo-46417: _thread uses PyStructSequence_NewType() (GH-30733)
Victor Stinner [Fri, 21 Jan 2022 01:51:04 +0000 (02:51 +0100)] 
bpo-46417: _thread uses PyStructSequence_NewType() (GH-30733)

The _thread module now creates its _ExceptHookArgs type as a heap
type using PyStructSequence_NewType(), rather than using a static
type.

3 years agobpo-46417: _testembed.c avoids Py_SetProgramName() (GH-30732)
Victor Stinner [Fri, 21 Jan 2022 01:12:18 +0000 (02:12 +0100)] 
bpo-46417: _testembed.c avoids Py_SetProgramName() (GH-30732)

* _testembed_Py_Initialize() now uses the PyConfig API, rather than
  deprecated Py_SetProgramName().
* Reduce INIT_LOOPS from 16 to 4: test_embed now takes 8.7 seconds
  rather than 14.7 seconds.

3 years agobpo-46417: Finalize structseq types at exit (GH-30645)
Victor Stinner [Fri, 21 Jan 2022 00:42:25 +0000 (01:42 +0100)] 
bpo-46417: Finalize structseq types at exit (GH-30645)

Add _PyStructSequence_FiniType() and _PyStaticType_Dealloc()
functions to finalize a structseq static type in Py_Finalize().
Currrently, these functions do nothing if Python is built in release
mode.

Clear static types:

* AsyncGenHooksType: sys.set_asyncgen_hooks()
* FlagsType: sys.flags
* FloatInfoType: sys.float_info
* Hash_InfoType: sys.hash_info
* Int_InfoType: sys.int_info
* ThreadInfoType: sys.thread_info
* UnraisableHookArgsType: sys.unraisablehook
* VersionInfoType: sys.version
* WindowsVersionType: sys.getwindowsversion()

3 years agobpo-41857: mention timeout argument units in select.poll() and select.depoll() doc...
Zane Bitter [Thu, 20 Jan 2022 23:08:44 +0000 (18:08 -0500)] 
bpo-41857: mention timeout argument units in select.poll() and select.depoll() doc-strings (GH-22406)

3 years agobpo-46080: fix argparse help generation exception in edge case (GH-30111)
Felix Fontein [Thu, 20 Jan 2022 22:48:48 +0000 (23:48 +0100)] 
bpo-46080: fix argparse help generation exception in edge case (GH-30111)

Fix an uncaught exception during help text generation when
argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS
and help is specified.

3 years agobpo-46441: Add a boilerplate to test syntax errors in interactive mode (GH-30720)
Batuhan Taskaya [Thu, 20 Jan 2022 20:07:43 +0000 (23:07 +0300)] 
bpo-46441: Add a boilerplate to test syntax errors in interactive mode (GH-30720)

3 years agobpo-46316: optimize `pathlib.Path.iterdir()` (GH-30501)
Barney Gale [Thu, 20 Jan 2022 19:20:00 +0000 (19:20 +0000)] 
bpo-46316: optimize `pathlib.Path.iterdir()` (GH-30501)

`os.listdir()` doesn't return entries for `.` or `..`, so we don't need to
check for them here.

3 years agobpo-40280: Misc fixes for wasm32-emscripten (GH-30722)
Christian Heimes [Thu, 20 Jan 2022 17:56:33 +0000 (19:56 +0200)] 
bpo-40280: Misc fixes for wasm32-emscripten (GH-30722)

3 years agobpo-46429: Merge all deepfrozen files into one (GH-30572)
Kumar Aditya [Thu, 20 Jan 2022 16:38:39 +0000 (22:08 +0530)] 
bpo-46429: Merge all deepfrozen files into one (GH-30572)

3 years agoFix the caret position in some syntax errors in interactive mode (GH-30718)
Pablo Galindo Salgado [Thu, 20 Jan 2022 15:34:13 +0000 (15:34 +0000)] 
Fix the caret position in some syntax errors in interactive mode (GH-30718)

3 years agobpo-46409: Make generators in bytecode (GH-30633)
Mark Shannon [Thu, 20 Jan 2022 11:46:39 +0000 (11:46 +0000)] 
bpo-46409: Make generators in bytecode (GH-30633)

* Add RETURN_GENERATOR and JUMP_NO_INTERRUPT opcodes.

* Trim frame and generator by word each.

* Minor refactor of frame.c

* Update test.test_sys to account for smaller frames.

* Treat generator functions as normal functions when evaluating and specializing.

3 years agono-issue: Fix documentation typos. (GH-30576)
Piotr Fusik [Thu, 20 Jan 2022 08:17:15 +0000 (09:17 +0100)] 
no-issue: Fix documentation typos. (GH-30576)

3 years agobpo-46443: deepfreeze: use small ints and singleton zero bytes (GH-30715)
Kumar Aditya [Thu, 20 Jan 2022 06:13:21 +0000 (11:43 +0530)] 
bpo-46443: deepfreeze: use small ints and singleton zero bytes (GH-30715)

3 years agobpo-46437: remove useless `hasattr` from `test_typing` (#30704)
Nikita Sobolev [Wed, 19 Jan 2022 21:24:27 +0000 (00:24 +0300)] 
bpo-46437: remove useless `hasattr` from `test_typing` (#30704)

3 years agodoc: Clarify os.urandom return type (#30282)
Florian Bruhin [Wed, 19 Jan 2022 21:22:15 +0000 (22:22 +0100)] 
doc: Clarify os.urandom return type (#30282)

Other descriptions in the same file also use 'bytestring' to refer to bytes objects

3 years agodocs: correct outdated MappingProxyType docstrings (#30281)
Joshua Bronson [Wed, 19 Jan 2022 21:20:43 +0000 (16:20 -0500)] 
docs: correct outdated MappingProxyType docstrings (#30281)

The docstrings for MappingProxyType's keys(), values(), and items()
methods were never updated to reflect the changes that Python 3 brought
to these APIs, namely returning views rather than lists.

3 years agoUpdate documentation in datetime module strftime-and-strptime-behavior fix typo in...
Evan [Wed, 19 Jan 2022 17:39:57 +0000 (18:39 +0100)] 
Update documentation in datetime module strftime-and-strptime-behavior fix typo in '%W' format code description (GH-30232)

A small change to the documentation of datetime module , in the format codes section of stftime and strptime. Changed the description of format code '%W' from 'as a decimal number' to 'a zero padded   decimal number' so it's in line with the example having leading zeros.  Similar to the format code '%U' above.

Automerge-Triggered-By: GH:pganssle
3 years agoMark all clinic headers as generated (GH-30679)
Erlend Egeberg Aasland [Wed, 19 Jan 2022 16:54:45 +0000 (17:54 +0100)] 
Mark all clinic headers as generated (GH-30679)

3 years agobpo-45680: Minor formatting fix in stdtypes.rst (GH-30690)
Ken Jin [Wed, 19 Jan 2022 15:37:05 +0000 (23:37 +0800)] 
bpo-45680: Minor formatting fix in stdtypes.rst (GH-30690)

Makes quotation consistent with rest of docs in commit 0eae9a2a2db6cc5a72535f61bb988cc417011640.

3 years agobpo-46413: properly test `__{r}or__` code paths in `_SpecialGenericAlias` (GH-30640)
Nikita Sobolev [Wed, 19 Jan 2022 15:32:25 +0000 (18:32 +0300)] 
bpo-46413: properly test `__{r}or__` code paths in `_SpecialGenericAlias` (GH-30640)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
3 years agobpo-45680: Clarify documentation on ``GenericAlias`` objects (GH-29335)
Alex Waygood [Wed, 19 Jan 2022 14:53:41 +0000 (14:53 +0000)] 
bpo-45680: Clarify documentation on ``GenericAlias`` objects (GH-29335)

The documentation on ``GenericAlias`` objects implies at multiple points that
only container classes can define ``__class_getitem__``. This is misleading.
This PR proposes a rewrite of the documentation to clarify that non-container
classes can define ``__class_getitem__``, and to clarify what it means when a
non-container class is parameterized.

See also: initial discussion of issues with this piece of documentation in
GH-29308, and previous BPO issue [42280](https://bugs.python.org/issue42280).

Also improved references in glossary and typing docs. Fixed some links.

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
3 years agobpo-46416: Allow direct invocation of `Lib/test/test_typing.py` (GH-30641)
Nikita Sobolev [Wed, 19 Jan 2022 14:13:38 +0000 (17:13 +0300)] 
bpo-46416: Allow direct invocation of `Lib/test/test_typing.py` (GH-30641)

Use `__name__`

3 years agobpo-22039: [doc] clarify that there are no plans to disable deleting an attribute...
Irit Katriel [Wed, 19 Jan 2022 12:03:51 +0000 (12:03 +0000)] 
bpo-22039: [doc] clarify that there are no plans to disable deleting an attribute via PyObject_SetAttr (GH-30639)

3 years ago bpo-43869: Time Epoch is the same on all platforms (GH-30664)
Victor Stinner [Wed, 19 Jan 2022 10:27:11 +0000 (11:27 +0100)] 
  bpo-43869: Time Epoch is the same on all platforms (GH-30664)

3 years agobpo-45535: [Enum] include special dunders in dir() (GH-30677)
Ethan Furman [Tue, 18 Jan 2022 23:13:13 +0000 (15:13 -0800)] 
bpo-45535: [Enum] include special dunders in dir() (GH-30677)

Include the `__dunders__` in `dir()` that make `Enum` special:

- `__contains__`
- `__getitem__`
- `__iter__`
- `__len__`
- `__members__`

3 years agobpo-45554: Document multiprocessing.Process.exitcode values (GH-30142)
John Marshall [Tue, 18 Jan 2022 21:31:27 +0000 (21:31 +0000)] 
bpo-45554: Document multiprocessing.Process.exitcode values (GH-30142)

This addresses [bpo-45554]() by expanding the `exitcode` documentation to also describe what `exitcode` will be in cases of normal termination, `sys.exit()` called, and on uncaught exceptions.

Automerge-Triggered-By: GH:pitrou
3 years agobpo-44024: Improve the TypeError message in getattr and hasattr (GH-25863)
Géry Ogam [Tue, 18 Jan 2022 20:46:26 +0000 (21:46 +0100)] 
bpo-44024: Improve the TypeError message in getattr and hasattr (GH-25863)

Use common error message for non-string attribute name in the builtin
functions getattr and hasattr.
The special check no longer needed since Python 3.0.

3 years agobpo-46045: Do not use POSIX semaphores on NetBSD (GH-30047)
Thomas Klausner [Tue, 18 Jan 2022 20:38:35 +0000 (21:38 +0100)] 
bpo-46045: Do not use POSIX semaphores on NetBSD (GH-30047)

This fixes hanging tests test_compileall,, test_multiprocessing_fork and test_concurrent_futures.

3 years agobpo-20823: Clarify copyreg.pickle() documentation (GH-30230)
Kumar Aditya [Tue, 18 Jan 2022 19:53:43 +0000 (01:23 +0530)] 
bpo-20823: Clarify copyreg.pickle() documentation (GH-30230)

3 years agobpo-46425: Fix direct invocation of multiple test modules (GH-30666)
Nikita Sobolev [Tue, 18 Jan 2022 19:28:18 +0000 (22:28 +0300)] 
bpo-46425: Fix direct invocation of multiple test modules (GH-30666)

3 years agobpo-43869: Improve epoch docs (GH-25777)
Miguel Brito [Tue, 18 Jan 2022 15:55:16 +0000 (15:55 +0000)] 
bpo-43869: Improve epoch docs (GH-25777)

3 years agobpo-46028: Calculate base_executable by resolving symlinks in a venv (GH-30144)
Steve Dower [Tue, 18 Jan 2022 15:46:26 +0000 (15:46 +0000)] 
bpo-46028: Calculate base_executable by resolving symlinks in a venv (GH-30144)

3 years agobpo-46424: [typing] cover `Annotation[arg]` invalid usage in tests (GH-30663)
Nikita Sobolev [Tue, 18 Jan 2022 14:43:51 +0000 (17:43 +0300)] 
bpo-46424: [typing] cover `Annotation[arg]` invalid usage in tests (GH-30663)

3 years agobpo-46402: Promote SQLite URI tricks in `sqlite3` docs (GH-30660)
Erlend Egeberg Aasland [Tue, 18 Jan 2022 12:37:02 +0000 (13:37 +0100)] 
bpo-46402: Promote SQLite URI tricks in `sqlite3` docs (GH-30660)

Provide some examples of URI parameters in sqlite connect().

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
3 years agobpo-46339: Include clarification on assert in 'get_error_line_from_tokenizer_buffers...
Pablo Galindo Salgado [Tue, 18 Jan 2022 11:13:00 +0000 (11:13 +0000)] 
bpo-46339: Include clarification on assert in 'get_error_line_from_tokenizer_buffers' (#30545)

3 years agobpo-42161: Hoist the _PyLong_GetOne() call out of the inner loop. (GH-30656)
Raymond Hettinger [Tue, 18 Jan 2022 08:02:35 +0000 (02:02 -0600)] 
bpo-42161: Hoist the _PyLong_GetOne() call out of the inner loop. (GH-30656)