[Checkins] [zopefoundation/Acquisition] 90aebe: Fix wrapping of matmul and imatmul (#15)
GitHub
noreply at github.com
Sun Feb 5 14:12:58 CET 2017
Branch: refs/heads/master
Home: https://github.com/zopefoundation/Acquisition
Commit: 90aebeaf2ee04a5975c1ca5adb5176b4ed2c4c77
https://github.com/zopefoundation/Acquisition/commit/90aebeaf2ee04a5975c1ca5adb5176b4ed2c4c77
Author: stephan-hof <stephan-hof at users.noreply.github.com>
Date: 2017-02-05 (Sun, 05 Feb 2017)
Changed paths:
M src/Acquisition/__init__.py
M src/Acquisition/tests.py
Log Message:
-----------
Fix wrapping of matmul and imatmul (#15)
* Improve unittest.
Before:
It was two steps
1) Acquire the method (for example __iadd__).
On a C-Level this triggers Base_getattro
2) Then call the return object.
However this is not exactly what CPython does on a statement like this:
a += 1
CPython looks first at the number protocol of that type.
If the number protocol has the slot defined it calls it, otherwise it
raises a TypeError.
https://docs.python.org/3.6/c-api/typeobj.html?highlight=pynumbermethods#c.PyNumberMethods
=> CPython omits Base_getattro at all.
Now: By using the operator module, the unittests behave exactly as
cpython on a statement like this:
a += 1
* Support proper wrapping of matrix multiplication.
More information about the checkins
mailing list