summaryrefslogtreecommitdiffstats
path: root/Modules/_operator.c
Commit message (Collapse)AuthorAgeFilesLines
* [3.9] bpo-44558: Match countOf `is`/`==` treatment to c (GH-27007). (GH-27055)Dong-hee Na2021-07-071-2/+2
|
* bpo-40791: Make compare_digest more constant-time. (GH-20444)Miss Islington (bot)2020-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 GH-1 from https://bugs.python.org/issue40791 .) (cherry picked from commit 31729366e2bc09632e78f3896dbce0ae64914f28) Co-authored-by: Devin Jeanpierre <jeanpierreda@google.com>
* [3.9] bpo-40791: Use CRYPTO_memcmp() for compare_digest (GH-20456) (GH-20461)Christian Heimes2020-05-281-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.. (cherry picked from commit db5aed931f8a617f7b63e773f62db468fe9c5ca1) Co-authored-by: Christian Heimes <christian@python.org>
* 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.