-
Notifications
You must be signed in to change notification settings - Fork 313
Closed
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues, especially the pinned issues.
Exception report
Last 200 Keys:
k h - d i e n l l / D e s k t o p / s o l a r - w a r e h o u s e - o p t i m i z a t i o n 1
. 1 Space ( 1 ) . p y " Enter
& Space C : / U s e r s / b k h - d i e n l l / A p p D a t a / L o c a l / P r o g r a m s /
P y t h o n / P y t h o n 3 1 3 / p y t h o n . e x e Space " c : / U s e r s / b k h - d i e n l l / D e s k t o p / s o l a r - w a r e h o u s e - o p t i m i z a t i o n 1 . 1 Space ( 1
) . p y " Enter
Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -5.
at System.Console.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
at Microsoft.PowerShell.PSConsoleReadLine.AcceptLineImpl(Boolean validate)
at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
Screenshot

When using type checkers (e.g., mypy, pylance), the following function signature causes a type error:
def _load_excel_data_with_fallback(self, filename: str, sheet_name: str = None):
Error: "Expression of type 'None' cannot be assigned to parameter of type 'str'"
Expected:
No type error if the argument can be None.
Fix:
Change the annotation to:
def _load_excel_data_with_fallback(self, filename: str, sheet_name: Optional[str] = None):
Environment:
- Python 3.11.3
- Windows 10
- Linter: mypy/pylance
Reference: mypy common issues
Environment data
**Environment:**
- Windows 10
- PowerShell version: [run `$PSVersionTable.PSVersion`]
- PSReadLine version: [run `(Get-Module PSReadline).Version`]
- BufferWidth: [run `[console]::BufferWidth`]
- BufferHeight: [run `[console]::BufferHeight`]
Steps to reproduce
Steps to reproduce:
- Open PowerShell.
- Run a Python script that produces a lot of output (e.g., print statements in a loop).
Expected behavior
Expected:
No type error if the argument can be None.
Actual behavior
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -5.
Metadata
Metadata
Assignees
Labels
No labels