Skip to content

Pyan3 v1.0.1

Compare
Choose a tag to compare
@Technologicat Technologicat released this 21 Nov 11:35
· 150 commits to master since this release

Bugfixes:

  • crash in analyzer when resolving super() call with no known bases
  • crash in collapse_inner() during postprocessing
  • use /usr/bin/env python3 instead of hard-coded /usr/bin/python3 in hashbang in pyan.py to support virtualenvs correctly

Enhancements:

  • analyze the with statement: add uses edges from the node containing the with block to __enter__ and __exit__ methods of the with'd object; also track binding from with ... as foo (single target only for now, and __enter__ is assumed to return self)
  • analyze instantiation: add a uses edge to MyClass.__init__ for a call to MyClass()
  • node flavoring both in analysis and in output (class, function, method, staticmethod, classmethod)
  • figure out which names correspond to arguments in FunctionDef; prevent leakage of matching names from the enclosing scope. This fixes some spurious edges.
  • avoid adding a uses wildcard when resolving super() fails. This fixes spurious, possibly seemingly recursive, uses edges in the case that part of the class hierarchy is not available for analysis. (The most common reasons for super() resolution to fail are that either the analyzer is still running pass 1 [MRO is computed between passes], or some relevant source file is not in the analyzed set.)

Technical improvements:

  • refactor analyzer: split into the main class and anutils
  • reorder methods in the analyzer main class to make the source code more logical to read for humans