summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* 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().
* bpo-1635741: Release Unicode interned strings at exit (GH-21269)Victor Stinner2020-07-011-0/+1
| | | | | | | * PyUnicode_InternInPlace() now ensures that interned strings are ready. * Add _PyUnicode_ClearInterned(). * Py_Finalize() now releases Unicode interned strings: call _PyUnicode_ClearInterned().
* bpo-40521: Cleanup finalize_interp_types() (GH-21265)Victor Stinner2020-07-011-2/+2
| | | | Remove the now unused is_main_interp parameter of finalize_interp_types().
* bpo-23427: Add sys.orig_argv attribute (GH-20729)Victor Stinner2020-06-292-8/+9
| | | | | | | Add sys.orig_argv attribute: the list of the original command line arguments passed to the Python executable. Rename also PyConfig._orig_argv to PyConfig.orig_argv and document it.
* bpo-39151: Simplify DFS in the assembler (GH-17733)Pablo Galindo2020-06-281-33/+18
|
* bpo-41076: Pre-feed the parser with the f-string expression location (GH-21054)Lysandros Nikolaou2020-06-272-2400/+2400
| | | This commit changes the parsing of f-string expressions with the new parser. The parser gets pre-fed with the location of the expression itself (not the f-string, which was what we were doing before). This allows us to completely skip the shifting of the AST nodes after the parsing is completed.
* bpo-40521: Optimize PyBytes_FromStringAndSize(str, 0) (GH-21142)Victor Stinner2020-06-251-0/+5
| | | | | | | | | | | | | | | | Always create the empty bytes string singleton. Optimize PyBytes_FromStringAndSize(str, 0): it no longer has to check if the empty string singleton was created or not, it is always available. Add functions: * _PyBytes_Init() * bytes_get_empty(), bytes_new_empty() * bytes_create_empty_string_singleton() * unicode_create_empty_string_singleton() _Py_unicode_state: rename empty structure member to empty_string.
* bpo-40521: Always create the empty tuple singleton (GH-21116)Victor Stinner2020-06-241-1/+8
| | | | | | | | | | | Py_InitializeFromConfig() now always creates the empty tuple singleton as soon as possible. Optimize PyTuple_New(0): it no longer has to check if the empty tuple was created or not, it is always creatd. * Add tuple_create_empty_tuple_singleton() function. * Add tuple_get_empty() function. * Remove state parameter of tuple_alloc().
* bpo-41094: Fix decoding errors with audit when open files. (GH-21095)Serhiy Storchaka2020-06-241-4/+19
|
* bpo-40521: Fix _PyContext_Fini() (GH-21103)Victor Stinner2020-06-241-1/+3
| | | Only clear _token_missing in the main interpreter.
* bpo-40521: Make empty Unicode string per interpreter (GH-21096)Victor Stinner2020-06-231-5/+3
| | | Each interpreter now has its own empty Unicode string singleton.
* bpo-40521: Make MemoryError free list per interpreter (GH-21086)Victor Stinner2020-06-231-5/+2
| | | | | | | Each interpreter now has its own MemoryError free list: it is not longer shared by all interpreters. Add _Py_exc_state structure and PyInterpreterState.exc_state member. Move also errnomap into _Py_exc_state.
* bpo-40521: Empty frozenset is no longer a singleton (GH-21085)Raymond Hettinger2020-06-231-1/+0
| | | | | | | | | * Revert "bpo-40521: Make the empty frozenset per interpreter (GH-21068)" This reverts commit 261cfedf7657a515e04428bba58eba2a9bb88208. * bpo-40521: Empty frozensets are no longer singletons * Complete the removal of the frozenset singleton
* bpo-40521: Cleanup code of free lists (GH-21082)Victor Stinner2020-06-231-4/+10
| | | Add get_xxx_state() function to factorize duplicated code.
* Call _PyWarnings_InitState() in subinterpreters (GH-21078)Victor Stinner2020-06-231-11/+9
| | | | Py_InitializeFromConfig() now calls also _PyWarnings_InitState() in subinterpreters.
* bpo-40521: Make bytes singletons per interpreter (GH-21074)Victor Stinner2020-06-231-3/+1
| | | | | | Each interpreter now has its own empty bytes string and single byte character singletons. Replace STRINGLIB_EMPTY macro with STRINGLIB_GET_EMPTY() macro.
* bpo-40521: Make the empty frozenset per interpreter (GH-21068)Victor Stinner2020-06-231-3/+1
| | | Each interpreter now has its own empty frozenset singleton.
* bpo-40521: Make dict free lists per-interpreter (GH-20645)Victor Stinner2020-06-231-3/+1
| | | | | | | | | | | Each interpreter now has its own dict free list: * Move dict free lists into PyInterpreterState. * Move PyDict_MAXFREELIST define to pycore_interp.h * Add _Py_dict_state structure. * Add tstate parameter to _PyDict_ClearFreeList() and _PyDict_Fini(). * In debug mode, ensure that the dict free lists are not used after _PyDict_Fini() is called. * Remove "#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS".
* bpo-41078: Fix bltinmodule.c with Py_TRACE_REFS (GH-21058)Victor Stinner2020-06-221-0/+1
| | | | Add pycore_object.h include to fix bltinmodule.c when Py_TRACE_REFS macro is defined.
* bpo-41078: Rename pycore_tupleobject.h to pycore_tuple.h (GH-21056)Victor Stinner2020-06-224-22/+21
|
* bpo-41061: Fix incorrect expressions in hashtable (GH-21028)Christian Heimes2020-06-221-2/+2
| | | Signed-off-by: Christian Heimes <christian@python.org>
* bpo-41056: Fix reference to deallocated stack in pathconfig (Coverity) ↵Gregory P. Smith2020-06-221-1/+1
| | | | | | | (GH-21013) Reported by Coverity. (CID 1457554 RETURN_LOCAL) path0 is assigned as a pointer to this right before it goes out of scope.
* bpo-40939: Rename PyPegen* functions to PyParser* (GH-21016)Lysandros Nikolaou2020-06-211-8/+8
| | | | | | Rename PyPegen* functions to PyParser*, so that we can remove the old set of PyParser* functions that were using the old parser.
* bpo-40939: Remove the old parser (Part 2) (GH-21005)Lysandros Nikolaou2020-06-205-2695/+0
| | | Remove some remaining files and Makefile targets for the old parser
* bpo-40636: PEP 618: add strict parameter to zip() (GH-20921)Guido van Rossum2020-06-191-8/+85
| | | | | | | | zip() now supports PEP 618's strict parameter, which raises a ValueError if the arguments are exhausted at different lengths. Patch by Brandt Bucher. Co-authored-by: Brandt Bucher <brandtbucher@gmail.com> Co-authored-by: Ram Rachum <ram@rachum.com>
* bpo-40943: PY_SSIZE_T_CLEAN required for '#' formats (GH-20784)Victor Stinner2020-06-192-77/+45
| | | | | | | The PY_SSIZE_T_CLEAN macro must now be defined to use PyArg_ParseTuple() and Py_BuildValue() "#" formats: "es#", "et#", "s#", "u#", "y#", "z#", "U#" and "Z#". See the PEP 353. Update _testcapi.test_buildvalue_issue38913().
* bpo-41006: Remove init_sys_streams() hack (GH-20954)Victor Stinner2020-06-171-13/+0
| | | | The encodings.latin_1 module is no longer imported at startup. Now it is only imported when it is the filesystem encoding or the stdio encoding.
* bpo-36346: Add Py_DEPRECATED to deprecated unicode APIs (GH-20878)Inada Naoki2020-06-171-0/+4
| | | | Co-authored-by: Kyle Stanley <aeros167@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40985: Show correct SyntaxError text when last line has a LINECONT ↵Lysandros Nikolaou2020-06-161-4/+8
| | | | | | | | (GH-20888) When a file ends with a line that contains a line continuation character the text of the emitted SyntaxError is empty, contrary to the old parser, where the error text contained the text of the last line.
* bpo-36020: Require vsnprintf() to build Python (GH-20899)Victor Stinner2020-06-151-37/+5
| | | | | | | | The C99 functions snprintf() and vsnprintf() are now required to build Python. PyOS_snprintf() and PyOS_vsnprintf() no longer call Py_FatalError(). Previously, they called Py_FatalError() on a buffer overflow on platforms which don't provide vsnprintf().
* bpo-36020: Remove snprintf macro in pyerrors.h (GH-20889)Victor Stinner2020-06-151-10/+17
| | | | | | | | | | On Windows, #include "pyerrors.h" no longer defines "snprintf" and "vsnprintf" macros. PyOS_snprintf() and PyOS_vsnprintf() should be used to get portable behavior. Replace snprintf() calls with PyOS_snprintf() and replace vsnprintf() calls with PyOS_vsnprintf().
* bpo-40910: PyConfig_Clear() clears _orig_argv (GH-20886)Victor Stinner2020-06-151-0/+2
| | | bpo-40910, bpo-40953: PyConfig_Clear() clears _orig_argv.
* bpo-29782: Consolidate _Py_Bit_Length() (GH-20739)Niklas Fiekas2020-06-151-15/+0
| | | | | | | | | | In GH-2866, _Py_Bit_Length() was added to pymath.h for lack of a better location. GH-20518 added a more appropriate header file for bit utilities. It also shows how to properly use intrinsics. This allows reconsidering bpo-29782. * Move the function to the new header. * Changed return type to match __builtin_clzl() and reviewed usage. * Use intrinsics where available. * Pick a fallback implementation suitable for inlining.
* bpo-40957: Fix refleak in _Py_fopen_obj() (GH-20827)Christian Heimes2020-06-131-0/+1
| | | Signed-off-by: Christian Heimes <christian@python.org>
* bpo-40834: Fix truncate when sending str object with channel (GH-20555)An Long2020-06-131-1/+1
|
* Remove redundant var in PyErr_NewException() (GH-20850)Hai Shi2020-06-131-2/+0
|
* bpo-40939: Remove the old parser (GH-20768)Pablo Galindo2020-06-115-5788/+6
| | | This commit removes the old parser, the deprecated parser module, the old parser compatibility flags and environment variables and all associated support code and documentation.
* bpo-40925: Remove unused stack macro SET_VALUE (GH-20783)Dong-hee Na2020-06-111-1/+0
|
* bpo-39465: Use _PyInterpreterState_GET() (GH-20788)Victor Stinner2020-06-102-8/+8
| | | | | | | | | | | | Replace _PyThreadState_GET() with _PyInterpreterState_GET() in: * get_small_int() * gcmodule.c: add also get_gc_state() function * _PyTrash_deposit_object() * _PyTrash_destroy_chain() * warnings_get_state() * Py_GetRecursionLimit() Cleanup listnode.c: add 'parser' variable.
* _PyPreConfig_Read() decodes argv at each iteration (GH-20786)Victor Stinner2020-06-101-9/+11
| | | | _PyPreConfig_Read() now calls _PyPreCmdline_SetArgv() at each iteration, so bytes strings are decoded from the new encoding.
* bpo-40943: Replace PY_FORMAT_SIZE_T with "z" (GH-20781)Victor Stinner2020-06-102-12/+7
| | | | | | | The PEP 353, written in 2005, introduced PY_FORMAT_SIZE_T. Python no longer supports macOS 10.4 and Visual Studio 2010, but requires more recent macOS and Visual Studio versions. In 2020 with Python 3.10, it is now safe to use directly "%zu" to format size_t and "%zi" to format Py_ssize_t.
* bpo-40910: Export Py_GetArgcArgv() function (GH-20721)Victor Stinner2020-06-083-18/+28
| | | | | | | | | | | | Export explicitly the Py_GetArgcArgv() function to the C API and document the function. Previously, it was exported implicitly which no longer works since Python is built with -fvisibility=hidden. * Add PyConfig._orig_argv member. * Py_InitializeFromConfig() no longer calls _PyConfig_Write() twice. * PyConfig_Read() no longer initializes Py_GetArgcArgv(): it is now _PyConfig_Write() responsibility. * _PyConfig_Write() result type becomes PyStatus instead of void. * Write an unit test on Py_GetArgcArgv().
* bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var ↵Sandro Mani2020-06-082-7/+27
| | | | (GH-20605)
* bpo-29882: Add _Py_popcount32() function (GH-20518)Victor Stinner2020-06-081-22/+3
| | | | | | * Rename pycore_byteswap.h to pycore_bitutils.h. * Move popcount_digit() to pycore_bitutils.h as _Py_popcount32(). * _Py_popcount32() uses GCC and clang builtin function if available. * Add unit tests to _Py_popcount32().
* bpo-39791 native hooks for importlib.resources.files (GH-20576)Jason R. Coombs2020-06-082-2168/+2005
| | | | | | | | | | | | | | | | | | | | | | | | | * Provide native .files support on SourceFileLoader. * Add native importlib.resources.files() support to zipimporter. Remove fallback support. * make regen-all * 📜🤖 Added by blurb_it. * Move 'files' into the ResourceReader so it can carry the relevant module name context. * Create 'importlib.readers' module and add FileReader to it. * Add zip reader and rely on it for a TraversableResources object on zipimporter. * Remove TraversableAdapter, no longer needed. * Update blurb. * Replace backslashes with forward slashes. * Incorporate changes from importlib_metadata 2.0, finalizing the interface for extension via get_resource_reader. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-40887: Don't use finalized free lists (GH-20700)Victor Stinner2020-06-081-0/+12
| | | | | | In debug mode, ensure that free lists are no longer used after being finalized. Set numfree to -1 in finalization functions (eg. _PyList_Fini()), and then check that numfree is not equal to -1 before using a free list (e.g list_dealloc()).
* bpo-40887: Fix finalize_interp_clear() for free lists (GH-20698)Victor Stinner2020-06-071-27/+17
| | | | Reorganize code to ensure that free lists are cleared in the right order. Call _PyWarnings_Fini() before _PyList_Fini().
* bpo-40870: Invalidate usage of some constants with ast.Name (GH-20649)Batuhan Taskaya2020-06-061-0/+22
|