New submission from Enji Cooper <yaneurab...@gmail.com>:

When a body of C extensions needs to be ported from python <3.8 to 3.8, one of 
the issues one might run into is improperly defined methods in a C extension, 
which results in SystemErrors stating:

>>> SystemError: bad call flags

This new behavior was added as part of Issue # 33012.

While the issues definitely need to be resolved in the C extensions, where to 
start is not completely clear. I had to put `printfs` in PyCFunction_NewEx and 
PyDescr_NewMethod to track down the issues, e.g.,

>>> printf("method name: %s\n", method->ml_name);

While this might be misleading for duplicate method definitions, it definitely 
helps narrow down the offending code.

Adding the method name to the SystemError would be a big step in the right 
direction in terms of making it easier to resolve these issues.

PS I realize that this might be masked by casting PyCFunction on methods or by 
not using gcc 8+, but I'd argue that C extensions need to have developer issues 
like this be clearer to the end-reader.

----------
components: Extension Modules
messages: 363575
nosy: ngie
priority: normal
severity: normal
status: open
title: "SystemError: bad call flags" exceptions added as part of BPO-33012 are 
difficult to debug
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39884>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to