summaryrefslogtreecommitdiffstats
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* bpo-42246: Eliminate jumps to exit blocks by copying those blocks. (#23251)Mark Shannon2020-11-122-117/+114
| | | * Compiler: eliminate jumps to short exit blocks by copying.
* bpo-42308: Add threading.__excepthook__ (GH-23218)Mario Corchero2020-11-122-0/+25
| | | | | Add threading.__excepthook__ to allow retrieving the original value of threading.excepthook in case it is set to a broken or a different value.
* Bump magic number. (GH-23245)Mark Shannon2020-11-121-1/+2
|
* bpo-42246: Partial implementation of PEP 626. (GH-23113)Mark Shannon2020-11-126-34/+28
| | | * Implement new line number table format, as defined in PEP 626.
* bpo-39411: pyclbr rewrite on AST (#18103)Batuhan Taskaya2020-11-112-211/+109
| | | | | - Rewrite pyclbr using an AST processor - Add is_async to the pyclbr.Function
* bpo-42140: Improve asyncio.wait function (GH-22938)Diogo Dutra2020-11-102-2/+28
| | | | | | | | | | # Improve asyncio.wait function The original code creates the futures set two times. We can create this set before, avoiding the second creation. This new behaviour [breaks the aiokafka library](https://github.com/aio-libs/aiokafka/pull/672), because it gives an iterator to that function, so the second iteration become empty. Automerge-Triggered-By: GH:1st1
* bpo-42085: Introduce dedicated entry in PyAsyncMethods for sending values ↵Vladimir Matveev2020-11-101-1/+1
| | | | (#22780)
* bpo-42014: shutil.rmtree: call onerror with correct function (GH-22585)Michal Čihař2020-11-101-1/+1
| | | | | | | The onerror is supposed to be called with failed function, but in this case lstat is wrongly used instead of open. Not sure if this needs bug or not... Automerge-Triggered-By: GH:hynek
* bpo-42183: Fix a stack overflow error for asyncio Task or Future repr() ↵Andrew Svetlov2020-11-102-3/+40
| | | | | | | | (GH-23020) The overflow occurs under some circumstances when a task or future recursively returns itself. Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* Fix typo in test_array.py (GH-23189)Ikko Ashimine2020-11-101-1/+1
|
* bpo-42260: Compute the path config in the main init (GH-23211)Victor Stinner2020-11-101-7/+19
| | | | | | | | | | | | | | | | | | | | | The path configuration is now computed in the "main" initialization. The core initialization no longer computes it. * Add _PyConfig_Read() function to read the configuration without computing the path configuration. * pyinit_core() no longer computes the path configuration: it is now computed by init_interp_main(). * The path configuration output members of PyConfig are now optional: * executable * base_executable * prefix * base_prefix * exec_prefix * base_exec_prefix * _PySys_UpdateConfig() now skips NULL strings in PyConfig. * _testembed: Rename test_set_config() to test_init_set_config() for consistency with other tests.
* bpo-36310: Allow pygettext.py to detect calls to gettext in f-strings. ↵jack11422020-11-091-0/+70
| | | | | | | (GH-19875) Adds support to Tools/i18n/pygettext.py for gettext calls in f-strings. This process is done by parsing the f-strings, processing each value, and flagging the ones which contain a gettext call. Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
* bpo-41543: contextlib.nullcontext can fill in for an async context manager ↵Tom Gringauz2020-11-092-2/+20
| | | | | (GH-21870) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-40624: Add support for the XPath != operator in xml.etree (GH-22147)Ammar Askar2020-11-092-7/+59
|
* bpo-42233: Add union type expression support for GenericAlias and fix ↵kj2020-11-091-0/+22
| | | | de-duplicating of GenericAlias (GH-23077)
* bpo-41754: Ignore NotADirectoryError in invocation of xdg-settings (GH-23075)Ronald Oussoren2020-11-081-1/+1
| | | | It is not clear why this can happen, but several users have mentioned getting this exception on macOS.
* bpo-41100: Support macOS 11 and Apple Silicon (GH-22855)Ronald Oussoren2020-11-089-14/+322
| | | | | | | | | | | Co-authored-by: Lawrence D’Anna <lawrence_danna@apple.com> * Add support for macOS 11 and Apple Silicon (aka arm64) As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy * Support building on recent versions of macOS while deploying to older versions This allows building installers on macOS 11 while still supporting macOS 10.9.
* bpo-42133: update parts of the stdlib to fall back to `__spec__.loader` when ↵Brett Cannon2020-11-074-14/+33
| | | | `__loader__` is missing (#22929)
* bpo-41832: PyType_FromModuleAndSpec() now accepts NULL tp_doc (GH-23123)Hai Shi2020-11-061-0/+3
|
* bpo-26389: Allow passing an exception object in the traceback module (GH-22610)Zackery Spytz2020-11-052-13/+43
| | | | | | The format_exception(), format_exception_only(), and print_exception() functions can now take an exception object as a positional-only argument. Co-Authored-By: Matthias Bussonnier <bussonniermatthias@gmail.com>
* bpo-42260: PyConfig_Read() only parses argv once (GH-23168)Victor Stinner2020-11-052-6/+12
| | | | | | | | | | | | The PyConfig_Read() function now only parses PyConfig.argv arguments once: PyConfig.parse_argv is set to 2 after arguments are parsed. Since Python arguments are strippped from PyConfig.argv, parsing arguments twice would parse the application options as Python options. * Rework the PyConfig documentation. * Fix _testinternalcapi.set_config() error handling. * SetConfigTests no longer needs parse_argv=0 when restoring the old configuration.
* bpo-42260: Add _PyConfig_FromDict() (GH-23167)Victor Stinner2020-11-052-0/+257
| | | | | | | * Rename config_as_dict() to _PyConfig_AsDict(). * Add 'module_search_paths_set' to _PyConfig_AsDict(). * Add _PyConfig_FromDict(). * Add get_config() and set_config() to _testinternalcapi. * Add config_check_consistency().
* bpo-41877 Check for asert, aseert, assrt in mocks (GH-23165)vabr-g2020-11-052-3/+12
| | | | | | | | | | | Currently, a Mock object which is not unsafe will raise an AttributeError if an attribute with the prefix assert or assret is accessed on it. This protects against misspellings of real assert method calls, which lead to tests passing silently even if the tested code does not satisfy the intended assertion. Recently a check was done in a large code base (Google) and three more frequent ways of misspelling assert were found causing harm: asert, aseert, assrt. These are now added to the existing check.
* bpo-42266: Handle monkey-patching descriptors in LOAD_ATTR cache (GH-23157)Pablo Galindo2020-11-051-0/+23
|
* bpo-40816 Add AsyncContextDecorator class (GH-20516)Kazantcev Andrey2020-11-052-1/+51
| | | | Co-authored-by: Yury Selivanov <yury@edgedb.com>
* bpo-42260: Add _PyInterpreterState_SetConfig() (GH-23158)Victor Stinner2020-11-041-0/+9
| | | | | | | | * Inline _PyInterpreterState_SetConfig(): replace it with _PyConfig_Copy(). * Add _PyErr_SetFromPyStatus() * Add _PyInterpreterState_GetConfigCopy() * Add a new _PyInterpreterState_SetConfig() function. * Add an unit which gets, modifies, and sets the config.
* Disable peg generator tests when building with PGO (GH-23141)serge-sans-paille2020-11-041-0/+6
| | | | | Otherwise, when running the testsuite, test_peg_generator tries to compile C code using the optimized flags and fails because it cannot find the profile data.
* bpo-42236: os.device_encoding() respects UTF-8 Mode (GH-23119)Victor Stinner2020-11-041-0/+27
| | | | On Unix, the os.device_encoding() function now returns 'UTF-8' rather than the device encoding if the Python UTF-8 Mode is enabled.
* bpo-42251: Add gettrace and getprofile to threading (GH-23125)Mario Corchero2020-11-042-1/+30
| | | This allows to retrieve the functions that were set in these two, which might differ from sys.gettrace and sys.getprofile within a thread.
* Merge tag 'v3.10.0a2' into masterPablo Galindo2020-11-031-66/+132
|\ | | | | | | Python 3.10.0a2
| * Python 3.10.0a2v3.10.0a2Pablo Galindo2020-11-031-66/+132
| |
* | bpo-42249: Fix writing binary Plist files larger than 4 GiB. (GH-23121)Serhiy Storchaka2020-11-031-1/+1
|/
* bpo-26789: Fix logging.FileHandler._open() at exit (GH-23053)Victor Stinner2020-11-022-7/+45
| | | | | | | | | | | | | | | | | | | The logging.FileHandler class now keeps a reference to the builtin open() function to be able to open or reopen the file during Python finalization. Fix errors like: Exception ignored in: (...) Traceback (most recent call last): (...) File ".../logging/__init__.py", line 1463, in error File ".../logging/__init__.py", line 1577, in _log File ".../logging/__init__.py", line 1587, in handle File ".../logging/__init__.py", line 1649, in callHandlers File ".../logging/__init__.py", line 948, in handle File ".../logging/__init__.py", line 1182, in emit File ".../logging/__init__.py", line 1171, in _open NameError: name 'open' is not defined
* bpo-42103: Improve validation of Plist files. (GH-22882)Serhiy Storchaka2020-11-022-57/+358
| | | | | | | | * Prevent some possible DoS attacks via providing invalid Plist files with extremely large number of objects or collection sizes. * Raise InvalidFileException for too large bytes and string size instead of returning garbage. * Raise InvalidFileException instead of ValueError for specific invalid datetime (NaN). * Raise InvalidFileException instead of TypeError for non-hashable dict keys. * Add more tests for invalid Plist files.
* bpo-41943: Fix bug where assertLogs doesn't correctly filter messages… ↵Irit Katriel2020-11-022-0/+13
| | | | | | | | | (GH-22565) … by level @vsajip , @pitrou Automerge-Triggered-By: GH:vsajip
* Revert "bpo-37193: remove thread objects which finished process its request ↵Jason R. Coombs2020-11-022-84/+13
| | | | | (GH-13893)" (GH-23107) This reverts commit c41559021213cfc9dc62a83fc63306b3bdc3e64b.
* bpo-42224: Fix test_format when locale does not expect number grouping ↵Lysandros Nikolaou2020-11-021-2/+5
| | | | (GH-23067)
* bpo-41435: Add sys._current_exceptions() function (GH-21689)Julien Danjou2020-11-021-0/+67
| | | | | | This adds a new function named sys._current_exceptions() which is equivalent ot sys._current_frames() except that it returns the exceptions currently handled by other threads. It is equivalent to calling sys.exc_info() for each running thread.
* bpo-42230: Improve asyncio documentation regarding accepting sets vs ↵Jakub Stasiak2020-11-021-2/+2
| | | | | | | | | | | | | | iterables (GH-23073) People call wait() and as_completed() with various non-set iterables, a list should be the most common but there are others as well[1]. Considering typeshed also documents wait()[2] and as_completed()[3] as accepting arbitrary iterables I think it's a good idea to document the status quo better. [1] https://github.com/aio-libs/aiokafka/pull/672 [2] https://github.com/python/typeshed/blob/620989bac572f30349b95590ebe81a73ce0fe862/stdlib/3/asyncio/tasks.pyi#L161 [3] https://github.com/python/typeshed/blob/620989bac572f30349b95590ebe81a73ce0fe862/stdlib/3/asyncio/tasks.pyi#L40
* bpo-41229: Update docs for explicit aclose()-required cases and add ↵Joongi Kim2020-11-022-1/+84
| | | | | | | | | | | | | | | | | | | contextlib.aclosing() method (GH-21545) This is a PR to: * Add `contextlib.aclosing` which ia analogous to `contextlib.closing` but for async-generators with an explicit test case for [bpo-41229]() * Update the docs to describe when we need explicit `aclose()` invocation. which are motivated by the following issues, articles, and examples: * [bpo-41229]() * https://github.com/njsmith/async_generator * https://vorpus.org/blog/some-thoughts-on-asynchronous-api-design-in-a-post-asyncawait-world/#cleanup-in-generators-and-async-generators * https://www.python.org/dev/peps/pep-0533/ * https://github.com/achimnol/aiotools/blob/ef7bf0cea7af/src/aiotools/context.py#L152 Particuarly regarding [PEP-533](https://www.python.org/dev/peps/pep-0533/), its acceptance (`__aiterclose__()`) would make this little addition of `contextlib.aclosing()` unnecessary for most use cases, but until then this could serve as a good counterpart and analogy to `contextlib.closing()`. The same applies for `contextlib.closing` with `__iterclose__()`. Also, still there are other use cases, e.g., when working with non-generator objects with `aclose()` methods.
* bpo-40511: Stop unwanted flashing of IDLE calltips (GH-20910)Tal Einat2020-11-023-7/+141
| | | | | | They were occurring with both repeated 'force-calltip' invocations and by typing parentheses in expressions, strings, and comments in the argument code. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-37193: remove thread objects which finished process its request (GH-13893)MARUYAMA Norihiro2020-11-012-13/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-37193: remove the thread which finished process request from threads list * rename variable t to thread. * don't remove thread from list if it is daemon. * use lock to protect self._threads. * use finally block in case of exception from shutdown_request(). * check "not thread.daemon" before lock to avoid holding the lock if it's unnecessary. * fix the place of _threads_lock. * separate code to remove a current thread into a function. * check ValueError when removing thread. * fix wrong code which all instance shared same lock. * Extract thread management into a _Threads class to encapsulate atomic operations and separate concerns. * Replace multiple references of 'block_on_close' with one, avoiding the possibility that 'block_on_close' could change during the course of processing requests. Now, there's exactly one _threads object with behavior fixed for the duration. * Add docstrings to private classes. * Add test to ensure that a ThreadingTCPServer can be closed without serving any requests. * Use _NoThreads as the default value. Fixes AttributeError when server is closed without serving any requests. * Add blurb * Add test capturing failure. Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-42233: Correctly repr GenericAlias when used with typing module (GH-23081)kj2020-11-012-0/+9
| | | | | | | | | | | | | | | Noticed by @serhiy-storchaka in the bpo. `typing`'s types were not showing the parameterized generic. Eg. previously: ```python >>> typing.Union[dict[str, float], list[int]] 'typing.Union[dict, list]' ``` Now: ```python >>> typing.Union[dict[str, float], list[int]] 'typing.Union[dict[str, float], list[int]]' ``` Automerge-Triggered-By: GH:gvanrossum
* tempfile: Use random.choises() instead of choise() (GH-23068)Inada Naoki2020-11-012-6/+3
|
* bpo-29566: binhex.binhex now consitently writes MacOS 9 line endings. (GH-23059)Ronald Oussoren2020-11-012-2/+14
| | | [bpo-29566]() notes that binhex.binhex uses inconsistent line endings (both Unix and MacOS9 line endings are used). This PR changes this to use the MacOS9 line endings everywhere.
* bpo-42218: Correctly handle errors in left-recursive rules (GH-23065)Lysandros Nikolaou2020-10-311-0/+8
| | | | | | | Left-recursive rules need to check for errors explicitly, since even if the rule returns NULL, the parsing might continue and lead to long-distance failures. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* Revert "bpo-42160: tempfile: Reduce overhead of pid check. (GH-22997)"Inada Naoki2020-10-312-12/+14
| | | | | `_RandomNameSequence` is not true singleton so using `os.register_at_fork` doesn't make sense unlike `random._inst`. This reverts commit 8e409cebad42032bb7d0f2cadd8b1e36081d98af.
* bpo-42208: Add _locale._get_locale_encoding() (GH-23052)Victor Stinner2020-10-313-98/+48
| | | | | | * Add a new _locale._get_locale_encoding() function to get the current locale encoding. * Modify locale.getpreferredencoding() to use it. * Remove the _bootlocale module.
* bpo-42214: Fix check for NOTEQUAL token in the PEG parser for the ↵Pablo Galindo2020-10-301-0/+17
| | | | barry_as_flufl rule (GH-23048)
* bpo-42172: Correct typo for test_socket.py (GH-23013)Akashkumar D Khunt2020-10-301-3/+3
|