Skip to content

[CI] tests/ignite/metrics/test_dill.py::test_metric is failing on py3.11 #2921

@vfdev-5

Description

@vfdev-5
=================================== FAILURES ===================================
_________________________________ test_metric __________________________________

    def test_metric():
        def _test(m, values, e):
            for v in values:
                m.update(v)
            assert m.compute() == e
    
        metric = Accumulation()
    
>       m1 = dill.loads(dill.dumps(metric))

tests/ignite/metrics/test_dill.py:29: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/dill/_dill.py:327: in loads
    return load(file, ignore, **kwds)
/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/dill/_dill.py:313: in load
    return Unpickler(file, ignore=ignore, **kwds).load()
/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/dill/_dill.py:525: in load
    obj = StockUnpickler.load(self)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (1, 0, 0, 1, 1, 3, ...)

    def _create_code(*args):
        if PY3 and hasattr(args[-3], 'encode'): #FIXME: from PY2 fails (optcode)
            args = list(args)
            args[-3] = args[-3].encode() # co_lnotab
            args[-10] = args[-10].encode() # co_code
        if hasattr(CodeType, 'co_posonlyargcount'):
>           if len(args) == 16: return CodeType(*args)
E           TypeError: code() argument 13 must be str, not int

/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/dill/_dill.py:659: TypeError
tests/ignite/metrics/test_dill.py::test_metric - TypeError: code() argument 13 must be str, not int

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions