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
Traceback (most recent call last):
File "/Users/ryanthompson/PycharmProjects/learningProjects/dill_regression/regression_test.py", line 6, in <module>
loaded = dill.loads(serialized)
File "/Users/ryanthompson/.pyenv/versions/3.8.11/lib/python3.8/site-packages/dill/_dill.py", line 387, in loads
return load(file, ignore, **kwds)
File "/Users/ryanthompson/.pyenv/versions/3.8.11/lib/python3.8/site-packages/dill/_dill.py", line 373, in load
return Unpickler(file, ignore=ignore, **kwds).load()
File "/Users/ryanthompson/.pyenv/versions/3.8.11/lib/python3.8/site-packages/dill/_dill.py", line 646, in load
obj = StockUnpickler.load(self)
File "/Users/ryanthompson/.pyenv/versions/3.8.11/lib/python3.8/typing.py", line 804, in __getitem__
return self.__getitem_inner__(params)
File "/Users/ryanthompson/.pyenv/versions/3.8.11/lib/python3.8/typing.py", line 261, in inner
return func(*args, **kwds)
File "/Users/ryanthompson/.pyenv/versions/3.8.11/lib/python3.8/typing.py", line 830, in __getitem_inner__
params = tuple(_type_check(p, msg) for p in params)
File "/Users/ryanthompson/.pyenv/versions/3.8.11/lib/python3.8/typing.py", line 830, in <genexpr>
params = tuple(_type_check(p, msg) for p in params)
File "/Users/ryanthompson/.pyenv/versions/3.8.11/lib/python3.8/typing.py", line 149, in _type_check
raise TypeError(f"{msg} Got {arg!r:.100}.")
TypeError: Tuple[t0, t1, ...]: each t must be a type. Got ().
Thanks for the report. I can reproduce on 3.9 and 3.10, but not a recent build of 3.11. I assume @serhiy-storchaka's changes to the representation of empty tuples fixed this issue.
We're not going to fix this for 3.9 and lower because those branches are in security fix-only mode, but we can still fix it on 3.10.
Activity
JelleZijlstra commentedon Jun 24, 2022
Thanks for the report. I can reproduce on 3.9 and 3.10, but not a recent build of 3.11. I assume @serhiy-storchaka's changes to the representation of empty tuples fixed this issue.
We're not going to fix this for 3.9 and lower because those branches are in security fix-only mode, but we can still fix it on 3.10.
mmckerns commentedon Jun 24, 2022
Just for completeness... here's a little more information on the bug (from the OP issue at
dill):pythongh-94245: Test pickling and copying of typing.Tuple[()]
pythongh-94245: Fix pickling and copying of typing.Tuple[()]
serhiy-storchaka commentedon Jun 25, 2022
Backporting #31836 can fix this issue. #94260 is an alternate fix. #94259 contains tests, they should be added in all versions.
[3.10] gh-94245: Fix pickling and copying of typing.Tuple[()] (GH-94260)
gh-94245: Test pickling and copying of typing.Tuple[()] (GH-94259)
pythongh-94245: Test pickling and copying of typing.Tuple[()] (python…
pythongh-94245: Test pickling and copying of typing.Tuple[()] (python…
gh-94245: Test pickling and copying of typing.Tuple[()] (GH-94259)
gh-94245: Test pickling and copying of typing.Tuple[()] (GH-94259) (G…
Revert 30935 defer bpo45162 to 312 (#94285)
fix: #517 special handling of typing module