Skip to content

Commit cb1c9a0

Browse files
committed
More useless None assignments
1 parent eb8ef50 commit cb1c9a0

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

Pythonwin/pywin/framework/scriptutils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def JumpToDocument(fileName, lineno=0, col=1, nChars=0, bScrollToTop=0):
603603

604604

605605
def _HandlePythonFailure(what, syntaxErrorPathName=None):
606-
typ, details, tb = sys.exc_info()
606+
details = sys.exc_info()[1]
607607
if isinstance(details, SyntaxError):
608608
try:
609609
msg, (fileName, line, col, text) = details
@@ -616,7 +616,6 @@ def _HandlePythonFailure(what, syntaxErrorPathName=None):
616616
else:
617617
traceback.print_exc()
618618
win32ui.SetStatusText(f"Failed to {what} - {details}")
619-
tb = None # Clean up a cycle.
620619

621620

622621
# Find the Python TabNanny in either the standard library or the Python Tools/Scripts directory.

com/win32comext/axscript/client/framework.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,11 +1193,11 @@ def EvalInScriptedSection(self, codeBlock, globals, locals=None):
11931193

11941194
def HandleException(self, codeBlock: AXScriptCodeBlock | None) -> NoReturn:
11951195
"""Never returns - raises a ComException"""
1196-
exc_type, exc_value, _ = sys.exc_info()
1196+
exc_value = sys.exc_info()[2]
11971197
# If a SERVER exception, re-raise it. If a client side COM error, it is
11981198
# likely to have originated from the script code itself, and therefore
11991199
# needs to be reported like any other exception.
1200-
if IsCOMServerException(exc_type):
1200+
if IsCOMServerException(type(exc_value)):
12011201
# Ensure the traceback doesn't cause a cycle.
12021202
raise
12031203
# It could be an error by another script.

isapi/threaded_extension.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ def HandleDispatchError(self, ecb):
156156
ecb.HttpStatusCode = isapicon.HSE_STATUS_ERROR
157157
# control_block.LogData = "we failed!"
158158
exc_typ, exc_val, exc_tb = sys.exc_info()
159-
limit = None
160159
try:
161160
try:
162161
import html
@@ -166,9 +165,9 @@ def HandleDispatchError(self, ecb):
166165
)
167166
print(file=ecb)
168167
print("<H3>Traceback (most recent call last):</H3>", file=ecb)
169-
list = traceback.format_tb(
170-
exc_tb, limit
171-
) + traceback.format_exception_only(exc_typ, exc_val)
168+
list = traceback.format_tb(exc_tb) + traceback.format_exception_only(
169+
exc_typ, exc_val
170+
)
172171
bold = list.pop()
173172
print(
174173
"<PRE>{}<B>{}</B></PRE>".format(
@@ -187,7 +186,4 @@ def HandleDispatchError(self, ecb):
187186
print("ORIGINAL extension error:")
188187
traceback.print_exception(exc_typ, exc_val, exc_tb)
189188
finally:
190-
# holding tracebacks in a local of a frame that may itself be
191-
# part of a traceback used to be evil and cause leaks!
192-
exc_tb = None
193189
ecb.DoneWithSession()

0 commit comments

Comments
 (0)