[kupfer] debug: Use debug.install() to install atexit hooks
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] debug: Use debug.install() to install atexit hooks
- Date: Fri, 23 Oct 2009 10:41:00 +0000 (UTC)
commit b318b74a0e86de19b19218cf614ba6933212dd8d
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Fri Oct 23 12:17:12 2009 +0200
debug: Use debug.install() to install atexit hooks
This makes debug a "normal" module instead of an "evil" module, no
longer installing atexit hooks directly on import.
debug.py | 6 ++++--
kupfer/main.py | 9 +++++----
2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/debug.py b/debug.py
index dcb9165..f701e32 100644
--- a/debug.py
+++ b/debug.py
@@ -83,5 +83,7 @@ def icon_stats():
key=lambda k: icon_cache[size][k]["accesses"]):
print k, icon_cache[size][k]["accesses"]
-atexit.register(mem_stats)
-#atexit.register(icon_stats)
+def install():
+ """Install atexit handlers for debug information"""
+ atexit.register(mem_stats)
+ #atexit.register(icon_stats)
diff --git a/kupfer/main.py b/kupfer/main.py
index 3e6f247..f01c0e8 100644
--- a/kupfer/main.py
+++ b/kupfer/main.py
@@ -92,10 +92,6 @@ def get_options():
print_banner()
raise SystemExit
if k == "--debug":
- try:
- import debug
- except ImportError, e:
- pass
global _debug
_debug = True
@@ -129,6 +125,11 @@ def main():
if _debug:
pretty.debug = _debug
+ try:
+ import debug
+ debug.install()
+ except ImportError, e:
+ pass
sys.excepthook = sys.__excepthook__
w = browser.WindowController()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]