[Python-Dev] Re: Migrate typing in builtin

2019-10-09 Thread Guido van Rossum
Can someone else with a reasonable understanding of the type machinery in CPython help Philippe? IMO the entire _GenericAlias class that's currently implemented in Python in typing.py needs to be reimplemented in C. However for a prototype (to show how other aspects of the proposal will look) it i

[Python-Dev] Re: Migrate typing in builtin

2019-10-09 Thread Philippe Prados
In my current implementation (proof of concept), I must use a trick to detect the _GenericAlias, without import. I check the tp_name. static PyObject* union_to_tuple(PyObject* cls) { //printf("union_to_tuple"); if (!strcmp(Py_TYPE(cls)->tp_name,"_GenericAlias")) { PyObject* origin