summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* bpo-41493: Refactoring dictresize (GH-21751)Inada Naoki2020-08-071-26/+41
| | | Split newsize calculation into new function. dictresize() now accepts exact newsize.
* bpo-41431: Optimize dict_merge for copy (GH-21674)Inada Naoki2020-08-041-29/+67
|
* A (very) slight speed improvement for iterating over bytes (#21705)Guido van Rossum2020-08-031-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | My mentee @xvxvxvxvxv noticed that iterating over array.array is slightly faster than iterating over bytes. Looking at the source I observed that arrayiter_next() calls `getitem(ao, it->index++)` wheras striter_next() uses the idiom (paraphrased) item = PyLong_FromLong(seq->ob_sval[it->it_index]); if (item != NULL) ++it->it_next; return item; I'm not 100% sure but I think that the second version has fewer opportunity for the CPU to overlap the `index++` operation with the rest of the code (which in both cases involves a call). So here I am optimistically incrementing the index -- if the PyLong_FromLong() call fails, this will leave the iterator pointing at the next byte, but honestly I doubt that anyone would seriously consider resuming use of the iterator after that kind of failure (it would have to be a MemoryError). And the author of arrayiter_next() made the same consideration (or never ever gave it a thought :-). With this, a loop like for _ in b: pass is now slightly *faster* than the same thing over an equivalent array, rather than slightly *slower* (in both cases a few percent).
* bpo-41342: Convert int.__round__ to Argument Clinic (GH-21549)Serhiy Storchaka2020-07-202-8/+50
|
* bpo-41334: Convert constructors of str, bytes and bytearray to Argument ↵Serhiy Storchaka2020-07-206-87/+293
| | | | Clinic (GH-21535)
* bpo-41343: Convert methods of complex to Argument Clinic (GH-21550)Dong-hee Na2020-07-202-26/+99
|
* bpo-41333: Convert OrderedDict.pop() to Argument Clinic (GH-21534)Serhiy Storchaka2020-07-194-25/+67
|
* bpo-41295: Reimplement the Carlo Verre "hackcheck" (GH-21528)scoder2020-07-181-7/+20
| | | | | Walk down the MRO backwards to find the type that originally defined the final `tp_setattro`, then make sure we are not jumping over intermediate C-level bases with the Python-level call. Automerge-Triggered-By: @gvanrossum
* bpo-41262: Convert memoryview to Argument Clinic. (GH-21421)Serhiy Storchaka2020-07-182-74/+267
|
* Fix a small grammatical mistake in a comment (GH-21526)Brett Cannon2020-07-171-1/+1
| | | Automerge-Triggered-By: @brettcannon
* bpo-40941: Unify implicit and explicit state in the frame and generator ↵Mark Shannon2020-07-172-68/+93
| | | | | | | 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.
* bpo-36346: Make using the legacy Unicode C API optional (GH-21437)Serhiy Storchaka2020-07-101-23/+58
| | | | 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-39573: Use the Py_TYPE() macro (GH-21433)Victor Stinner2020-07-103-5/+5
| | | Replace obj->ob_type with Py_TYPE(obj).
* bpo-41263: Convert code.__new__ to Argument Clinic (GH-21426)Serhiy Storchaka2020-07-102-38/+173
|
* bpo-29590: fix stack trace for gen.throw() with yield from (#19896)Chris Jerdonek2020-07-091-0/+10
| | | | | | | | * Add failing test. * bpo-29590: fix stack trace for gen.throw() with yield from (GH-NNNN) When gen.throw() is called on a generator after a "yield from", the intermediate stack trace entries are lost. This commit fixes that.
* 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.