[issue33420] __origin__ invariant broken

2018-05-03 Thread Adam Paszke
Adam Paszke added the comment: Of course, I'm not expecting this to be 100% reliable, and so I'm ok with the answer that the comment is now outdated. I'd like to avoid adding extra dependencies for so simple things, so I guess I'll just special case that in my code for

[issue33420] __origin__ invariant broken

2018-05-03 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Yes, the comment needs to be updated, but as you said, no guaranties about undocumented dunder attribute. We tried to preserve as much of the API as possible in 3.7 after PEP 560, but something needs to be sacrificed (especially in the

[issue33420] __origin__ invariant broken

2018-05-03 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +gvanrossum, levkivskyi ___ Python tracker ___

[issue33420] __origin__ invariant broken

2018-05-03 Thread Adam Paszke
New submission from Adam Paszke : Hi everyone, I have a module that needs to inspect type annotations on a few functions. One of the types I need to special case on is typing.Tuple, and I used code like this to detect it: if getattr(annotation, '__origin__', None) ==