Commit Graph

106945 Commits

Author SHA1 Message Date
Batuhan Taşkaya 4454057269
bpo-39562: Prevent collision of future and compiler flags (GH-19230)
The constant values of future flags in the __future__ module
is updated in order to prevent collision with compiler flags.
Previously PyCF_ALLOW_TOP_LEVEL_AWAIT was clashing
with CO_FUTURE_DIVISION.
2020-04-22 18:09:03 +02:00
Steve Dower 9b49893900
bpo-40214: Fix ctypes WinDLL test with insecure flags (GH-19652) 2020-04-22 17:04:46 +01:00
Victor Stinner 9bee32b34e
bpo-40138: Fix Windows os.waitpid() for large exit code (GH-19637)
Fix the Windows implementation of os.waitpid() for exit code
larger than "INT_MAX >> 8". The exit status is now interpreted as an
unsigned number.

os.waitstatus_to_exitcode() now accepts wait status larger than
INT_MAX.
2020-04-22 16:30:35 +02:00
Ned Deily bcc136ba89
bpo-38329: python.org macOS installers now update Current symlink (GH-19650)
Previously, python.org macOS installers did not alter the Current version
symlink in /Library/Frameworks/Python.framework/Versions when installing
a version of Python 3.x, only when installing 2.x.  Now that Python 2 is
retired, it's time to change that.  This should make it a bit easier
to embed Python 3 into other macOS applications.
2020-04-22 04:27:13 -04:00
Joshua Root b310700976
bpo-38360: macOS: support alternate form of -isysroot flag (GH-16480)
It is possible to use either '-isysroot /some/path' (with a space) or
'-isysroot/some/path' (no space in between). Support both forms in
places where special handling of -isysroot is done, rather than just
the first form.
Co-authored-by: Ned Deily <nad@python.org>
2020-04-22 03:44:10 -04:00
Miro Hrončok 3a69f3caee
bpo-38439: Add 256px IDLE icon (GH-17473)
Icon author: Andrew Clover, bpo-1490384
2020-04-22 03:21:44 -04:00
Ned Deily 783a673f23
bpo-40164: Update macOS installer builds to use OpenSSL 1.1.1g. (GH-19642) 2020-04-21 22:41:33 -04:00
Raymond Hettinger 75bedbe2ed
bpo-40327: Improve atomicity, speed, and memory efficiency of the items() loop (GH-19628) 2020-04-21 16:20:52 -07:00
Raymond Hettinger d3a8d616fa
Small improvements to the recipes and examples. (GH-19635)
* Add underscores to long numbers to improve readability
* Use bigger dataset in the bootstrapping example
* Convert single-server queue example to more useful multi-server queue
2020-04-21 16:11:00 -07:00
Kyle Stanley 9c82ea7868
bpo-34037: Add Python API whatsnew for loop.shutdown_default_executor() (#19634)
Co-Authored-By: Victor Stinner <vstinner@python.org>
2020-04-21 16:50:51 -04:00
Pablo Galindo 11a7f158ef
bpo-40335: Correctly handle multi-line strings in tokenize error scenarios (GH-19619)
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2020-04-21 01:53:04 +01:00
sweeneyde 6a9e80a931
bpo-40313: speed up bytes.hex() (GH-19594)
Automerge-Triggered-By: @gpshead
2020-04-20 17:17:52 -07:00
Raymond Hettinger bba760e9b6
Fix uninitialized struct member (GH-19589) 2020-04-20 13:47:12 -07:00
HongWeipeng a25a04fea5
bpo-39942:Fix failure in `TypeVar` when missing `__name__` (GH-19616)
https://bugs.python.org/issue39942
2020-04-20 21:01:53 +01:00
Antoine Pitrou eba9f6155d
bpo-40330: Fix utf-8 size check in ShareableList (GH-19606)
The item size must be checked after encoding to bytes, not before.

Automerge-Triggered-By: @pitrou
2020-04-20 11:54:55 -07:00
Hai Shi 5dd21f5d1c
bpo-39849: Enable assertions in _testcapimodule.c and _testinternalcapi.c (GH-19623) 2020-04-21 01:49:13 +09:00
Barry 9b0b5d2bae
bpo-40260: Revert breaking changes made in modulefinder (GH-19595) 2020-04-20 15:58:42 +01:00
Galden df8913f7c4
Fix typo in Lib/tracepack.py (GH-19605)
Typo fix: "emites" -> "emit".
2020-04-19 19:17:37 -07:00
Batuhan Taşkaya 3955da8568
ignore Modules/python.exp on AIX (autogenerated) (GH-19607) 2020-04-19 19:02:17 +01:00
Tim Hoffmann 8aea4b3605
bpo-40148: Add PurePath.with_stem() (GH-19295)
Add PurePath.with_stem()
2020-04-19 17:29:49 +02:00
Thomas Krennwallner c8f1715283
bpo-38891: avoid quadratic item access performance of ShareableList (GH-18996)
Avoid linear runtime of ShareableList.__getitem__ and
ShareableList.__setitem__ by storing running allocated bytes in
ShareableList._allocated_bytes instead of the number of bytes for
a particular stored item.

Co-authored-by: Antoine Pitrou <antoine@python.org>
2020-04-19 17:19:24 +02:00
Kyle Stanley 1ac6e37929
bpo-39207: Spawn workers on demand in ProcessPoolExecutor (GH-19453)
Roughly based on 904e34d4e6, but with a few substantial differences.

/cc @pitrou @brianquinlan
2020-04-19 07:00:59 -07:00
Tim Lo c12375aa0b
bpo-39285: Clarify example for PurePath.match (GH-19458)
Fixes Issue39285

The example incorrectly returned True for match.

Furthermore the example is ambiguous in its usage of PureWindowsPath.
Windows is case-insensitve, however the underlying match functionality
utilizes fnmatch.fnmatchcase.

Automerge-Triggered-By: @pitrou
2020-04-19 02:43:11 -07:00
Raymond Hettinger 4fe002045f
bpo-40325: Deprecate set object support in random.sample() (GH-19591) 2020-04-19 00:36:42 -07:00
Furkan Önder 482259d0dc
bpo-27635: Fix pickle documentation about `__new__` not being called. (GH-19269)
Automerge-Triggered-By: @pitrou
2020-04-18 11:09:09 -07:00
Karthikeyan Singaravelan 696136b993
bpo-35113: Fix inspect.getsource to return correct source for inner classes (#10307)
* Use ast module to find class definition

* Add NEWS entry

* Fix class with multiple children and move decorator code to the method

* Fix PR comments

1. Use node.decorator_list to select decorators
2. Remove unwanted variables in ClassVisitor
3. Simplify stack management as per review

* Add test for nested functions and async calls

* Fix pydoc test since comments are returned now correctly

* Set event loop policy as None to fix environment related change

* Refactor visit_AsyncFunctionDef and tests

* Refactor to use local variables and fix tests

* Add patch attribution

* Use self.addCleanup for asyncio

* Rename ClassVisitor to ClassFinder and fix asyncio cleanup

* Return first class inside conditional in case of multiple definitions. Remove decorator for class source.

* Add docstring to make the test correct

* Modify NEWS entry regarding decorators

* Return decorators too for bpo-15856

* Move ast and the class source code to top. Use proper Exception.
2020-04-18 21:49:32 +05:30
Hakan Çelik ce578831a4
Add spaces around the ":=" operator in ast_unparse.c (GH-19568) 2020-04-18 17:17:19 +01:00
Serhiy Storchaka 2b5603140c
bpo-40178: Convert the remaining os functions to Argument Clinic. (GH-19360)
Convert os.getgrouplist(), os.initgroups(), os.sendfile() and
os.get_terminal_size().
2020-04-18 19:14:10 +03:00
Serhiy Storchaka 12446e6a60
bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364)
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
2020-04-18 17:52:48 +03:00
Chih-Hsuan Yen fb940408ce
bpo-35967: Skip test with `uname -p` on Android (GH-19577)
The uname binary on Android does not support -p [1]. Here is a sample
log:
```
0:06:03 load avg: 0.56 [254/421/8] test_platform failed -- running: test_asyncio (5 min 53 sec)
uname: Unknown option p (see "uname --help")
test test_platform failed -- Traceback (most recent call last):
  File "/data/local/tmp/lib/python3.9/test/test_platform.py", line 170, in test_uname_processor
    proc_res = subprocess.check_output(['uname', '-p'], text=True).strip()
  File "/data/local/tmp/lib/python3.9/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/data/local/tmp/lib/python3.9/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['uname', '-p']' returned non-zero exit status 1.
```
[1] https://android.googlesource.com/platform/external/toybox/+/refs/heads/master/toys/posix/uname.c

Automerge-Triggered-By: @jaraco
2020-04-18 07:20:54 -07:00
Serhiy Storchaka 7e64414f57
bpo-40257: Improve help for the typing module (GH-19546)
* Show docstring for special forms.
* Show docstring for special generic aliases.
* Show documentation for __origin__ for generic aliases.
2020-04-18 17:13:21 +03:00
Galden c606624af8
Fix two typos in multiprocessing (GH-19571) 2020-04-18 08:58:29 +02:00
Victor Stinner 87502ddd71
bpo-40286: Use random.randbytes() in tests (GH-19575) 2020-04-17 22:54:38 +02:00
Serhiy Storchaka 223221b290
bpo-40286: Makes simpler the relation between randbytes() and getrandbits() (GH-19574) 2020-04-17 23:51:28 +03:00
Barney Gale 5b1d9184bb
bpo-39894: Route calls from pathlib.Path.samefile() to os.stat() via the path accessor (GH-18836) 2020-04-17 19:47:27 +02:00
Barney Gale c746c4f353
bpo-39897: Remove needless `Path(self.parent)` call, which makes `is_mount()` misbehave in `Path` subclasses. (GH-18839) 2020-04-17 19:42:06 +02:00
Antoine Pitrou 75a3378810
bpo-40282: Allow random.getrandbits(0) (GH-19539) 2020-04-17 19:32:14 +02:00
Victor Stinner d7c657d4b1
bpo-40302: UTF-32 encoder SWAB4() macro use a|b rather than a+b (GH-19572) 2020-04-17 19:13:34 +02:00
Victor Stinner 1a1bd2e238
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.
2020-04-17 19:13:06 +02:00
Victor Stinner 9f5fe7910f
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.
2020-04-17 19:05:35 +02:00
Barney Gale 22386bb4ef
bpo-39901: Move `pathlib.Path.owner()` and `group()` implementations into the path accessor. (GH-18844) 2020-04-17 18:41:07 +02:00
Mariusz Felisiak 06a35542aa
bpo-40300: Allow empty logging.Formatter.default_msec_format. (GH-19551) 2020-04-17 17:02:47 +01:00
Victor Stinner 1ae035b7e8
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.
2020-04-17 17:47:20 +02:00
Inada Naoki 485e715cb1
bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540)
It has not returned the file position after the seek.
2020-04-17 15:56:35 +09:00
Raymond Hettinger bf1a81258c
Minor modernization and readability improvement to the tokenizer example (GH-19558) 2020-04-16 19:54:13 -07:00
Jeffrey Quesnelle a75e730075
bpo-40294: Fix _asyncio when module is loaded/unloaded multiple times (GH-19542) 2020-04-17 04:09:45 +02:00
Christoph Zwerschke a388bbd3f1
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".
2020-04-16 18:54:53 -07:00
Batuhan Taşkaya 5565c30f0b
bpo-39793: use the same domain on make_msgid tests (#18698)
* bpo-39793: use same domain on make_msgid tests

* apply suggestions
2020-04-16 13:29:12 -04:00
Raymond Hettinger 70f027dd22
bpo-40290: Add zscore() to statistics.NormalDist. (GH-19547) 2020-04-16 10:25:14 -07:00
Jason R. Coombs 518835f335
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>
2020-04-16 08:28:09 -04:00