diff --git a/IPython/prefilter.py b/IPython/prefilter.py index 6da7db7..d317884 100644 --- a/IPython/prefilter.py +++ b/IPython/prefilter.py @@ -140,8 +140,8 @@ def prefilter(line_info, ip): checkEscChars, checkAssignment, checkAutomagic, - checkPythonOps, checkAlias, + checkPythonOps, checkAutocall, ]: handler = check(line_info, ip) @@ -238,17 +238,6 @@ def checkAutomagic(l_info,ip): return ip.handle_magic -def checkPythonOps(l_info,ip): - """If the 'rest' of the line begins with a function call or pretty much - any python operator, we should simply execute the line (regardless of - whether or not there's a possible alias or autocall expansion). This - avoids spurious (and very confusing) geattr() accesses.""" - if l_info.theRest and l_info.theRest[0] in '!=()<>,+*/%^&|': - return ip.handle_normal - else: - return None - - def checkAlias(l_info,ip): "Check if the initital identifier on the line is an alias." # Note: aliases can not contain '.' @@ -262,6 +251,17 @@ def checkAlias(l_info,ip): return ip.handle_alias +def checkPythonOps(l_info,ip): + """If the 'rest' of the line begins with a function call or pretty much + any python operator, we should simply execute the line (regardless of + whether or not there's a possible autocall expansion). This avoids + spurious (and very confusing) geattr() accesses.""" + if l_info.theRest and l_info.theRest[0] in '!=()<>,+*/%^&|': + return ip.handle_normal + else: + return None + + def checkAutocall(l_info,ip): "Check if the initial word/function is callable and autocall is on." if not ip.rc.autocall: diff --git a/test/test_prefilter.py b/test/test_prefilter.py index 499a5bc..f240303 100644 --- a/test/test_prefilter.py +++ b/test/test_prefilter.py @@ -292,6 +292,7 @@ for ac_state in [0,1]: # XXX See note above #("alias_head.with_dot unshadowed, autocall=%s" % ac_state, handle_alias), ("alias_cmd.something aliases must match whole expr", handle_normal), + ("alias_cmd /", handle_alias), ]) for ns in [ip.user_ns, ip.IP.internal_ns, __builtin__.__dict__ ]: