-
Notifications
You must be signed in to change notification settings - Fork 48
Description
The member variable name up causes a collision with the generated c function MyClass_setup. This causes an error during C compile time. This is mainly a coincidence that set + up is the same as setup.
Version: mypy 0.950 (compiled: yes) with MSVC++ 19.21.27702.2 for x64
Edit: also confirmed with mypy 0.970+dev.74b35bef35ad5a7b1aa635f52ffcfd850eadc589.dirty (compiled: no)
Example
Running mypyc on this python class:
class MyClass:
def __init__(self, arg1):
self.up = arg1
produces this generated C function:
static int MyClass_setup(example1___MyClassObject *self, PyObject *value, void *closure);
which conflicts with the existing MyClass_setup function that is generated for classes:
static PyObject *MyClass_setup(PyTypeObject *type);
Expected behavior
A member variable "up" would not cause a collision. For example, other variable names like this:
class MyClass:
def __init__(self, arg1):
self.membervar1 = arg1
produce generated code like this:
static int MyClass_setmembervar1(example1___MyClassObject *self, PyObject *value, void *closure);
which does not conflict with other function names.