mahmoud / glom

☄️ Python's nested data operator (and CLI), for all your declarative restructuring needs. Got data? Glom it! ☄️
https://glom.readthedocs.io
Other
1.89k stars 61 forks source link

Intermittent recursion depth exceeded on v20.7.0 CI #189

Closed mahmoud closed 4 years ago

mahmoud commented 4 years ago

Reproduced every few Travis runs for Pythons <3.7. Always on glom/test/test_error.py::test_midway_branch

For example: https://travis-ci.org/github/mahmoud/glom/jobs/716806565

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/test/test_error.py", line 112, in _debug_some_str

    return str(value)

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/core.py", line 169, in __str__

    self._target_spec_trace = format_target_spec_trace(self._scope, self.__wrapped)

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/core.py", line 247, in format_target_spec_trace

    segments.append(recurse(branches[-1], last_branch))

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/core.py", line 237, in <lambda>

    recurse = lambda s, last=False: format_target_spec_trace(s, root_error, width, depth + 1, prev_target, last)

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/core.py", line 240, in format_target_spec_trace

    for scope, spec, target, error, branches in _unpack_stack(scope):

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/core.py", line 199, in _unpack_stack

    if child in branches:

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/_collections_abc.py", line 449, in __eq__

    return dict(self.items()) == dict(other.items())
... (the frame above 900 odd times) ...
  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/test/test_error.py", line 112, in _debug_some_str

    return str(value)

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/core.py", line 169, in __str__

    self._target_spec_trace = format_target_spec_trace(self._scope, self.__wrapped)

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/core.py", line 247, in format_target_spec_trace

    segments.append(recurse(branches[-1], last_branch))

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/core.py", line 237, in <lambda>

    recurse = lambda s, last=False: format_target_spec_trace(s, root_error, width, depth + 1, prev_target, last)

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/core.py", line 240, in format_target_spec_trace

    for scope, spec, target, error, branches in _unpack_stack(scope):

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/site-packages/glom/core.py", line 199, in _unpack_stack

    if child in branches:

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/_collections_abc.py", line 449, in __eq__

    return dict(self.items()) == dict(other.items())

Other highlights include:

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/_collections_abc.py", line 447, in __eq__

    if not isinstance(other, Mapping):

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/abc.py", line 182, in __instancecheck__

    if subclass in cls._abc_cache:

and

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/_collections_abc.py", line 447, in __eq__

    if not isinstance(other, Mapping):

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/abc.py", line 182, in __instancecheck__

    if subclass in cls._abc_cache:

  File "/home/travis/build/mahmoud/glom/.tox/py34/lib/python3.4/_weakrefset.py", line 75, in __contains__

    return wr in self.data

But it all goes back to the eq on mapping's weakref. Probably got fixed in Py37/Py38, because I don't think I've ever seen those fail on travis.