]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
5 years agobpo-40302: Replace PY_INT64_T with int64_t (GH-19573)
Victor Stinner [Fri, 17 Apr 2020 17:13:06 +0000 (19:13 +0200)] 
bpo-40302: Replace PY_INT64_T with int64_t (GH-19573)

* Replace PY_INT64_T with int64_t
* Replace PY_UINT32_T with uint32_t
* Replace PY_UINT64_T with uint64_t

sha3module.c no longer checks if PY_UINT64_T is defined since it's
always defined and uint64_t is always available on platforms
supported by Python.

5 years agobpo-40286: Add randbytes() method to random.Random (GH-19527)
Victor Stinner [Fri, 17 Apr 2020 17:05:35 +0000 (19:05 +0200)] 
bpo-40286: Add randbytes() method to random.Random (GH-19527)

Add random.randbytes() function and random.Random.randbytes()
method to generate random bytes.

Modify secrets.token_bytes() to use SystemRandom.randbytes()
rather than calling directly os.urandom().

Rename also genrand_int32() to genrand_uint32(), since it returns an
unsigned 32-bit integer, not a signed integer.

The _random module is now built with Py_BUILD_CORE_MODULE defined.

5 years agobpo-39901: Move `pathlib.Path.owner()` and `group()` implementations into the path...
Barney Gale [Fri, 17 Apr 2020 16:41:07 +0000 (17:41 +0100)] 
bpo-39901: Move `pathlib.Path.owner()` and `group()` implementations into the path accessor. (GH-18844)

5 years agobpo-40300: Allow empty logging.Formatter.default_msec_format. (GH-19551)
Mariusz Felisiak [Fri, 17 Apr 2020 16:02:47 +0000 (18:02 +0200)] 
bpo-40300: Allow empty logging.Formatter.default_msec_format. (GH-19551)

5 years agobpo-40302: Add pycore_byteswap.h header file (GH-19552)
Victor Stinner [Fri, 17 Apr 2020 15:47:20 +0000 (17:47 +0200)] 
bpo-40302: Add pycore_byteswap.h header file (GH-19552)

Add a new internal pycore_byteswap.h header file with the following
functions:

* _Py_bswap16()
* _Py_bswap32()
* _Py_bswap64()

Use these functions in _ctypes, sha256 and sha512 modules,
and also use in the UTF-32 encoder.

sha256, sha512 and _ctypes modules are now built with the internal
C API.

5 years agobpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540)
Inada Naoki [Fri, 17 Apr 2020 06:56:35 +0000 (15:56 +0900)] 
bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540)

It has not returned the file position after the seek.

5 years agoMinor modernization and readability improvement to the tokenizer example (GH-19558)
Raymond Hettinger [Fri, 17 Apr 2020 02:54:13 +0000 (19:54 -0700)] 
Minor modernization and readability improvement to the tokenizer example (GH-19558)

5 years agobpo-40294: Fix _asyncio when module is loaded/unloaded multiple times (GH-19542)
Jeffrey Quesnelle [Fri, 17 Apr 2020 02:09:45 +0000 (22:09 -0400)] 
bpo-40294: Fix _asyncio when module is loaded/unloaded multiple times (GH-19542)

5 years agoFix parameter names in assertIn() docs (GH-18829)
Christoph Zwerschke [Fri, 17 Apr 2020 01:54:53 +0000 (03:54 +0200)] 
Fix parameter names in assertIn() docs (GH-18829)

The names "member" and "container" for the arguments are also used in the module and shown with the help() function, and are immediately understandable in this context, contrary to "first" and "second".

5 years agobpo-39793: use the same domain on make_msgid tests (#18698)
Batuhan Taşkaya [Thu, 16 Apr 2020 17:29:12 +0000 (20:29 +0300)] 
bpo-39793: use the same domain on make_msgid tests (#18698)

* bpo-39793: use same domain on make_msgid tests

* apply suggestions

5 years agobpo-40290: Add zscore() to statistics.NormalDist. (GH-19547)
Raymond Hettinger [Thu, 16 Apr 2020 17:25:14 +0000 (10:25 -0700)] 
bpo-40290: Add zscore() to statistics.NormalDist. (GH-19547)

5 years agobpo-35967 resolve platform.processor late (GH-12239)
Jason R. Coombs [Thu, 16 Apr 2020 12:28:09 +0000 (08:28 -0400)] 
bpo-35967 resolve platform.processor late (GH-12239)

* Replace flag-flip indirection with direct inspection

* Use any for simpler code

* Avoid flag flip and set results directly.

* Resolve processor in a single function.

* Extract processor handling into a namespace (class)

* Remove _syscmd_uname, unused

* Restore platform.processor behavior to match prior expectation (reliant on uname -p in a subprocess).

* Extract '_unknown_as_blank' function.

* Override uname_result to resolve the processor late.

* Add a test intended to capture the expected values from 'uname -p'

* Instead of trying to keep track of all of the possible outputs on different systems (probably a fool's errand), simply assert that except for the known platform variance, uname().processor matches the output of 'uname -p'

* Use a skipIf directive

* Use contextlib.suppress to suppress the error. Inline strip call.

* 📜🤖 Added by blurb_it.

* Remove use of contextlib.suppress (it would fail with NameError if it had any effect). Rely on _unknown_as_blank to replace unknown with blank.

Co-authored-by: blurb-it[bot] <blurb-it[bot]@users.noreply.github.com>
5 years agobpo-40209: Use tokenize.open in test_unparse (GH-19399)
Hakan Çelik [Thu, 16 Apr 2020 10:11:55 +0000 (13:11 +0300)] 
bpo-40209: Use tokenize.open in test_unparse (GH-19399)

5 years agoFix typo in exception thrown by ast.unparse (GH-19534)
Shantanu [Thu, 16 Apr 2020 10:10:12 +0000 (03:10 -0700)] 
Fix typo in exception thrown by ast.unparse (GH-19534)

5 years agobpo-35967: Make test_platform.test_uname_processor more lenient to satisfy build...
Jason R. Coombs [Wed, 15 Apr 2020 23:55:35 +0000 (19:55 -0400)] 
bpo-35967: Make test_platform.test_uname_processor more lenient to satisfy build bots. (GH-19544)

* bpo-35967: Make test more lenient to satisfy build bots.

* Update Lib/test/test_platform.py

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
* Expect '' for 'unknown'

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
5 years agobpo-40270: Enable json extension in Windows sqlite extension (GH-19528)
Ammar Askar [Wed, 15 Apr 2020 21:19:26 +0000 (14:19 -0700)] 
bpo-40270: Enable json extension in Windows sqlite extension (GH-19528)

5 years agobpo-40257: Output object's own docstring in pydoc (GH-19479)
Serhiy Storchaka [Wed, 15 Apr 2020 20:00:20 +0000 (23:00 +0300)] 
bpo-40257: Output object's own docstring in pydoc (GH-19479)

5 years agobpo-29255: Wait in KqueueSelector.select when no fds are registered (GH-19508)
Russell Davis [Wed, 15 Apr 2020 18:57:06 +0000 (11:57 -0700)] 
bpo-29255: Wait in KqueueSelector.select when no fds are registered (GH-19508)

Also partially fixes bpo-25680 (there's still a discrepancy in behavior
on Windows that needs to be fixed).

5 years agobpo-35967: Baseline values for uname -p (GH-12824)
Jason R. Coombs [Wed, 15 Apr 2020 18:32:01 +0000 (14:32 -0400)] 
bpo-35967: Baseline values for uname -p (GH-12824)

* Add a test intended to capture the expected values from 'uname -p'

* Instead of trying to keep track of all of the possible outputs on different systems (probably a fool's errand), simply assert that except for the known platform variance, uname().processor matches the output of 'uname -p'

* Use a skipIf directive

* Use contextlib.suppress to suppress the error. Inline strip call.

5 years agobpo-40267: Fix message when last input character produces a SyntaxError (GH-19521)
Lysandros Nikolaou [Wed, 15 Apr 2020 18:22:10 +0000 (21:22 +0300)] 
bpo-40267: Fix message when last input character produces a SyntaxError (GH-19521)

When there is a SyntaxError after reading the last input character from
the tokenizer and if no newline follows it, the error message used to be
`unexpected EOF while parsing`, which is wrong.

5 years agoClean up compatibility code in importlib fixtures (#19156)
Jason R. Coombs [Wed, 15 Apr 2020 17:55:43 +0000 (13:55 -0400)] 
Clean up compatibility code in importlib fixtures (#19156)

5 years agobpo-40268: Reformat posixmodule.c includes (GH-19536)
Victor Stinner [Wed, 15 Apr 2020 13:07:31 +0000 (15:07 +0200)] 
bpo-40268: Reformat posixmodule.c includes (GH-19536)

5 years agoOptimize _Py_strhex_impl() (GH-19535)
Victor Stinner [Wed, 15 Apr 2020 12:05:24 +0000 (14:05 +0200)] 
Optimize _Py_strhex_impl() (GH-19535)

Avoid a temporary buffer to create a bytes string: use
PyBytes_FromStringAndSize() to directly allocate a bytes object.

Cleanup also the code: PEP 7 formatting, move variable definitions
closer to where they are used. Fix assertion checking "j" index.

5 years agobpo-40277: Add a repr() to namedtuple's _tuplegetter to aid with introspection (GH...
Ammar Askar [Wed, 15 Apr 2020 06:36:08 +0000 (23:36 -0700)] 
bpo-40277: Add a repr() to namedtuple's _tuplegetter to aid with introspection (GH-19537)

5 years agobpo-40268: Remove unused imports in pylifecycle.c (GH-19533)
Victor Stinner [Wed, 15 Apr 2020 02:01:58 +0000 (04:01 +0200)] 
bpo-40268: Remove unused imports in pylifecycle.c (GH-19533)

Remove unused imports in files:

* initconfig.c
* main.c
* preconfig.h
* pylifecycle.c
* python.c
* pythonrun.c

5 years agobpo-40268: Remove unused osdefs.h includes (GH-19532)
Victor Stinner [Wed, 15 Apr 2020 01:24:57 +0000 (03:24 +0200)] 
bpo-40268: Remove unused osdefs.h includes (GH-19532)

When the include is needed, add required symbol in a comment.

5 years agobpo-40268: Remove unused pycore_pymem.h includes (GH-19531)
Victor Stinner [Wed, 15 Apr 2020 00:57:50 +0000 (02:57 +0200)] 
bpo-40268: Remove unused pycore_pymem.h includes (GH-19531)

5 years agobpo-40268: Remove unused structmember.h includes (GH-19530)
Victor Stinner [Wed, 15 Apr 2020 00:35:41 +0000 (02:35 +0200)] 
bpo-40268: Remove unused structmember.h includes (GH-19530)

If only offsetof() is needed: include stddef.h instead.

When structmember.h is used, add a comment explaining that
PyMemberDef is used.

5 years agobpo-40268: Remove explicit pythread.h includes (#19529)
Victor Stinner [Wed, 15 Apr 2020 00:04:42 +0000 (02:04 +0200)] 
bpo-40268: Remove explicit pythread.h includes (#19529)

Remove explicit pythread.h includes: it is always included
by Python.h.

5 years agobpo-39481: PEP 585 for dataclasses, mailbox, contextvars (GH-19425)
Ethan Smith [Tue, 14 Apr 2020 23:14:15 +0000 (16:14 -0700)] 
bpo-39481: PEP 585 for dataclasses, mailbox, contextvars (GH-19425)

5 years agobpo-39522: Always initialise kind attribute in constant ast nodes (GH-19525)
Pablo Galindo [Tue, 14 Apr 2020 20:40:41 +0000 (21:40 +0100)] 
bpo-39522: Always initialise kind attribute in constant ast nodes (GH-19525)

5 years agobpo-39522: Use _PyUnicodeWriter_WriteStr instead of PyUnicode_AS_DATA (GH-19523)
Batuhan Taşkaya [Tue, 14 Apr 2020 20:21:22 +0000 (23:21 +0300)] 
bpo-39522: Use _PyUnicodeWriter_WriteStr instead of PyUnicode_AS_DATA (GH-19523)

5 years agobpo-9216: Nobody expects the geohashing FIPS inquisition (GH-19520)
Miro Hrončok [Tue, 14 Apr 2020 19:49:11 +0000 (21:49 +0200)] 
bpo-9216: Nobody expects the geohashing FIPS inquisition (GH-19520)

Automerge-Triggered-By: @tiran
5 years agobpo-40260: Update modulefinder to use io.open_code() and respect coding comments...
Barry [Tue, 14 Apr 2020 19:16:06 +0000 (20:16 +0100)] 
bpo-40260: Update modulefinder to use io.open_code() and respect coding comments (GH-19488)

5 years agobpo-395222: Correctly unparse unicode prefix in ast_unparse.c (GH-19512)
Batuhan Taşkaya [Tue, 14 Apr 2020 18:55:01 +0000 (21:55 +0300)] 
bpo-395222: Correctly unparse unicode prefix in ast_unparse.c (GH-19512)

5 years agobpo-32033: Fix test_pwd failures on Android (GH-19502)
Zackery Spytz [Tue, 14 Apr 2020 18:11:46 +0000 (12:11 -0600)] 
bpo-32033: Fix test_pwd failures on Android (GH-19502)

5 years agobpo-40170: Convert PyObject_IS_GC() macro to a function (GH-19464)
Hai Shi [Tue, 14 Apr 2020 18:11:20 +0000 (02:11 +0800)] 
bpo-40170: Convert PyObject_IS_GC() macro to a function (GH-19464)

5 years agobpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19511)
Dong-hee Na [Tue, 14 Apr 2020 16:35:36 +0000 (01:35 +0900)] 
bpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19511)

5 years agobpo-40268: Move struct _gc_runtime_state to pycore_gc.h (GH-19515)
Victor Stinner [Tue, 14 Apr 2020 16:30:41 +0000 (18:30 +0200)] 
bpo-40268: Move struct _gc_runtime_state to pycore_gc.h (GH-19515)

5 years agoregrtest: log timeout at startup (GH-19514)
Victor Stinner [Tue, 14 Apr 2020 16:29:44 +0000 (18:29 +0200)] 
regrtest: log timeout at startup (GH-19514)

Reduce also worker timeout.

5 years agobpo-40232: Update PyOS_AfterFork_Child() to use _PyThread_at_fork_reinit() (GH-19450)
Dong-hee Na [Tue, 14 Apr 2020 16:16:24 +0000 (01:16 +0900)] 
bpo-40232: Update PyOS_AfterFork_Child() to use _PyThread_at_fork_reinit() (GH-19450)

5 years agobpo-40268: Remove a few pycore_pystate.h includes (GH-19510)
Victor Stinner [Tue, 14 Apr 2020 15:52:15 +0000 (17:52 +0200)] 
bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)

5 years agobpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19477)
Dong-hee Na [Tue, 14 Apr 2020 13:15:52 +0000 (22:15 +0900)] 
bpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19477)

5 years agobpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)
Victor Stinner [Tue, 14 Apr 2020 13:14:01 +0000 (15:14 +0200)] 
bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)

Rename _PyInterpreterState_GET_UNSAFE() to _PyInterpreterState_GET()
for consistency with _PyThreadState_GET() and to have a shorter name
(help to fit into 80 columns).

Add also "assert(tstate != NULL);" to the function.

5 years agobpo-40268: Include explicitly pycore_interp.h (GH-19505)
Victor Stinner [Tue, 14 Apr 2020 12:26:24 +0000 (14:26 +0200)] 
bpo-40268: Include explicitly pycore_interp.h (GH-19505)

pycore_pystate.h no longer includes pycore_interp.h:
it's now included explicitly in files accessing PyInterpreterState.

5 years agobpo-39481: Make weakref and WeakSet generic (GH-19497)
Ethan Smith [Tue, 14 Apr 2020 04:54:40 +0000 (21:54 -0700)] 
bpo-39481: Make weakref and WeakSet generic (GH-19497)

5 years agobpo-39481: Make functools.cached_property, partial, partialmethod generic (#19427)
Ethan Smith [Tue, 14 Apr 2020 04:53:04 +0000 (21:53 -0700)] 
bpo-39481: Make functools.cached_property, partial, partialmethod generic (#19427)

5 years agocloses bpo-40266, closes bpo-39953: Use numeric lib code if compiling against old...
Benjamin Peterson [Tue, 14 Apr 2020 03:11:40 +0000 (22:11 -0500)] 
closes bpo-40266, closes bpo-39953: Use numeric lib code if compiling against old OpenSSL. (GH-19506)

5 years agoFix typo from Lib/asyncio/events.py (GH-19410)
Galden [Tue, 14 Apr 2020 00:04:32 +0000 (08:04 +0800)] 
Fix typo from Lib/asyncio/events.py (GH-19410)

5 years agobpo-40208: Remove deprecated has_exec method of SymbolTable (GH-19396)
Batuhan Taşkaya [Mon, 13 Apr 2020 23:51:32 +0000 (02:51 +0300)] 
bpo-40208: Remove deprecated has_exec method of SymbolTable (GH-19396)

5 years agobpo-39380: Change ftplib encoding from latin-1 to utf-8 (GH-18048)
Sebastian Pedersen [Mon, 13 Apr 2020 23:07:56 +0000 (01:07 +0200)] 
bpo-39380: Change ftplib encoding from latin-1 to utf-8 (GH-18048)

Add the encoding in ftplib.FTP and ftplib.FTP_TLS to the
constructor as keyword-only and change the default from "latin-1" to "utf-8"
to follow RFC 2640.

5 years agobpo-32894: Support unparsing of infinity numbers in ast_unparser.c (GH-17426)
Batuhan Taşkaya [Mon, 13 Apr 2020 22:51:31 +0000 (01:51 +0300)] 
bpo-32894: Support unparsing of infinity numbers in ast_unparser.c (GH-17426)

5 years agobpo-40091: Fix a hang at fork in the logging module (GH-19416)
Victor Stinner [Mon, 13 Apr 2020 22:25:34 +0000 (00:25 +0200)] 
bpo-40091: Fix a hang at fork in the logging module (GH-19416)

Fix a hang at fork in the logging module: the new private
_at_fork_reinit() method is now used to reinitialize locks at fork in
the child process.

The createLock() method is no longer used at fork.

5 years agobpo-39481: fix test_genericalias on Android (GH-19469)
Chih-Hsuan Yen [Mon, 13 Apr 2020 22:00:16 +0000 (06:00 +0800)] 
bpo-39481: fix test_genericalias on Android (GH-19469)

Android bionic does not implement shm_open/shm_unlink [1].
As a result _posixshmem extension does not exist and
multiprocessing.shared_memory cannot be imported.

[1] https://android.googlesource.com/platform/bionic/+/master/docs/status.md

5 years agobpo-40241: Add pycore_interp.h header (GH-19499)
Victor Stinner [Mon, 13 Apr 2020 10:47:17 +0000 (12:47 +0200)] 
bpo-40241: Add pycore_interp.h header (GH-19499)

Move PyInterpreterState and related functions to a new internal
pycore_interp.h header file.

5 years agobpo-40268: Add pycore_runtime.h header file (GH-19493)
Victor Stinner [Mon, 13 Apr 2020 09:45:21 +0000 (11:45 +0200)] 
bpo-40268: Add pycore_runtime.h header file (GH-19493)

Move PyRuntimeState from pycore_pystate.h to pycore_runtime.h.

Remove _PyGILState_check_enabled macro: access directly
_PyRuntime.gilstate.check_enabled.

5 years agobpo-40241: Add pycore_gc.h header file (GH-19494)
Victor Stinner [Mon, 13 Apr 2020 09:38:42 +0000 (11:38 +0200)] 
bpo-40241: Add pycore_gc.h header file (GH-19494)

Move the PyGC_Head structure and the following private macros to the
internal C API:

* _PyGCHead_FINALIZED()
* _PyGCHead_NEXT()
* _PyGCHead_PREV()
* _PyGCHead_SET_FINALIZED()
* _PyGCHead_SET_NEXT()
* _PyGCHead_SET_PREV()
* _PyGC_FINALIZED()
* _PyGC_PREV_MASK
* _PyGC_PREV_MASK_COLLECTING
* _PyGC_PREV_MASK_FINALIZED
* _PyGC_PREV_SHIFT
* _PyGC_SET_FINALIZED()
* _PyObject_GC_IS_TRACKED()
* _PyObject_GC_MAY_BE_TRACKED()
* _Py_AS_GC(o)

Keep the private _PyGC_FINALIZED() macro in the public C API for
backward compatibility with Python 3.8: make it an alias to the new
PyObject_GC_IsFinalized() function.

Move the SIZEOF_PYGC_HEAD constant from _testcapi module to
_testinternalcapi module.

5 years agoImproved documentation for `BUILD_CONST_KEY_MAP` (GH-19454)
laike9m [Mon, 13 Apr 2020 02:55:45 +0000 (19:55 -0700)] 
Improved documentation for `BUILD_CONST_KEY_MAP` (GH-19454)

5 years agoAdd double quote cases to invalid prefix tests (GH-19489)
Pablo Galindo [Mon, 13 Apr 2020 01:47:35 +0000 (02:47 +0100)] 
Add double quote cases to invalid prefix tests (GH-19489)

5 years agobpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492)
Victor Stinner [Mon, 13 Apr 2020 01:04:28 +0000 (03:04 +0200)] 
bpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492)

Don't access PyInterpreterState.config member directly anymore, but
use new functions:

* _PyInterpreterState_GetConfig()
* _PyInterpreterState_SetConfig()
* _Py_GetConfig()

5 years agobpo-40234: Revert "bpo-37266: Daemon threads are now denied in subinterpreters (GH...
Victor Stinner [Sun, 12 Apr 2020 21:45:09 +0000 (23:45 +0200)] 
bpo-40234: Revert "bpo-37266: Daemon threads are now denied in subinterpreters (GH-14049)" (GH-19456)

This reverts commit 066e5b1a917ec2134e8997d2cadd815724314252.

5 years agocloses bpo-39953: Generate ifdefs around library code definitions. (GH-19490)
Benjamin Peterson [Sun, 12 Apr 2020 18:59:31 +0000 (13:59 -0500)] 
closes bpo-39953: Generate ifdefs around library code definitions. (GH-19490)

5 years agobpo-40246: Report a better error message for invalid string prefixes (GH-19476)
Lysandros Nikolaou [Sun, 12 Apr 2020 18:21:00 +0000 (21:21 +0300)] 
bpo-40246: Report a better error message for invalid string prefixes (GH-19476)

5 years agobpo-31758: Prevent crashes when using an uninitialized _elementtree.XMLParser object...
Oren Milman [Sun, 12 Apr 2020 14:36:41 +0000 (17:36 +0300)] 
bpo-31758: Prevent crashes when using an uninitialized _elementtree.XMLParser object (GH-3997)

5 years agobpo-13743: Add some documentation strings to xml.dom.minidom (GH-16355)
Alex Itkes [Sun, 12 Apr 2020 14:21:58 +0000 (17:21 +0300)] 
bpo-13743: Add some documentation strings to xml.dom.minidom (GH-16355)

5 years agobpo-39011: Preserve line endings within ElementTree attributes (GH-18468)
mefistotelis [Sun, 12 Apr 2020 12:51:58 +0000 (14:51 +0200)] 
bpo-39011: Preserve line endings within ElementTree attributes (GH-18468)

* bpo-39011: Preserve line endings within attributes

Line endings within attributes were previously normalized to "\n" in Py3.7/3.8.
This patch removes that normalization, as line endings which were
replaced by entity numbers should be preserved in original form.

5 years agobpo-39943: Add the const qualifier to pointers on non-mutable PyBytes data. (GH-19472)
Serhiy Storchaka [Sun, 12 Apr 2020 11:58:27 +0000 (14:58 +0300)] 
bpo-39943: Add the const qualifier to pointers on non-mutable PyBytes data. (GH-19472)

5 years agocloses bpo-39953: Update OpenSSL error codes table. (GH-19082)
Benjamin Peterson [Sat, 11 Apr 2020 20:36:12 +0000 (15:36 -0500)] 
closes bpo-39953: Update OpenSSL error codes table. (GH-19082)

I updated the error codes using the OpenSSL 1.1.1f source tree.

5 years agobpo-40126: Fix reverting multiple patches in unittest.mock. (GH-19351)
Serhiy Storchaka [Sat, 11 Apr 2020 07:59:24 +0000 (10:59 +0300)] 
bpo-40126: Fix reverting multiple patches in unittest.mock. (GH-19351)

Patcher's __exit__() is now never called if its __enter__() is failed.
Returning true from __exit__() silences now the exception.

5 years agobpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode data. (GH...
Serhiy Storchaka [Sat, 11 Apr 2020 07:48:40 +0000 (10:48 +0300)] 
bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode data. (GH-19345)

5 years agobpo-38501: Add a warning section to multiprocessing.Pool docs about resource managing...
Pablo Galindo [Sat, 11 Apr 2020 02:05:37 +0000 (03:05 +0100)] 
bpo-38501: Add a warning section to multiprocessing.Pool docs about resource managing (GH-19466)

5 years agobpo-40241: Add PyObject_GC_IsTracked and PyObject_GC_IsFinalized to the public C...
Pablo Galindo [Sat, 11 Apr 2020 00:21:54 +0000 (01:21 +0100)] 
bpo-40241: Add PyObject_GC_IsTracked and PyObject_GC_IsFinalized to the public C-API (GH-19461)

Add the functions PyObject_GC_IsTracked and PyObject_GC_IsFinalized to the public API to allow to query if Python objects are being currently tracked or have been already finalized by the garbage collector respectively.

5 years agobpo-39481: PEP 585 for a variety of modules (GH-19423)
Batuhan Taşkaya [Fri, 10 Apr 2020 14:46:36 +0000 (17:46 +0300)] 
bpo-39481: PEP 585 for a variety of modules (GH-19423)

- concurrent.futures
- ctypes
- http.cookies
- multiprocessing
- queue
- tempfile
- unittest.case
- urllib.parse

5 years agobpo-39481: PEP 585 for difflib, filecmp, fileinput (#19422)
Ethan Smith [Fri, 10 Apr 2020 04:47:31 +0000 (21:47 -0700)] 
bpo-39481: PEP 585 for difflib, filecmp, fileinput (#19422)

5 years agobpo-39481: PEP 585 for enumerate, AsyncGeneratorType, mmap (GH-19421)
Ethan Smith [Fri, 10 Apr 2020 04:25:53 +0000 (21:25 -0700)] 
bpo-39481: PEP 585 for enumerate, AsyncGeneratorType, mmap (GH-19421)

5 years agobpo-39481: PEP 585 for ipaddress.py (GH-19418)
Batuhan Taşkaya [Fri, 10 Apr 2020 04:04:54 +0000 (07:04 +0300)] 
bpo-39481: PEP 585 for ipaddress.py (GH-19418)

5 years agoGeneric itertools.chain (GH-19417)
Ethan Smith [Fri, 10 Apr 2020 03:28:08 +0000 (20:28 -0700)] 
Generic itertools.chain (GH-19417)

5 years agobpo-39943: Keep constness of pointer objects. (19405)
Andy Lester [Fri, 10 Apr 2020 01:05:38 +0000 (20:05 -0500)] 
bpo-39943: Keep constness of pointer objects. (19405)

* Keep constness of pointer objects.

Also moved an auto variable that got consted into its innermost necessary scope.

* move def

Co-authored-by: Benjamin Peterson <benjamin@python.org>
5 years agobpo-31904: Fix test_c_locale_coercion encodings for VxWorks RTOS (GH-19448)
pxinwr [Thu, 9 Apr 2020 15:46:23 +0000 (23:46 +0800)] 
bpo-31904: Fix test_c_locale_coercion encodings for VxWorks RTOS (GH-19448)

5 years agobpo-40077: Remove redundant cast in json module (GH-19438)
Hai Shi [Thu, 9 Apr 2020 15:10:29 +0000 (23:10 +0800)] 
bpo-40077: Remove redundant cast in json module (GH-19438)

5 years agobpo-25780: Expose CAN_RAW_JOIN_FILTERS in the socket module (GH-19190)
Zackery Spytz [Thu, 9 Apr 2020 12:03:49 +0000 (06:03 -0600)] 
bpo-25780: Expose CAN_RAW_JOIN_FILTERS in the socket module (GH-19190)

Co-Authored-By: Stefan Tatschner <stefan@rumpelsepp.org>
5 years agobpo-40082: trip_signal() uses the main interpreter (GH-19441)
Victor Stinner [Wed, 8 Apr 2020 21:35:05 +0000 (23:35 +0200)] 
bpo-40082: trip_signal() uses the main interpreter (GH-19441)

Fix the signal handler: it now always uses the main interpreter,
rather than trying to get the current Python thread state.

The following function now accepts an interpreter, instead of a
Python thread state:

* _PyEval_SignalReceived()
* _Py_ThreadCanHandleSignals()
* _PyEval_AddPendingCall()
* COMPUTE_EVAL_BREAKER()
* SET_GIL_DROP_REQUEST(), RESET_GIL_DROP_REQUEST()
* SIGNAL_PENDING_CALLS(), UNSIGNAL_PENDING_CALLS()
* SIGNAL_PENDING_SIGNALS(), UNSIGNAL_PENDING_SIGNALS()
* SIGNAL_ASYNC_EXC(), UNSIGNAL_ASYNC_EXC()

Py_AddPendingCall() now uses the main interpreter if it fails to the
current Python thread state.

Convert _PyThreadState_GET() and PyInterpreterState_GET_UNSAFE()
macros to static inline functions.

5 years agobpo-37127: Remove _pending_calls.finishing (GH-19439)
Victor Stinner [Wed, 8 Apr 2020 20:10:53 +0000 (22:10 +0200)] 
bpo-37127: Remove _pending_calls.finishing (GH-19439)

5 years agobpo-40226: PyInterpreterState_Delete() deletes pending calls (GH-19436)
Victor Stinner [Wed, 8 Apr 2020 15:54:59 +0000 (17:54 +0200)] 
bpo-40226: PyInterpreterState_Delete() deletes pending calls (GH-19436)

PyInterpreterState_New() is now responsible to create pending calls,
PyInterpreterState_Delete() now deletes pending calls.

* Rename _PyEval_InitThreads() to _PyEval_InitGIL() and rename
  _PyEval_InitGIL() to _PyEval_FiniGIL().
* _PyEval_InitState() and PyEval_FiniState() now create and delete
  pending calls. _PyEval_InitState() now returns -1 on memory
  allocation failure.
* Add init_interp_create_gil() helper function: code shared by
  Py_NewInterpreter() and Py_InitializeFromConfig().
* init_interp_create_gil() now also calls _PyEval_FiniGIL(),
  _PyEval_InitGIL() and _PyGILState_Init() in subinterpreters, but
  these functions now do nothing when called from a subinterpreter.

5 years agoRemove extraneous ')' in abstract.h (GH-19146)
Jimmy Yang [Wed, 8 Apr 2020 09:28:59 +0000 (02:28 -0700)] 
Remove extraneous ')' in abstract.h (GH-19146)

5 years agobpo-40187: Refactor typing.TypedDict. (GH-19372)
Serhiy Storchaka [Wed, 8 Apr 2020 08:03:27 +0000 (11:03 +0300)] 
bpo-40187: Refactor typing.TypedDict. (GH-19372)

5 years agobpo-40185: Refactor typing.NamedTuple (GH-19371)
Serhiy Storchaka [Wed, 8 Apr 2020 07:59:04 +0000 (10:59 +0300)] 
bpo-40185: Refactor typing.NamedTuple (GH-19371)

5 years agobpo-40170: Remove PyIndex_Check() macro (GH-19428)
Victor Stinner [Wed, 8 Apr 2020 00:26:41 +0000 (02:26 +0200)] 
bpo-40170: Remove PyIndex_Check() macro (GH-19428)

Always declare PyIndex_Check() as an opaque function to hide
implementation details: remove PyIndex_Check() macro. The macro
accessed directly the PyTypeObject.tp_as_number member.

5 years agobpo-40170: Add _PyIndex_Check() internal function (GH-19426)
Victor Stinner [Wed, 8 Apr 2020 00:01:56 +0000 (02:01 +0200)] 
bpo-40170: Add _PyIndex_Check() internal function (GH-19426)

Add _PyIndex_Check() function to the internal C API: fast inlined
verson of PyIndex_Check().

Add Include/internal/pycore_abstract.h header file.

Replace PyIndex_Check() with _PyIndex_Check() in C files of Objects
and Python subdirectories.

5 years agobpo-40170: PyType_HasFeature() now always calls PyType_GetFlags() (GH-19378)
Victor Stinner [Tue, 7 Apr 2020 23:42:27 +0000 (01:42 +0200)] 
bpo-40170: PyType_HasFeature() now always calls PyType_GetFlags() (GH-19378)

PyType_HasFeature() now always calls PyType_GetFlags() to hide
implementation details. Previously, it accessed directly the
PyTypeObject.tp_flags member when the limited C API was not used.

Add fast inlined version _PyType_HasFeature() and _PyType_IS_GC()
for object.c and typeobject.c.

5 years agobpo-40170: Convert PyObject_CheckBuffer() macro to a function (GH-19376)
Victor Stinner [Tue, 7 Apr 2020 23:13:53 +0000 (01:13 +0200)] 
bpo-40170: Convert PyObject_CheckBuffer() macro to a function (GH-19376)

Convert PyObject_CheckBuffer() macro to a function to hide
implementation details: the macro accessed directly the
PyTypeObject.tp_as_buffer member.

5 years agobpo-40170: PyObject_NEW() becomes an alias to PyObject_New() (GH-19379)
Victor Stinner [Tue, 7 Apr 2020 22:38:15 +0000 (00:38 +0200)] 
bpo-40170: PyObject_NEW() becomes an alias to PyObject_New() (GH-19379)

The PyObject_NEW() macro becomes an alias to the PyObject_New()
macro, and the PyObject_NEW_VAR() macro becomes an alias to the
PyObject_NewVar() macro, to hide implementation details. They no
longer access directly the PyTypeObject.tp_basicsize member.

Exclude _PyObject_SIZE() and _PyObject_VAR_SIZE() macros from
the limited C API.

Replace PyObject_NEW() with PyObject_New() and replace
PyObject_NEW_VAR() with PyObject_NewVar().

5 years agobpo-39481: Make os.DirEntry generic (GH-19415)
Batuhan Taşkaya [Tue, 7 Apr 2020 21:37:19 +0000 (00:37 +0300)] 
bpo-39481: Make os.DirEntry generic (GH-19415)

5 years agobpo-40089: Add _at_fork_reinit() method to locks (GH-19195)
Victor Stinner [Tue, 7 Apr 2020 21:11:49 +0000 (23:11 +0200)] 
bpo-40089: Add _at_fork_reinit() method to locks (GH-19195)

Add a private _at_fork_reinit() method to _thread.Lock,
_thread.RLock, threading.RLock and threading.Condition classes:
reinitialize the lock after fork in the child process; reset the lock
to the unlocked state.

Rename also the private _reset_internal_locks() method of
threading.Event to _at_fork_reinit().

* Add _PyThread_at_fork_reinit() private function. It is excluded
  from the limited C API.
* threading.Thread._reset_internal_locks() now calls
  _at_fork_reinit() on self._tstate_lock rather than creating a new
  Python lock object.

5 years agobpo-39481: Implementation for PEP 585 (#18239)
Guido van Rossum [Tue, 7 Apr 2020 16:50:06 +0000 (09:50 -0700)] 
bpo-39481: Implementation for PEP 585 (#18239)

This implements things like `list[int]`,
which returns an object of type `types.GenericAlias`.
This object mostly acts as a proxy for `list`,
but has attributes `__origin__` and `__args__`
that allow recovering the parts (with values `list` and `(int,)`.

There is also an approximate notion of type variables;
e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`.
Type variables are objects of type `typing.TypeVar`.

5 years agobpo-40149: Implement traverse in _abc._abc_data (GH-19412)
Victor Stinner [Tue, 7 Apr 2020 16:36:04 +0000 (18:36 +0200)] 
bpo-40149: Implement traverse in _abc._abc_data (GH-19412)

Implement traverse and clear slots in _abc._abc_data type.

5 years agobpo-37388: Don't check encoding/errors during finalization (GH-19409)
Victor Stinner [Tue, 7 Apr 2020 14:07:42 +0000 (16:07 +0200)] 
bpo-37388: Don't check encoding/errors during finalization (GH-19409)

str.encode() and str.decode() no longer check the encoding and errors
in development mode or in debug mode during Python finalization. The
codecs machinery can no longer work on very late calls to
str.encode() and str.decode().

This change should help to call _PyObject_Dump() to debug during late
Python finalization.

5 years agoDocument missing methods of ssl.SSLObject (#19400)
Rémi Lapeyre [Tue, 7 Apr 2020 07:38:59 +0000 (09:38 +0200)] 
Document missing methods of ssl.SSLObject (#19400)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
5 years agobpo-40214: Temporarily disable a ctypes test (GH-19404)
Zachary Ware [Tue, 7 Apr 2020 06:39:58 +0000 (01:39 -0500)] 
bpo-40214: Temporarily disable a ctypes test (GH-19404)

Only one particular sub-test of
ctypes.test.test_loading.test_load_dll_with_flags is disabled, which
caused failures on Azure Pipelines CI.

5 years agocloses bpo-40166: Change Unicode Howto so that it does not have a specific number...
amaajemyfren [Tue, 7 Apr 2020 04:16:02 +0000 (07:16 +0300)] 
closes bpo-40166: Change Unicode Howto so that it does not have a specific number of assigned code points. (GH-19328)

Change the number of code points from a specific number to a link to the latest standard that has a description of how many code points there are.