[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-09-09 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: > I anyway always wonder, why functions, which are methods, do not hold a > reference to the class, which they belong to. This may indeed be a useful feature on its own, but it will also require a much more wider discussion. -- ___

[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-09-06 Thread Netzeband
Netzeband added the comment: Thanks for your explanations. It sounds, that there is no way to fix this issue officially. Only the meta-class workaround is left, which is - as you highlight - really just a workaround. I anyway always wonder, why functions, which are methods, do not hold a

[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-09-02 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: (Sorry for typos, fixed now.) > Maybe any upcoming python version could store this information in __local__ ? > So maybe we could clone this ticket to the python core in order to address > this? I would say it is a too big change, and it is unlikely to hap

[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-09-02 Thread Ivan Levkivskyi
Change by Ivan Levkivskyi : -- Removed message: https://bugs.python.org/msg350980 ___ Python tracker ___ ___ Python-bugs-list mailin

[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-09-02 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: > Maybe any upcoming python version could store this information in __local__ ? > So maybe we could clone this ticket to the python core in order to address > this? I would say it is a too big change, and it is unlikely to happen only for the reason like t

[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-08-25 Thread Netzeband
Netzeband added the comment: I think I found a better workaround (by accident). I was debugging another issue with get_type_hints for the case that this function is used inside the __new__ method of a metaclass and with methods of the class to define. Here the same issue happens: Forward dec

[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-08-19 Thread Netzeband
Netzeband added the comment: I tried my idea with the small example code above. However it does not work like expected: (see zipped example project, attached to this comment) At the moment where the function decorator is applied to the method of the inner class, the local namespace ("locals

[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-08-19 Thread Netzeband
Netzeband added the comment: Thanks for your response. I was also thinking much about it and was not able to find a nice idea how to get this working. The problem is, that we loose the local-namespace information as soon as we leave the context of the function, where the class was defined i

[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-08-19 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Thanks for reporting! I spent some time thinking about this and I can't find any reasonable way of doing this, sorry. Anyway, let's keep this open, maybe someone will come up with a proposal. -- ___ Python track

[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-08-16 Thread Ivan Levkivskyi
Change by Ivan Levkivskyi : -- nosy: +levkivskyi ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-08-13 Thread Netzeband
New submission from Netzeband : When evaluating the type-hints of an inner-class (a class defined inside a function scope), the forward declaration does not work correctly. In this case the typing.get_type_hints does not get the right namespace, thus the class-string specified is not found.