summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35455: Fix thread_time for Solaris OS (GH-11118)Jakub Kulík2020-11-022-0/+20
|
* bpo-26789: Fix logging.FileHandler._open() at exit (GH-23053)Victor Stinner2020-11-024-8/+50
| | | | | | | | | | | | | | | | | | | 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-41796: Make _ast module state per interpreter (GH-23024)Victor Stinner2020-11-028-202/+549
| | | | | | | | | | | The ast module internal state is now per interpreter. * Rename "astmodulestate" to "struct ast_state" * Add pycore_ast.h internal header: the ast_state structure is now declared in pycore_ast.h. * Add PyInterpreterState.ast (struct ast_state) * Remove get_ast_state() * Rename get_global_ast_state() to get_ast_state() * PyAST_obj2mod() now handles get_ast_state() failures
* bpo-42103: Improve validation of Plist files. (GH-22882)Serhiy Storchaka2020-11-024-57/+363
| | | | | | | | * 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-023-0/+14
| | | | | | | | | (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-023-86/+13
| | | | | (GH-13893)" (GH-23107) This reverts commit c41559021213cfc9dc62a83fc63306b3bdc3e64b.
* bpo-42236: Enhance init and encoding documentation (GH-23109)Victor Stinner2020-11-0219-523/+738
| | | | | | | | | | | | | | | | | | | | | Enhance the documentation of the Python startup, filesystem encoding and error handling, locale encoding. Add a new "Python UTF-8 Mode" section. * Add "locale encoding" and "filesystem encoding and error handler" to the glossary * Remove documentation from Include/cpython/initconfig.h: move it to Doc/c-api/init_config.rst. * Doc/c-api/init_config.rst: * Document command line options and environment variables * Document default values. * Add a new "Python UTF-8 Mode" section in Doc/library/os.rst. * Add warnings to Py_DecodeLocale() and Py_EncodeLocale() docs. * Document how Python selects the filesystem encoding and error handler at a single place: PyConfig.filesystem_encoding and PyConfig.filesystem_errors. * PyConfig: move orig_argv member at the right place.
* 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-027-1/+185
| | | | | | 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-022-6/+6
| | | | | | | | | | | | | | 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-025-4/+133
| | | | | | | | | | | | | | | | | | | 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.
* Minor formatting edits to the descriptor howto guide (GH-23092)Raymond Hettinger2020-11-021-19/+20
|
* bpo-40511: Stop unwanted flashing of IDLE calltips (GH-20910)Tal Einat2020-11-024-7/+144
| | | | | | 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>
* Add member objects to the descriptor howto guide (GH-23084)Raymond Hettinger2020-11-021-0/+156
|
* bpo-37193: remove thread objects which finished process its request (GH-13893)MARUYAMA Norihiro2020-11-013-13/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-42236: Use UTF-8 encoding if nl_langinfo(CODESET) fails (GH-23086)Victor Stinner2020-11-018-90/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the nl_langinfo(CODESET) function returns an empty string, Python now uses UTF-8 as the filesystem encoding. In May 2010 (commit b744ba1d14c5487576c95d0311e357b707600b47), I modified Python to log a warning and use UTF-8 as the filesystem encoding (instead of None) if nl_langinfo(CODESET) returns an empty string. In August 2020 (commit 94908bbc1503df830d1d615e7b57744ae1b41079), I modified Python startup to fail with a fatal error and a specific error message if nl_langinfo(CODESET) returns an empty string. The intent was to prevent guessing the encoding and also investigate user configuration where this case happens. In 10 years (2010 to 2020), I saw zero user report about the error message related to nl_langinfo(CODESET) returning an empty string. Today, UTF-8 became the defacto standard and it's safe to make the assumption that the user expects UTF-8. For example, nl_langinfo(CODESET) can return an empty string on macOS if the LC_CTYPE locale is not supported, and UTF-8 is the default encoding on macOS. While this change is likely to not affect anyone in practice, it should make UTF-8 lover happy ;-) Rewrite also the documentation explaining how Python selects the filesystem encoding and error handler.
* bpo-42236: Enhance _locale._get_locale_encoding() (GH-23083)Victor Stinner2020-11-015-52/+76
| | | | | | | | | * Rename _Py_GetLocaleEncoding() to _Py_GetLocaleEncodingObject() * Add _Py_GetLocaleEncoding() which returns a wchar_t* string to share code between _Py_GetLocaleEncodingObject() and config_get_locale_encoding(). * _Py_GetLocaleEncodingObject() now decodes nl_langinfo(CODESET) from the current locale encoding with surrogateescape, rather than using UTF-8.
* bpo-42233: Correctly repr GenericAlias when used with typing module (GH-23081)kj2020-11-013-0/+12
| | | | | | | | | | | | | | | 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
* Expand and clarify the "Invoking Descriptors" section of the Descriptor ↵Raymond Hettinger2020-11-012-38/+79
| | | | HowTo (GH-23078)
* bpo-37483: Add PyObject_CallOneArg() in the What's New in Python 3.9 (GH-23062)Dong-hee Na2020-11-011-0/+4
|
* 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-013-2/+15
| | | [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-42146: Unify cleanup in subprocess_fork_exec() (GH-22970)Alexey Izbyshev2020-11-011-35/+18
| | | | | | | | | | | * bpo-42146: Unify cleanup in subprocess_fork_exec() Also ignore errors from _enable_gc(): * They are always suppressed by the current code due to a bug. * _enable_gc() is only used if `preexec_fn != None`, which is unsafe. * We don't have a good way to handle errors in case we successfully created a child process. Co-authored-by: Gregory P. Smith <greg@krypto.org>
* bpo-42198: New section in stdtypes for type annotation types (GH-23063)kj2020-10-311-4/+14
|
* bpo-42218: Correctly handle errors in left-recursive rules (GH-23065)Lysandros Nikolaou2020-10-314-0/+32
| | | | | | | 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>
* bpo-42198: Improve consistency of Union docs (GH-23029)kj2020-10-312-24/+15
| | | | | | | No backport is required since union is only in 3.10. This addresses "3. Consistency nitpicks for Union's docs" in the bpo. Please skip news. Thank you.
* bpo-40956: Convert _sqlite3 module level functions to Argument Clinic (GH-22484)Erlend Egeberg Aasland2020-10-314-88/+313
|
* bpo-42198: Document __new__ for types.GenericAlias (GH-23039)kj2020-10-312-2/+14
|
* Revert "bpo-42160: tempfile: Reduce overhead of pid check. (GH-22997)"Inada Naoki2020-10-313-13/+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-316-102/+85
| | | | | | * 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-42208: Add _Py_GetLocaleEncoding() (GH-23050)Victor Stinner2020-10-316-110/+112
| | | | | | | | _io.TextIOWrapper no longer calls getpreferredencoding(False) of _bootlocale to get the locale encoding, but calls _Py_GetLocaleEncoding() instead. Add config_get_fs_encoding() sub-function. Reorganize also config_get_locale_encoding() code.
* bpo-42214: Fix check for NOTEQUAL token in the PEG parser for the ↵Pablo Galindo2020-10-306-5/+23
| | | | barry_as_flufl rule (GH-23048)
* GitHub Action: Add gdb to posix dependencies (GH-23043)Victor Stinner2020-10-301-6/+6
| | | Sort also dependencies and remove duplicates (liblzma-dev).
* bpo-42208: Call GC collect earlier in PyInterpreterState_Clear() (GH-23044)Victor Stinner2020-10-304-15/+35
| | | | | | | | The last GC collection is now done before clearing builtins and sys dictionaries. Add also assertions to ensure that gc.collect() is no longer called after _PyGC_Fini(). Pass also the tstate to PyInterpreterState_Clear() to pass the correct tstate to _PyGC_CollectNoFail() and _PyGC_Fini().
* bpo-36876: Small adjustments to the C-analyzer tool. (GH-23045)Eric Snow2020-10-3016-218/+633
| | | This is a little bit of clean-up, small fixes, and additional helpers prior to building an updated & accurate list of globals to eliminate.
* bpo-42208: Fix test_gdb for gc_collect_main() name (GH-23041)Victor Stinner2020-10-301-2/+2
| | | | The gcmodule.c collect() function was renamed to gc_collect_main(): update gdb/libpython.py (python-gdb.py).
* bpo-42208: Move _PyImport_Cleanup() to pylifecycle.c (GH-23040)Victor Stinner2020-10-302-230/+290
| | | | | Move _PyImport_Cleanup() to pylifecycle.c, rename it to finalize_modules(), split it (200 lines) into many smaller sub-functions and cleanup the code.
* bpo-42208: Pass tstate to _PyGC_CollectNoFail() (GH-23038)Victor Stinner2020-10-305-34/+25
| | | | | | | | | | | | Move private _PyGC_CollectNoFail() to the internal C API. Remove the private _PyGC_CollectIfEnabled() which was just an alias to the public PyGC_Collect() function since Python 3.8. Rename functions: * collect() => gc_collect_main() * collect_with_callback() => gc_collect_with_callback() * collect_generations() => gc_collect_generations()
* DOC: attribute PyPy for the idea behind LOAD_ATTR cache (GH-23036)Matti Picus2020-10-301-1/+1
| | | Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-42206: Propagate and raise errors from PyAST_Validate in the parser ↵Batuhan Taskaya2020-10-302-1/+5
| | | | (GH-23035)
* bpo-42172: Correct typo for test_socket.py (GH-23013)Akashkumar D Khunt2020-10-301-3/+3
|
* bpo-42160: tempfile: Reduce overhead of pid check. (GH-22997)Eric W2020-10-303-14/+13
| | | | The _RandomSequence class in tempfile used to check the current pid every time its rng property was used. This commit replaces this code with `os.register_at_fork` to reduce the overhead.
* bpo-42198: Link to GenericAlias in typing and expressions (GH-23030)kj2020-10-302-44/+75
| | | Follow up to 7cdf30fff39ea97f403b5472096349998d190e30 and 4173320920706b49a004bdddd8d7108e8984e3fc. This addresses the point "1. Update links in typing, subscription and union to point to GenericAlias." in the bpo for this PR.
* bpo-42061: Document __format__ for IP addresses (GH-23018)Teugea Ioan-Teodor2020-10-293-4/+39
| | | Automerge-Triggered-By: GH:ericvsmith
* bpo-42180: fix plural in arguments and control (GH-23015)Rafael Fontenelle2020-10-291-1/+1
| | | https://bugs.python.org/issue42180
* bpo-42029: Remove IRIX code (GH-23023)Victor Stinner2020-10-294-25/+8
| | | | IRIX code was slowy removed in Python 2.4 (--with-sgi-dl), Python 3.3 (Irix threads), and Python 3.7.
* bpo-42143: Ensure PyFunction_NewWithQualName() can't fail after creating the ↵Yonatan Goldschmidt2020-10-292-13/+18
| | | | | | func object (GH-22953) func_dealloc() does not handle partially-created objects. Best not to give it any.
* bpo-34204: Use pickle.DEFAULT_PROTOCOL in shelve (GH-19639)Zackery Spytz2020-10-295-8/+29
| | | | Use pickle.DEFAULT_PROTOCOL (currently 5) in shelve instead of a hardcoded 3.
* bpo-41805: Documentation for PEP 585 (GH-22615)kj2020-10-274-0/+211
|
* bpo-42161: Micro-optimize _collections._count_elements() (GH-23008)Victor Stinner2020-10-271-4/+5
| | | Move the _PyLong_GetOne() call outside the fast-path loop.