You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
False-negative when instantiating a class before its constructor is defined #2324
Oh, interesting. This could be dealt with by deferring the first method when the class signature isn't known yet. But we'd need some kind of flag to tell us whether we've processed __init__ yet (and maybe if there isn't one it should be set to True at the start, by the semantic analyzer).
Do you feel up to trying to submit a PR for this? No pressure!
It seems as if any method can call any method, so a two-pass system might work best. Once to process all of the function signatures, then another to process the code.
Activity
gvanrossum commentedon Oct 25, 2016
Oh, interesting. This could be dealt with by deferring the first method when the class signature isn't known yet. But we'd need some kind of flag to tell us whether we've processed
__init__yet (and maybe if there isn't one it should be set to True at the start, by the semantic analyzer).Do you feel up to trying to submit a PR for this? No pressure!
ffigiel commentedon Oct 25, 2016
I could work on that, any tips what module/function to begin from?
gvanrossum commentedon Oct 27, 2016
JukkaL commentedon Dec 5, 2017
Bumping priority because this seem to happen with some frequency and the workaround is not easy to figure out.
JelleZijlstra commentedon Dec 5, 2017
This is a dupe of #1727, which is older and has more discussion; going to close this one and make the other one high-pri.
mckaysalisbury commentedon Dec 6, 2017
It seems as if any method can call any method, so a two-pass system might work best. Once to process all of the function signatures, then another to process the code.
gvanrossum commentedon Dec 6, 2017
Thanks for the advice.