Skip to content

Commit c6c454d

Browse files
committed
Small optimization, avoid extra function.
1 parent 808fa72 commit c6c454d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Lib/threading.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,17 +1063,14 @@ def _bootstrap_inner(self):
10631063
if _profile_hook:
10641064
_sys.setprofile(_profile_hook)
10651065

1066-
if self._context is None:
1067-
# Run with empty context, matching behaviour of
1068-
# threading.local and older versions of Python.
1069-
run = self.run
1070-
else:
1071-
# Run with the provided or the inherited context.
1072-
def run():
1073-
self._context.run(self.run)
1074-
10751066
try:
1076-
run()
1067+
if self._context is None:
1068+
# Run with empty context, matching behaviour of
1069+
# threading.local and older versions of Python.
1070+
self.run()
1071+
else:
1072+
# Run with the provided or the inherited context.
1073+
self._context.run(self.run)
10771074
except:
10781075
self._invoke_excepthook(self)
10791076
finally:

0 commit comments

Comments
 (0)