summaryrefslogtreecommitdiff
path: root/Objects/dictobject.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40428: Remove PyTuple_ClearFreeList() function (GH-19769)Victor Stinner2020-04-291-7/+4
| | | | | | | | | | | | | | | | | | | Remove the following function from the C API: * PyAsyncGen_ClearFreeLists() * PyContext_ClearFreeList() * PyDict_ClearFreeList() * PyFloat_ClearFreeList() * PyFrame_ClearFreeList() * PyList_ClearFreeList() * PySet_ClearFreeList() * PyTuple_ClearFreeList() Make these functions private, move them to the internal C API and change their return type to void. Call explicitly PyGC_Collect() to free all free lists. Note: PySet_ClearFreeList() did nothing.
* bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)Victor Stinner2020-04-141-2/+3
|
* bpo-39481: Implementation for PEP 585 (#18239)Guido van Rossum2020-04-071-0/+1
| | | | | | | | | | | | This implements things like `list[int]`, which returns an object of type `types.GenericAlias`. This object mostly acts as a proxy for `list`, but has attributes `__origin__` and `__args__` that allow recovering the parts (with values `list` and `(int,)`. There is also an approximate notion of type variables; e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`. Type variables are objects of type `typing.TypeVar`.
* bpo-37207: Use PEP 590 vectorcall to speed up dict() (GH-19280)Dong-hee Na2020-04-021-0/+33
|
* bpo-39943: Properly const the pointers in dictkeys_get_index (GH-19170)Andy Lester2020-03-261-5/+5
|
* bpo-36144: Dictionary Union (PEP 584) (#12088)Brandt Bucher2020-02-241-18/+53
|
* bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521)Dong-hee Na2020-02-171-6/+6
|
* bpo-39245: Switch to public API for Vectorcall (GH-18460)Petr Viktorin2020-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The bulk of this patch was generated automatically with: for name in \ PyObject_Vectorcall \ Py_TPFLAGS_HAVE_VECTORCALL \ PyObject_VectorcallMethod \ PyVectorcall_Function \ PyObject_CallOneArg \ PyObject_CallMethodNoArgs \ PyObject_CallMethodOneArg \ ; do echo $name git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g" done old=_PyObject_FastCallDict new=PyObject_VectorcallDict git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g" and then cleaned up: - Revert changes to in docs & news - Revert changes to backcompat defines in headers - Nudge misaligned comments
* bpo-39573: Use Py_TYPE() macro in Objects directory (GH-18392)Victor Stinner2020-02-071-1/+1
| | | Replace direct access to PyObject.ob_type with Py_TYPE().
* bpo-39542: Simplify _Py_NewReference() (GH-18332)Victor Stinner2020-02-031-8/+18
| | | | | | | | | * Remove _Py_INC_REFTOTAL and _Py_DEC_REFTOTAL macros: modify directly _Py_RefTotal. * _Py_ForgetReference() is no longer defined if the Py_TRACE_REFS macro is not defined. * Remove _Py_NewReference() implementation from object.c: unify the two implementations in object.h inline function. * Fix Py_TRACE_REFS build: _Py_INC_TPALLOCS() macro has been removed.
* bpo-38588: Fix possible crashes in dict and list when calling ↵Dong-hee Na2019-12-311-0/+2
| | | | | | PyObject_RichCompareBool (GH-17734) Take strong references before calling PyObject_RichCompareBool to protect against the case where the object dies during the call.
* bpo-38613: Optimize set operations of dict keys. (GH-16961)Inada Naoki2019-11-081-21/+33
|
* bpo-38555: Fix an undefined behavior. (GH-16883)Serhiy Storchaka2019-10-231-8/+7
|
* bpo-38525: Fix a segmentation fault when using reverse iterators of empty ↵Dong-hee Na2019-10-191-2/+7
| | | | | dict (GH-16846) The reverse iterator for empty dictionaries was not handling correctly shared-key dictionaries.
* bpo-38202: Fix a crash in dict_view & non-itearble. (GH-16241)Zackery Spytz2019-10-131-0/+4
|
* Fix strict-aliasing rules errors on gcc 4.8.5. (GH-16714)Dong-hee Na2019-10-111-1/+1
|
* bpo-36389: _PyObject_CheckConsistency() available in release mode (GH-16612)Victor Stinner2019-10-071-16/+20
| | | | | | | | | | | | | | | | | | | | | bpo-36389, bpo-38376: The _PyObject_CheckConsistency() function is now also available in release mode. For example, it can be used to debug a crash in the visit_decref() function of the GC. Modify the following functions to also work in release mode: * _PyDict_CheckConsistency() * _PyObject_CheckConsistency() * _PyType_CheckConsistency() * _PyUnicode_CheckConsistency() Other changes: * _PyMem_IsPtrFreed(ptr) now also returns 1 if ptr is NULL (equals to 0). * _PyBytesWriter_CheckConsistency() now returns 1 and is only used with assert(). * Reorder _PyObject_Dump() to write safe fields first, and only attempt to render repr() at the end.
* Fix a compile warning in dictobject.c (GH-16610)Hai Shi2019-10-071-1/+0
|
* bpo-38210: Fix intersection operation with dict view and iterator. (GH-16602)Dong-hee Na2019-10-061-8/+0
|
* bpo-38219: Optimize dict creating and updating by a dict. (GH-16268)Serhiy Storchaka2019-09-251-8/+13
|
* bpo-37206: Unrepresentable default values no longer represented as None. ↵Serhiy Storchaka2019-09-141-2/+2
| | | | | | | (GH-13933) In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all.
* Fix typo in dict object comment (#15814)dalgarno2019-09-101-1/+1
|
* Make PyXXX_Fini() functions private (GH-15531)Victor Stinner2019-08-271-1/+1
| | | | | For example, rename PyTuple_Fini() to _PyTuple_Fini(). These functions are only declared in the internal C API.
* bpo-27575: port set intersection logic into dictview intersection (GH-7696)Forest Gregg2019-08-261-4/+77
|
* bpo-37648: Fixed minor inconsistency in some __contains__. (GH-14904)Serhiy Storchaka2019-08-041-1/+1
| | | | | The collection's item is now always at the left and the needle is on the right of ==.
* bpo-37547: add _PyObject_CallMethodOneArg (GH-14685)Jeroen Demeyer2019-07-111-4/+4
|
* bpo-37483: add _PyObject_CallOneArg() function (#14558)Jeroen Demeyer2019-07-041-2/+1
|
* bpo-26219: per opcode cache for LOAD_GLOBAL (GH-12884)Inada Naoki2019-06-031-12/+13
| | | | | | This patch implements per opcode cache mechanism, and use it in only LOAD_GLOBAL opcode. Based on Yury's opcache3.patch in bpo-26219.
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-301-14/+14
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-35983: skip trashcan for subclasses (GH-11841)Jeroen Demeyer2019-05-101-2/+2
| | | | | Add new trashcan macros to deal with a double deallocation that could occur when the `tp_dealloc` of a subclass calls the `tp_dealloc` of a base class and that base class uses the trashcan mechanism. Patch by Jeroen Demeyer.
* bpo-36869: fix warning of unused variables (GH-13182)Emmanuel Arias2019-05-101-1/+2
|
* bpo-36389: Add _PyObject_CheckConsistency() function (GH-12803)Victor Stinner2019-04-121-59/+59
| | | | | | Add a new _PyObject_CheckConsistency() function which can be used to help debugging. The function is available in release mode. Add a 'check_content' parameter to _PyDict_CheckConsistency().
* bpo-20180: Use argument clinic for dict.pop() and dict.popitem() (GH-12792)Inada Naoki2019-04-121-34/+41
|
* bpo-29202: improve dict iteration (GH-11900)Cheryl Sabella2019-04-051-9/+6
| | | Use fewer iterations instead of iterating over the whole entry table.
* bpo-36473: add maximum iteration check for dict .values() and .items() ↵Thomas Perl2019-04-021-0/+12
| | | | (GH-12619)
* bpo-36452: dictiter: track maximum iteration count (GH-12596)Thomas Perl2019-03-281-0/+6
|
* bpo-36412: fix a possible crash in dictobject.c's new_dict() (GH-12519)Zackery Spytz2019-03-241-1/+3
|
* bpo-30040: optimize inserting into empty dict (GH-12307)Inada Naoki2019-03-181-2/+49
|
* bpo-30040: new empty dict uses key-sharing dict (GH-1080)Inada Naoki2019-03-121-4/+5
| | | | Sizeof new empty dict becomes 72 bytes from 240 bytes (amd64). It is same size to empty dict created by dict.clear().
* bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)Serhiy Storchaka2019-02-251-8/+35
|
* bpo-35444: Unify and optimize the helper for getting a builtin object. ↵Serhiy Storchaka2018-12-111-1/+2
| | | | | | | | (GH-11047) This speeds up pickling of some iterators. This fixes also error handling in pickling methods when fail to look up builtin "getattr".
* bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)Serhiy Storchaka2018-11-271-9/+9
| | | | | | Fix invalid function cast warnings with gcc 8 for method conventions different from METH_NOARGS, METH_O and METH_VARARGS excluding Argument Clinic generated code.
* bpo-33012: Fix signatures of METH_NOARGS funstions. (GH-10736)Serhiy Storchaka2018-11-271-2/+2
|
* bpo-35081: Add Include/internal/pycore_object.h (GH-10640)Victor Stinner2018-11-211-0/+1
| | | | Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from Include/objimpl.h to Include/internal/pycore_object.h.
* bpo-35230: dict: Remove some macros (GH-10513)INADA Naoki2018-11-141-42/+59
| | | | Remove _Py_REF_DEBUG_COMMA, DK_DEBUG_INCREF, and DK_DEBUG_DECREF. Convert DK_INCREF and DK_DECREF to static inline functions.
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-1/+1
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-33462: Add __reversed__ to dict and dict views (GH-6827)Rémi Lapeyre2018-11-061-5/+202
|
* bpo-35081: Add _PyThreadState_GET() internal macro (GH-10266)Victor Stinner2018-11-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | If Py_BUILD_CORE is defined, the PyThreadState_GET() macro access _PyRuntime which comes from the internal pycore_state.h header. Public headers must not require internal headers. Move PyThreadState_GET() and _PyInterpreterState_GET_UNSAFE() from Include/pystate.h to Include/internal/pycore_state.h, and rename PyThreadState_GET() to _PyThreadState_GET() there. The PyThreadState_GET() macro of pystate.h is now redefined when pycore_state.h is included, to use the fast _PyThreadState_GET(). Changes: * Add _PyThreadState_GET() macro * Replace "PyThreadState_GET()->interp" with _PyInterpreterState_GET_UNSAFE() * Replace PyThreadState_GET() with _PyThreadState_GET() in internal C files (compiled with Py_BUILD_CORE defined), but keep PyThreadState_GET() in the public header files. * _testcapimodule.c: replace PyThreadState_GET() with PyThreadState_Get(); the module is not compiled with Py_BUILD_CORE defined. * pycore_state.h now requires Py_BUILD_CORE to be defined.
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* bpo-35081: Cleanup pystate.c and pystate.h (GH-10240)Victor Stinner2018-10-301-2/+2
| | | | | | | | | | | | * Remove _PyThreadState_Current * Replace GET_TSTATE() with PyThreadState_GET() * Replace GET_INTERP_STATE() with _PyInterpreterState_GET_UNSAFE() * Replace direct access to _PyThreadState_Current with PyThreadState_GET() * Replace _PyThreadState_Current with _PyRuntime.gilstate.tstate_current * Rename SET_TSTATE() to _PyThreadState_SET(), name more consistent with _PyThreadState_GET() * Update outdated comments