| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
For future reference, the cdef problem should be fixed by cython/cython#5479 |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. For Python files, I would prefer using the set_module helper, because I was in the situation before that I did not want this to happen.
(Specfically, some doctest related utils fail to find the source due to it.)
But, for cython code those things should already be failing, so...
Sorry, something went wrong.
ENH: update `__module__` in `numpy.random` module
|
Re: module for cdef classes. A good fix looks really hard. The basic problem is that type defines its own property for __module__ which ignores whatever you set in the class dictionary for static types. However. For heap types it works: # distutils: extra_compile_args = -DCYTHON_USE_TYPE_SPECS=1
cdef class C:
__module__ = "a"
print(C.__module__) # prints "a"
Is that any use to Numpy? (I'm also not sure that the issue that @mattip linked is a hugely great fix. It'd fix self.__module__ but not cls.__module__ |
Sorry, something went wrong.
Not sure I would enable it just for this sake, but I suspect heap-types are in our future anyway, so I don't mind doing it (unless someone has a clear downside). FWIW, I don't think allowing to set __module__ and __name__/__qualname__ is very necessary/reasonable for non-heap types. cdef class myclass:
__module__ = "something"
Which would set tp_name to f{__module__}.myclass rather than f{module.__name__}.myclass. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This is a follow-up PR after #27716. It updates np.random functions and methods' __module__ to numpy.random.
The only items left with incorrect __module__ are cdef classes, as Cython doesn't allows changing it.
List from here: pytorch/pytorch#136559 (comment)