-
Notifications
You must be signed in to change notification settings - Fork 825
Excessive exception traces with Pythonwin.exe v307 #2393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this line should change to |
Thank you very much! I have applied your fix locally and the behavior is now correct. |
Fixed by #2394 |
I noticed that the error statement is still somewhat mangled. It reads:
But i would expect this:
As CPython has a very similar defect, I raised python/cpython#125380 |
About my last comment here: CPython's method traceback.print_exception omits “Traceback (most recent call last):” for syntax errors as there is no traceback object. And there is no traceback object as code with syntax errors won’t compile and therefor can’t be executed. |
Thanks! Feel free to open a new issue here for further improvements! |
Steps to reproduce the problem
Open the Pythonwin.exe and type
Expected behavior (as per python.exe)
File "", line 1
c := 3
^^
SyntaxError: invalid syntax
Actual behavior
Firing event 'ProcessEnter' failed.
Traceback (most recent call last):
File "C:\Program Files\Python313\Lib\code.py", line 65, in runsource
code = self.compile(source, filename, symbol)
File "C:\Program Files\Python313\Lib\codeop.py", line 152, in call
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\Program Files\Python313\Lib\codeop.py", line 74, in _maybe_compile
return compiler(source, filename, symbol, incomplete_input=False)
File "C:\Program Files\Python313\Lib\codeop.py", line 117, in call
codeob = compile(source, filename, symbol, flags, True)
File "", line 1
c := 3
^^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python313\Lib\site-packages\pythonwin\pywin\scintilla\bindings.py", line 148, in fire
rc = binding.handler(*args)
File "C:\Program Files\Python313\Lib\site-packages\pythonwin\pywin\framework\interact.py", line 565, in ProcessEnterEvent
if self.interp.runsource(
~~~~~~~~~~~~~~~~~~~~~^
source, ""
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
): # Need more input!
^
File "C:\Program Files\Python313\Lib\code.py", line 68, in runsource
self.showsyntaxerror(filename, source=source)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: PythonwinInteractiveInterpreter.showsyntaxerror() got an unexpected keyword argument 'source'
System information
Python version and distribution:
PythonWin 3.13.0 (tags/v3.13.0:60403a5, Oct 7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)] on win32.
pywin32 version:
307, installed with pip
Windows Version:
Win 10 with local admin account
DLL locations:
C:\Program Files\Python313\Lib\site-packages\pywin32_system32\pywintypes313.dll
C:\Program Files\Python313\Lib\site-packages\pywin32_system32\pythoncom313.dll
The text was updated successfully, but these errors were encountered: