diff --git a/IPython/lib/deepreload.py b/IPython/lib/deepreload.py index 4cdd1e5..5a98e83 100644 --- a/IPython/lib/deepreload.py +++ b/IPython/lib/deepreload.py @@ -93,7 +93,7 @@ def get_parent(globals, level): else: # Normal module, so work out the package name if any lastdot = modname.rfind('.') - if lastdot < 0 and level > 0: + if lastdot < 0 < level: raise ValueError("Attempted relative import in non-package") if lastdot < 0: globals['__package__'] = None diff --git a/IPython/utils/PyColorize.py b/IPython/utils/PyColorize.py index aec5231..cb9c67f 100644 --- a/IPython/utils/PyColorize.py +++ b/IPython/utils/PyColorize.py @@ -235,7 +235,7 @@ class Parser: return # map token type to a color group - if token.LPAR <= toktype and toktype <= token.OP: + if token.LPAR <= toktype <= token.OP: toktype = token.OP elif toktype == token.NAME and keyword.iskeyword(toktext): toktype = _KEYWORD