Skip to content
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

getsource yields python scalars for numpy scalars #674

Closed
mmckerns opened this issue Sep 9, 2024 · 0 comments · Fixed by #678
Closed

getsource yields python scalars for numpy scalars #674

mmckerns opened this issue Sep 9, 2024 · 0 comments · Fixed by #678
Labels
Milestone

Comments

@mmckerns
Copy link
Member

mmckerns commented Sep 9, 2024

dill.source.getsource correctly identifies numpy scalars, but doesn't create them, and instead returns the python equivalent. Should apply code to cast to the appropriate dtype.

$ python
Python 3.8.20 (default, Sep  7 2024, 10:50:45) 
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dill
>>> import numpy
>>> oo = 0
>>> ll = numpy.int64(1)
>>> print(dill.source.getsource(oo, force=True))
0

>>> print(dill.source.getsource(ll, force=True))
from numpy import int64
1

>>> 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant