summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* bpo-38605: Revert making 'from __future__ import annotations' the default ↵Pablo Galindo2021-04-214-120/+157
| | | | | | (GH-25490) This reverts commits 044a1048ca93d466965afc027b91a5a9eb9ce23c and 1be456ae9d53bb1cba2b24fc86175c282d1c2169, adapting the code to changes that happened after it.
* bpo-25460: Surround suggestions by quotes (GH-25473)Pablo Galindo2021-04-191-2/+2
|
* bpo-38530: Cover more error paths in error suggestion functions (GH-25462)Pablo Galindo2021-04-171-2/+5
|
* bpo-38530: Include builtins in NameError suggestions (GH-25460)Pablo Galindo2021-04-171-1/+11
|
* bpo-38530: Match exactly AttributeError and NameError when offering ↵Pablo Galindo2021-04-161-2/+2
| | | | suggestions (GH-25443)
* bpo-41323: compiler: Reuse tuple in constant tuple folding (GH-25419)Inada Naoki2021-04-164-3253/+3266
|
* bpo-43846: Use less stack for large literals and calls (GH-25403)Mark Shannon2021-04-151-50/+144
| | | | | | | | | * Modify compiler to reduce stack consumption for large expressions. * Add more tests for stack usage. * Add NEWS item. * Raise SystemError for truly excessive stack use.
* bpo-38530: Optimize the calculation of string sizes when offering ↵Pablo Galindo2021-04-141-8/+10
| | | | suggestions (GH-25412)
* bpo-38530: Make sure that failing to generate suggestions on failure will ↵Pablo Galindo2021-04-142-7/+5
| | | | not propagate exceptions (GH-25408)
* bpo-38530: Offer suggestions on NameError (GH-25397)Pablo Galindo2021-04-142-8/+69
| | | | | | | | | | | When printing NameError raised by the interpreter, PyErr_Display will offer suggestions of simmilar variable names in the function that the exception was raised from: >>> schwarzschild_black_hole = None >>> schwarschild_black_hole Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'schwarschild_black_hole' is not defined. Did you mean: schwarzschild_black_hole?
* bpo-38530: Offer suggestions on AttributeError (#16856)Pablo Galindo2021-04-142-1/+157
| | | | | | | | | When printing AttributeError, PyErr_Display will offer suggestions of similar attribute names in the object that the exception was raised from: >>> collections.namedtoplo Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you mean: namedtuple?
* bpo-43760: Speed up check for tracing in interpreter dispatch (#25276)Mark Shannon2021-04-133-28/+38
| | | | | | | | | * Remove redundant tracing_possible field from interpreter state. * Move 'use_tracing' from tstate onto C stack, for fastest possible checking in dispatch logic. * Add comments stressing the importance stack discipline when dealing with CFrames. * Add NEWS
* bpo-43680: _pyio.open() becomes a static method (GH-25354)Victor Stinner2021-04-121-3/+3
| | | | | | | | | | | The Python _pyio.open() function becomes a static method to behave as io.open() built-in function: don't become a bound method when stored as a class variable. It becomes possible since static methods are now callable in Python 3.10. Moreover, _pyio.OpenWrapper becomes a simple alias to _pyio.open. init_set_builtins_open() now sets builtins.open to io.open, rather than setting it to io.OpenWrapper, since OpenWrapper is now an alias to open in the io and _pyio modules.
* bpo-43753: Add Py_Is() and Py_IsNone() functions (GH-25227)Victor Stinner2021-04-101-17/+16
| | | | | | | Add the Py_Is(x, y) function to test if the 'x' object is the 'y' object, the same as "x is y" in Python. Add also the Py_IsNone(), Py_IsTrue(), Py_IsFalse() functions to test if an object is, respectively, the None singleton, the True singleton or the False singleton.
* bpo-43798: Add source location attributes to alias (GH-25324)Matthew Suozzo2021-04-101-3/+97
| | | | | | | * Add source location attributes to alias. * Move alias star construction to pegen helper. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-43760: Streamline dispatch sequence for machines without computed gotos. ↵Mark Shannon2021-04-081-61/+52
| | | | | | | | (GH-25244) * Do fetch and decode at end of opcode then jump directly to switch. Should allow compilers that don't support computed-gotos, specifically MSVC, to generate better code.
* bpo-42923: Fix _Py_DumpExtensionModules() for NULL sysdict (GH-25262)Victor Stinner2021-04-071-6/+8
| | | Fix Py_FatalError() is called before interp->sysdict is set.
* bpo-43244: Rename pycore_ast.h functions to _PyAST_xxx() (GH-25252)Victor Stinner2021-04-072-285/+294
| | | | | | Rename AST functions of pycore_ast.h to use the "_PyAST_" prefix. Remove macros creating aliases without prefix. For example, Module() becomes _PyAST_Module(). Update Grammar/python.gram to use _PyAST_xxx() functions.
* bpo-43495 : Push missing frame block in compile.c (GH-24865)tomKPZ2021-04-071-1/+10
|
* bpo-43244: Remove Yield macro from pycore_ast.h (GH-25243)Victor Stinner2021-04-076-286/+288
| | | | | | | | * pycore_ast.h no longer defines the Yield macro. * Fix a compiler warning on Windows: "warning C4005: 'Yield': macro redefinition". * Python-ast.c now defines directly functions with their real _Py_xxx() name, rather than xxx(). * Remove "#undef Yield" in C files including pycore_ast.h.
* Correct micro release number and add a couple of asserts. (GH-25224)Mark Shannon2021-04-071-3/+3
|
* bpo-43105: Importlib now resolves relative paths when creating module spec ↵Steve Dower2021-04-071-2436/+2494
| | | | objects from file locations (GH-25121)
* bump the bytecode magic number (GH-25225)Dennis Sweeney2021-04-061-1/+1
|
* bpo-42135: Deprecate implementations of find_module() and find_loader() ↵Brett Cannon2021-04-063-3603/+3670
| | | | (GH-25169)
* bpo-43683: Handle generator entry in bytecode (GH-25138)Mark Shannon2021-04-064-2586/+2656
| | | | | | * Handle check for sending None to starting generator and coroutine into bytecode. * Document new bytecode and make it fail gracefully if mis-compiled.
* bpo-42128: __match_args__ can't be a list anymore (GH-25203)Brandt Bucher2021-04-061-8/+1
|
* bpo-27129: Update magic numbers and bootstrapping for GH-25069 (GH-25172)Dennis Sweeney2021-04-041-1/+1
| | | | | | | * Update magic numbers and bootstrapping for GH-25069 * add blurb Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-43672: raise ImportWarning when calling find_loader() (GH-25119)Brett Cannon2021-04-021-523/+528
|
* bpo-43687: Py_Initialize() creates singletons earlier (GH-25147)Victor Stinner2021-04-022-45/+73
| | | | | Reorganize pycore_interp_init() to initialize singletons before the the first PyType_Ready() call. Fix an issue when Python is configured using --without-doc-strings.
* bpo-27129: Use instruction offsets, not byte offsets, in bytecode and ↵Mark Shannon2021-04-016-4515/+4498
| | | | | | | internally. (GH-25069) * Use instruction offset, rather than bytecode offset. Streamlines interpreter dispatch a bit, and removes most EXTENDED_ARGs for jumps. * Change some uses of PyCode_Addr2Line to PyFrame_GetLineNumber
* bpo-42955: Add _overlapped to sys.stdlib_module_names (GH-25122)Victor Stinner2021-04-011-0/+1
|
* bpo-42134: Raise ImportWarning when calling find_module() in the import ↵Brett Cannon2021-03-302-956/+971
| | | | system (GH-25044)
* bpo-43660: Fix crash when displaying exceptions with custom values for ↵Pablo Galindo2021-03-291-1/+2
| | | | sys.stderr (GH-25075)
* bpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481)Inada Naoki2021-03-293-2/+20
| | | | | | | | | | | See [PEP 597](https://www.python.org/dev/peps/pep-0597/). * Add `-X warn_default_encoding` and `PYTHONWARNDEFAULTENCODING`. * Add EncodingWarning * Add io.text_encoding() * open(), TextIOWrapper() emits EncodingWarning when encoding is omitted and warn_default_encoding is enabled. * _pyio.TextIOWrapper() uses UTF-8 as fallback default encoding used when failed to import locale module. (used during building Python) * bz2, configparser, gzip, lzma, pathlib, tempfile modules use io.text_encoding(). * What's new entry
* bpo-42136: Deprecate module_repr() as found in importlib (GH-25022)Brett Cannon2021-03-262-1468/+1490
|
* Move big block of macros out of function to improve readability. (GH-25020)Mark Shannon2021-03-251-38/+40
|
* Only check evalbreaker after calls and on backwards egdes. Makes sure that ↵Mark Shannon2021-03-241-46/+37
| | | | __exit__ or __aexit__ is called in with statments in case of interrupt. (GH-18334)
* bpo-42137: have ModuleType.__repr__ prefer __spec__ over module_repr() ↵Brett Cannon2021-03-241-123/+124
| | | | | (GH-24953) This is to work towards the removal of the use of module_repr() in Python 3.12 (documented as deprecated since 3.4).
* bpo-31861: Fix reference leak in builtin_anext_impl() (GH-25008)Pablo Galindo2021-03-241-1/+4
|
* bpo-43244: Remove the pyarena.h header (GH-25007)Victor Stinner2021-03-246-94/+95
| | | | | | | | | | | | | | | | | | Remove the pyarena.h header file with functions: * PyArena_New() * PyArena_Free() * PyArena_Malloc() * PyArena_AddPyObject() These functions were undocumented, excluded from the limited C API, and were only used internally by the compiler. Add pycore_pyarena.h header. Rename functions: * PyArena_New() => _PyArena_New() * PyArena_Free() => _PyArena_Free() * PyArena_Malloc() => _PyArena_Malloc() * PyArena_AddPyObject() => _PyArena_AddPyObject()
* bpo-43244: Remove parser_interface.h header file (GH-25001)Victor Stinner2021-03-242-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Remove parser functions using the "struct _mod" type, because the AST C API was removed: * PyParser_ASTFromFile() * PyParser_ASTFromFileObject() * PyParser_ASTFromFilename() * PyParser_ASTFromString() * PyParser_ASTFromStringObject() These functions were undocumented and excluded from the limited C API. Add pycore_parser.h internal header file. Rename functions: * PyParser_ASTFromFileObject() => _PyParser_ASTFromFile() * PyParser_ASTFromStringObject() => _PyParser_ASTFromString() These functions are no longer exported (replace PyAPI_FUNC() with extern). Remove also _PyPegen_run_parser_from_file() function. Update test_peg_generator to use _PyPegen_run_parser_from_file_pointer() instead.
* bpo-43244: Add pycore_compile.h header file (GH-25000)Victor Stinner2021-03-236-49/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the compiler functions using "struct _mod" type, because the public AST C API was removed: * PyAST_Compile() * PyAST_CompileEx() * PyAST_CompileObject() * PyFuture_FromAST() * PyFuture_FromASTObject() These functions were undocumented and excluded from the limited C API. Rename functions: * PyAST_CompileObject() => _PyAST_Compile() * PyFuture_FromASTObject() => _PyFuture_FromAST() Moreover, _PyFuture_FromAST() is no longer exported (replace PyAPI_FUNC() with extern). _PyAST_Compile() remains exported for test_peg_generator. Remove also compatibility functions: * PyAST_Compile() * PyAST_CompileEx() * PyFuture_FromAST()
* bpo-31861: Add aiter and anext to builtins (#23847)Joshua Bronson2021-03-232-1/+100
| | | | | | Co-authored-by: jab <jab@users.noreply.github.com> Co-authored-by: Daniel Pope <mauve@mauveweb.co.uk> Co-authored-by: Justin Wang <justin39@gmail.com>