Skip to content

Infinite recursion in ast rewriter  #2724

@ionelmc

Description

@ionelmc

Weird issue in one of my tests (https://travis-ci.org/ionelmc/python-manhole/jobs/269038610#L361-L361)

tests/test_manhole.py:63: in test_log_when_uninstalled
    import manhole
.tox/2.7-eventlet-nocov/lib/python2.7/site-packages/manhole.py:49: in <module>
    _ORIGINAL_FDOPEN = _get_original('os', 'fdopen')
.tox/2.7-eventlet-nocov/lib/python2.7/site-packages/manhole.py:39: in _get_original
    return getattr(_original(mod), name)
.tox/2.7-eventlet-nocov/lib/python2.7/site-packages/eventlet/patcher.py:194: in original
    real_mod = __import__(modname, {}, {}, modname.split('.')[:-1])
.tox/2.7-eventlet-nocov/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:98: in find_module
    if not self._should_rewrite(name, fn_pypath, state):
.tox/2.7-eventlet-nocov/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:166: in _should_rewrite
    if fn_pypath.fnmatch(pat):
.tox/2.7-eventlet-nocov/lib/python2.7/site-packages/py/_path/common.py:249: in fnmatch
    return FNMatcher(pattern)(self)
.tox/2.7-eventlet-nocov/lib/python2.7/site-packages/py/_path/common.py:445: in __call__
    return fnmatch.fnmatch(name, pattern)
.tox/2.7-eventlet-nocov/lib/python2.7/fnmatch.py:40: in fnmatch
    import os
.tox/2.7-eventlet-nocov/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:98: in find_module
    if not self._should_rewrite(name, fn_pypath, state):
.tox/2.7-eventlet-nocov/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:166: in _should_rewrite
    if fn_pypath.fnmatch(pat):
E   RuntimeError: maximum recursion depth exceeded while calling a Python object
!!! Recursion detected (same locals & position)

Is this enough to figure out the problem? I'd put my money on that lazy "import os" as the cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questiongeneral question, might be closed after 2 weeks of inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions