[IPython-dev] Regression bug in 0.8.x input filtering

Hans Meine hans_meine at gmx.net
Fri May 18 06:42:22 EDT 2007


Hi!

This won't come as a surprise AFAICS, but it's a great thing we have a test 
suite now.  Today, I tried to paste the following multi-line statement from 
epydoc's sources into ipython, and got an exception:

_SIGNATURE_RE = re.compile(
    # Class name (for builtin methods)
    r'^\s*((?P<self>\w+)\.)?' +
    # The function name (must match exactly) [XX] not anymore!
    r'(?P<func>\w+)' +
    # The parameters
    r'\((?P<params>(\s*\[?\s*\*{0,2}[\w\-\.]+(\s*=.+?)?'+
    r'(\s*\[?\s*,\s*\]?\s*\*{0,2}[\w\-\.]+(\s*=.+?)?)*\]*)?)\s*\)' +
    # The return value (optional)
    r'(\s*(->)\s*(?P<return>\S.*?))?'+
    # The end marker
    r'\s*(\n|\s+(--|<=+>)\s+|$|\.\s+|\.\n)')

The latest 0.8.x versions throw an error on the second non-comment 
continuation line:

IPython 0.8.1 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: _SIGNATURE_RE = re.compile(
   ...:     # Class name (for builtin methods)
   ...:     r'^\s*((?P<self>\w+)\.)?' +
   ...:     # The function name (must match exactly) [XX] not anymore!
   ...:     r'(?P<func>\w+)' +
------------------------------------------------------------
   File "<ipython console>", line 5
     _ip.magic(r"r '(?P<func>\w+)' +")
       ^
SyntaxError: invalid syntax

It works with 0.7.x though (I tried 0.7.1 and 0.7.3, both 0.8.0 and 0.8.1 
fail).

Ciao, /  /
     /--/
    /  / ANS



More information about the IPython-dev mailing list