[Reproducible-commits] [diffoscope] 06/13: Fix main exception handling

Jérémy Bobbio lunar at moszumanska.debian.org
Thu Oct 15 16:04:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository diffoscope.

commit 21eee2d90838d3b260097831a453a0b2aacd4c1f
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Thu Oct 15 10:04:11 2015 +0000

    Fix main exception handling
    
    If an exception is raised in create_parser(), then parsed_args is not
    set, which is bad as we look it up in the exception handler. So let's
    set it to None before the try block.
---
 diffoscope/__main__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/diffoscope/__main__.py b/diffoscope/__main__.py
index d0ed2df..04d84bc 100644
--- a/diffoscope/__main__.py
+++ b/diffoscope/__main__.py
@@ -131,6 +131,7 @@ def main(args=None):
     if args is None:
         args = sys.argv[1:]
     signal.signal(signal.SIGTERM, sigterm_handler)
+    parsed_args = None
     try:
         parser = create_parser()
         parsed_args = parser.parse_args(args)
@@ -140,7 +141,7 @@ def main(args=None):
         sys.exit(2)
     except Exception:
         traceback.print_exc()
-        if parsed_args.debugger:
+        if parsed_args and parsed_args.debugger:
             import pdb
             pdb.post_mortem()
         sys.exit(2)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git



More information about the Reproducible-commits mailing list