diff options
author | Georg Brandl <georg@python.org> | 2006-11-16 16:50:59 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-11-16 16:50:59 (GMT) |
commit | 540821183b0a6105d5cf262db837332b14e0e259 (patch) | |
tree | e502037389efb145f06efb27e88bb98a1c80bdb1 /Lib | |
parent | adff8eb8d69718023e1443a8835bf5b99c87d5d5 (diff) | |
download | cpython-540821183b0a6105d5cf262db837332b14e0e259.zip cpython-540821183b0a6105d5cf262db837332b14e0e259.tar.gz cpython-540821183b0a6105d5cf262db837332b14e0e259.tar.bz2 |
Bug #1597824: return the registered function from atexit.register()
to facilitate usage as a decorator.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/atexit.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/atexit.py b/Lib/atexit.py index c9f4cc6..93fddf7 100644 --- a/Lib/atexit.py +++ b/Lib/atexit.py @@ -40,8 +40,11 @@ def register(func, *targs, **kargs): func - function to be called at exit targs - optional arguments to pass to func kargs - optional keyword arguments to pass to func + + func is returned to facilitate usage as a decorator. """ _exithandlers.append((func, targs, kargs)) + return func if hasattr(sys, "exitfunc"): # Assume it's another registered exit function - append it to our list |