summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* bpo-44441: _PyImport_Fini2() resets PyImport_Inittab (GH-26874) (GH-26878)Victor Stinner2021-06-231-0/+3
| | | | | | | Py_RunMain() now resets PyImport_Inittab to its initial value at exit. It must be possible to call PyImport_AppendInittab() or PyImport_ExtendInittab() at each Python initialization. (cherry picked from commit 489699ca05bed5cfd10e847d8580840812b476cd)
* bpo-41299: Reduce lag in Windows threading timeouts by using a higher ↵Miss Islington (bot)2021-06-111-4/+10
| | | | | | | precision time source (GH-26568) (cherry picked from commit 449e6f0ef395231e3abe467f910b02d7f075c27f) Co-authored-by: Ryan Hileman <lunixbochs@gmail.com>
* [3.9] bpo-11105: Do not crash when compiling recursive ASTs (GH-20594) ↵Batuhan Taskaya2021-06-031-0/+700
| | | | | | | | | | | | (GH-26522) When compiling an AST object with a direct / indirect reference cycles, on the conversion phase because of exceeding amount of calls, a segfault was raised. This patch adds recursion guards to places for preventing user inputs to not to crash AST but instead raise a RecursionError.. (cherry picked from commit f3491242e41933aa9529add7102edb68b80a25e9) Co-authored-by: Batuhan Taskaya <batuhan@python.org>
* [3.9] bpo-43667: Fix broken Unicode encoding in non-UTF locales on Solaris ↵Jakub Kulík2021-05-211-0/+106
| | | | | | | (GH-25096) (GH-25847) (cherry picked from commit 9032cf5cb1e33c0349089cfb0f6bf11ed3c30e86) Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
* bpo-28146: Fix a confusing error message in str.format() (GH-24213)Miss Islington (bot)2021-05-131-2/+8
| | | | | | Automerge-Triggered-By: GH:pitrou (cherry picked from commit 4aeee0b47b3a2b604bbac37040320ffc88c291f2) Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
* bpo-44070: No longer eagerly makes import filenames absolute, except for ↵Steve Dower2021-05-101-1829/+1830
| | | | extension modules (GH-26025)
* bpo-42800: Add audit events for f_code and tb_frame (GH-24182)Steve Dower2021-05-031-1/+1
| | | | | | | | Accessing the following attributes will now fire PEP 578 style audit hooks as (object.__getattr__, obj, name): * PyTracebackObject: tb_frame * PyFrameObject: f_code * PyGenObject: gi_code, gi_frame * PyCoroObject: cr_code, cr_frame * PyAsyncGenObject: ag_code, ag_frame
* bpo-43105: Importlib now resolves relative paths when creating module spec ↵Steve Dower2021-04-071-2687/+2777
| | | | objects from file locations (GH-25121)
* [3.9] bpo-43710: Rollback the 3.9 bpo-42500 fix, it broke the ABI in 3.9.3 ↵Gregory P. Smith2021-04-044-16/+16
| | | | | | | (#25179) This reverts commit 8b795ab5541d8a4e69be4137dfdc207714270b77. It changed the PyThreadState structure size, breaking the ABI in 3.9.3.
* bpo-43660: Fix crash when displaying exceptions with custom values for ↵Miss Islington (bot)2021-03-291-1/+2
| | | | | | | | | sys.stderr (GH-25075) (GH-25083) (cherry picked from commit 09b90a037d18f5d4acdf1b14082e57bda78e85d3) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.9] bpo-43517: Fix false positive in detection of circular imports ↵Antoine Pitrou2021-03-201-1/+1
| | | | | | | | | (GH-24895) (GH-24948) (cherry picked from commit 2fd16ef406bba239b1334057fb499496a84b3aa2) Co-authored-by: Antoine Pitrou <antoine@python.org> Automerge-Triggered-By: GH:pitrou
* bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)Miss Islington (bot)2021-03-171-39/+79
| | | | | | | | | | | | | Python no longer fails at startup with a fatal error if a command line argument contains an invalid Unicode character. The Py_DecodeLocale() function now escapes byte sequences which would be decoded as Unicode characters outside the [U+0000; U+10ffff] range. Use MAX_UNICODE constant in unicodeobject.c. (cherry picked from commit 9976834f807ea63ca51bc4f89be457d734148682) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-43499: Silence compiler warnings about using legacy C API on Windows ↵Serhiy Storchaka2021-03-162-0/+9
| | | | (GH-24873)
* bpo-42500: Fix recursion in or after except (GH-23568) (#24501)Mark Shannon2021-03-024-16/+16
| | | | | * Use counter, rather boolean state when handling soft overflows. (cherry picked from commit 4e7a69bdb63a104587759d7784124492dcdd496e)
* bpo-42780: Fix set_inheritable() for O_PATH file descriptors on Linux ↵cptpcrd2021-01-211-0/+7
| | | | | (GH-24172) (GH-24278) (cherry picked from commit 7dc71c425cf6aa6a4070a418dce5d95ca435c79f)
* Bring Python into the new year. (GH-24036)Miss Islington (bot)2021-01-011-1/+1
| | | | | (cherry picked from commit de6f20a6de48d63066b2cf5b317f50629f01d74a) Co-authored-by: Dong-hee Na <donghee.na@python.org>
* bpo-26564: fix obsolete comment in traceback.c (GH-23819)Miss Islington (bot)2020-12-171-1/+2
| | | | | (cherry picked from commit 40125ab3252453bf205ed906e46bf9741c27bf9d) Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
* bpo-32381: Fix PyRun_SimpleFileExFlags() encoding (GH-23642) (GH-23692)Victor Stinner2020-12-081-92/+132
| | | | | | | | | | | | Fix encoding name when running a ".pyc" file on Windows: PyRun_SimpleFileExFlags() now uses the correct encoding to decode the filename. * Add pyrun_file() subfunction. * Add pyrun_simple_file() subfunction. * PyRun_SimpleFileExFlags() now calls _Py_fopen_obj() rather than _Py_fopen(). (cherry picked from commit b6d98c10fff6f320f8fdf595c3f9a05d8be4e31d)
* bpo-42536: GC track recycled tuples (GH-23623) (GH-23651)Brandt Bucher2020-12-071-0/+5
| | | | | | | | | | | | | | | | | Several built-in and standard library types now ensure that their internal result tuples are always tracked by the garbage collector: - collections.OrderedDict.items - dict.items - enumerate - functools.reduce - itertools.combinations - itertools.combinations_with_replacement - itertools.permutations - itertools.product - itertools.zip_longest - zip Previously, they could have become untracked by a prior garbage collection. (cherry picked from commit 226a012d1cd61f42ecd3056c554922f359a1a35d)
* bpo-42521: Add note about 'Python -d' only working on debug builds (GH-23607)Miss Islington (bot)2020-12-021-1/+2
| | | | | (cherry picked from commit 99b594404d364b363c184f48338d6ee81bee26dd) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.9] bpo-41100: Support macOS 11 and Apple Silicon (GH-22855) (GH-23295)Ronald Oussoren2020-11-222-13/+60
| | | | | | | | | | | | | | | | | | | | * [3.9] bpo-41100: Support macOS 11 and Apple Silicon (GH-22855) 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.. (cherry picked from commit 41761933c1c30bb6003b65eef1ba23a83db4eae4) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> * Back port of changes to _decimal to support arm64 * temp_dir is in test.support in 3.9
* [3.9] bpo-40998: Fix a refleak in create_filter() (GH-23365) (GH-23369)Christian Heimes2020-11-181-2/+5
| | | (cherry picked from commit d1e38d4023aa29e7ed64d4f8eb9c1e4a3c86a2e5)
* bpo-40998: Address compiler warnings found by ubsan (GH-20929)Miss Islington (bot)2020-11-181-4/+3
| | | | | | | | Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: GH:tiran (cherry picked from commit 07f2adedf0940b06d136208ec386d69b7d2d5b43) Co-authored-by: Christian Heimes <christian@python.org>
* [3.9] bpo-39934: Account for control blocks in 'except' in compiler. ↵Irit Katriel2020-11-171-8/+11
| | | | | (GH-22395) (GH-23303) * bpo-39934: backport PR 22395 to 3.9
* bpo-41686: Always create the SIGINT event on Windows (GH-23344) (GH-23347)Victor Stinner2020-11-171-25/+2
| | | | | | bpo-41686, bpo-41713: On Windows, the SIGINT event, _PyOS_SigintEvent(), is now created even if Python is configured to not install signal handlers (PyConfig.install_signal_handlers=0 or Py_InitializeEx(0)).
* bpo-42296: On Windows, fix CTRL+C regression (GH-23257)Miss Islington (bot)2020-11-131-5/+33
| | | | | | | | | | | | | | On Windows, fix a regression in signal handling which prevented to interrupt a program using CTRL+C. The signal handler can be run in a thread different than the Python thread, in which case the test deciding if the thread can handle signals is wrong. On Windows, _PyEval_SignalReceived() now always sets eval_breaker to 1 since it cannot test _Py_ThreadCanHandleSignals(), and eval_frame_handle_pending() always calls _Py_ThreadCanHandleSignals() to recompute eval_breaker. (cherry picked from commit d96a7a83133250377219227b5cfab4dbdddc5d3a) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-42057: Fix peephole optimizer (GH-22802)Inada Naoki2020-10-221-1/+1
|
* bpo-38324: Fix test__locale.py Windows failures (GH-20529)Miss Skeleton (bot)2020-10-201-2/+13
| | | | | | | Use wide-char _W_* fields of lconv structure on Windows Remove "ps_AF" from test__locale.known_numerics on Windows (cherry picked from commit f2312037e3a974d26ed3e23884f94c6af111a27a) Co-authored-by: TIGirardi <tiagoigirardi@gmail.com>
* bpo-41894: Fix UnicodeDecodeError while loading native module (GH-22466)Miss Skeleton (bot)2020-10-153-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running in a non-UTF-8 locale, if an error occurs while importing a native Python module (say because a dependent share library is missing), the error message string returned may contain non-ASCII code points causing a UnicodeDecodeError. PyUnicode_DecodeFSDefault is used for buffers which may contain filesystem paths. For consistency with os.strerror(), PyUnicode_DecodeLocale is used for buffers which contain system error messages. While the shortname parameter is always encoded in ASCII according to PEP 489, it is left decoded using PyUnicode_FromString to minimize the changes and since it should not affect the decoding (albeit _potentially_ slower). In dynload_hpux, since the error buffer contains a message generated from a static ASCII string and the module filesystem path, PyUnicode_DecodeFSDefault is used instead of PyUnicode_DecodeLocale as is used elsewhere. * bpo-41894: Fix bugs in dynload error msg handling For both dynload_aix and dynload_hpux, properly handle the possibility that decoding strings may return NULL and when such an error happens, properly decrement any previously decoded strings and return early. In addition, in dynload_aix, ensure that we pass the decoded string *object* pathname_ob to PyErr_SetImportError instead of the original pathname buffer. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit 2d2af320d94afc6561e8f8adf174c9d3fd9065bc) Co-authored-by: Kevin Adler <kadler@us.ibm.com>
* bpo-41993: Fix possible issues in remove_module() (GH-22631) (GH-22647)Miss Skeleton (bot)2020-10-141-10/+13
| | | | | | | | | | * PyMapping_HasKey() is not safe because it silences all exceptions and can return incorrect result. * Informative exceptions from PyMapping_DelItem() are overridden with RuntimeError and the original exception raised before calling remove_module() is lost. * There is a race condition between PyMapping_HasKey() and PyMapping_DelItem(). (cherry picked from commit 8287aadb75f6bd0154996424819334cd3839707c) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-41819: Fix compiler warning in init_dump_ascii_wstr() (GH-22332)Miss Islington (bot)2020-09-211-1/+1
| | | | | | | | Fix the compiler warning: format specifies type `wint_t` (aka `int`) but the argument has type `unsigned int` (cherry picked from commit c322948892438a387d752ec18d1eb512699a4d67) Co-authored-by: Samuel Marks <807580+SamuelMarks@users.noreply.github.com>
* [3.9] bpo-41631: _ast module uses again a global state (GH-21961) (GH-22258)Pablo Galindo2020-09-152-253/+23
| | | | | | | | | | | | | | | | | | | | Partially revert commit ac46eb4ad6662cf6d771b20d8963658b2186c48c: "bpo-38113: Update the Python-ast.c generator to PEP384 (gh-15957)". Using a module state per module instance is causing subtle practical problems. For example, the Mercurial project replaces the __import__() function to implement lazy import, whereas Python expected that "import _ast" always return a fully initialized _ast module. Add _PyAST_Fini() to clear the state at exit. The _ast module has no state (set _astmodule.m_size to 0). Remove astmodule_traverse(), astmodule_clear() and astmodule_free() functions.. (cherry picked from commit e5fbe0cbd4be99ced5f000ad382208ad2a561c90) Co-authored-by: Victor Stinner <vstinner@python.org>
* Fix compiler warnings in init_dump_ascii_wstr() (GH-22150)Miss Islington (bot)2020-09-091-1/+1
| | | | | | | | | | | | | | | | | | | | Fix GCC 9.3 (using -O3) warnings on x86: initconfig.c: In function ‘init_dump_ascii_wstr’: initconfig.c:2679:34: warning: format ‘%lc’ expects argument of type ‘wint_t’, but argument 2 has type ‘wchar_t’ {aka ‘long int’} 2679 | PySys_WriteStderr("%lc", ch); initconfig.c:2682:38: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘wchar_t’ {aka ‘long int’} 2682 | PySys_WriteStderr("\\x%02x", ch); initconfig.c:2686:38: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘wchar_t’ {aka ‘long int’} 2686 | PySys_WriteStderr("\\U%08x", ch); initconfig.c:2690:38: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘wchar_t’ {aka ‘long int’} 2690 | PySys_WriteStderr("\\u%04x", ch); (cherry picked from commit 640e8e1d5f61d5868453d992da04bf4741327748) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-41525: Make the Python program help ASCII-only (GH-21836)Miss Islington (bot)2020-09-091-1/+1
| | | | | (cherry picked from commit 58de1dd6a8677bd213802c19204b827cb7134695) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-41531: Fix compilation of dict literals with more than 0xFFFF elements ↵Miss Islington (bot)2020-09-041-1/+1
| | | | | | | (GH-21850) (GH-22107) (cherry picked from commit c51db0ea40ddabaf5f771ea633b37fcf4c90a495) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* closes bpo-41533: Fix a potential memory leak when allocating a stack (GH-21847)Miss Islington (bot)2020-09-041-0/+3
| | | | | | | Free the stack allocated in va_build_stack if do_mkstack fails and the stack is not a small_stack (cherry picked from commit 75c80b0bda89debf312f075716b8c467d411f90e) Co-authored-by: Tony Solomonik <tony.solomonik@gmail.com>
* bpo-41681: Fix for `f-string/str.format` error description when using 2 `,` ↵Miss Islington (bot)2020-09-011-2/+4
| | | | | | | | | | | | in format specifier (GH-22036) (GH-22041) * Fixed `f-string/str.format` error description when using two `,` in format specifier. Co-authored-by: millefalcon <hanish0019@hmail.com> (cherry picked from commit 0d6aa7f0ee38eb453bc8f73bf4830e6172be2f35) Co-authored-by: han-solo <hanish0019@gmail.com> Co-authored-by: han-solo <hanish0019@gmail.com>
* bpo-41524: fix pointer bug in PyOS_mystr{n}icmp (GH-21845) (GH-21978)Miss Islington (bot)2020-08-301-7/+11
|
* [3.9] bpo-41194: Convert _ast extension to PEP 489 (GH-21807)Victor Stinner2020-08-101-150/+176
| | | | | | | | | | | | * bpo-41194: Convert _ast extension to PEP 489 (GH-21293) Convert the _ast extension module to PEP 489 "Multiphase initialization". Replace the global _ast state with a module state. (cherry picked from commit b1cc6ba73a51d5cc3aeb113b5e7378fb50a0e20a) * bpo-41204: Fix compiler warning in ast_type_init() (GH-21307) (cherry picked from commit 1f76453173267887ed05bb3783e862cb22365ae8)
* Fix -Wstrict-prototypes warning in thread_pthread.h. (GH-21477)Miss Islington (bot)2020-07-151-1/+1
| | | | | (cherry picked from commit ea62a4bd54421693ed6b24a1bbd18ebed3bdb8f8) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* [3.9] bpo-41218: Only mark async code with CO_COROUTINE. (GH-21357) (GH-21362)Pablo Galindo2020-07-061-4/+6
| | | | | | | | | | 3.8.3 had a regression where compiling with ast.PyCF_ALLOW_TOP_LEVEL_AWAIT woudl agressively mark things are coroutine even if there were not. (cherry picked from commit bd46174) Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com> Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
* bpo-29778: Ensure python3.dll is loaded from correct locations when Python ↵Miss Islington (bot)2020-07-062-48/+0
| | | | | | | | | is embedded (GH-21297) Also enables using debug build of `python3_d.dll` Reference: CVE-2020-15523 (cherry picked from commit dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5) Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-21222: Fix improperly merged change so that final hooks are called ↵Steve Dower2020-07-031-2/+2
| | | | before types are cleared (GH-21304)
* bpo-41162: Clear audit hooks later during finalization (GH-21222)Steve Dower2020-07-031-3/+7
| | | Co-authored-by: Konge <zkonge@outlook.com>
* bpo-41180: Audit code.__new__ when unmarshalling (GH-21271)Miss Islington (bot)2020-07-031-0/+6
| | | | | (cherry picked from commit d160e0f8e283d0a8737644588b38e8c6a07c134f) Co-authored-by: tkmikan <36260601+tkmikan@users.noreply.github.com>
* [3.9] bpo-41194: The _ast module cannot be loaded more than once (GH-21290) ↵Victor Stinner2020-07-031-2006/+1900
| | | | | | | | | | | | | | | | | | | | | | | (GH-21292) * bpo-41194: Pass module state in Python-ast.c (GH-21284) Rework asdl_c.py to pass the module state to functions in Python-ast.c, instead of using astmodulestate_global. Handle also PyState_AddModule() failure in init_types(). (cherry picked from commit 74419f0c64959bb8392fcf3659058410423038e1) * bpo-41194: The _ast module cannot be loaded more than once (GH-21290) Fix a crash in the _ast module: it can no longer be loaded more than once. It now uses a global state rather than a module state. * Move _ast module state: use a global state instead. * Set _astmodule.m_size to -1, so the extension cannot be loaded more than once. (cherry picked from commit 91e1bc18bd467a13bceb62e16fbc435b33381c82)
* [3.9] bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags ↵Guido van Rossum2020-06-282-2/+3
| | | | (#21022)
* [3.9] bpo-41076: Pre-feed the parser with the f-string expression location ↵Pablo Galindo2020-06-282-2446/+2445
| | | | | | (GH-21054) (GH-21190) This commit changes the parsing of f-string expressions with the new parser. The parser gets pre-fed with the location of the expression itself (not the f-string, which was what we were doing before). This allows us to completely skip the shifting of the AST nodes after the parsing is completed.. (cherry picked from commit 1f0f4abb110b9fbade6175842b6a26ab0b8df6dd)
* [3.9] bpo-41132: Use pymalloc allocator in the f-string parser (GH-21173) ↵Lysandros Nikolaou2020-06-271-7/+7
| | | | | | | (GH-21183) (cherry picked from commit 6dcbc2422de9e2a7ff89a4689572d84001e230b2) Automerge-Triggered-By: @pablogsal
* bpo-41094: Fix decoding errors with audit when open files. (GH-21095)Miss Islington (bot)2020-06-241-4/+19
| | | | | (cherry picked from commit 6c6810d98979add7a89391c3c38990d0859f7a29) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>