summaryrefslogtreecommitdiffstats
path: root/Modules/_operator.c
Commit message (Collapse)AuthorAgeFilesLines
* DOC: correct bytesarray -> bytearray in comments (GH-92410) (GH-94090)Miss Islington (bot)2022-06-221-1/+1
| | | | | (cherry picked from commit 0709586744ec58dd60492e16b08fff6dc1149a0a) Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
* bpo-44558: Match countOf `is`/`==` treatment to c (GH-27007)Miss Islington (bot)2021-07-071-2/+2
| | | | | (cherry picked from commit 6bd3ecfc272b122b55a6adec50dd7a7c868f262f) Co-authored-by: Rupert Tombs <rupert.tombs@gmail.com>
* bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351) ↵Miss Islington (bot)2021-06-171-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-26766) * Make functools types immutable * Multibyte codec types are now immutable * pyexpat.xmlparser is now immutable * array.arrayiterator is now immutable * _thread types are now immutable * _csv types are now immutable * _queue.SimpleQueue is now immutable * mmap.mmap is now immutable * unicodedata.UCD is now immutable * sqlite3 types are now immutable * _lsprof.Profiler is now immutable * _overlapped.Overlapped is now immutable * _operator types are now immutable * winapi__overlapped.Overlapped is now immutable * _lzma types are now immutable * _bz2 types are now immutable * _dbm.dbm and _gdbm.gdbm are now immutable (cherry picked from commit 00710e6346fd2394aa020b2dfae170093effac98) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no> Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* bpo-42972: Fully support GC protocol for _operator heap types (GH-26371) ↵Miss Islington (bot)2021-05-271-5/+33
| | | | | | | (GH-26413) (cherry picked from commit f4b70c22c8e37dd7a06702e30b121a6651683421) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* bpo-40137: Add pycore_moduleobject.h internal header (GH-25507)Victor Stinner2021-04-211-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add pycore_moduleobject.h internal header file with static inline functions to access module members: * _PyModule_GetDict() * _PyModule_GetDef() * _PyModule_GetState() These functions don't check at runtime if their argument has a valid type and can be inlined even if Python is not built with LTO. _PyType_GetModuleByDef() uses _PyModule_GetDef(). Replace PyModule_GetState() with _PyModule_GetState() in the extension modules, considered as performance sensitive: * _abc * _functools * _operator * _pickle * _queue * _random * _sre * _struct * _thread * _winapi * array * posix The following extensions are now built with the Py_BUILD_CORE_MODULE macro defined, to be able to use the internal pycore_moduleobject.h header: _abc, array, _operator, _queue, _sre, _struct.
* bpo-40791: Make compare_digest more constant-time. (GH-20444)Devin Jeanpierre2020-11-211-1/+1
| | | | | | | | * bpo-40791: Make compare_digest more constant-time. The existing volatile `left`/`right` pointers guarantee that the reads will all occur, but does not guarantee that they will be _used_. So a compiler can still short-circuit the loop, saving e.g. the overhead of doing the xors and especially the overhead of the data dependency between `result` and the reads. That would change performance depending on where the first unequal byte occurs. This change removes that optimization. (This is change #1 from https://bugs.python.org/issue40791 .)
* bpo-40077: Convert _operator to use PyType_FromSpec (GH-21954)Dong-hee Na2020-08-261-156/+142
|
* bpo-40791: Use CRYPTO_memcmp() for compare_digest (#20456)Christian Heimes2020-05-271-0/+2
| | | | | | | | hashlib.compare_digest uses OpenSSL's CRYPTO_memcmp() function when OpenSSL is available. Note: The _operator module is a builtin module. I don't want to add libcrypto dependency to libpython. Therefore I duplicated the wrapper function and added a copy to _hashopenssl.c.
* bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode ↵Serhiy Storchaka2020-04-111-1/+1
| | | | data. (GH-19345)
* bpo-1635741: Port operator module to multiphase initialization (PEP 489) ↵Paulo Henrique Silva2020-03-251-23/+26
| | | | (GH-19150)
* bpo-40024: Update C extension modules to use PyModule_AddType() (GH-19119)Dong-hee Na2020-03-241-13/+11
| | | | | | Update _asyncio, _bz2, _csv, _curses, _datetime, _io, _operator, _pickle, _queue, blake2, multibytecodec and overlapped C extension modules to use PyModule_AddType().
* 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-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-6/+6
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-35582: Inline arguments tuple unpacking in handwritten code. (GH-11524)Serhiy Storchaka2019-01-121-11/+10
| | | | | Inline PyArg_UnpackTuple() and _PyArg_UnpackStack() in performance sensitive code in the builtins and operator modules.
* bpo-35664: Optimize operator.itemgetter (GH-11435)Raymond Hettinger2019-01-071-5/+37
|
* bpo-35303: Fix a reference leak in _operator.c's methodcaller_repr(). (GH-10689)Zackery Spytz2018-11-231-0/+1
|
* bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. ↵Siddhesh Poyarekar2018-04-291-3/+3
| | | | | | | | | (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-30592: Fixed error messages for some builtins. (#1996)Serhiy Storchaka2017-06-081-2/+2
| | | | | Error messages when pass keyword arguments to some builtins that don't support keyword arguments contained double parenthesis: "()()". The regression was introduced by bpo-30534.
* Issue #29460: _PyArg_NoKeywords(), _PyArg_NoStackKeywords() andSerhiy Storchaka2017-02-061-3/+3
| | | | _PyArg_NoPositional() now are macros.
* Issue #20186: Converted the _operator module to Argument Clinic.Serhiy Storchaka2017-01-191-245/+780
| | | | Patch by Tal Einat.
* Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of ↵Serhiy Storchaka2016-12-161-11/+2
| | | | dict.
* Issue #27809: methodcaller_reduce() uses fast callVictor Stinner2016-08-221-11/+7
|
* merge 3.4 (#27783)Benjamin Peterson2016-08-171-8/+8
|\
| * merge 3.3 (#27783)Benjamin Peterson2016-08-171-8/+7
| |
* | Issue #26822: Decreased an overhead of using _PyArg_NoKeywords() in calls ofSerhiy Storchaka2016-04-291-3/+3
| | | | | | | | itemgetter, attrgetter and methodcaller objects.
* | Issue #26822: itemgetter, attrgetter and methodcaller objects no longerSerhiy Storchaka2016-04-231-0/+6
| | | | | | | | silently ignore keyword arguments.
* | Issue #22955: Fixed reference leak in attrgetter.repr().Serhiy Storchaka2015-05-211-1/+3
| |
* | Issue #22955: attrgetter, itemgetter and methodcaller objects in the operatorSerhiy Storchaka2015-05-201-7/+270
| | | | | | | | | | module now support pickling. Added readable and evaluable repr for these objects. Based on patch by Josh Rosenberg.
* | #16518: Bring error messages in harmony with docs ("bytes-like object")R David Murray2014-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | Some time ago we changed the docs to consistently use the term 'bytes-like object' in all the contexts where bytes, bytearray, memoryview, etc are used. This patch (by Ezio Melotti) completes that work by changing the error messages that previously reported that certain types did "not support the buffer interface" to instead say that a bytes-like object is required. (The glossary entry for bytes-like object references the discussion of the buffer protocol in the docs.)
* | merge 3.4Benjamin Peterson2014-05-111-1/+1
|\ \ | |/
| * use logical rather than bit andBenjamin Peterson2014-05-111-1/+1
| |
* | PEP 465: a dedicated infix operator for matrix multiplication (closes #21176)Benjamin Peterson2014-04-101-0/+4
|/
* #16523: merge with 3.3.Ezio Melotti2013-05-081-5/+5
|
* Issue #16694: Add a pure Python implementation of the operator module.Antoine Pitrou2013-04-201-0/+960
Patch by Zachary Ware.