[issue27703] Replace two Py_XDECREFs with Py_DECREFs in do_raise

Antti Haapala report at bugs.python.org
Mon Aug 8 02:20:08 EDT 2016


Antti Haapala added the comment:

Normally I wouldn't recommend changing working code. However those asserts would be OK; if either of them is NULL, then the previous if would have had undefined behaviour already. Thus the `XDECREF` wrongly signals that it'd be OK if they were NULLs until this point, which is not true.

I'd rather see more asserts in the code; would be a big aid in possible refactoring; now for example `PyErr_SetObject` checks twice and thrice if either of the arguments is NULL; would be nice to go see the call site and see asserts in place there, showing that the arguments never were NULL to begin with.

----------
nosy: +ztane

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27703>
_______________________________________


More information about the Python-bugs-list mailing list