summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* bpo-41175: Guard against a NULL pointer dereference within bytearrayobject ↵stratakis2020-07-081-1/+3
| | | | | | | (GH-21240) The issue is triggered by the bytearray() + bytearray() operation. Detected by GCC 10 static analysis tool.
* bpo-36346: Undeprecate private function _PyUnicode_AsUnicode(). (GH-21336)Serhiy Storchaka2020-07-051-6/+0
|
* bpo-1635741: Fix unicode_dealloc() for mortal interned string (GH-21270)Victor Stinner2020-07-031-4/+14
| | | | When unicode_dealloc() is called on a mortal interned string, the string reference counter is now reset at zero.
* bpo-39960: Allow heap types in the "Carlo Verre" hack check that override ↵scoder2020-07-031-11/+30
| | | | | "tp_setattro()" (GH-21092) Automerge-Triggered-By: @gvanrossum
* bpo-1635741: Release Unicode interned strings at exit (GH-21269)Victor Stinner2020-07-011-32/+28
| | | | | | | * PyUnicode_InternInPlace() now ensures that interned strings are ready. * Add _PyUnicode_ClearInterned(). * Py_Finalize() now releases Unicode interned strings: call _PyUnicode_ClearInterned().
* bpo-36346: Raise DeprecationWarning when creating legacy Unicode (GH-20933)Inada Naoki2020-06-301-3/+20
|
* bpo-36346: Prepare for removing the legacy Unicode C API (AC only). (GH-21223)Serhiy Storchaka2020-06-301-0/+74
|
* bpo-41123: Remove PyUnicode_AsUnicodeCopy (GH-21209)Inada Naoki2020-06-301-33/+0
|
* bpo-37999: Simplify the conversion code for %c, %d, %x, etc. (GH-20437)Serhiy Storchaka2020-06-293-58/+26
| | | | Since PyLong_AsLong() no longer use __int__, explicit call of PyNumber_Index() before it is no longer needed.
* Fix typo in Object/listobject.c (GH-21079)Jeong Ukjae2020-06-291-1/+1
|
* bpo-41123: Remove PyLong_FromUnicode() (GH-21204)Inada Naoki2020-06-292-12/+1
|
* bpo-41123: Remove PyUnicode_GetMax() (GH-21192)Inada Naoki2020-06-291-14/+0
|
* bpo-41123: Remove Py_UNICODE_str* functions (GH-21164)Inada Naoki2020-06-271-88/+0
| | | They are undocumented and deprecated since Python 3.3.
* bpo-41103: Remove old buffer protocol support (#21117)Inada Naoki2020-06-251-79/+0
| | | They are deprecated since Python 3.0.
* bpo-40521: Optimize PyBytes_FromStringAndSize(str, 0) (GH-21142)Victor Stinner2020-06-252-51/+99
| | | | | | | | | | | | | | | | 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-48/+96
| | | | | | | | | | | 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-40521: Make Unicode latin1 singletons per interpreter (GH-21101)Victor Stinner2020-06-241-42/+32
| | | | | | | | | Each interpreter now has its own Unicode latin1 singletons. Remove "ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS" and "ifdef LATIN1_SINGLETONS": always enable latin1 singletons. Optimize unicode_result_ready(): only attempt to get a latin1 singleton for PyUnicode_1BYTE_KIND.
* bpo-40521: Optimize PyUnicode_New(0, maxchar) (GH-21099)Victor Stinner2020-06-231-55/+25
| | | | | | Functions of unicodeobject.c, like PyUnicode_New(), no longer check if the empty Unicode singleton has been initialized or not. Consider that it is always initialized. The Unicode API must not be used before _PyUnicode_Init() or after _PyUnicode_Fini().
* bpo-40521: Make empty Unicode string per interpreter (GH-21096)Victor Stinner2020-06-238-83/+123
| | | Each interpreter now has its own empty Unicode string singleton.
* bpo-40521: Make MemoryError free list per interpreter (GH-21086)Victor Stinner2020-06-231-30/+45
| | | | | | | 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-33/+5
| | | | | | | | | * 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-237-65/+100
| | | Add get_xxx_state() function to factorize duplicated code.
* bpo-36710: Pass tstate explicitly in abstract.c (GH-21075)Victor Stinner2020-06-231-40/+61
| | | | In functions calling more than one PyErr function, get tstate and then pass it explicitly.
* bpo-40521: Make bytes singletons per interpreter (GH-21074)Victor Stinner2020-06-239-44/+79
| | | | | | 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-10/+15
| | | Each interpreter now has its own empty frozenset singleton.
* bpo-40521: Make dict free lists per-interpreter (GH-20645)Victor Stinner2020-06-231-59/+66
| | | | | | | | | | | 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: Rename pycore_tupleobject.h to pycore_tuple.h (GH-21056)Victor Stinner2020-06-227-22/+21
|
* bpo-40824: Do not mask errors in __iter__ in "in" and the operator module. ↵Serhiy Storchaka2020-06-221-1/+3
| | | | | | | (GH-20537) Unexpected errors in calling the __iter__ method are no longer masked by TypeError in the "in" operator and functions operator.contains(), operator.indexOf() and operator.countOf().
* bpo-36346: Add Py_DEPRECATED to deprecated unicode APIs (GH-20878)Inada Naoki2020-06-171-0/+23
| | | | Co-authored-by: Kyle Stanley <aeros167@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40989: PyObject_INIT() becomes an alias to PyObject_Init() (GH-20901)Victor Stinner2020-06-158-30/+40
| | | | | | | | | | | | | | The PyObject_INIT() and PyObject_INIT_VAR() macros become aliases to, respectively, PyObject_Init() and PyObject_InitVar() functions. Rename _PyObject_INIT() and _PyObject_INIT_VAR() static inline functions to, respectively, _PyObject_Init() and _PyObject_InitVar(), and move them to pycore_object.h. Remove their return value: their return type becomes void. The _datetime module is now built with the Py_BUILD_CORE_MODULE macro defined. Remove an outdated comment on _Py_tracemalloc_config.
* bpo-29782: Consolidate _Py_Bit_Length() (GH-20739)Niklas Fiekas2020-06-151-9/+16
| | | | | | | | | | 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-40890: Fix compiler warning in dictobject.c (GH-20876)Pablo Galindo2020-06-151-3/+2
|
* bpo-40890: Add `mapping` property to dict views (GH-20749)Dennis Sweeney2020-06-121-3/+20
|
* Restrict co_code to be under INT_MAX in codeobject (GH-20628)Ammar Askar2020-06-102-3/+11
|
* bpo-39465: Use _PyInterpreterState_GET() (GH-20788)Victor Stinner2020-06-102-6/+6
| | | | | | | | | | | | 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.
* bpo-40943: Replace PY_FORMAT_SIZE_T with "z" (GH-20781)Victor Stinner2020-06-104-65/+62
| | | | | | | 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-40703: Let PyType_FromSpec() set "type.__module__" only if it is not set ↵scoder2020-06-101-15/+20
| | | | yet. (GH-20273)
* bpo-40889: Optimize dict.items() ^ dict.items() (GH-20718)Dennis Sweeney2020-06-101-0/+90
|
* bpo-29882: Add _Py_popcount32() function (GH-20518)Victor Stinner2020-06-082-9/+8
| | | | | | * 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-40887: Don't use finalized free lists (GH-20700)Victor Stinner2020-06-085-3/+76
| | | | | | 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-40881: Fix unicode_release_interned() (GH-20699)Victor Stinner2020-06-071-2/+2
| | | Use Py_SET_REFCNT() in unicode_release_interned().
* bpo-40724: Support setting buffer slots from type specs (GH-20648)scoder2020-06-061-2/+2
| | | This is not part of the limited API but makes the buffer slots available for type specs.
* bpo-40521: Make async gen free lists per-interpreter (GH-20643)Victor Stinner2020-06-051-40/+38
| | | | | | | | | Each interpreter now has its own asynchronous generator free lists: * Move async gen free lists into PyInterpreterState. * Move _PyAsyncGen_MAXFREELIST define to pycore_interp.h * Add _Py_async_gen_state structure. * Add tstate parameter to _PyAsyncGen_ClearFreeLists and _PyAsyncGen_Fini().
* bpo-40521: Make list free list per-interpreter (GH-20642)Victor Stinner2020-06-051-31/+29
| | | | | | | | | | | | Each interpreter now has its own list free list: * Move list numfree and free_list into PyInterpreterState. * Add _Py_list_state structure. * Add tstate parameter to _PyList_ClearFreeList() and _PyList_Fini(). * Remove "#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS". * _PyGC_Fini() clears gcstate->garbage list which can be stored in the list free list. Call _PyGC_Fini() before _PyList_Fini() to prevent leaking this list.
* bpo-40521: Make frame free list per-interpreter (GH-20638)Victor Stinner2020-06-041-49/+37
| | | | | | | | | | Each interpreter now has its own frame free list: * Move frame free list into PyInterpreterState. * Add _Py_frame_state structure. * Add tstate parameter to _PyFrame_ClearFreeList() and _PyFrame_Fini(). * Remove "#if PyFrame_MAXFREELIST > 0". * Remove "#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS".
* bpo-40521: Make slice cache per-interpreter (GH-20637)Victor Stinner2020-06-041-14/+15
| | | | | | Each interpreter now has its own slice cache: * Move slice cache into PyInterpreterState. * Add tstate parameter to _PySlice_Fini().
* bpo-40521: Make float free list per-interpreter (GH-20636)Victor Stinner2020-06-041-26/+29
| | | | | | | | Each interpreter now has its own float free list: * Move tuple numfree and free_list into PyInterpreterState. * Add _Py_float_state structure. * Add tstate parameter to _PyFloat_ClearFreeList() and _PyFloat_Fini().
* bpo-40521: Make tuple free list per-interpreter (GH-20247)Victor Stinner2020-06-041-58/+53
| | | | | | | | | | Each interpreter now has its own tuple free lists: * Move tuple numfree and free_list arrays into PyInterpreterState. * Define PyTuple_MAXSAVESIZE and PyTuple_MAXFREELIST macros in pycore_interp.h. * Add _Py_tuple_state structure. Pass it explicitly to tuple_alloc(). * Add tstate parameter to _PyTuple_ClearFreeList() * Each interpreter now has its own empty tuple singleton.
* Don't raise an exception on normal return from generator. (GH-19473)Mark Shannon2020-06-041-1/+2
|
* Fix MSVC warning in frameobject.c (GH-20590)Ammar Askar2020-06-041-1/+3
|