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

NumPy 2.0.0 test regression: test_diff.py: RecursionError: maximum recursion depth exceeded #667

Closed
mgorny opened this issue Jul 8, 2024 · 3 comments · Fixed by #676
Closed

Comments

@mgorny
Copy link
Contributor

mgorny commented Jul 8, 2024

When NumPy 2.0.0 is installed, test_diff.py crashes with a RecursionError:

$ python dill/tests/test_diff.py 
Traceback (most recent call last):
  File "/tmp/dill/dill/tests/test_diff.py", line 9, in <module>
    from dill import __diff as diff
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/dill/__diff.py", line 233, in <module>
    memorise(mod)
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/dill/__diff.py", line 111, in memorise
    [mem(value) for key, value in g.items()]
     ^^^^^^^^^^
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/dill/__diff.py", line 111, in memorise
    [mem(value) for key, value in g.items()]
     ^^^^^^^^^^
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/dill/__diff.py", line 97, in memorise
    s = get_seq(obj)
        ^^^^^^^^^^^^
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/dill/__diff.py", line 64, in get_seq
    elif HAS_NUMPY and o_type in (numpy.ndarray, numpy.ma.core.MaskedConstant):
                                                 ^^^^^^^^
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/numpy/__init__.py", line 343, in __getattr__
    import numpy.ma as ma
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/dill/__diff.py", line 220, in _imp
    mod = __import__(*args, **kwds)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/numpy/ma/__init__.py", line 42, in <module>
    from . import core
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/dill/__diff.py", line 223, in _imp
    memorise(sys.modules[m])
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/dill/__diff.py", line 111, in memorise
    [mem(value) for key, value in g.items()]
     ^^^^^^^^^^
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/dill/__diff.py", line 97, in memorise
    s = get_seq(obj)
        ^^^^^^^^^^^^
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/dill/__diff.py", line 64, in get_seq
    elif HAS_NUMPY and o_type in (numpy.ndarray, numpy.ma.core.MaskedConstant):
                                                 ^^^^^^^^
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/numpy/__init__.py", line 343, in __getattr__
    import numpy.ma as ma
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/numpy/__init__.py", line 343, in __getattr__
    import numpy.ma as ma
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/numpy/__init__.py", line 343, in __getattr__
    import numpy.ma as ma
  [Previous line repeated 967 more times]
  File "/tmp/dill/.tox/py312/lib/python3.12/site-packages/dill/__diff.py", line 220, in _imp
    mod = __import__(*args, **kwds)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 471, in _lock_unlock_module
  File "<frozen importlib._bootstrap>", line 311, in acquire
  File "<frozen importlib._bootstrap>", line 170, in __enter__
  File "<frozen importlib._bootstrap>", line 132, in setdefault
RecursionError: maximum recursion depth exceeded
gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Jul 8, 2024
@mgorny
Copy link
Contributor Author

mgorny commented Sep 9, 2024

Thanks!

@EwoutH
Copy link

EwoutH commented Sep 11, 2024

Thanks for fixing and merging this!

When do you expect to tag a new release which includes this PR? I'm really curious if this solves an similar issue I'm facing.

@mmckerns
Copy link
Member

I need to solve two known issues related to serialization of objects impacted by change in threads and frames, etc. in python 3.13. Hopefully, I can address those two issues in the next few days, and tag a release early to mid next week.

@mmckerns mmckerns added this to the dill-0.3.9 milestone Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants