You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is expected or not? Reproducer below.
Thanks!
Tim
Output with cloudpickle 0.7.0:
(cp7) $ python reproducer.py
<pkg.mymod2.MyClass object at 0x7fbf18b3d828>
cloudpickle 0.8.0:
(cp8) $ python reproducer.py
Traceback (most recent call last):
File "reproducer.py", line 7, in <module>print(f())
File "/mypath/pkg/mymod.py", line 4, in funcfrom .mymod2 import MyClass
KeyError: "'__name__' not in globals"
pkg/
__init__.py
mymod.py
mymod2.py
reproducer.py
# pkg/__init__.py# blank
# pkg/mymod.pyclassBlah(object):
@staticmethoddeffunc():
from .mymod2importMyClassreturnMyClass()
You're correct, its a bug.
In 0.8.0 we reverted functions globals handling to the behavior of 0.5.3, and accidentally reintroduced a bug of 0.5.3 that was never reported before.
It is not related to staticmethod specifically, it is due to the relative import mechanism (the failing line is from .mymod2 import MyClass)
I'll do a PR to fix this.
Not sure if this is expected or not? Reproducer below.
Thanks!
Tim
Output with cloudpickle 0.7.0:
cloudpickle 0.8.0:
The text was updated successfully, but these errors were encountered: