]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
3 years agoRemove unnecessary basic block from comprehensions (GH-31263)
Brandt Bucher [Mon, 14 Feb 2022 17:48:45 +0000 (09:48 -0800)] 
Remove unnecessary basic block from comprehensions (GH-31263)

3 years agobpo-46747: Add missing key parameters in the bisect docs (GH-31323)
Zackery Spytz [Mon, 14 Feb 2022 16:16:49 +0000 (08:16 -0800)] 
bpo-46747: Add missing key parameters in the bisect docs (GH-31323)

Added *key* parameter to `bisect.bisect()` and `bisect.insort()` in bisect module docs.

3 years agoAdd pair counts to stats output and summary. (GH-31324)
Mark Shannon [Mon, 14 Feb 2022 15:53:38 +0000 (15:53 +0000)] 
Add pair counts to stats output and summary. (GH-31324)

3 years agoInclude length in stats for UNPACK_SEQUENCE. (GH-31254)
Mark Shannon [Mon, 14 Feb 2022 10:01:31 +0000 (10:01 +0000)] 
Include length in stats for UNPACK_SEQUENCE. (GH-31254)

3 years agoCorrections to format precision description. (GH-31291)
John Belmonte [Mon, 14 Feb 2022 00:00:32 +0000 (09:00 +0900)] 
Corrections to format precision description. (GH-31291)

* `precision` field is a decimal integer
  * clarify that stated limitations are on presentation type
    rather than input value type.  Especially misleading is
    "precision is not allowed for integer values", since integer
    value input to a format like `.1f` is fine.
  * regarding max field size, replace "non-number" with "string",
    which is the only non-numeric presentation type

Automerge-Triggered-By: GH:ericvsmith
3 years agoImprove docstring for set.discard() (GH-31315)
Raymond Hettinger [Sun, 13 Feb 2022 21:42:59 +0000 (15:42 -0600)] 
Improve docstring for set.discard() (GH-31315)

3 years agobpo-45447: Fix entry in What's New 3.11 (GH-31307)
Terry Jan Reedy [Sun, 13 Feb 2022 02:12:21 +0000 (21:12 -0500)] 
bpo-45447: Fix entry in What's New 3.11 (GH-31307)

3 years agobpo-45447: Add entry to What's new 3.9 (GH-31305)
Terry Jan Reedy [Sun, 13 Feb 2022 02:11:19 +0000 (21:11 -0500)] 
bpo-45447: Add entry to What's new 3.9 (GH-31305)

3 years agobpo-45447: Add entry to What's new 3.10 (GH-31304)
Terry Jan Reedy [Sun, 13 Feb 2022 02:10:29 +0000 (21:10 -0500)] 
bpo-45447: Add entry to What's new 3.10 (GH-31304)

3 years agobpo-45447: Add syntax highlighting for `.pyi` files in IDLE (GH-28950)
Alex Waygood [Sun, 13 Feb 2022 00:04:48 +0000 (00:04 +0000)] 
bpo-45447: Add syntax highlighting for `.pyi` files in IDLE (GH-28950)

Also add .pyi to the python extensions in the "File-open" and "File-save" dialogues.
Add util.py to contain objects that are used in multiple idlelib modules
and have no dependencies on any of them.

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
3 years agobpo-46333: include `module` in `ForwardRef.__repr__` (#31283)
aha79 [Sat, 12 Feb 2022 15:35:57 +0000 (16:35 +0100)] 
bpo-46333: include `module` in `ForwardRef.__repr__` (#31283)

The module parameter carries semantic information about the forward ref.
Show to the user that forward refs with same argument but different
module are different.

Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
3 years agobpo-46400: Update libexpat from 2.4.1 to 2.4.4 (GH-31022)
Cyril Jouve [Sat, 12 Feb 2022 15:29:41 +0000 (16:29 +0100)] 
bpo-46400: Update libexpat from 2.4.1 to 2.4.4 (GH-31022)

3 years agobpo-45948: Remove constructor discrepancy in C version of ElementTree.XMLParser ...
Jacob Walls [Sat, 12 Feb 2022 08:27:02 +0000 (03:27 -0500)] 
bpo-45948: Remove constructor discrepancy in C version of ElementTree.XMLParser (GH-31152)

Both implementations accept target=None now.

3 years agobpo-46586: Fix documentation links (GH-31216)
Meer Suri [Sat, 12 Feb 2022 04:21:38 +0000 (12:21 +0800)] 
bpo-46586: Fix documentation links (GH-31216)

* Fix enum.property documentation link

3 years agobpo-46355: Amend What's New in Python 3.11 C API wording (GH-31288)
Erlend Egeberg Aasland [Sat, 12 Feb 2022 00:48:26 +0000 (01:48 +0100)] 
bpo-46355: Amend What's New in Python 3.11 C API wording (GH-31288)

3 years agobpo-46483: [doc] pathlib classes no longer support parameterized generics (GH-31281)
Alex Waygood [Fri, 11 Feb 2022 20:39:37 +0000 (20:39 +0000)] 
bpo-46483: [doc] pathlib classes no longer support parameterized generics (GH-31281)

Remove pathlib classes from the list in stdtypes.rst of classes
that can be parameterized at runtime.

3 years agobpo-46615: Don't crash when set operations mutate the sets (GH-31120)
Dennis Sweeney [Fri, 11 Feb 2022 16:25:08 +0000 (11:25 -0500)] 
bpo-46615: Don't crash when set operations mutate the sets (GH-31120)

Ensure strong references are acquired whenever using `set_next()`. Added randomized test cases for `__eq__` methods that sometimes mutate sets when called.

3 years agobpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)
Petr Viktorin [Fri, 11 Feb 2022 16:22:11 +0000 (17:22 +0100)] 
bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)

* Make PyType_GetModuleByDef public (remove underscore)

Co-authored-by: Victor Stinner <vstinner@python.org>
3 years agobpo-45490: Rename static inline functions (GH-31217)
Victor Stinner [Fri, 11 Feb 2022 16:01:10 +0000 (17:01 +0100)] 
bpo-45490: Rename static inline functions (GH-31217)

When a static inline function is wrapped by a macro which casts its
arguments to the expected type, there is no need that the function
has a different name than the macro. Use the same name for the macro
and the function to avoid confusion.

Rename _PyUnicode_get_wstr_length() to PyUnicode_WSTR_LENGTH().

Don't rename static inline _Py_NewRef() and _Py_XNewRef() functions,
since the C API exports Py_NewRef() and Py_XNewRef() functions as
regular functions. The name cannot be reused in this case.

3 years agoFix the signature of multiprocessing.set_executable (GH-31276)
Géry Ogam [Fri, 11 Feb 2022 14:42:54 +0000 (15:42 +0100)] 
Fix the signature of multiprocessing.set_executable (GH-31276)

Automerge-Triggered-By: GH:merwok
3 years agobpo-46323: Fix double-free issue for borrowed refs (GH-31272)
Dong-hee Na [Fri, 11 Feb 2022 08:48:47 +0000 (17:48 +0900)] 
bpo-46323: Fix double-free issue for borrowed refs (GH-31272)

3 years agobpo-46246: add missing __slots__ to importlib.metadata.DeprecatedList (GH-30452)
Arie Bovenberg [Fri, 11 Feb 2022 00:56:21 +0000 (01:56 +0100)] 
bpo-46246: add missing __slots__ to importlib.metadata.DeprecatedList (GH-30452)

Confirmed with @jaraco that this indeed needs a fix.

A question that came up while I was digging into the code: I think `SelectableGroups` could similarly use `__slots__ = ()`, since its purpose seems only for convenience around `dict`, not to have attributes of its own.

Automerge-Triggered-By: GH:jaraco
3 years agobpo-36876: Make sure the c-analyzer is checking all the source files.' (gh-31264)
Eric Snow [Thu, 10 Feb 2022 23:14:19 +0000 (16:14 -0700)] 
bpo-36876: Make sure the c-analyzer is checking all the source files.' (gh-31264)

https://bugs.python.org/issue36876

3 years agobpo-44953: Add newline at end of NEWS entry (GH-31265)
Dennis Sweeney [Thu, 10 Feb 2022 22:57:24 +0000 (17:57 -0500)] 
bpo-44953: Add newline at end of NEWS entry (GH-31265)

3 years agobpo-44953: Add vectorcall for itemgetter and attrgetter instances (GH-27828)
Dennis Sweeney [Thu, 10 Feb 2022 21:57:47 +0000 (16:57 -0500)] 
bpo-44953: Add vectorcall for itemgetter and attrgetter instances (GH-27828)

3 years agobpo-45923: Add `RESUME_QUICK` (GH-31244)
Brandt Bucher [Thu, 10 Feb 2022 17:50:02 +0000 (09:50 -0800)] 
bpo-45923: Add `RESUME_QUICK` (GH-31244)

3 years agoGather stats for PRECALL_METHOD. (GH-31259)
Mark Shannon [Thu, 10 Feb 2022 15:55:52 +0000 (15:55 +0000)] 
Gather stats for PRECALL_METHOD. (GH-31259)

3 years agoDon't print rejected tokens when using the debug flags in the parser (GH-31258)
Pablo Galindo Salgado [Thu, 10 Feb 2022 14:38:27 +0000 (14:38 +0000)] 
Don't print rejected tokens when using the debug flags in the parser (GH-31258)

3 years agoAllow the parser to avoid nested processing of invalid rules (GH-31252)
Pablo Galindo Salgado [Thu, 10 Feb 2022 13:12:14 +0000 (13:12 +0000)] 
Allow the parser to avoid nested processing of invalid rules (GH-31252)

3 years agobpo-46532: Reduce number of memory writes to update call_shape.kwnames. (GH-31231)
Mark Shannon [Thu, 10 Feb 2022 12:57:55 +0000 (12:57 +0000)] 
bpo-46532: Reduce number of memory writes to update call_shape.kwnames. (GH-31231)

3 years agoFix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253)
Andrew Svetlov [Thu, 10 Feb 2022 12:57:20 +0000 (14:57 +0200)] 
Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253)

3 years agoFix sys.getdxp() when configured with --enable-pystats. (GH-31251)
Mark Shannon [Thu, 10 Feb 2022 12:14:57 +0000 (12:14 +0000)] 
Fix sys.getdxp() when configured with --enable-pystats. (GH-31251)

3 years agoAdd stats for PRECALL_FUNCTION. (GH-31250)
Mark Shannon [Thu, 10 Feb 2022 11:47:52 +0000 (11:47 +0000)] 
Add stats for PRECALL_FUNCTION. (GH-31250)

3 years agoRight justify numeric columns in stats summary script. (GH-31234)
Mark Shannon [Thu, 10 Feb 2022 11:01:18 +0000 (11:01 +0000)] 
Right justify numeric columns in stats summary script. (GH-31234)

3 years agobpo-46323: Allow alloca(0) for python callback function of ctypes (GH-31249)
Dong-hee Na [Thu, 10 Feb 2022 10:10:07 +0000 (19:10 +0900)] 
bpo-46323: Allow alloca(0) for python callback function of ctypes (GH-31249)

3 years agoFix sphinx-lint after #31097 and b878b3a (GH-31248)
Nikita Sobolev [Thu, 10 Feb 2022 09:08:47 +0000 (12:08 +0300)] 
Fix sphinx-lint after #31097 and b878b3a (GH-31248)

`main` branch is failing, see https://dev.azure.com/python/cpython/_build/results?buildId=96616&view=logs&j=4db1505a-29e5-5cc0-240b-53a8a2681f75&t=a975920c-8356-5388-147c-613d5fab0171

Logs:

```
PATH=./venv/bin:$PATH sphinx-lint -i tools -i ./venv -i README.rst
No problems found.
PATH=./venv/bin:$PATH sphinx-lint ../Misc/NEWS.d/next/
[1] ../Misc/NEWS.d/next/Library/2022-02-09-00-53-23.[bpo-45863]().zqQXVv.rst:0: No newline at end of file (no-newline-at-end-of-file).
[1] ../Misc/NEWS.d/next/Build/2022-01-19-11-08-32.[bpo-46430]().k403m_.rst:0: No newline at end of file (no-newline-at-end-of-file).
2 problems with severity 1 found.
```

This PR fixes these two problems, so `main` is green again.

Related PR: https://github.com/python/cpython/pull/31097
CC @JulienPalard

Automerge-Triggered-By: GH:JulienPalard
3 years agobpo-42238: [doc] moving from rstlint.py to sphinx-lint. (GH-31097)
Julien Palard [Thu, 10 Feb 2022 07:59:04 +0000 (08:59 +0100)] 
bpo-42238: [doc] moving from rstlint.py to sphinx-lint. (GH-31097)

3 years agobpo-46707: Avoid potential exponential backtracking in some syntax errors (GH-31241)
Pablo Galindo Salgado [Thu, 10 Feb 2022 03:37:17 +0000 (03:37 +0000)] 
bpo-46707: Avoid potential exponential backtracking in some syntax errors (GH-31241)

3 years agobpo-36876: Minor cleanup to c-analyzer "ignored" data.' (gh-31239)
Eric Snow [Thu, 10 Feb 2022 00:10:53 +0000 (17:10 -0700)] 
bpo-36876: Minor cleanup to c-analyzer "ignored" data.' (gh-31239)

https://bugs.python.org/issue36876

3 years agobpo-46528: Attempt SWAPs at compile-time (GH-30970)
Brandt Bucher [Wed, 9 Feb 2022 23:15:36 +0000 (15:15 -0800)] 
bpo-46528: Attempt SWAPs at compile-time (GH-30970)

3 years agobpo-43532: add version added to KW_ONLY (GH-31235)
Henry Schreiner [Wed, 9 Feb 2022 20:56:10 +0000 (15:56 -0500)] 
bpo-43532: add version added to KW_ONLY (GH-31235)

Minor missing version note mentioned at the end of  (and affected me independently before reading that note).

Automerge-Triggered-By: GH:ericvsmith
3 years agobpo-46528: Check PyMem_Malloc for NULL (GH-30998)
Brandt Bucher [Wed, 9 Feb 2022 19:31:01 +0000 (11:31 -0800)] 
bpo-46528: Check PyMem_Malloc for NULL (GH-30998)

3 years agobpo-46323: Reduce stack usage of ctypes python callback function. (GH-31224)
Dong-hee Na [Wed, 9 Feb 2022 18:10:11 +0000 (03:10 +0900)] 
bpo-46323: Reduce stack usage of ctypes python callback function. (GH-31224)

3 years agobpo-45863: tarfile: don't zero out header fields unnecessarily (GH-29693)
Joshua Root [Wed, 9 Feb 2022 17:06:19 +0000 (04:06 +1100)] 
bpo-45863: tarfile: don't zero out header fields unnecessarily (GH-29693)

Numeric fields of type float, notably mtime, can't be represented
exactly in the ustar header, so the pax header is used. But it is
helpful to set them to the nearest int (i.e. second rather than
nanosecond precision mtimes) in the ustar header as well, for the
benefit of unarchivers that don't understand the pax header.

Add test for tarfile.TarInfo.create_pax_header to confirm correct
behaviour.

3 years agobpo-46430: Intern strings in deep-frozen modules (GH-30683)
Kumar Aditya [Wed, 9 Feb 2022 16:52:42 +0000 (22:22 +0530)] 
bpo-46430: Intern strings in deep-frozen modules  (GH-30683)

3 years agobpo-44289: Keep argument file object's current position in tarfile.is_tarfile (GH...
Andrzej Mateja [Wed, 9 Feb 2022 16:19:16 +0000 (17:19 +0100)] 
bpo-44289: Keep argument file object's current position in tarfile.is_tarfile (GH-26488)

3 years agobpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223)
Nikita Sobolev [Wed, 9 Feb 2022 14:23:07 +0000 (17:23 +0300)] 
bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223)

3 years agobpo-46072: Output stats as markdown with collapsible sections. (GH-31228)
Mark Shannon [Wed, 9 Feb 2022 12:30:26 +0000 (12:30 +0000)] 
bpo-46072: Output stats as markdown with collapsible sections. (GH-31228)

3 years agobpo-36876: Update the c-analyzer whitelist. (gh-31225)
Eric Snow [Wed, 9 Feb 2022 01:37:57 +0000 (18:37 -0700)] 
bpo-36876: Update the c-analyzer whitelist. (gh-31225)

This change adds variables that had been added since the last time the whitelist was updated. It also cleans up the list a little.

https://bugs.python.org/issue36876

3 years agobpo-46556: emit `DeprecationWarning` from `pathlib.Path.__enter__()` (GH-30971)
Barney Gale [Tue, 8 Feb 2022 21:01:37 +0000 (21:01 +0000)] 
bpo-46556: emit `DeprecationWarning` from `pathlib.Path.__enter__()` (GH-30971)

In Python 3.9, Path.__exit__() was made a no-op and has never been documented.

Co-authored-by: Brett Cannon <brett@python.org>
3 years agobpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized global...
Eric Snow [Tue, 8 Feb 2022 20:39:07 +0000 (13:39 -0700)] 
bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized global objects. (gh-30928)

We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code.  It is still used in a number of non-builtin stdlib modules.

The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime.  A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings).

https://bugs.python.org/issue46541#msg411799 explains the rationale for this change.

The core of the change is in:

* (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros
* Include/internal/pycore_runtime_init.h - added the static initializers for the global strings
* Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState
* Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers

I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings.  That check is added to the PR CI config.

The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()).  This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *.

The following are not changed (yet):

* stop using _Py_IDENTIFIER() in the stdlib modules
* (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API
* (maybe) intern the strings during runtime init

https://bugs.python.org/issue46541

3 years agobpo-45952: Get the C analyzer tool working again. (gh-31220)
Eric Snow [Tue, 8 Feb 2022 19:37:53 +0000 (12:37 -0700)] 
bpo-45952: Get the C analyzer tool working again. (gh-31220)

https://bugs.python.org/issue45952

3 years agobpo-46475: Add typing.Never and typing.assert_never (GH-30842)
Jelle Zijlstra [Tue, 8 Feb 2022 18:50:26 +0000 (10:50 -0800)] 
bpo-46475: Add typing.Never and typing.assert_never (GH-30842)

3 years agobpo-45952: Get the C analyzer tool working again. (gh-31219)
Eric Snow [Tue, 8 Feb 2022 18:42:17 +0000 (11:42 -0700)] 
bpo-45952: Get the C analyzer tool working again. (gh-31219)

https://bugs.python.org/issue45952

3 years agobpo-46323: Use PyObject_Vectorcall while calling ctypes callback function (GH-31138)
Dong-hee Na [Tue, 8 Feb 2022 13:09:17 +0000 (22:09 +0900)] 
bpo-46323: Use PyObject_Vectorcall while calling ctypes callback function (GH-31138)

3 years agobpo-46521: Fix codeop to use a new partial-input mode of the parser (GH-31010)
Pablo Galindo Salgado [Tue, 8 Feb 2022 11:54:37 +0000 (11:54 +0000)] 
bpo-46521: Fix codeop to use a new partial-input mode of the parser (GH-31010)

3 years agobpo-46675: Allow object value arrays and split key dictionaries larger than 16 (GH...
Mark Shannon [Tue, 8 Feb 2022 11:50:38 +0000 (11:50 +0000)] 
bpo-46675: Allow object value arrays and split key dictionaries larger than 16 (GH-31191)

3 years agoPrint summary stats for overall success of specialization. (GH-31211)
Mark Shannon [Tue, 8 Feb 2022 11:50:02 +0000 (11:50 +0000)] 
Print summary stats for overall success of specialization. (GH-31211)

3 years agobpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203)
Gregory Beauregard [Tue, 8 Feb 2022 07:46:58 +0000 (23:46 -0800)] 
bpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203)

3 years agobpo-46323 Fix ref leak if ctypes.CFuncPtr raises an error. (GH-31209)
Dong-hee Na [Tue, 8 Feb 2022 05:22:13 +0000 (14:22 +0900)] 
bpo-46323 Fix ref leak if ctypes.CFuncPtr raises an error. (GH-31209)

3 years agobpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py (GH...
Jason Wilkes [Tue, 8 Feb 2022 01:09:07 +0000 (17:09 -0800)] 
bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py (GH-31204)

In [Lib/test/support/import_helper.py](https://github.com/python/cpython/blob/master/Lib/test/support/import_helper.py), the function `make_legacy_pyc` makes a call to `os.rename` which can fail when the source and target live on different devices. This happens (for example) when `PYTHONPYCACHEPREFIX` is set to a directory anywhere on disk, while a ramdisk is mounted on `/tmp` (the latter of which is the default on various Linux distros). Replacing `os.rename` with `shutil.move` fixes this.

Automerge-Triggered-By: GH:brettcannon
3 years agobpo-46659: calendar uses locale.getlocale() (GH-31166)
Victor Stinner [Mon, 7 Feb 2022 23:24:09 +0000 (00:24 +0100)] 
bpo-46659: calendar uses locale.getlocale() (GH-31166)

The calendar.LocaleTextCalendar and calendar.LocaleHTMLCalendar
classes module now use locale.getlocale(), instead of using
locale.getdefaultlocale(), if no locale is specified.

3 years agobpo-46534: Implement PEP 673 Self in typing.py (GH-30924)
James Hilton-Balfe [Mon, 7 Feb 2022 20:47:48 +0000 (20:47 +0000)] 
bpo-46534: Implement PEP 673 Self in typing.py (GH-30924)

Co-authored-by: Pradeep Kumar Srinivasan <gohanpra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agoSkip cron workflow for forks (GH-30748)
Hugo van Kemenade [Mon, 7 Feb 2022 19:40:40 +0000 (21:40 +0200)] 
Skip cron workflow for forks (GH-30748)

3 years agobpo-46638: Makes registry virtualisation setting stable when building MSIX packages...
Steve Dower [Mon, 7 Feb 2022 16:59:40 +0000 (16:59 +0000)] 
bpo-46638: Makes registry virtualisation setting stable when building MSIX packages (GH-31130)

3 years agobpo-46072: Merge dxpairs into py_stats. (GH-31197)
Mark Shannon [Mon, 7 Feb 2022 16:51:43 +0000 (16:51 +0000)] 
bpo-46072: Merge dxpairs into py_stats. (GH-31197)

3 years agobpo-46166: Fix compiler warnings in What's New in Python 3.11 (GH-31198)
Victor Stinner [Mon, 7 Feb 2022 16:46:22 +0000 (17:46 +0100)] 
bpo-46166: Fix compiler warnings in What's New in Python 3.11 (GH-31198)

Fix compiler warnings on PyObject_GetAttrString() calls in the What's
New in Python 3.11 doc of PyFrameObject changes.

3 years agobpo-46670: Fix #ifdef in sha3module.c (GH-31180)
Victor Stinner [Mon, 7 Feb 2022 15:22:24 +0000 (16:22 +0100)] 
bpo-46670: Fix #ifdef in sha3module.c (GH-31180)

* Test if HAVE_ALIGNED_REQUIRED is defined, not its value.
* Define explicitly NOT_PYTHON macro to 0.

Fix "gcc -Wundef" warnings.

3 years agobpo-46670: Remove unused macros in the Python directory (GH-31192)
Victor Stinner [Mon, 7 Feb 2022 15:21:52 +0000 (16:21 +0100)] 
bpo-46670: Remove unused macros in the Python directory (GH-31192)

3 years agobpo-46670: Remove unused macros in the Objects directory (GH-31193)
Victor Stinner [Mon, 7 Feb 2022 15:21:41 +0000 (16:21 +0100)] 
bpo-46670: Remove unused macros in the Objects directory (GH-31193)

3 years ago bpo-46670: Remove unused macros in the Modules directory (GH-31194)
Victor Stinner [Mon, 7 Feb 2022 15:21:31 +0000 (16:21 +0100)] 
 bpo-46670: Remove unused macros in the Modules directory (GH-31194)

* bpo-46670: Remove unused macros in the Modules directory

* Add again LINKAT_DIR_FD_CONVERTER: generated by Argument Clinic

3 years agobpo-39277: Fix PY_TIMEOUT_MAX cast in _threadmodule.c (GH-31195)
Victor Stinner [Mon, 7 Feb 2022 15:21:09 +0000 (16:21 +0100)] 
bpo-39277: Fix PY_TIMEOUT_MAX cast in _threadmodule.c (GH-31195)

Cast PY_TIMEOUT_MAX to double, not to _PyTime_t.

Fix the clang warning:

Modules/_threadmodule.c:1648:26: warning: implicit conversion from
'_PyTime_t' (aka 'long') to 'double' changes value from
9223372036854775 to 9223372036854776
[-Wimplicit-const-int-float-conversion]
    double timeout_max = (_PyTime_t)PY_TIMEOUT_MAX * 1e-6;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~ ~

3 years agobpo-46670: Remove unused macros in ceval.c (GH-31196)
Victor Stinner [Mon, 7 Feb 2022 15:06:27 +0000 (16:06 +0100)] 
bpo-46670: Remove unused macros in ceval.c (GH-31196)

Remove CHECKEXC() and EXT_POP() macros.

3 years agobpo-46072: Improve LOAD_METHOD stats (GH-31104)
Mark Shannon [Mon, 7 Feb 2022 14:30:34 +0000 (14:30 +0000)] 
bpo-46072: Improve LOAD_METHOD stats (GH-31104)

3 years agobpo-46323: _ctypes.CFuncPtr fails if _argtypes_ is too long (GH-31188)
Victor Stinner [Mon, 7 Feb 2022 13:53:15 +0000 (14:53 +0100)] 
bpo-46323: _ctypes.CFuncPtr fails if _argtypes_ is too long (GH-31188)

ctypes.CFUNCTYPE() and ctypes.WINFUNCTYPE() now fail to create the
type if its "_argtypes_" member contains too many arguments.
Previously, the error was only raised when calling a function.

Change also how CFUNCTYPE() and WINFUNCTYPE() handle KeyError to
prevent creating a chain of exceptions if ctypes.CFuncPtr raises an
error.

3 years agobpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186)
Nikita Sobolev [Mon, 7 Feb 2022 12:48:43 +0000 (15:48 +0300)] 
bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186)

Re-enable test_issue16464() of test_urllib2, move it to urllib2_localnet
and use the local HTTP server rather than an external HTTP server.

3 years agobpo-40479: Fix undefined behavior in Modules/_hashopenssl.c (GH-31153)
Zackery Spytz [Mon, 7 Feb 2022 07:40:54 +0000 (23:40 -0800)] 
bpo-40479: Fix undefined behavior in Modules/_hashopenssl.c (GH-31153)

va_end() must be called before returning.

3 years agobpo-46589: Improve documentation for typing._GenericAlias (GH-31026)
Matthew Rahtz [Mon, 7 Feb 2022 01:59:22 +0000 (01:59 +0000)] 
bpo-46589: Improve documentation for typing._GenericAlias (GH-31026)

(These should arguably be docstrings per convention in the rest of the file, but it doesn't really matter.)

3 years agobpo-46611: add coverage to instance and class checks in `typing.py` (GH-31078)
Nikita Sobolev [Mon, 7 Feb 2022 01:35:48 +0000 (04:35 +0300)] 
bpo-46611: add coverage to instance and class checks in `typing.py` (GH-31078)

3 years agobpo-46670: Test if a macro is defined, not its value (GH-31178)
Victor Stinner [Mon, 7 Feb 2022 00:46:51 +0000 (01:46 +0100)] 
bpo-46670: Test if a macro is defined, not its value (GH-31178)

* audioop.c: #ifdef WORDS_BIGENDIAN
* ctypes.h: #ifdef USING_MALLOC_CLOSURE_DOT_C
* _ctypes/malloc_closure.c: #ifdef HAVE_FFI_CLOSURE_ALLOC
  and #ifdef USING_APPLE_OS_LIBFFI
* pytime.c: #ifdef __APPLE__
* unicodeobject.c: #ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION

3 years agobpo-46670: Define all macros for stringlib (GH-31176)
Victor Stinner [Mon, 7 Feb 2022 00:26:58 +0000 (01:26 +0100)] 
bpo-46670: Define all macros for stringlib (GH-31176)

bytesobject.c, bytearrayobject.c and unicodeobject.c now define all
macros used by stringlib, to avoid using undefined macros.
Fix "gcc -Wundef" warnings.

3 years agobpo-46670: Remove unused get_frame_state() function (GH-31177)
Victor Stinner [Mon, 7 Feb 2022 00:25:44 +0000 (01:25 +0100)] 
bpo-46670: Remove unused get_frame_state() function (GH-31177)

The PyFrame_MAXFREELIST macro is no longer defined.

3 years agobpo-46655: allow stringized TypeAlias with get_type_hints (GH-31156)
Gregory Beauregard [Sun, 6 Feb 2022 23:16:22 +0000 (15:16 -0800)] 
bpo-46655: allow stringized TypeAlias with get_type_hints (GH-31156)

3 years agobpo-46659: test.support avoids locale.getdefaultlocale() (GH-31167)
Victor Stinner [Sun, 6 Feb 2022 20:51:56 +0000 (21:51 +0100)] 
bpo-46659: test.support avoids locale.getdefaultlocale() (GH-31167)

skip_if_buggy_ucrt_strfptime() of test.support now uses
locale.getpreferredencoding(False) instead of
locale.getdefaultlocale() to get the Windows code page.

3 years agobpo-46659: Update the test on the mbcs codec alias (GH-31168)
Victor Stinner [Sun, 6 Feb 2022 20:50:09 +0000 (21:50 +0100)] 
bpo-46659: Update the test on the mbcs codec alias (GH-31168)

encodings registers the _alias_mbcs() codec search function before
the search_function() codec search function. Previously, the
_alias_mbcs() was never used.

Fix the test_codecs.test_mbcs_alias() test: use the current ANSI code
page, not a fake ANSI code page number.

Remove the test_site.test_aliasing_mbcs() test: the alias is now
implemented in the encodings module, no longer in the site module.

3 years agoAdd more tests for variable substitution in generics (GH-31170)
Serhiy Storchaka [Sun, 6 Feb 2022 19:52:39 +0000 (21:52 +0200)] 
Add more tests for variable substitution in generics (GH-31170)

3 years agobpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)
Victor Stinner [Sun, 6 Feb 2022 14:08:54 +0000 (15:08 +0100)] 
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)

POST requests to http://www.example.com/ fail randomly.

3 years agobpo-23952: Document cgi module's maxlen variable (GH-30338)
Hugo van Kemenade [Sun, 6 Feb 2022 13:59:32 +0000 (15:59 +0200)] 
bpo-23952: Document cgi module's maxlen variable (GH-30338)

3 years ago[doc] Enhance readability by avoiding big blocks for small numbers. (GH-31157)
Julien Palard [Sun, 6 Feb 2022 12:44:04 +0000 (13:44 +0100)] 
[doc] Enhance readability by avoiding big blocks for small numbers. (GH-31157)

Initially reported by Gregory Jacob on the docs@ mailing list:

https://mail.python.org/archives/list/docs@python.org/thread/VPSFGLOZOHSPF7TGPOI65AOH25TCPSVR/

3 years agobpo-46640: Py_NAN now uses the C99 NAN constant (GH-31134)
Victor Stinner [Sun, 6 Feb 2022 12:13:04 +0000 (13:13 +0100)] 
bpo-46640: Py_NAN now uses the C99 NAN constant (GH-31134)

Building Python now requires a C99 <math.h> header file providing a
NAN constant, or the __builtin_nan() built-in function. If a platform
does not support Not-a-Number (NaN), the Py_NO_NAN macro can be
defined in the pyconfig.h file.

3 years agoAllows to specify the port on which serve documentation (GH-31145)
Christophe Nanteuil [Sun, 6 Feb 2022 10:22:06 +0000 (11:22 +0100)] 
Allows to specify the port on which serve documentation (GH-31145)

[user@localhost]$ make serve      # default configuration, no change
python3 ../Tools/scripts/serve.py build/html
Serving build/html on port 8000, control-C to stop
^CShutting down.

[user@localhost]$ make serve SERVE_PORT=8080 # new option
python3 ../Tools/scripts/serve.py build/html 8080
Serving build/html on port 8080, control-C to stop

3 years agobpo-40280: Address more test failures on Emscripten (GH-31050)
Christian Heimes [Sat, 5 Feb 2022 19:52:01 +0000 (21:52 +0200)] 
bpo-40280: Address more test failures on Emscripten (GH-31050)

Co-authored-by: Brett Cannon <brett@python.org>
3 years agobpo-46608: Fix argument parsing in freeze_modules.py (GH-31131)
Kumar Aditya [Sat, 5 Feb 2022 15:59:48 +0000 (21:29 +0530)] 
bpo-46608: Fix argument parsing in freeze_modules.py (GH-31131)

3 years agoFix __init_subclass__ using self instead of class (#31135)
Gregory Beauregard [Sat, 5 Feb 2022 15:50:00 +0000 (07:50 -0800)] 
Fix __init_subclass__ using self instead of class (#31135)

3 years agobpo-31369: include ``RegexFlag`` in ``re.__all__`` (GH-30279)
andrei kulakov [Sat, 5 Feb 2022 03:54:28 +0000 (22:54 -0500)] 
bpo-31369: include ``RegexFlag`` in ``re.__all__`` (GH-30279)

* added RegexFlag to re.__all__; added RegexFlag.NOFLAG

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agobpo-46608: exclude marshalled-frozen data if deep-freezing to save 300 KB space ...
Kumar Aditya [Fri, 4 Feb 2022 17:57:03 +0000 (23:27 +0530)] 
bpo-46608: exclude marshalled-frozen data if deep-freezing to save 300 KB space  (GH-31074)

This reduces the size of the data segment by **300 KB** of the executable because if the modules are deep-frozen then the marshalled frozen data just wastes space. This was inspired by comment by @gvanrossum in https://github.com/python/cpython/pull/29118#issuecomment-958521863. Note: There is a new option `--deepfreeze-only` in `freeze_modules.py` to change this behavior, it is on be default to save disk space.
```console
# du -s ./python before
27892   ./python
# du -s ./python after
27524   ./python
```

Automerge-Triggered-By: GH:ericsnowcurrently
3 years agobpo-46629: Update classicAppCompat.sccd for new signing certificate (GH-31111)
Steve Dower [Fri, 4 Feb 2022 16:11:19 +0000 (16:11 +0000)] 
bpo-46629: Update classicAppCompat.sccd for new signing certificate (GH-31111)

3 years agoAdd miss stats for specialized instructions. (GH-31108)
Mark Shannon [Fri, 4 Feb 2022 09:56:46 +0000 (09:56 +0000)] 
Add miss stats for specialized instructions. (GH-31108)

3 years agoOptimize images by IMGbot (GH-21348)
Manish Kumar ⛄ [Fri, 4 Feb 2022 06:49:43 +0000 (12:19 +0530)] 
Optimize images by IMGbot (GH-21348)

Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
3 years agobpo-46588: fix typo in test_calltip.py (GH-31119)
Caio Agiani [Fri, 4 Feb 2022 04:39:59 +0000 (01:39 -0300)] 
bpo-46588: fix typo in test_calltip.py  (GH-31119)