-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed as duplicate of#138944
Labels
pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Some syntax errors (I was able to find at least 2 cases) lead to incorrect messages that completely make it impossible to understand what exactly is wrong. In this case, the error is always thrown on the first import with an alias via as.
The first case is written twice ;:
import torch;
import torch.nn as nn;
def foo(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
d = torch.sqrt(x ** 2 + y ** 2);;
return d;
The second case is the re-specified def when declaring the function.:
import torch;
import torch.nn as nn;
def foo(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
d = torch.sqrt(x ** 2 + y ** 2);
return d;
def def bar():
pass;
Deleting ; after importing with as returns the correct error message.
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Metadata
Metadata
Assignees
Labels
pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error