Commit 1c218ea
authored
Fix daemon false positives related to module-level __getattr__ (#16292)
In some cases, mypy daemon could generate false positives about imports
targeting packages with a module-level `__getattr__` methods. The root
cause was that the `mypy.build.in_partial_package` function would leave
a partially initialized module in the `modules` dictionary of
`BuildManager`, which could probably cause all sorts of confusion. I
fixed this by making sure that ASTs related to temporary `State` objects
don't get persisted.
Also updated a test case to properly delete a package -- an empty
directory is now actually a valid namespace package, so to delete a
package we should delete the directory, not just the files inside it.1 parent e1f6d6b commit 1c218ea
File tree
3 files changed
+35
-8
lines changed- mypy
- test-data/unit
3 files changed
+35
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1991 | 1991 | | |
1992 | 1992 | | |
1993 | 1993 | | |
1994 | | - | |
| 1994 | + | |
1995 | 1995 | | |
1996 | 1996 | | |
1997 | 1997 | | |
| |||
2109 | 2109 | | |
2110 | 2110 | | |
2111 | 2111 | | |
2112 | | - | |
| 2112 | + | |
2113 | 2113 | | |
2114 | 2114 | | |
2115 | 2115 | | |
| |||
2194 | 2194 | | |
2195 | 2195 | | |
2196 | 2196 | | |
2197 | | - | |
| 2197 | + | |
| 2198 | + | |
2198 | 2199 | | |
2199 | 2200 | | |
2200 | 2201 | | |
2201 | 2202 | | |
2202 | | - | |
| 2203 | + | |
| 2204 | + | |
2203 | 2205 | | |
2204 | 2206 | | |
2205 | 2207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
840 | | - | |
841 | | - | |
842 | | - | |
| 840 | + | |
843 | 841 | | |
844 | 842 | | |
845 | 843 | | |
846 | 844 | | |
847 | 845 | | |
848 | | - | |
| 846 | + | |
849 | 847 | | |
850 | 848 | | |
851 | 849 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10337 | 10337 | | |
10338 | 10338 | | |
10339 | 10339 | | |
| 10340 | + | |
| 10341 | + | |
| 10342 | + | |
| 10343 | + | |
| 10344 | + | |
| 10345 | + | |
| 10346 | + | |
| 10347 | + | |
| 10348 | + | |
| 10349 | + | |
| 10350 | + | |
| 10351 | + | |
| 10352 | + | |
| 10353 | + | |
| 10354 | + | |
| 10355 | + | |
| 10356 | + | |
| 10357 | + | |
| 10358 | + | |
| 10359 | + | |
| 10360 | + | |
| 10361 | + | |
| 10362 | + | |
| 10363 | + | |
| 10364 | + | |
| 10365 | + | |
| 10366 | + | |
0 commit comments