[issue36379] nb_inplace_pow is always called with an invalid argument

Zuzu_Typ report at bugs.python.org
Wed Mar 20 13:22:21 EDT 2019


Zuzu_Typ <zuzu.typ at gmail.com> added the comment:

Even though __ipow__ might be documented to take a third argument, if you build an inplace_pow function using the C-API, you can only pass one argument to it.

You can see that in the attached screenshot.

The example class shown in the screenshot can be found here: https://github.com/Zuzu-Typ/Python-C-API-extension-template

With the little template I wasn't able to reproduce the crash, but I did reassure myself that the third object is neither Py_None nor NULL, by adding "if (obj2 == Py_None || obj2 == NULL) return NULL;" before line 469 in "template.c", because calling __ipow__ still returned an example_class instance, instead of an error message, as it should if it returned NULL.

----------
Added file: https://bugs.python.org/file48225/Doesn't Work.png

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36379>
_______________________________________


More information about the Python-bugs-list mailing list