summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* bpo-38324: Fix test__locale.py Windows failures (GH-20529)TIGirardi2020-10-201-2/+13
| | | | Use wide-char _W_* fields of lconv structure on Windows Remove "ps_AF" from test__locale.known_numerics on Windows
* bpo-42093: Add opcode cache for LOAD_ATTR (GH-22803)Pablo Galindo2020-10-201-5/+216
|
* closes bpo-42030: Remove legacy AIX dynload support (GH-22717)Kevin Adler2020-10-161-190/+0
| | | | | | | | Since c19c5a6, AIX builds have defaulted to using dynload_shlib over dynload_aix when dlopen is available. This function has been available since AIX 4.3, which went out of support in 2003, the same year the previously referenced commit was made. It has been nearly 20 years since a version of AIX has been supported which has not used dynload_shlib so there's no reason to keep this legacy code around.
* bpo-41919, test_codecs: Move codecs.register calls to setUp() (GH-22513)Hai Shi2020-10-161-25/+0
| | | | * Move the codecs' (un)register operation to testcases. * Remove _codecs._forget_codec() and _PyCodec_Forget()
* bpo-41894: Fix UnicodeDecodeError while loading native module (GH-22466)Kevin Adler2020-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>
* closes bpo-42029: Remove dynload_dl (GH-22687)Kevin Adler2020-10-141-23/+0
| | | | | All references to this dynamic loading method were removed in b9949db, when support for this method was dropped, but the implementation code was not dropped (seemingly in oversight).
* bpo-40422: Move _Py_closerange to fileutils.c (GH-22680)Kyle Evans2020-10-131-0/+76
| | | | | | | This API is relatively lightweight and organizationally, given that it's used by multiple modules, it makes sense to move it to fileutils. Requires making sure that _posixsubprocess is compiled with the appropriate Py_BUIILD_CORE_BUILTIN macro.
* bpo-41993: Fix possible issues in remove_module() (GH-22631)Serhiy Storchaka2020-10-111-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().
* bpo-42002: Clean up initialization of the sys module. (GH-22642)Serhiy Storchaka2020-10-111-107/+45
| | | Makes the code clearer and make errors handling more correct.
* bpo-38605: bump the magic number for 'annotations' future (#22630)Batuhan Taskaya2020-10-101-111/+111
|
* bpo-41991: Remove _PyObject_HasAttrId (GH-22629)Serhiy Storchaka2020-10-102-4/+21
| | | It can silence arbitrary exceptions.
* bpo-42000: Cleanup the AST related C-code (GH-22641)Batuhan Taskaya2020-10-101-10/+4
| | | | | | | | - Use the proper asdl sequence when creating empty arguments - Remove reduntant casts (thanks to new typed asdl_sequences) - Remove MarshalPrototypeVisitor and some utilities from asdl generator - Fix the header of `Python/ast.c` (kept from pgen times) Automerge-Triggered-By: @pablogsal
* bpo-41756: Add PyIter_Send function (#22443)Vladimir Matveev2020-10-101-14/+7
|
* bpo-38605: Make 'from __future__ import annotations' the default (GH-20434)Batuhan Taskaya2020-10-063-37/+3
| | | | | The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions. For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
* bpo-41936. Remove macros Py_ALLOW_RECURSION/Py_END_ALLOW_RECURSION (GH-22552)Serhiy Storchaka2020-10-052-4/+0
|
* bpo-21955: Change my nickname in BINARY_ADD comment (GH-22481)Victor Stinner2020-10-011-1/+1
|
* bpo-41670: Remove outdated predict macro invocation. (GH-22026)Mark Shannon2020-09-291-2/+0
| | | Remove PREDICTion of POP_BLOCK from FOR_ITER.
* bpo-41842: Add codecs.unregister() function (GH-22360)Hai Shi2020-09-281-0/+25
| | | | Add codecs.unregister() and PyCodec_Unregister() functions to unregister a codec search function.
* bpo-39934: Account for control blocks in 'except' in compiler. (GH-22395)Mark Shannon2020-09-251-8/+11
| | | * Account for control blocks in 'except' in compiler. Fixes #39934.
* bpo-40941: Fix stackdepth compiler warnings (GH-22377)Victor Stinner2020-09-231-4/+4
| | | | Explicitly cast a difference of two pointers to int: PyFrameObject.f_stackdepth is an int.
* bpo-40941: Fix fold_tuple_on_constants() compiler warnings (GH-22378)Victor Stinner2020-09-231-4/+2
| | | | | | Add explicit casts to fix compiler warnings in fold_tuple_on_constants(). The limit of constants per code is now INT_MAX, rather than UINT_MAX.
* bpo-41834: Remove _Py_CheckRecursionLimit variable (GH-22359)Victor Stinner2020-09-231-13/+3
| | | | | | | | | | Remove the global _Py_CheckRecursionLimit variable: it has been replaced by ceval.recursion_limit of the PyInterpreterState structure. There is no need to keep the variable for the stable ABI, since Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() were not usable in Python 3.8 and older: these macros accessed PyThreadState members, whereas the PyThreadState structure is opaque in the limited C API.
* bpo-41819: Fix compiler warning in init_dump_ascii_wstr() (GH-22332)Samuel Marks2020-09-211-1/+1
| | | | | Fix the compiler warning: format specifies type `wint_t` (aka `int`) but the argument has type `unsigned int`
* bpo-41756: Introduce PyGen_Send C API (GH-22196)Vladimir Matveev2020-09-191-17/+41
| | | | | | | | | | | | | The new API allows to efficiently send values into native generators and coroutines avoiding use of StopIteration exceptions to signal returns. ceval loop now uses this method instead of the old "private" _PyGen_Send C API. This translates to 1.6x increased performance of 'await' calls in micro-benchmarks. Aside from CPython core improvements, this new API will also allow Cython to generate more efficient code, benefiting high-performance IO libraries like uvloop.
* bpo-41746: Add type information to asdl_seq objects (GH-22223)Pablo Galindo2020-09-168-414/+398
| | | | | | | | | | | | | * Add new capability to the PEG parser to type variable assignments. For instance: ``` | a[asdl_stmt_seq*]=';'.small_stmt+ [';'] NEWLINE { a } ``` * Add new sequence types from the asdl definition (automatically generated) * Make `asdl_seq` type a generic aliasing pointer type. * Create a new `asdl_generic_seq` for the generic case using `void*`. * The old `asdl_seq_GET`/`ast_seq_SET` macros now are typed. * New `asdl_seq_GET_UNTYPED`/`ast_seq_SET_UNTYPED` macros for dealing with generic sequences. * Changes all possible `asdl_seq` types to use specific versions everywhere.
* bpo-41631: _ast module uses again a global state (#21961)Victor Stinner2020-09-152-253/+28
| | | | | | | | | | | | | | | | | 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.
* Fix compiler warnings in init_dump_ascii_wstr() (GH-22150)Victor Stinner2020-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);
* bpo-41525: Make the Python program help ASCII-only (GH-21836)Serhiy Storchaka2020-09-091-1/+1
|
* bpo-1635741: Port mashal module to multi-phase init (#22149)Victor Stinner2020-09-081-16/+18
| | | | Port the 'mashal' extension module to the multi-phase initialization API (PEP 489).
* bpo-41681: Fix for `f-string/str.format` error description when using 2 `,` ↵han-solo2020-09-011-2/+4
| | | | | | | in format specifier (GH-22036) * Fixed `f-string/str.format` error description when using two `,` in format specifier. Co-authored-by: millefalcon <hanish0019@hmail.com>
* closes bpo-41533: Fix a potential memory leak when allocating a stack (GH-21847)Tony Solomonik2020-08-301-0/+3
| | | | Free the stack allocated in va_build_stack if do_mkstack fails and the stack is not a small_stack
* bpo-41524: fix pointer bug in PyOS_mystr{n}icmp (GH-21845)wmeehan2020-08-271-7/+11
| | | | | | | | | | | | | | * bpo-41524: fix pointer bug in PyOS_mystr{n}icmp The existing implementations of PyOS_mystrnicmp and PyOS_mystricmp can increment pointers beyond the end of a string. This commit fixes those cases by moving the mutation out of the condition. * 📜🤖 Added by blurb_it. * Address comments Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-1635741: Explict GC collect after PyInterpreterState_Clear() (GH-21902)Hai Shi2020-08-171-4/+2
| | | | Fix a reference cycle by triggering an explicit GC collection after calling PyInterpreterState_Clear().
* bpo-41531: Fix compilation of dict literals with more than 0xFFFF elements ↵Pablo Galindo2020-08-131-1/+1
| | | | (GH-21850)
* bpo-1635741: Clean sysdict and builtins of interpreter at exit (GH-21605)Hai Shi2020-08-121-2/+8
|
* bpo-41463: Generate information about jumps from 'opcode.py' rather than ↵Mark Shannon2020-08-041-59/+73
| | | | | duplicating it in 'compile.c' (GH-21714) Generate information about jumps from 'opcode.py' rather than duplicate it in 'compile.c'
* bpo-41323: Perform 'peephole' optimizations directly on the CFG. (GH-21517)Mark Shannon2020-07-305-4562/+4349
| | | * Move 'peephole' optimizations into compile.c and perform them directly on the CFG.
* bpo-41340: Removed fallback implementation for strdup (GH-21634)wasiher2020-07-271-12/+0
|
* bpo-40941: Unify implicit and explicit state in the frame and generator ↵Mark Shannon2020-07-171-16/+27
| | | | | | | objects into a single value. (GH-20803) * Merge gen and frame state variables into one. * Replace stack pointer with depth in PyFrameObject. Makes code easier to read and saves a word of memory.
* Fix -Wstrict-prototypes warning in thread_pthread.h. (GH-21477)Benjamin Peterson2020-07-151-1/+1
|
* bpo-36346: Make using the legacy Unicode C API optional (GH-21437)Serhiy Storchaka2020-07-102-6/+27
| | | | Add compile time option USE_UNICODE_WCHAR_CACHE. Setting it to 0 makes the interpreter not using the wchar_t cache and the legacy Unicode C API.
* bpo-29778: test_embed tests the path configuration (GH-21306)Victor Stinner2020-07-072-3/+85
|
* bpo-41218: Only mark async code with CO_COROUTINE. (#21357)Matthias Bussonnier2020-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.
* bpo-29778: Ensure python3.dll is loaded from correct locations when Python ↵Steve Dower2020-07-062-48/+0
| | | | | | is embedded (GH-21297) Also enables using debug build of `python3_d.dll` Reference: CVE-2020-15523
* bpo-41204: Fix compiler warning in ast_type_init() (GH-21307)Victor Stinner2020-07-041-4/+5
|
* bpo-41162: Clear audit hooks later during finalization (GH-21222)Konge2020-07-031-3/+7
|
* bpo-41180: Audit code.__new__ when unmarshalling (GH-21271)tkmikan2020-07-031-0/+6
|
* bpo-41194: Convert _ast extension to PEP 489 (GH-21293)Victor Stinner2020-07-031-149/+174
| | | | Convert the _ast extension module to PEP 489 "Multiphase initialization". Replace the global _ast state with a module state.
* bpo-41194: The _ast module cannot be loaded more than once (GH-21290)Victor Stinner2020-07-031-38/+32
| | | | | | | | 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.
* bpo-41194: Pass module state in Python-ast.c (GH-21284)Victor Stinner2020-07-031-1990/+1890
| | | | | | 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().