Skip to content

mitogen.core.Importer._update_linecache() may be confused about when to act #1401

@moreati

Description

@moreati

This method attempts to keep linecache up to date on Python 2.4. It's unclear to me whether the intent is

  • update linecache for any module loaded by Mitogen
  • update linecache for any module with fullname matching mitogen.*

The docstring could be interpreted either way. I think the code currently does the latter, but in the past it may have done the former, if 'master: prefix was ever mitogen:

mitogen/mitogen/core.py

Lines 1372 to 1379 in 73f60a3

def _update_linecache(self, path, data):
"""
The Python 2.4 linecache module, used to fetch source code for
tracebacks and :func:`inspect.getsource`, does not support PEP-302,
meaning it needs extra help to for Mitogen-loaded modules. Directly
populate its cache if a loaded module belongs to the Mitogen package.
"""
if PY24 and 'mitogen' in path:

mitogen/mitogen/core.py

Lines 1590 to 1592 in 73f60a3

self._update_linecache(
path='master:' + tup[2],
data=zlib.decompress(tup[3])

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-0.3Issues related to 0.3.X Mitogen releasesimporterIssues impacting core.py, parent.py, and master.py's import client and servers

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions