aboutsummaryrefslogtreecommitdiff
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* bpo-43152: Update assert statement to remove unused warning (GH-24473)Dong-hee Na2021-02-141-2/+1
|
* bpo-42217: compiler: merge same co_code and co_linetable objects (GH-23056)Inada Naoki2021-02-103-3847/+3835
|
* bpo-42882: Fix MSVC warnings in pystate.c (GH-24440)Ken Jin2021-02-041-1/+1
| | | _PyRuntimeState.unicode_ids.next_index type is Py_ssize_t.
* Only eliminate jumps to successor block if jump is unconditional. (GH-24417)Mark Shannon2021-02-021-17/+4
| | | | * Prevents elimination of the sole test of a value in statements like: if x or True: ...
* bpo-42990: Further refactoring of PyEval_ functions. (GH-24368)Mark Shannon2021-02-012-126/+204
| | | | | | | | | | * Further refactoring of PyEval_EvalCode and friends. Break into make-frame, and eval-frame parts. * Simplify function vector call using new _PyEval_Vector. * Remove unused internal functions: _PyEval_EvalCodeWithName and _PyEval_EvalCode. * Don't use legacy function PyEval_EvalCodeEx.
* bpo-40455: Fix gcc10+ warning about writing into a section of offset 0 ↵Pablo Galindo2021-01-301-3/+2
| | | | (GH-24384)
* bpo-42927: Inline cache for attributes defined with '__slots__' (#24216)Guido van Rossum2021-01-291-64/+116
|
* bpo-38631: Replace compiler fatal errors with exceptions (GH-24369)Victor Stinner2021-01-301-34/+52
| | | | | | | | * Replace Py_FatalError() calls with regular SystemError exceptions. * compiler_exit_scope() calls _PyErr_WriteUnraisableMsg() to log the PySequence_DelItem() failure. * compiler_unit_check() uses _PyMem_IsPtrFreed(). * compiler_make_closure(): remove "(reftype == FREE)" comment since reftype can also be LOCAL or GLOBAL_EXPLICIT.
* Fix a reference leak in the compiler for compiler_lambda() (GH-24382)Pablo Galindo2021-01-291-1/+3
|
* bpo-42979: Use _Py_CheckSlotResult() to check slots result (GH-24356)Victor Stinner2021-01-291-7/+11
| | | | | | | | | | | | | | | When Python is built in debug mode (with C assertions), calling a type slot like sq_length (__len__() in Python) now fails with a fatal error if the slot succeeded with an exception set, or failed with no exception set. The error message contains the slot, the type name, and the current exception (if an exception is set). * Check the result of all slots using _Py_CheckSlotResult(). * No longer pass op_name to ternary_op() in release mode. * Replace operator with dunder Python method name in error messages. For example, replace "*" with "__mul__". * Fix compiler_exit_scope() when an exception is set. * Fix bytearray.extend() when an exception is set: don't call bytearray_setslice() with an exception set.
* bpo-42990: Introduce 'frame constructor' struct to simplify API for ↵Mark Shannon2021-01-291-62/+68
| | | | | | | PyEval_CodeEval and friends (GH-24298) * Introduce 'frame constructor' to simplify API for frame creation * Embed struct using a macro to conform to PEP 7
* bpo-42955: Remove sub-packages from sys.stdlib_module_names (GH-24353)Victor Stinner2021-01-281-12/+0
|
* bpo-33387: update documentation for exception handling opcode changes (GH-24334)Irit Katriel2021-01-261-2/+0
| | | | | * bpo-33387: remove obsolete comment * bpo-33387: update SETUP_WITH opcode documentation
* bpo-42955: Rename module_names to sys.stdlib_module_names (GH-24332)Victor Stinner2021-01-253-18/+18
| | | | * Rename _Py_module_names to _Py_stdlib_module_names. * Rename Python/module_names.h to Python/stdlib_module_names.h.
* bpo-42955: Add sys.modules_names (GH-24238)Victor Stinner2021-01-253-190/+226
| | | | Add sys.module_names, containing the list of the standard library module names.
* bpo-27772: Make preceding width with 0 valid in string format. (GH-11270)Serhiy Storchaka2021-01-251-1/+1
| | | | Previously it was an error with confusing error message.
* bpo-42780: Fix set_inheritable() for O_PATH file descriptors on Linux (GH-24172)cptpcrd2021-01-201-0/+7
|
* bpo-42923: _Py_DumpExtensionModules() ignores stdlib ext (GH-24254)Victor Stinner2021-01-192-13/+43
|
* bpo-42955: Add Python/module_names.h (GH-24258)Victor Stinner2021-01-191-0/+336
| | | | | | | | | | Add a private list of all stdlib modules: _Py_module_names. * Add Tools/scripts/generate_module_names.py script. * Makefile: Add "make regen-module-names" command. * setup.py: Add --list-module-names option. * GitHub Action and Travis CI also runs "make regen-module-names", not ony "make regen-all", to ensure that the module names remains up to date.
* bpo-42923: Dump extension modules on fatal error (GH-24207)Victor Stinner2021-01-181-0/+41
| | | | | | | The Py_FatalError() function and the faulthandler module now dump the list of extension modules on a fatal error. Add _Py_DumpExtensionModules() and _PyModule_IsExtension() internal functions.
* bpo-42923: Py_FatalError() avoids fprintf() (GH-24242)Victor Stinner2021-01-182-43/+44
| | | | | * Replace buffered fprintf() with unbuffered _Py_write_noraise() in Py_FatalError(). * _Py_DumpHexadecimal() now accepts uintptr_t.
* Mark instructions at end of class scope as artificial. (GH-24222)Mark Shannon2021-01-151-0/+2
|
* Eliminate NOPs in extended blocks. (GH-24209)Mark Shannon2021-01-131-5/+13
|
* bpo-42908: Mark cleanup code at end of try-except and with artificial (#24202)Mark Shannon2021-01-134-4358/+4432
| | | | | | | | | * Mark bytecodes at end of try-except as artificial. * Make sure that the CFG is consistent throughout optimiization. * Extend line-number propagation logic so that implicit returns after 'try-except' or 'with' have the correct line numbers. * Update importlib
* bpo-41994: Fix refcount issues in Python/import.c (GH-22632)Serhiy Storchaka2021-01-121-56/+50
| | | https://bugs.python.org/issue41994
* bpo-42882: _PyRuntimeState_Init() leaves unicode next_index unchanged (GH-24193)Victor Stinner2021-01-121-1/+4
| | | | | | | | Fix the _PyUnicode_FromId() function (_Py_IDENTIFIER(var) API) when Py_Initialize() / Py_Finalize() is called multiple times: preserve _PyRuntime.unicode_ids.next_index value. Use _PyRuntimeState_INIT macro instead memset(0) to reset _PyRuntimeState members to zero.
* Update frame.f_lineno before any call to the (C) tracing function. (GH-24150)Mark Shannon2021-01-071-33/+54
| | | * Minimizes breakage of C extensions and ensures PyFrame_GetLineNumber is efficient.
* bpo-42823: Fix frame lineno when frame.f_trace is set (GH-24099)Mark Shannon2021-01-053-1144/+1151
| | | | | | | | | * Add test for frame.f_lineno with/without tracing. * Make sure that frame.f_lineno is correct regardless of whether frame.f_trace is set. * Update importlib * Add NEWS
* bpo-42810: Mark jumps at end of if and try statements as artificial. (GH-24091)Mark Shannon2021-01-044-2185/+2202
| | | | | | | * Mark jumps at end of if and try statements as artificial. * Update importlib * Add comment explaining the purpose of ADDOP_JUMP_NOLINE.
* Delete the now unused c_do_not_emit_bytecode field. (#24094)Mark Shannon2021-01-041-33/+0
|
* Bring Python into the new year. (GH-24036)Dong-hee Na2021-01-021-1/+1
|
* bpo-42745: finalize_interp_types() calls _PyType_Fini() (GH-23953)Victor Stinner2020-12-261-3/+1
| | | | | Call _PyType_Fini() in subinterpreters. Fix reference leaks in subinterpreters.
* bpo-40521: Per-interpreter interned strings (GH-20085)Victor Stinner2020-12-261-0/+2
| | | | | | | | | | | Make the Unicode dictionary of interned strings compatible with subinterpreters. Remove the INTERN_NAME_STRINGS macro in typeobject.c: names are always now interned (even if EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro is defined). _PyUnicode_ClearInterned() now uses PyDict_Next() to no longer allocate memory, to ensure that the interned dictionary is cleared.
* bpo-42745: Make the type cache per-interpreter (GH-23947)Victor Stinner2020-12-262-1/+3
| | | | | | | | | | | Make the type attribute lookup cache per-interpreter. Add private _PyType_InitCache() function, called by PyInterpreterState_New(). Continue to share next_version_tag between interpreters, since static types are still shared by interpreters. Remove MCACHE macro: the cache is no longer disabled if the EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro is defined.
* bpo-39465: Fix _PyUnicode_FromId() for subinterpreters (GH-20058)Victor Stinner2020-12-261-11/+19
| | | | | | | | | | | | | | | | | Make _PyUnicode_FromId() function compatible with subinterpreters. Each interpreter now has an array of identifier objects (interned strings decoded from UTF-8). * Add PyInterpreterState.unicode.identifiers: array of identifiers objects. * Add _PyRuntimeState.unicode_ids used to allocate unique indexes to _Py_Identifier. * Rewrite the _Py_Identifier structure. Microbenchmark on _PyUnicode_FromId(&PyId_a) with _Py_IDENTIFIER(a): [ref] 2.42 ns +- 0.00 ns -> [atomic] 3.39 ns +- 0.00 ns: 1.40x slower This change adds 1 ns per _PyUnicode_FromId() call in average.
* bpo-42246: Don't eliminate jumps to jumps, if it will break PEP 626. (GH-23896)Mark Shannon2020-12-234-4155/+4191
|
* Fix typos in sysmodule (GH-23883)Joannah Nanjekye2020-12-221-2/+2
|
* bpo-42634: Mark reraise after except blocks as artificial. (GH-23877)Mark Shannon2020-12-214-4995/+5007
| | | | | | | * Mark reraise after except blocks as artificial. * Update importlib * Update dis test.
* bpo-24792: Fix zipimporter masking the cause of import errors (GH-22204)Irit Katriel2020-12-181-710/+719
| | | | | zipimport's _unmarshal_code swallows import errors and then _get_module_code doesn't know the cause of the error, and returns the generic, and sometimes incorrect, 'could not find...'. Automerge-Triggered-By: GH:brettcannon
* bpo-42246: Make sure that `f_lasti`, and thus `f_lineno`, is set correctly ↵Mark Shannon2020-12-176-214/+218
| | | | | | | | | after raising or reraising an exception (GH-23803) * Ensure that f_lasti is set correctly after an exception is raised to conform to PEP 626. * Update importlib * Add NEWS.
* bpo-26564: fix obsolete comment in traceback.c (GH-23819)Irit Katriel2020-12-171-1/+2
|
* bpo-42645: Make sure that return/break/continue are only traced once when ↵Mark Shannon2020-12-162-1664/+1673
| | | | | | | | | exiting via a finally block. (GH-23780) * Make sure that return/break/continue are only traced once when exiting via a finally block. * Add test for return in try-finally. * Update importlib
* bpo-42615: Delete redundant jump instructions that only bypass empty blocks ↵Om G2020-12-162-101/+143
| | | | | | | | | | | | | | | | | | | | | | | (GH-23733) * Delete jump instructions that bypass empty blocks * Add news entry * Explicitly check for unconditional jump opcodes Using the is_jump function results in the inclusion of instructions like returns for which this optimization is not really valid. So, instead explicitly check that the instruction is an unconditional jump. * Handle conditional jumps, delete jumps gracefully * Ensure b_nofallthrough and b_reachable are valid * Add test for redundant jumps * Regenerate importlib.h and edit Misc/ACKS * Fix bad whitespace
* bpo-42639: Move atexit state to PyInterpreterState (GH-23763)Victor Stinner2020-12-152-12/+9
| | | | | | | | | * Add _PyAtExit_Call() function and remove pyexitfunc and pyexitmodule members of PyInterpreterState. The function logs atexit callback errors using _PyErr_WriteUnraisableMsg(). * Add _PyAtExit_Init() and _PyAtExit_Fini() functions. * Remove traverse, clear and free functions of the atexit module. Co-authored-by: Dong-hee Na <donghee.na@python.org>
* bpo-42246: Remove DO_NOT_EMIT_BYTECODE macros, so that while loops and if ↵Mark Shannon2020-12-154-3457/+3402
| | | | statements conform to PEP 626. (GH-23743)
* bpo-42639: atexit now logs callbacks exceptions (GH-23771)Victor Stinner2020-12-141-6/+3
| | | | | | | | | | | At Python exit, if a callback registered with atexit.register() fails, its exception is now logged. Previously, only some exceptions were logged, and the last exception was always silently ignored. Add _PyAtExit_Call() function and remove PyInterpreterState.atexit_func member. call_py_exitfuncs() now calls directly _PyAtExit_Call(). The atexit module must now always be built as a built-in module.
* bpo-42639: Cleanup atexitmodule.c (GH-23770)Victor Stinner2020-12-141-14/+2
| | | | | | | | | * Rename "atexitmodule_state" to "struct atexit_state". * Rename "modstate" to "state". * Rename "self" parameter to "module". * test_atexit uses textwrap.dedent(). * Remove _Py_PyAtExit() function: inline it into atexit_exec(). * PyInterpreterState: rename pyexitfunc to atexit_func, rename pyexitmodule to atexit_module.
* bpo-42635: Mark JUMP_ABSOLUTE at end of 'for' loop as artificial to avoid ↵Mark Shannon2020-12-143-3767/+3769
| | | | spurious line events. (GH-23761)
* Don't generate spurious line number in try-except-finally. (#23760)Mark Shannon2020-12-143-1732/+1734
|
* bpo-31904: Define THREAD_STACK_SIZE for VxWorks (GH-23718)pxinwr2020-12-091-0/+4
|