Commit Graph

106715 Commits

Author SHA1 Message Date
Ram Rachum 89a2209ae6
bpo-40016: re docstring: Clarify relationship of inline and argument flags (#19078)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-03-25 14:44:47 -04:00
Victor Stinner 87d3b9db4a
bpo-39882: Add _Py_FatalErrorFormat() function (GH-19157) 2020-03-25 19:27:36 +01:00
Victor Stinner ace018ca47
bpo-40050: Rephrase NEWS entry (GH-19148) 2020-03-25 18:31:55 +01:00
Andy Lester 7668a8bc93
Use calloc-based functions, not malloc. (GH-19152) 2020-03-24 23:26:44 -05:00
Paulo Henrique Silva 7dd549eb08
bpo-1635741: Port _functools module to multiphase initialization (PEP 489) (GH-19151) 2020-03-25 03:19:58 +01:00
Paulo Henrique Silva f3d5ac4772
bpo-1635741: Port operator module to multiphase initialization (PEP 489) (GH-19150) 2020-03-25 03:18:47 +01:00
Curtis Bucher 8f1ed21ecf
bpo-36144: Add union operators to WeakValueDictionary584 (#19127) 2020-03-24 18:51:29 -07:00
Dong-hee Na 37fcbb65d4
bpo-40024: Update C extension modules to use PyModule_AddType() (GH-19119)
Update _asyncio, _bz2, _csv, _curses, _datetime,
_io, _operator, _pickle, _queue, blake2,
multibytecodec and overlapped C extension modules
to use PyModule_AddType().
2020-03-24 23:08:51 +01:00
Roman Yurchak 15e5024d04
bpo-40029 mark test_importlib.test_zip as requiring zlib (#19105)
* bpo-40029 mark test_importlib.test_zip as requiring zlib

* Decorate TestZip / TestEgg classes as requiring zlib
2020-03-24 15:02:53 -04:00
Victor Stinner 93460d097f
bpo-1635741: Port _weakref extension module to multiphase initialization (PEP 489) (GH-19140)
Co-authored-by: Hai Shi <shihai1992@gmail.com>
2020-03-24 18:31:19 +01:00
Victor Stinner f5c7cabb2b
bpo-40014: Fix os.getgrouplist() (GH-19126)
Fix os.getgrouplist(): if getgrouplist() function fails because the
group list is too small, retry with a larger group list.

On failure, the glibc implementation of getgrouplist() sets ngroups
to the total number of groups. For other implementations, double the
group list size.
2020-03-24 18:22:10 +01:00
Juhana Jauhiainen 4b3252cb76
bpo-40013: Clarify documentation of restval in csv.DictReader (GH-19099) 2020-03-24 22:41:42 +05:30
Victor Stinner 83d46e0622
bpo-40050: Fix importlib._bootstrap_external (GH-19135)
Remove two unused imports: _thread and _weakref. Avoid creating a new
winreg builtin module if it's already available in sys.modules.

The winreg module is now stored as "winreg" rather than "_winreg".
2020-03-24 18:03:34 +01:00
Gregory P. Smith 9b8e74ca77
Clarify a guarantee of the logging module. (GH-19132)
When no additional arguments are passed to logging.debug() and related
methods, no % operation is performed on the passed in message.
2020-03-24 09:48:32 -07:00
Victor Stinner 5804f878e7
bpo-20526: Fix PyThreadState_Clear(): don't decref frame (GH-19120)
PyThreadState.frame is a borrowed reference, not a strong reference:
PyThreadState_Clear() must not call Py_CLEAR(tstate->frame).

Remove test_threading.test_warnings_at_exit(): we cannot warranty
that the Python thread state of daemon threads is cleared in a
reliable way during Python shutdown.
2020-03-24 16:32:26 +01:00
Stefan Krah 472fc843ca
bpo-39689: Do not use native packing for format "?" with standard size (GH-18969) 2020-03-24 06:01:13 -07:00
Russell Owen 6000087fe9
closes bpo-40017: Add CLOCK_TAI constant to the time module. (GH-19096)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-03-23 22:41:40 -05:00
laike9m 70d9d74411
Updated documentation for FOR_ITER (GH-19113)
Added a comma to make the sentence less confusing.
2020-03-24 09:03:06 +08:00
Victor Stinner 188078c39d
Revert "bpo-1635741: Port _weakref extension module to multiphase initialization (PEP 489) (GH-19084)" (#19128)
bpo-1635741, bpo-40050: This reverts
commit 8334f30a74.
2020-03-24 00:48:03 +01:00
Łukasz Langa 7979298ec1
Post 3.9.0a5 2020-03-23 23:00:48 +01:00
Łukasz Langa fd88a026be Python 3.9.0a5
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl544Y4ACgkQsmmV4xAl
 BWib5Q//SUfuC1VL72wNZTECCa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etzi0BnxvQz3klUQiOpdxjH+Qp8ipUT58SMlZa3sDsm8heS73Tt7IFxx9UB58J
 vHMdumAlcpoUyFTAKC1BByR+HFcMbW2U2QIyTt4NEjPD874KqmC2P3JINwLHqAFT
 WEzSOTW6c3CUixX1EbzCUzaSMDap4CBjjiGJQleFreWy/sEZnEDZ7+Dca0GO0seM
 yK4yUzgTX+902zfueQXnyU8/Z7sOB//6/MnESleGXR64Lcf35GK2BA0PF8RT4zcJ
 wlnuDHGGIQMIYuX1Tm8dZQUIIshl6JURxDhujU3pCFeJmKCzaH/QYCLfDLRGvjJl
 Rt8a62OojrAGQEakuF6ohbJAvIfDF/ks82Qzk8xfaKmAQjKsBWAg0bpxReI0bBHE
 jEPss1zujUvFNwe0cY1SBIFxNFl86H8tvj/mCxeyFOm0DYEibtlMKqPhErjHOY90
 Cc+s/NyJgA==
 =zk5D
 -----END PGP SIGNATURE-----

Merge tag 'v3.9.0a5'

Python 3.9.0a5
2020-03-23 23:00:18 +01:00
Curtis Bucher 25e580a73c
bpo-36144: Add union operators to WeakKeyDictionary (#19106) 2020-03-23 13:49:46 -07:00
AlphaHot 8dd1792c68
bpo-40036: Deleting duplicates in itertoolsmodule.c (GH-18958) 2020-03-23 13:14:39 -07:00
Curtis Bucher f393b2c588
bpo-36144: Add PEP 584 operators to collections.ChainMap (#18832)
* Update ChainMap to include | and |=

Created __ior__, __or__ and __ror__ methods in ChainMap class.

* Update ACKS

* Update docs

* Update test_collections.py to include test_issue584().

Added testing for | and |= operators for ChainMap objects.

* Update test_union_operators

Renamed test_union operators, fixed errors and style problems raised by brandtbucher.

* Update test_union_operators in TestChainMap

Added testing for union operator between ChainMap and iterable of key-value pairs.

* Update test_union operators in test_collections.py

Gave more descriptive variable names and eliminated unnecessary tmp variable.

* Update test_union_operators in test_collections.py

Added cm3

* Check .maps rather than Chainmap equality.

* Add news entry

* Update Lib/test/test_collections.py

Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>

* Removed whitespace

* Added Guido's changes

* Fixed Docs

* Removed whitespace

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2020-03-23 12:02:05 -07:00
Victor Stinner 8ec7370c89
bpo-40014: Fix os.getgrouplist() on macOS (GH-19118)
On macOS, getgrouplist() returns a non-zero value without setting
errno if the group list is too small. Double the list size and call
it again in this case.
2020-03-23 20:00:57 +01:00
Paulo Henrique Silva bd409bb5b7
bpo-1635741: Port time module to multiphase initialization (PEP 489) (GH-19107) 2020-03-23 19:58:23 +01:00
Łukasz Langa dcd4c4f9c9
Python 3.9.0a5 2020-03-23 17:19:13 +01:00
Zackery Spytz 9a81ab107a
bpo-39830: Add zipfile.Path to __all__ (GH-19115) 2020-03-23 09:29:36 -04:00
Serhiy Storchaka bace59d8b8
bpo-39999: Improve compatibility of the ast module. (GH-19056)
* Re-add removed classes Suite, slice, Param, AugLoad and AugStore.
* Add docstrings for dummy classes.
* Add docstrings for attribute aliases.
* Set __module__ to "ast" instead of "_ast".
2020-03-22 20:33:34 +02:00
Ronald Oussoren 044cf94f61
bpo-22490: Remove __PYVENV_LAUNCHER__ from environment during launch (GH-9516)
* bpo-22490: Remove "__PYVENV_LAUNCHER__" from the shell environment on macOS

This changeset removes the environment varialbe "__PYVENV_LAUNCHER__"
during interpreter launch as it is only needed to communicate between
the stub executable in framework installs and the actual interpreter.

Leaving the environment variable present may lead to misbehaviour when
launching other scripts.

* Actually commit the changes for issue 22490...

* Correct typo

Co-Authored-By: Nicola Soranzo <nicola.soranzo@gmail.com>

* Run make patchcheck

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
2020-03-22 14:31:46 -04:00
Dong-hee Na 05e4a296ec
bpo-40024: Add PyModule_AddType() helper function (GH-19088) 2020-03-22 17:17:34 +01:00
Serhiy Storchaka b33e52511a
bpo-36543: Remove the xml.etree.cElementTree module. (GH-19108) 2020-03-22 14:31:38 +02:00
Serhiy Storchaka b146568dfc
bpo-39652: Truncate the column name after '[' only if PARSE_COLNAMES is set. (GH-18942) 2020-03-21 15:53:28 +02:00
Serhiy Storchaka 684d2b9a07
bpo-24916: Remove an outdated comment. (GH-19101) 2020-03-21 15:45:30 +02:00
Victor Stinner 6723e933c4
bpo-39946: Remove _PyThreadState_GetFrame (GH-19094)
Remove _PyRuntime.getframe hook and remove _PyThreadState_GetFrame
macro which was an alias to _PyRuntime.getframe. They were only
exposed by the internal C API. Remove also PyThreadFrameGetter type.
2020-03-20 17:46:56 +01:00
Victor Stinner fd1e1a18fa
bpo-39947: Add PyThreadState_GetFrame() function (GH-19092)
Add PyThreadState_GetFrame() function: get the current frame
of a Python thread state.
2020-03-20 15:51:45 +01:00
Victor Stinner d83168854e
bpo-40010: Optimize pending calls in multithreaded applications (GH-19091)
If a thread different than the main thread schedules a pending call
(Py_AddPendingCall()), the bytecode evaluation loop is no longer
interrupted at each bytecode instruction to check for pending calls
which cannot be executed. Only the main thread can execute pending
calls.

Previously, the bytecode evaluation loop was interrupted at each
instruction until the main thread executes pending calls.

* Add _Py_ThreadCanHandlePendingCalls() function.
* SIGNAL_PENDING_CALLS() now only sets eval_breaker to 1 if the
  current thread can execute pending calls. Only the main thread can
  execute pending calls.
2020-03-20 14:50:35 +01:00
Victor Stinner d2a8e5b42c
bpo-40010: COMPUTE_EVAL_BREAKER() checks for subinterpreter (GH-19087)
COMPUTE_EVAL_BREAKER() now also checks if the Python thread state
belongs to the main interpreter. Don't break the evaluation loop if
there are pending signals but the Python thread state it belongs to a
subinterpeter.

* Add _Py_IsMainThread() function.
* Add _Py_ThreadCanHandleSignals() function.
2020-03-20 13:38:58 +01:00
Victor Stinner da2914db4b
bpo-40010: Pass tstate to ceval GIL functions (GH-19077)
* Add eval_frame_handle_pending() helper function: cold code path.
* Fix PyEval_ReleaseLock(): don't dereference tstate if it's NULL.
2020-03-20 09:29:08 +01:00
Hai Shi 8334f30a74
bpo-1635741: Port _weakref extension module to multiphase initialization (PEP 489) (GH-19084) 2020-03-20 09:16:45 +01:00
amaajemyfren 2de7ac9798
bpo-39797 Changes to socketserver.BaseServer's shutdown() method. (GH-18929)
Automerge-Triggered-By: @ned-deily
2020-03-20 01:03:18 -07:00
Victor Stinner 7bf069b611
bpo-40019: Skip test_gdb if Python was optimized (GH-19081)
test_gdb now skips tests if it detects that gdb failed to read debug
information because the Python binary is optimized.
2020-03-20 08:23:26 +01:00
Victor Stinner a36adfa6bb
bpo-39877: 4th take_gil() fix for daemon threads (GH-19080)
bpo-39877, bpo-40010: Add a third tstate_must_exit() check in
take_gil() to prevent using tstate which has been freed.
2020-03-19 19:48:25 +01:00
Mark Dickinson c691f20952
Fix "versionchanged" for pow named arguments (GH-19042)
The ability to use named arguments in "pow" was introduced in Python 3.8, not Python 3.9. See https://bugs.python.org/issue38237
2020-03-19 18:12:59 +00:00
Hai Shi 13397ee47d
bpo-39824: Convert PyModule_GetState() to get_module_state() (GH-19076)
Automerge-Triggered-By: @vstinner
2020-03-19 10:11:33 -07:00
Victor Stinner 5a3a71dddb
bpo-40010: Optimize signal handling in multithreaded applications (GH-19067)
If a thread different than the main thread gets a signal, the
bytecode evaluation loop is no longer interrupted at each bytecode
instruction to check for pending signals which cannot be handled.
Only the main thread of the main interpreter can handle signals.

Previously, the bytecode evaluation loop was interrupted at each
instruction until the main thread handles signals.

Changes:

* COMPUTE_EVAL_BREAKER() and SIGNAL_PENDING_SIGNALS() no longer set
  eval_breaker to 1 if the current thread cannot handle signals.
* take_gil() now always recomputes eval_breaker.
2020-03-19 17:40:12 +01:00
Dong-hee Na 77248a2889
bpo-1635741: Port _collections module to multiphase initialization (GH-19074) 2020-03-19 17:16:04 +01:00
Batuhan Taşkaya 9052f7a41b
bpo-39562: Allow executing asynchronous comprehensions in the asyncio REPL (GH-18968)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-03-19 11:35:44 +00:00
Batuhan Taşkaya 0ac59f93c0
bpo-40000: Improve error messages when validating invalid ast.Constant nodes (GH-19055)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-03-19 11:32:28 +00:00
Victor Stinner 50e6e99178
bpo-39984: Move pending calls to PyInterpreterState (GH-19066)
If Py_AddPendingCall() is called in a subinterpreter, the function is
now scheduled to be called from the subinterpreter, rather than being
called from the main interpreter.

Each subinterpreter now has its own list of scheduled calls.

* Move pending and eval_breaker fields from _PyRuntimeState.ceval
  to PyInterpreterState.ceval.
* new_interpreter() now calls _PyEval_InitThreads() to create
  pending calls lock.
* Fix Py_AddPendingCall() for subinterpreters. It now calls
  _PyThreadState_GET() which works in a subinterpreter if the
  caller holds the GIL, and only falls back on
  PyGILState_GetThisThreadState() if _PyThreadState_GET()
  returns NULL.
2020-03-19 02:41:21 +01:00