-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the behavior of promote_noncircular
the default?
#22801
Comments
What this comes down to: should |
|
Do we have any examples of cases where we want the |
One case that seems useful is "make sure these have the same type", in which case it's ok if the arguments already have the same types. So maybe that should be allowed by |
Before #19918 I used to see a lot more StackOverflowErrors in my own code. Should we consider adopting its behavior for the general promotion mechanism?
To be a little more concrete in my description than I was in #19918, note that we have this:
i.e.,
promote
does not guarantee that the types will change. So if you employ this common pattern:then
foo('a', 2)
will result in a StackOverflowError. Those errors sometimes take a long time to resolve (in complicated cases, I've seen tens of minutes) and the backtraces are not very helpful; it's particularly awful if you'ressh
-ing over a slow link and you just watch the text scroll by...One danger: what if there are genuine applications where you
promote
, and then test the two types to see if they are the same; if not, do something different. I can't remember seeing code like that, but it could exist in principle.So alternatively perhaps we should make
promote_noncircular
an official exported interface, and cross-link the docstrings.And finally, we could keep the status quo, or eliminate
promote_noncircular
entirely.The text was updated successfully, but these errors were encountered: