summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* bpo-32280: Store _PyRuntime in a named section (GH-4802) (#27448)Miss Islington (bot)2021-07-291-2/+28
| | | | | | | | | | This commit stores the _PyRuntime structure in a section of the same name. This allows a debugging or crash reporting tool to quickly locate this structure at runtime without requiring the symbol table. Co-authored-by: Pablo Galindo <pablogsal@gmail.com> (cherry picked from commit 35002aa8f62dda1f79035e9904abdf476683e9be) Co-authored-by: Max Bélanger <aeromax@gmail.com> Co-authored-by: Max Bélanger <aeromax@gmail.com>
* [3.10] bpo-43897: Reject "_" captures and top-level MatchStar in the AST ↵Miss Islington (bot)2021-07-291-20/+28
| | | | | | | | | | validator (GH-27432) (GH-27435) (cherry picked from commit 8d0647485db5af2a0f0929d6509479ca45f1281b) Co-authored-by: Brandt Bucher <brandt@python.org> Automerge-Triggered-By: GH:brandtbucher
* bpo-44740: Lowercase "internet" and "web" where appropriate. (GH-27378) ↵Miss Islington (bot)2021-07-261-1/+1
| | | | | | | | (GH-27380) Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 11749e2dc20ad6a76e9a39e948853e89b2b4bbed) Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
* [3.10] bpo-44600: Fix line numbers for pattern matching cleanup code ↵Miss Islington (bot)2021-07-261-4/+12
| | | | | | | | | | (GH-27346) (GH-27356) (cherry picked from commit 4214f470f0cb9b6fef9a90758756fbc00ba95b5a) Co-authored-by: Charles Burkland <charles.aburkland@gmail.com> Automerge-Triggered-By: GH:brandtbucher
* bpo-44645: Check for interrupts on any potentially backwards edge (GH-27216) ↵Miss Islington (bot)2021-07-191-1/+6
| | | | | | | (GH-27235) (cherry picked from commit d09c13417890427f829e3df297beb0e27133f8f4) Co-authored-by: Mark Shannon <mark@hotpy.org>
* bpo-44655: Include the name of the type in unset __slots__ attribute errors ↵Miss Islington (bot)2021-07-171-4/+9
| | | | | | | | | (GH-27199) (GH-27201) (cherry picked from commit f783428a2313a729ca8b539c5a86ff114b9ff375) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-44655: Don't include suggestions for attributes that are the same as the ↵Miss Islington (bot)2021-07-161-0/+3
| | | | | | | missing one (GH-27197) (GH-27198) (cherry picked from commit 6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* Revert "bpo-44645: Check for interrupts on any potentially backwards edge. ↵Miss Islington (bot)2021-07-161-6/+1
| | | | | | | | (GH-27167)" (GH-27194) (#27195) This reverts commit 000e70ad5246732fcbd27cf59268185cbd5ad734. (cherry picked from commit c90c591e5158ab7b531dcd6e2a5f00bc70ba7637) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-44626: Merge basic blocks earlier to enable better handling of exit ↵Mark Shannon2021-07-163-3819/+3856
| | | | | blocks without line numbers (GH-27138) (GH-27182) (cherry picked from commit a86f7dae0acf918d54086cb85e5a0b0bedeedce7)
* [3.10] bpo-44645: Check for interrupts on any potentially backwards edge. ↵Mark Shannon2021-07-161-1/+6
| | | | | | | (GH-27167) (GH-27183) (cherry picked from commit 000e70ad5246732fcbd27cf59268185cbd5ad734) Co-authored-by: Mark Shannon <mark@hotpy.org>
* bpo-44622: Set line number of END_ASYNC_FOR to match that of iterator. ↵Mark Shannon2021-07-151-1/+3
| | | | | (GH-27160) (GH-27163) (cherry picked from commit f333ab0f2edec26a769ed558263ac662e5475451)
* [3.10] bpo-44589: raise a SyntaxError when mapping patterns have duplicate ↵Miss Islington (bot)2021-07-151-4/+41
| | | | | | | | | | literal keys (GH-27131) (GH-27157) (cherry picked from commit 2693132292b2acf381ac6fa729bf3acf41d9d72b) Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com> Automerge-Triggered-By: GH:brandtbucher
* bpo-44616: Mark all clean up instructions at end of named exception block as ↵Mark Shannon2021-07-141-3/+2
| | | | | artificial (GH-27109) (GH-27135) (cherry picked from commit e5862f79c16e28f1ec51d179698739a9b2d8c1d2)
* bpo-44472: Fix ltrace functionality when exceptions are raised (GH-26822) ↵Miss Islington (bot)2021-07-131-0/+3
| | | | | | | | | (GH-26830) (cherry picked from commit 06cda808f149fae9b4c688f752b6eccd0d455ba4) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.10] bpo-43897: ast validation for pattern matching nodes (GH-27074)Batuhan Taskaya2021-07-101-31/+123
| | | | | (cherry picked from commit 8dcb7d98086888230db94a1eb07bae1b5db82bc9) Co-authored-by: Batuhan Taskaya <batuhan@python.org>
* bpo-44570: Fix line tracing for forward jumps to duplicated tails (GH-27067)Mark Shannon2021-07-081-19/+13
|
* bpo-41180: Replace marshal code.__new__ audit event with marshal.load[s] and ↵Steve Dower2021-06-301-10/+20
| | | | marshal.dumps (GH-26970)
* bpo-44441: _PyImport_Fini2() resets PyImport_Inittab (GH-26874) (GH-26877)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-44466: Faulthandler now detects the GC (GH-26823) (GH-26826)Victor Stinner2021-06-211-0/+4
| | | | | | The faulthandler module now detects if a fatal error occurs during a garbage collector collection (only if all_threads is true). (cherry picked from commit d19163912bfc790283724f05328bd31e4e65003d)
* bpo-44297: Fix missing line number in generator expressions (GH-26821)Mark Shannon2021-06-212-958/+959
| | | | | * Make sure that line number is set when entering comprehension scope in compiler. (cherry picked from commit 82e5c28af7049c4f5343c808f172cbe2e145f49b)
* bpo-41299: Reduce lag in Windows threading timeouts by using a higher ↵Miss Islington (bot)2021-06-201-4/+10
| | | | | | | | | precision time source (GH-26568) (GH-26580) (cherry picked from commit 449e6f0ef395231e3abe467f910b02d7f075c27f) Co-authored-by: Ryan Hileman <lunixbochs@gmail.com> Co-authored-by: Ryan Hileman <lunixbochs@gmail.com>
* bpo-11105: Do not crash when compiling recursive ASTs (GH-20594)Miss Islington (bot)2021-06-031-0/+808
| | | | | | | | | | 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.10] bpo-44298: Backport #26513 to 3.10 (#26516)Mark Shannon2021-06-033-2853/+2862
| | | | | * Backport 937cebc93 to 3.10 * Update importlib
* 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>
* [3.10] bpo-43933: Force RETURN_VALUE bytecodes to have line numbers (GH-26061)Mark Shannon2021-05-131-0/+29
| | | * Guarantee that line number is set for returns.
* bpo-44063: set the missing end locations on the compiler (GH-25956) (#25972)Miss Islington (bot)2021-05-071-5/+13
| | | | | (cherry picked from commit b2ec37a7224318d466e0877790ed740ce8b4867d) Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
* bpo-40943: Fix skipitem() didn't raise SystemError (GH-25937)Miss Islington (bot)2021-05-071-8/+5
| | | | | | | `convertitem()` raises `SystemError` when 'GH-' is used without `PY_SSIZE_T_CLEAN`. This commit makes `skipitem()` raise it too. (cherry picked from commit 4ebf4a6bfad4afcbab3baf9c0159c7767e2a64c0) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* Correct location for syntax error in try-except (GH-25939)Mark Shannon2021-05-061-1/+1
|
* bpo-38530: Refactor and improve AttributeError suggestions (GH-25776)Dennis Sweeney2021-05-031-59/+130
| | | | | | | | | | | | | | | | | | | | - Make case-swaps half the cost of any other edit - Refactor Levenshtein code to not use memory allocator, and to bail early on no match. - Add comments to Levenshtein distance code - Add test cases for Levenshtein distance behind a debug macro - Set threshold to `(name_size + item_size + 3) * MOVE_COST / 6`. - Reasoning: similar to `difflib.SequenceMatcher.ratio()` >= 2/3: ``` "Multiset Jaccard similarity" >= 2/3 matching letters / total letters >= 2/3 (name_size - distance + item_size - distance) / (name_size + item_size) >= 2/3 1 - (2*distance) / (name_size + item_size) >= 2/3 1/3 >= (2*distance) / (name_size + item_size) (name_size + item_size) / 6 >= distance With rounding: (name_size + item_size + 3) // 6 >= distance ``` Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* bpo-43754: Fix compiler warning in Python/compile.c (GH-25855)Pablo Galindo2021-05-031-1/+1
| | | | | This fixes the following warning: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]
* bpo-43916: Move the _PyStructSequence_InitType function to the internal API ↵Pablo Galindo2021-05-031-0/+1
| | | | (GH-25854)
* bpo-42725: Render annotations effectless on symbol table with PEP 563 (GH-25583)Batuhan Taskaya2021-05-031-10/+91
|
* bpo-43754: Eliminate bindings for partial pattern matches (GH-25229)Brandt Bucher2021-05-024-340/+483
|
* bpo-43933: Set frame.f_lineno during call to __exit__ (GH-25719)Mark Shannon2021-04-304-2950/+2956
| | | * Set line number of __exit__ call in a with statement to be that of the with keyword.
* bpo-43667: Fix broken Unicode encoding in non-UTF locales on Solaris (GH-25096)Jakub Kulík2021-04-301-0/+106
|
* bpo-43916: PyStdPrinter_Type uses Py_TPFLAGS_DISALLOW_INSTANTIATION (GH-25749)Victor Stinner2021-04-301-1/+1
| | | | | | | The PyStdPrinter_Type type now uses the Py_TPFLAGS_DISALLOW_INSTANTIATION flag to disallow instantiation, rather than seting a tp_init method which always fail. Write also unit tests for PyStdPrinter_Type.
* bpo-43916: Add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag (GH-25721)Victor Stinner2021-04-301-30/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new Py_TPFLAGS_DISALLOW_INSTANTIATION type flag to disallow creating type instances: set tp_new to NULL and don't create the "__new__" key in the type dictionary. The flag is set automatically on static types if tp_base is NULL or &PyBaseObject_Type and tp_new is NULL. Use the flag on the following types: * _curses.ncurses_version type * _curses_panel.panel * _tkinter.Tcl_Obj * _tkinter.tkapp * _tkinter.tktimertoken * _xxsubinterpretersmodule.ChannelID * sys.flags type * sys.getwindowsversion() type * sys.version_info type Update MyStr example in the C API documentation to use Py_TPFLAGS_DISALLOW_INSTANTIATION. Add _PyStructSequence_InitType() function to create a structseq type with the Py_TPFLAGS_DISALLOW_INSTANTIATION flag set. type_new() calls _PyType_CheckConsistency() at exit.
* bpo-43977: Use tp_flags for collection matching (GH-25723)Mark Shannon2021-04-302-66/+8
| | | | | | | | | | | | | * Add Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING, add to all relevant standard builtin classes. * Set relevant flags on collections.abc.Sequence and Mapping. * Use flags in MATCH_SEQUENCE and MATCH_MAPPING opcodes. * Inherit Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING. * Add NEWS * Remove interpreter-state map_abc and seq_abc fields.
* bpo-43892: Validate the first term of complex literal value patterns (GH-25735)Brandt Bucher2021-04-302-38/+20
|
* bpo-42800: Rename AUDIT_READ to PY_AUDIT_READ (GH-25736)Steve Dower2021-04-301-1/+1
|
* bpo-42800: add audit hooks for f_code and tb_frame (GH-24182)Ryan Hileman2021-04-291-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 Add an AUDIT_READ attribute flag aliased to READ_RESTRICTED. Update obsolete flag documentation.
* bpo-42739: Don't use sentinels to mark end of line table. (GH-25657)Mark Shannon2021-04-295-4952/+4921
| | | | | * Add length parameter to PyLineTable_InitAddressRange and doen't use sentinel values at end of table. Makes the line number table more robust. * Update PyCodeAddressRange to match PEP 626.
* bpo-43892: Make match patterns explicit in the AST (GH-25585)Nick Coghlan2021-04-297-488/+1498
| | | Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* bpo-43962: Fix _PyInterpreterState_IDIncref() (GH-25683)Victor Stinner2021-04-281-6/+7
| | | | _PyInterpreterState_IDIncref() now calls _PyInterpreterState_IDInitref() and always increments id_refcount.
* bpo-38530: Require 50% similarity in NameError and AttributeError ↵Dennis Sweeney2021-04-271-1/+4
| | | | suggestions (GH-25584)
* bpo-42609: Check recursion depth in the AST validator and optimizer (GH-23744)Serhiy Storchaka2021-04-252-142/+291
|
* bpo-42737: annotations with complex targets no longer causes any runtime ↵Batuhan Taskaya2021-04-251-0/+6
| | | | effects (GH-23952)
* bpo-30555: Fix WindowsConsoleIO fails in the presence of fd redirection ↵Segev Finer2021-04-231-16/+45
| | | | | | | | (GH-1927) This works by not caching the handle and instead getting the handle from the file descriptor each time, so that if the actual handle changes by fd redirection closing/opening the console handle beneath our feet, we will keep working correctly.
* bpo-43914: Highlight invalid ranges in SyntaxErrors (#25525)Pablo Galindo2021-04-234-62/+209
| | | | | | | | | | | | | | | | | To improve the user experience understanding what part of the error messages associated with SyntaxErrors is wrong, we can highlight the whole error range and not only place the caret at the first character. In this way: >>> foo(x, z for z in range(10), t, w) File "<stdin>", line 1 foo(x, z for z in range(10), t, w) ^ SyntaxError: Generator expression must be parenthesized becomes >>> foo(x, z for z in range(10), t, w) File "<stdin>", line 1 foo(x, z for z in range(10), t, w) ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Generator expression must be parenthesized
* bpo-43475: Fix worst case collision behavior for NaN instances (GH-25493)Raymond Hettinger2021-04-222-5/+11
|