From b7f275dc0d9a7c8d397de1e3b95075c2aceb0881 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Tue, 24 Apr 2012 18:48:40 -0400 Subject: [PATCH] More arguments --- func_smash.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/func_smash.py b/func_smash.py index f1961ed..c5f0a29 100644 --- a/func_smash.py +++ b/func_smash.py @@ -103,7 +103,6 @@ def run(): def _parse_func(func, chain): codeobj = func.__code__ - print codeobj.co_argcount codestring = codeobj.co_code length = len(codestring) i = 0 @@ -193,10 +192,12 @@ def _demo(corpus, arg=12.0): print "Using {0}-function corpus.".format(len(corpus)) print "Smashed function disassembly:" print_function(func) - print - print "func({0}) =".format(arg), func(arg) - if len(sys.argv) > 2 and sys.argv[2] == "-i": + if not len(sys.argv) > 2 or "n" not in "".join(sys.argv[2:]): + print + print "func({0}) =".format(arg), func(arg) + + if len(sys.argv) > 2 and "i" in "".join(sys.argv[2:]): variables = dict(globals().items() + locals().items()) interact(banner="", local=variables)