This repository was archived by the owner on Apr 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
Numpy analysis is inconsistent from run to run #1414
Labels
bug
Something isn't working
feature: analysis
feature: imports
package: numpy
Issues specific to Numpy
Milestone
Comments
I'll see if I can get better repro |
Here is the minimal test that reproduces the issue: [TestMethod, Priority(0)]
public async Task LoopImports_Variables() {
var module1Code = @"
class A1:
def M1(self): return 0; pass
from module2 import y3
x = y3.M3()
";
var module2Code = @"
from module1 import A1
y1 = A1()
from module3 import A3
y3 = A3()
";
var module3Code = @"
class A3:
def M3(self): return '0'; pass
from module2 import y1
z = y1.M1()
";
var appCode = @"
from module1 import x
from module3 import z
x.
z.";
var module1Uri = TestData.GetTestSpecificUri("module1.py");
var module2Uri = TestData.GetTestSpecificUri("module2.py");
var module3Uri = TestData.GetTestSpecificUri("module3.py");
var appUri = TestData.GetTestSpecificUri("app.py");
var root = Path.GetDirectoryName(appUri.AbsolutePath);
await CreateServicesAsync(root, PythonVersions.LatestAvailable3X);
var rdt = Services.GetService<IRunningDocumentTable>();
var analyzer = Services.GetService<IPythonAnalyzer>();
rdt.OpenDocument(module1Uri, module1Code);
rdt.OpenDocument(module2Uri, module2Code);
rdt.OpenDocument(module3Uri, module3Code);
var app = rdt.OpenDocument(appUri, appCode);
await analyzer.WaitForCompleteAnalysisAsync();
var analysis = await app.GetAnalysisAsync(-1);
var cs = new CompletionSource(new PlainTextDocumentationSource(), ServerSettings.completion);
var comps = cs.GetCompletions(analysis, new SourceLocation(5, 3));
comps.Should().HaveLabels("capitalize");
comps = cs.GetCompletions(analysis, new SourceLocation(6, 3));
comps.Should().HaveLabels("bit_length");
} |
This was referenced Oct 2, 2019
How to fix #1635 ? |
There is no consistent fix. The problem is that analysis sometimes produces results as I showed and sometimes does not. It involves concurrency and circular dependencies between modules in numpy. You may try reloading window and see if the analysis result is different. |
Partial PR #1584, parts can be reused. |
In favor of #1666 |
Closed
Closing per #1686. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
bug
Something isn't working
feature: analysis
feature: imports
package: numpy
Issues specific to Numpy
Uh oh!
There was an error while loading. Please reload this page.
Run analysis, look at icons in the completion list. Reload and run again - you get different set. Ex, 3 sequential runs (look at
AxisError
,ALLOW_THREADS
,DataSource
). [abc] icon actually meansUnknown
The text was updated successfully, but these errors were encountered: