summaryrefslogtreecommitdiffstats
path: root/Modules/_collectionsmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40521: Convert deque freelist from global vars to instance vars (GH-25906)Raymond Hettinger2021-05-051-27/+32
|
* bpo-43977: Use tp_flags for collection matching (GH-25723)Mark Shannon2021-04-301-1/+2
| | | | | | | | | | | | | * Add Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING, add to all relevant standard builtin classes. * Set relevant flags on collections.abc.Sequence and Mapping. * Use flags in MATCH_SEQUENCE and MATCH_MAPPING opcodes. * Inherit Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING. * Add NEWS * Remove interpreter-state map_abc and seq_abc fields.
* Revert "bpo-40521: Remove freelist from collections.deque() (GH-21073)" ↵Raymond Hettinger2021-03-251-2/+21
| | | | | | | | (GH-24944) This reverts commit 32f2eda85957365d208f499b730d30b7eb419741. It can be re-applied if the subinterpreter PEP is approved. Otherwise, the commit degraded performance with no offsetting benefit.
* bpo-41361: Optimized argument parsing for deque_rotate (GH-24796)Dennis Sweeney2021-03-161-1/+12
|
* bpo-25246: Optimize deque.remove() (GH-23898)Raymond Hettinger2020-12-231-32/+42
|
* bpo-42161: Micro-optimize _collections._count_elements() (GH-23008)Victor Stinner2020-10-271-4/+5
| | | Move the _PyLong_GetOne() call outside the fast-path loop.
* bpo-42161: Modules/ uses _PyLong_GetZero() and _PyLong_GetOne() (GH-22998)Victor Stinner2020-10-271-4/+7
| | | | | | Use _PyLong_GetZero() and _PyLong_GetOne() in Modules/ directory. _cursesmodule.c and zoneinfo.c are now built with Py_BUILD_CORE_MODULE macro defined.
* bpo-40521: Remove freelist from collections.deque() (GH-21073)Raymond Hettinger2020-06-231-21/+2
|
* bpo-40277: Add a repr() to namedtuple's _tuplegetter to aid with ↵Ammar Askar2020-04-151-1/+9
| | | | introspection (GH-19537)
* bpo-40268: Remove unused structmember.h includes (GH-19530)Victor Stinner2020-04-151-2/+2
| | | | | | If only offsetof() is needed: include stddef.h instead. When structmember.h is used, add a comment explaining that PyMemberDef is used.
* bpo-39481: Implementation for PEP 585 (#18239)Guido van Rossum2020-04-071-0/+4
| | | | | | | | | | | | 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-40024: Add PyModule_AddType() helper function (GH-19088)Dong-hee Na2020-03-221-11/+3
|
* bpo-1635741: Port _collections module to multiphase initialization (GH-19074)Dong-hee Na2020-03-191-42/+42
|
* Simplify defaultdict.__or__ (#18931)Brandt Bucher2020-03-121-5/+1
|
* bpo-36144: Implement defaultdict union (GH-18729)Brandt Bucher2020-03-061-6/+45
| | | For PEP 585 (this isn't in the PEP but is an obvious follow-up).
* bpo-39573: Finish converting to new Py_IS_TYPE() macro (GH-18601)Andy Lester2020-03-041-1/+1
|
* 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-39590: make deque.__contains__ and deque.count hold strong references ↵sweeneyde2020-02-091-0/+4
| | | | (GH-18421)
* bpo-39573: Use Py_SET_SIZE() function (GH-18402)Victor Stinner2020-02-071-8/+8
| | | | Replace direct acccess to PyVarObject.ob_size with usage of the Py_SET_SIZE() function.
* bpo-39573: Use Py_TYPE() macro in Modules directory (GH-18393)Victor Stinner2020-02-071-2/+2
| | | Replace direct access to PyObject.ob_type with Py_TYPE().
* bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)Jeroen Demeyer2019-07-081-1/+1
|
* bpo-37493: use _PyObject_CallNoArg in more places (GH-14575)Jeroen Demeyer2019-07-041-1/+1
|
* bpo-37483: add _PyObject_CallOneArg() function (#14558)Jeroen Demeyer2019-07-041-2/+1
|
* bpo-37165: Convert _count_elements to the argument clinic (GH-13848)Raymond Hettinger2019-06-051-11/+16
|
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-10/+10
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264)Serhiy Storchaka2019-03-131-1/+1
|
* Fix the C function signature for _collections._tuplegetter.__reduce__. ↵Serhiy Storchaka2019-03-051-2/+2
| | | | | (GH-12180) Correctly fixes bpo-36197.
* bpo-33012: Fix compilation warnings in memoryobject.c and ↵Stéphane Wirtel2019-03-051-1/+1
| | | | | | _collectionsmodule.c (GH-12179) Cast function pointers to (void(*)(void)) before casting to (PyCFunction) to make "warning: cast between incompatible function types" false alarm quiet.
* bpo-36068: Make _tuplegetter objects serializable (GH-11981)Joe Jevnik2019-02-211-1/+12
|
* Speed-up argument parsing for common cases in deque.__init__()(GH-11717)Raymond Hettinger2019-02-011-3/+7
|
* bpo-32492: Tweak _collections._tuplegetter. (GH-11367)Serhiy Storchaka2018-12-311-8/+8
| | | | | | * Replace the docstrings cache with sys.intern(). * Improve tests. * Unify names of tp_descr_get and tp_descr_set functions.
* bpo-32492: 1.6x speed up in namedtuple attribute access using C fast-path ↵Pablo Galindo2018-12-301-0/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#10495) * bpo-32492: 2.5x speed up in namedtuple attribute access using C fast path * Add News entry * fixup! bpo-32492: 2.5x speed up in namedtuple attribute access using C fast path * Check for tuple in the __get__ of the new descriptor and don't cache the descriptor itself * Don't inherit from property. Implement GC methods to handle __doc__ * Add a test for the docstring substitution in descriptors * Update NEWS entry to reflect time against 3.7 branch * Simplify implementation with argument clinic, better error messages, only __new__ * Use positional-only parameters for the __new__ * Use PyTuple_GET_SIZE and PyTuple_GET_ITEM to tighter the implementation of tuplegetterdescr_get * Implement __set__ to make tuplegetter a data descriptor * Use Py_INCREF now that we inline PyTuple_GetItem * Apply the valid_index() function, saving one test * Move Py_None test out of the critical path.
* bpo-33029: Fix signatures of getter and setter functions. (GH-10746)Serhiy Storchaka2018-11-271-1/+1
| | | Fix also return type for few other functions (clear, releasebuffer).
* bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)Serhiy Storchaka2018-11-271-3/+3
| | | | | | 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-1/+1
|
* Minor performance tweak for deque.index() with a start argument (GH-9440)Raymond Hettinger2018-09-211-2/+4
|
* closes bpo-31608: Fix a crash in methods of a subclass of _collections.deque ↵Oren Milman2018-09-111-4/+13
| | | | with a bad __new__(). (GH-3788)
* Factor-out two substantially identical code blocks. (GH-8219)Raymond Hettinger2018-07-101-46/+10
|
* bpo-33677: Fix signatures of tp_clear handlers for AST and deque. (GH-7196)Serhiy Storchaka2018-05-311-3/+4
|
* bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. ↵Siddhesh Poyarekar2018-04-291-13/+13
| | | | | | | | | (GH-6030) METH_NOARGS functions need only a single argument but they are cast into a PyCFunction, which takes two arguments. This triggers an invalid function cast warning in gcc8 due to the argument mismatch. Fix this by adding a dummy unused argument.
* bpo-32571: Avoid raising unneeded AttributeError and silencing it in C code ↵Serhiy Storchaka2018-01-251-5/+3
| | | | | (GH-5222) Add two new private APIs: _PyObject_LookupAttr() and _PyObject_LookupAttrId()
* bpo-32240: Add the const qualifier to declarations of PyObject* array ↵Serhiy Storchaka2017-12-151-3/+3
| | | | arguments. (#4746)
* bpo-31586: Use _count_element fast path for real dicts.Oren Milman2017-09-271-1/+3
|
* bpo-27541: Reprs of subclasses of some classes now contain actual type name. ↵Serhiy Storchaka2017-09-211-4/+7
| | | | | (#3631) Affected classes are bytearray, array, deque, defaultdict, count and repeat.
* Code clean-up. Remove unnecessary pre-increment before the loop starts. (#3312)Raymond Hettinger2017-09-041-17/+10
|
* bpo-31095: fix potential crash during GC (GH-2974)INADA Naoki2017-08-241-0/+4
|
* bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)Serhiy Storchaka2017-07-031-15/+3
| | | | | the bare METH_FASTCALL be used for functions with positional-only parameters.
* bpo-29935: Fixed error messages in the index() method of tuple, list and ↵Serhiy Storchaka2017-03-301-2/+2
| | | | | deque (#887) when pass indices of wrong type.
* bpo-29878: Add global instances of int for 0 and 1. (#852)Serhiy Storchaka2017-03-301-16/+4
|
* bpo-29634: Reduce deque repeat execution when maxlen exist and size is not 1 ↵Louie Lu2017-02-241-0/+4
| | | | (#255) (#255)