summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* bpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933)Victor Stinner2021-03-239-15/+10
| | | | | | | | | | | | | | | | These functions were undocumented and excluded from the limited C API. Most names defined by these header files were not prefixed by "Py" and so could create names conflicts. For example, Python-ast.h defined a "Yield" macro which was conflict with the "Yield" name used by the Windows <winbase.h> header. Use the Python ast module instead. * Move Include/asdl.h to Include/internal/pycore_asdl.h. * Move Include/Python-ast.h to Include/internal/pycore_ast.h. * Remove ast.h header file. * pycore_symtable.h no longer includes Python-ast.h.
* Revert "bpo-40521: Make dtoa bigint free list per-interpreter (GH-24821)" ↵Victor Stinner2021-03-221-19/+17
| | | | | (GH-24964) This reverts commit 5bd1059184b154d339f1bd53d23c98b5bcf14c8c.
* bpo-43575: Use PEP 590 vectorcall to speed up map() (GH-24955)Dong-hee Na2021-03-221-2/+43
|
* bpo-43551: Fix PyImport_Import() for subinterpreters (GH-24929)junyixie2021-03-221-16/+21
| | | Avoid static variables.
* bpo-43517: Fix false positive in detection of circular imports (#24895)Antoine Pitrou2021-03-201-1/+1
|
* bpo-43244: Remove symtable.h header file (GH-24910)Victor Stinner2021-03-193-75/+43
| | | | | | | | | | | | | | | | | | Rename Include/symtable.h to to Include/internal/pycore_symtable.h, don't export symbols anymore (replace PyAPI_FUNC and PyAPI_DATA with extern) and rename functions: * PyST_GetScope() to _PyST_GetScope() * PySymtable_BuildObject() to _PySymtable_Build() * PySymtable_Free() to _PySymtable_Free() Remove PySymtable_Build(), Py_SymtableString() and Py_SymtableStringObject() functions. The Py_SymtableString() function was part the stable ABI by mistake but it could not be used, since the symtable.h header file was excluded from the limited C API. The Python symtable module remains available and is unchanged.
* bpo-43244: Remove the PyAST_Validate() function (GH-24911)Victor Stinner2021-03-182-2/+3
| | | | | | | | | | | | Remove the PyAST_Validate() function. It is no longer possible to build a AST object (mod_ty type) with the public C API. The function was already excluded from the limited C API (PEP 384). Rename PyAST_Validate() function to _PyAST_Validate(), move it to the internal C API, and don't export it anymore (replace PyAPI_FUNC with extern). The function was added in bpo-12575 by the commit 832bfe2ebd5ecfa92031cd40c8b41835ba90487f.
* bpo-43541: Fix PyEval_EvalCodeEx() regression (GH-24918)Victor Stinner2021-03-181-4/+2
| | | | | | | | | | | * Remove an assertion which required CO_NEWLOCALS and CO_OPTIMIZED code flags. It is ok to call this function on a code with these flags set. * Fix reference counting on builtins: remove Py_DECREF(). Fix regression introduced in the commit 46496f9d12582bf11f4911ad0f23315d6f277907. Add also a comment to document that _PyEval_BuiltinsFromGlobals() returns a borrowed reference.
* bpo-43244: Fix test_peg_generator for PyAST_Validate() (GH-24912)Victor Stinner2021-03-181-251/+5
| | | | | | | | | test_peg_generator now defines _Py_TEST_PEGEN macro when building C code to not call PyAST_Validate() in Parser/pegen.c. Moreover, it defines Py_BUILD_CORE_MODULE macro to get access to the internal C API. Remove "global_ast_state" from Python-ast.c when it's built by test_peg_generator: always get the AST state from the current interpreter.
* bpo-43244: Add pycore_ast.h header file (GH-24908)Victor Stinner2021-03-173-13/+7
| | | | | | | | Move _PyAST_GetDocString() and _PyAST_ExprAsUnicode() functions the internal C API: from Include/ast.h to a new Include/internal/pycore_ast.h header file. Don't export these functions anymore: replace PyAPI_FUNC() with extern. Remove also unused includes.
* bpo-43244: Rename pycore_ast.h to pycore_ast_state.h (GH-24907)Victor Stinner2021-03-171-1/+1
|
* bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)Victor Stinner2021-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.
* bpo-43497: Emit SyntaxWarnings for assertions with tuple constants. (GH-24867)tsukasa-au2021-03-161-4/+8
| | | | | | | | | | | | | | | | | | | * bpo-43497: Emit SyntaxWarnings for assertions with tuple constants. Add a test that shows that a tuple constant (a tuple, where all of its members are also compile-time constants) produces a SyntaxWarning. Then fix this failure. * Make SyntaxWarnings also work when "optimized". * Split tests for SyntaxWarning to SyntaxError conversion SyntaxWarnings emitted by the compiler when configured to be errors are actually raised as SyntaxError exceptions. Move these tests into their own method and add a test to ensure they are raised. Previously we only tested that they were not raised for a "valid" assertion statement.
* Mark POP_TOP at end of expression statement as artificial, to conform to PEP ↵Mark Shannon2021-03-151-0/+2
| | | | 626. (GH-24860)
* bpo-39316: Make sure that attribute accesses and stores, including method ↵Mark Shannon2021-03-143-6/+22
| | | | calls, conform to PEP 626. (GH-24859)
* bpo-40521: Make dtoa bigint free list per-interpreter (GH-24821)junyixie2021-03-131-17/+19
|
* bpo-43311: Create GIL autoTSSkey ealier (GH-24819)Victor Stinner2021-03-102-6/+24
| | | | | | At Python startup, call _PyGILState_Init() before PyInterpreterState_New() which calls _PyThreadState_GET(). When Python is built using --with-experimental-isolated-subinterpreters, _PyThreadState_GET() uses autoTSSkey.
* bpo-43287: Use PEP 590 vectorcall to speed up filter() (GH-24611)Dong-hee Na2021-03-101-2/+35
|