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

import issues with py311 #528

Closed
tacaswell opened this issue Feb 2, 2022 · 7 comments · Fixed by #533
Closed

import issues with py311 #528

tacaswell opened this issue Feb 2, 2022 · 7 comments · Fixed by #533

Comments

@tacaswell
Copy link
Contributor

There appears to be more issues with toolz + py311 + circular imports:

$ ipython
Python 3.11.0a4+ (heads/main:bebaa95fd0, Feb  1 2022, 14:37:27) [GCC 11.1.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.30.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import tlz

In [2]: tlz.__version__
Out[2]: '0.11.2+3.gf3ac821'

In [3]: import tlz.curried
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-e8157afb3962> in <module>
----> 1 import tlz.curried

~/.pybuild/bleeding/lib/python3.11/importlib/_bootstrap.py in _find_and_load(name, import_)

~/.pybuild/bleeding/lib/python3.11/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

~/.pybuild/bleeding/lib/python3.11/importlib/_bootstrap.py in _load_unlocked(spec)

~/.virtualenvs/bleeding/lib/python3.11/site-packages/tlz/_build_tlz.py in exec_module(self, module)
     83                 package, dot, submodules = v.__name__.partition('.')
     84                 module_name = ''.join(['tlz', dot, submodules])
---> 85                 submodule = import_module(module_name)
     86                 module.__dict__[k] = submodule
     87 

~/.pybuild/bleeding/lib/python3.11/importlib/__init__.py in import_module(name, package)
    124                 break
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 
    128 

~/.pybuild/bleeding/lib/python3.11/importlib/_bootstrap.py in _gcd_import(name, package, level)

~/.pybuild/bleeding/lib/python3.11/importlib/_bootstrap.py in _find_and_load(name, import_)

~/.pybuild/bleeding/lib/python3.11/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

AttributeError: 'TlzSpec' object has no attribute '_uninitialized_submodules'

In [4]: 
@eriknw
Copy link
Member

eriknw commented Feb 2, 2022

There sure is! I actually poked around with this a few days ago in PR #527:

https://github.com/pytoolz/toolz/runs/4986061605?check_suite_focus=true

I haven't dug any deeper yet, but it might be nice if we can upstream changes so we no longer break.

@tacaswell
Copy link
Contributor Author

Ah, sorry I did not search hard enough before opening this issue.

@eriknw
Copy link
Member

eriknw commented Feb 2, 2022

ha, no worries, thanks for the issue!

@opoplawski
Copy link

Any progress here? Fedora is updating to 3.11 and tests are failing:

___________________________________ test_tlz ___________________________________
    def test_tlz():
        import tlz
        tlz.curry
        tlz.functoolz.curry
        assert tlz.__package__ == 'tlz'
        assert tlz.__name__ == 'tlz'
>       import tlz.curried
toolz/tests/test_tlz.py:10: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
<frozen importlib._bootstrap>:1178: in _find_and_load
    ???
<frozen importlib._bootstrap>:1149: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
../../BUILDROOT/python-toolz-0.11.2-4.fc37.noarch/usr/lib/python3.11/site-packages/tlz/_build_tlz.py:85: in exec_module
    submodule = import_module(module_name)
/usr/lib64/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1206: in _gcd_import
    ???
<frozen importlib._bootstrap>:1178: in _find_and_load
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
name = 'tlz.curried.operator', import_ = <function _gcd_import at 0x3ff952cfd80>
>   ???
E   AttributeError: 'TlzSpec' object has no attribute '_uninitialized_submodules'
<frozen importlib._bootstrap>:1147: AttributeError

@eriknw
Copy link
Member

eriknw commented Jun 15, 2022

My bad. Got sick. Better now. I'll get a fix in ASAP. May take a couple of days. Thanks for the nudge.

@tacaswell
Copy link
Contributor Author

Thank you @eriknw ! Looking at that diff I am not sure I would have ever gotten there.....

@opoplawski
Copy link

Thank you!

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

Successfully merging a pull request may close this issue.

3 participants