Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix behaviour of dedent triggering. Closes gh-142.

  • Loading branch information...
commit 2b929059d9dbf938b155aa9da92f9254c15d6a28 1 parent 47ca451
@dwf authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 IPython/core/inputsplitter.py
View
8 IPython/core/inputsplitter.py
@@ -103,7 +103,13 @@
# while developing.
# compiled regexps for autoindent management
-dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
+dedent_re = re.compile('|'.join([
+ r'^\s+raise(\s.*)?$', # raise statement (+ space + other stuff, maybe)
+ r'^\s+raise\([^\)]*\).*$', # wacky raise with immediate open paren
+ r'^\s+return(\s.*)?$', # normal return (+ space + other stuff, maybe)
+ r'^\s+return\([^\)]*\).*$', # wacky return with immediate open paren
+ r'^\s+pass\s*$' # pass (optionally followed by trailing spaces)
+]))
ini_spaces_re = re.compile(r'^([ \t\r\f\v]+)')
# regexp to match pure comment lines so we don't accidentally insert 'if 1:'

0 comments on commit 2b92905

Please sign in to comment.
Something went wrong with that request. Please try again.