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

3 years agoMerge remote-tracking branch 'upstream/main'
Pablo Galindo [Thu, 3 Feb 2022 22:56:59 +0000 (22:56 +0000)] 
Merge remote-tracking branch 'upstream/main'

3 years agoPost 3.11.0a5
Pablo Galindo [Thu, 3 Feb 2022 22:56:12 +0000 (22:56 +0000)] 
Post 3.11.0a5

3 years agobpo-46630: Fix initial focus of IDLE query dialogs (GH-31112)
Terry Jan Reedy [Thu, 3 Feb 2022 22:06:17 +0000 (17:06 -0500)] 
bpo-46630: Fix initial focus of IDLE query dialogs (GH-31112)

On Windows, one had to Tab or click on the entry box
to get a cursor and be able to enter anything.

3 years agobpo-45975: IDLE - Remove extraneous parens (GH-31107)
Terry Jan Reedy [Thu, 3 Feb 2022 19:44:35 +0000 (14:44 -0500)] 
bpo-45975: IDLE - Remove extraneous parens (GH-31107)

mistakenly included in 3 files in previous PR
and backported both to 3.10 and 3.9.

3 years agocloses bpo-46626: Expose IP_BIND_ADDRESS_NO_PORT socket option. (GH-31106)
Benjamin Peterson [Thu, 3 Feb 2022 18:46:50 +0000 (10:46 -0800)] 
closes bpo-46626: Expose IP_BIND_ADDRESS_NO_PORT socket option. (GH-31106)

3 years agoCollect stats for UNPACK_SEQUENCE. (GH-31105)
Mark Shannon [Thu, 3 Feb 2022 18:40:56 +0000 (18:40 +0000)] 
Collect stats for UNPACK_SEQUENCE. (GH-31105)

3 years agoPython 3.11.0a5 v3.11.0a5
Pablo Galindo [Thu, 3 Feb 2022 18:34:09 +0000 (18:34 +0000)] 
Python 3.11.0a5

3 years agoPass reference to func, as well as args, when pushing frame. (GH-31100)
Mark Shannon [Thu, 3 Feb 2022 18:36:28 +0000 (18:36 +0000)] 
Pass reference to func, as well as args, when pushing frame. (GH-31100)

3 years agobpo-46436: Fix command-line option -d/--directory in module http.server (GH-30701)
Géry Ogam [Thu, 3 Feb 2022 15:51:05 +0000 (16:51 +0100)] 
bpo-46436: Fix command-line option -d/--directory in module http.server (GH-30701)

Fix command-line option -d/--directory in http.server main
function that was ignored when combined with --cgi.

Automerge-Triggered-By: GH:merwok
3 years agobpo-46569: [Enum] fix typo in `StrEnum` docs (GH-31007)
Nikita Sobolev [Thu, 3 Feb 2022 15:22:41 +0000 (18:22 +0300)] 
bpo-46569: [Enum] fix typo in `StrEnum` docs (GH-31007)

3 years agobpo-46624: Defer to 3.12: "Remove deprecated support for non-integer values" (GH...
Miro Hrončok [Thu, 3 Feb 2022 13:48:13 +0000 (14:48 +0100)] 
bpo-46624: Defer to 3.12: "Remove deprecated support for non-integer values" (GH-31098)

3 years agobpo-45885: Add more stats for COMPARE_OP in specialize.c (GH-31040)
Dennis Sweeney [Thu, 3 Feb 2022 13:32:52 +0000 (08:32 -0500)] 
bpo-45885: Add more stats for COMPARE_OP in specialize.c (GH-31040)

3 years agobpo-45773: Remove invalid peephole optimizations (GH-31066)
Brandt Bucher [Thu, 3 Feb 2022 10:14:44 +0000 (02:14 -0800)] 
bpo-45773: Remove invalid peephole optimizations (GH-31066)

3 years agobpo-44977: Deprecate delegation of int to __trunc__ (GH-31031)
Zackery Spytz [Thu, 3 Feb 2022 09:43:25 +0000 (01:43 -0800)] 
bpo-44977: Deprecate delegation of int to __trunc__ (GH-31031)

Calling int(a) when type(a) implements __trunc__ but not __int__
or __index__ now raises a DeprecationWarning.

3 years agobpo-46483: Remove `__class_getitem__` from `pathlib.PurePath` (GH-30848)
Nikita Sobolev [Thu, 3 Feb 2022 09:25:10 +0000 (12:25 +0300)] 
bpo-46483: Remove `__class_getitem__` from `pathlib.PurePath` (GH-30848)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
3 years agobpo-46565: `del` loop vars that are leaking into module namespaces (GH-30993)
Nikita Sobolev [Thu, 3 Feb 2022 09:20:08 +0000 (12:20 +0300)] 
bpo-46565: `del` loop vars that are leaking into module namespaces (GH-30993)

3 years agoRestrict use of Mock objects as specs (GH-31090)
Matthew Suozzo [Thu, 3 Feb 2022 08:41:19 +0000 (03:41 -0500)] 
Restrict use of Mock objects as specs (GH-31090)

Follow-on to https://github.com/python/cpython/pull/25326

This covers cases where mock objects are passed directly to spec.

3 years agobpo-45629: Improve test.support.skip_if_buildbot (GH-31094)
Gregory P. Smith [Thu, 3 Feb 2022 05:36:16 +0000 (21:36 -0800)] 
bpo-45629: Improve test.support.skip_if_buildbot (GH-31094)

It was added as part of #29222 to avoid running freeze tool tests on the
buildbots but the logic was wrong so it did not skip tests on typical posix
setup buildbots where the worker is launched from cron via an @reboot task and
thus have no USER environment variable.  This uses the canonical
`getpass.getuser()` API rather than rolling its own attempt.

3 years agobpo-45975: Use walrus operator for some idlelib while loops (GH-31083)
Nick Drozd [Thu, 3 Feb 2022 01:59:24 +0000 (19:59 -0600)] 
bpo-45975: Use walrus operator for some idlelib while loops (GH-31083)

3 years agobpo-46576: bpo-46524: Disable compiler optimization within test_peg_generator. (...
Gregory P. Smith [Wed, 2 Feb 2022 20:15:16 +0000 (12:15 -0800)] 
bpo-46576: bpo-46524: Disable compiler optimization within test_peg_generator. (#31015)

Disable compiler optimization within test_peg_generator.

This speed up test_peg_generator by always disabling compiler
optimizations by using -O0 or equivalent when the test is building its
own C extensions.

A build not using --with-pydebug in order to speed up test execution
winds up with this test taking a very long time as it would do
repeated compilation of parser C code using the same optimization
flags as CPython was built with.

This speeds the test up 6-8x on gps-raspbian.

Also incorporate's #31017's win32 conditional and flags.

Co-authored-by: Kumar Aditya kumaraditya303
3 years agobpo-46616: Ensures test_importlib.test_windows cleans up registry keys after completi...
Steve Dower [Wed, 2 Feb 2022 19:54:27 +0000 (19:54 +0000)] 
bpo-46616: Ensures test_importlib.test_windows cleans up registry keys after completion (GH-31086)

3 years agobpo-45173: Keep configparser deprecations until Python 3.12 (GH-30952)
Hugo van Kemenade [Wed, 2 Feb 2022 16:59:39 +0000 (18:59 +0200)] 
bpo-45173: Keep configparser deprecations until Python 3.12 (GH-30952)

* Revert "bpo-45173 Remove configparser deprecations"

This reverts commit df2284bc416dcccba1125b12af4499c45baabe4f.

* bpo-45173: Note these configparser deprecations will be removed in 3.12

3 years agobpo-37705: Remove orphaned PC/errmap.mak (GH-29724)
Oleg Iarygin [Wed, 2 Feb 2022 16:23:30 +0000 (19:23 +0300)] 
bpo-37705: Remove orphaned PC/errmap.mak (GH-29724)

After GH-15623 deleted `generrmap.c`, a related mak-file stopped working. The mak contains generrmap-related rules only so it should be removed altogether.

Further search for `errmap\.mak|generrmap` regex through content of CPython files shows no dangling reference left.

Since generrmap is already effectively removed, this pull request contains no blurp.

3 years agobpo-46433: _PyType_GetModuleByDef: handle static types in MRO (GH-30696)
Petr Viktorin [Wed, 2 Feb 2022 15:57:51 +0000 (16:57 +0100)] 
bpo-46433: _PyType_GetModuleByDef: handle static types in MRO (GH-30696)

Automerge-Triggered-By: GH:encukou
3 years agoAdd specialization stats for FOR_ITER. (GH-31079)
Mark Shannon [Wed, 2 Feb 2022 15:56:47 +0000 (15:56 +0000)] 
Add specialization stats for FOR_ITER. (GH-31079)

3 years ago bpo-45459: Add Py_buffer to limited API (GH-29991)
Christian Heimes [Wed, 2 Feb 2022 15:03:10 +0000 (17:03 +0200)] 
 bpo-45459: Add Py_buffer to limited API (GH-29991)

- [x] ``Py_buffer`` struct
- [x] ``PyBuffer_*()`` API functions
- [x] ``PyBUF_*`` constants
- [x] ``Py_bf_getbuffer`` and ``Py_bf_releasebuffer`` type slots
- [x] ``PyMemoryView_FromBuffer()`` API
- [x] tests for limited API
- [x] ``make regen-limited-abi``
- [x] documentation update
- [ ] export ``PyPickleBuffer*()`` API ???

3 years agobpo-43012: remove `pathlib._Accessor` (GH-25701)
Barney Gale [Wed, 2 Feb 2022 12:38:25 +0000 (12:38 +0000)] 
bpo-43012: remove `pathlib._Accessor` (GH-25701)

Per Pitrou:

> The original intent for the “accessor” thing was to have a variant that did all accesses under a filesystem tree in a race condition-free way using openat and friends. It turned out to be much too hairy to actually implement, so was entirely abandoned, but the accessor abstraction was left there.

https://discuss.python.org/t/make-pathlib-extensible/3428/2

Accessors are:

- Lacking any internal purpose - '_NormalAccessor' is the only implementation
- Lacking any firm conceptual difference to `Path` objects themselves (inc. subclasses)
- Non-public, i.e. underscore prefixed - '_Accessor' and '_NormalAccessor'
- Unofficially used to implement customized `Path` objects, but once once [bpo-24132]() is addressed there will be a supported route for that.

This patch preserves all existing behaviour.

3 years agobpo-46072: Add some frame stats. (GH-31060)
Mark Shannon [Wed, 2 Feb 2022 11:01:33 +0000 (11:01 +0000)] 
bpo-46072: Add some frame stats. (GH-31060)