facebookincubator / cinder

Cinder is Meta's internal performance-oriented production version of CPython.
https://trycinder.com
Other
3.42k stars 122 forks source link

Static Python allows passing too many arguments to `__init__` #45

Closed LuKuangChen closed 2 years ago

LuKuangChen commented 2 years ago

What version of Static Python are you using?

4f1b313 2021-07-26

What program did you run?

# constructor_args_static.py

class Person:
    def __init__(self, name, age):
        pass

def main():
    p1 = Person('Alice', 21, False)
    return p1

What happened?

The program terminates without errors.

What should have happened?

We expected a compile-time error because the Person constructor (__init__) accepts only 2 arguments, but was given 3.

DinoV commented 2 years ago

Fixed with a6a0dcbc588de4cea63e8d20d976bfda0fd7a55a