Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a9ef5e56
Commit
a9ef5e56
authored
Dec 11, 2004
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SF bug #1083202L UnboundLocalError raised by atexit module
The sys module could be called before being imported.
parent
bb4f1bdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Lib/atexit.py
Lib/atexit.py
+3
-3
No files found.
Lib/atexit.py
View file @
a9ef5e56
...
...
@@ -7,6 +7,8 @@ One public function, register, is defined.
__all__
=
[
"register"
]
import
sys
_exithandlers
=
[]
def
_run_exitfuncs
():
"""run any registered exit functions
...
...
@@ -23,7 +25,7 @@ def _run_exitfuncs():
except
SystemExit
:
exc_info
=
sys
.
exc_info
()
except
:
import
sys
,
traceback
import
traceback
print
>>
sys
.
stderr
,
"Error in atexit._run_exitfuncs:"
traceback
.
print_exc
()
exc_info
=
sys
.
exc_info
()
...
...
@@ -41,12 +43,10 @@ def register(func, *targs, **kargs):
"""
_exithandlers
.
append
((
func
,
targs
,
kargs
))
import
sys
if
hasattr
(
sys
,
"exitfunc"
):
# Assume it's another registered exit function - append it to our list
register
(
sys
.
exitfunc
)
sys
.
exitfunc
=
_run_exitfuncs
del
sys
if
__name__
==
"__main__"
:
def
x1
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment