Skip to content

Docs/stated limits - #76

Merged
vitsalis merged 4 commits into
vitsalis:mainfrom
babyvitbot:docs/stated-limits
Nov 18, 2026
Merged

vitsalis merged 4 commits into
vitsalis:mainfrom
babyvitbot:docs/stated-limits

Conversation

@babyvitbot

Copy link
Copy Markdown
Contributor

No description provided.

babyvitbot and others added 4 commits November 18, 2026 07:45
The note that PyCG is maintained again keeps its other sentences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The evaluation labelled every false negative on its 30 packages with a
cause. Two causes were mechanisms that the design did not state. The
design now states them as limits, and a test pins what the analysis
reports. The analysis does not change.

A getter that raises AttributeError (Lookup through an instance).
Python calls the class's __getattr__ when a property's getter or a
descriptor's __get__ raises AttributeError. The analysis calls
__getattr__ only where no class of the MRO defines the name.
Measured on the macro-benchmark of pycg-evaluation (30 packages, PyCG
c5c6a89): 32 missed edges have this cause (bottle 19, structlog 8,
anytree 4, asyncstdlib 1). A rule "a load of a name bound to a property
or descriptor also calls the class's __getattr__", measured on a copy of
the analysis, adds 31 of them and 21 wrong edges (anytree 19, bottle 2).
That is more than one wrong edge for every ten true ones, the bound for
admitting a rule, so the rule is not built.
Test: test_limit_a_getter_that_raises_attribute_error_does_not_call_getattr.

An assert narrows as if it always runs (Class tests).
Under python -O an assert does not run, so the code after
assert isinstance(x, C) also runs with values that are not instances of
C. The analysis follows the default interpreter. Measured: 4 missed
edges of h11 (normalize_and_validate and get_comma_header calling
str.lower and str.split), in a ground truth that also counts runs under
-O.
Test: test_limit_an_assert_narrows_as_if_it_always_runs.

Both programs were run under Python 3.15.2 (the assert one also with
-O) to confirm what Python does, and under PyCG to confirm what the
analysis reports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There is no `dev` branch in the published repository: `main` is the
branch, and a change reaches it through a pull request.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The redesigned analysis is PyCG 2. The version was the placeholder
0.1.0.dev0; the releases of the 2021 analysis on PyPI are 0.0.x. The
output document records this version in its `generator` field.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vitsalis
vitsalis merged commit 5a735f7 into vitsalis:main Nov 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants