Code snippets failing on the interpreter
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
IPython |
Fix Released
|
Medium
|
Brian Granger |
Bug Description
In [1]: from IPython.
In [2]: i = Interpreter()
In [3]: i.execute('from textwrap import dedent')
Out[3]:
{'input': {'raw': 'from textwrap import dedent',
'number': 1}
In [4]: i.execute(
-------
TypeError Traceback (most recent call last)
/home/gvaroquau
/home/gvaroquau
373 outflag = 1 # start by assuming error, success will reset it
374 try:
--> 375 exec code in self.user_ns
376 outflag = 0
377 except SystemExit:
TypeError: exec: arg 1 must be a string, file, or code object
In [5]: i.execute(
-------
IndentationError Traceback (most recent call last)
/home/gvaroquau
/home/gvaroquau
352 for cmd in commands:
353 try:
--> 354 code = self.command_
355 except (SyntaxError, OverflowError, ValueError), e:
356 self.traceback_
/usr/lib/
164 - Raise SyntaxError, ValueError or OverflowError if the command is a
165 syntax error (OverflowError and ValueError can be produced by
166 malformed literals).
167 """
--> 168 return _maybe_
/usr/lib/
97 return code
98 if not code1 and repr(err1) == repr(err2):
---> 99 raise SyntaxError, err1
100
101 def _compile(source, filename, symbol):
IndentationError: unexpected indent (<string>, line 1)
Related branches
- Fernando Perez: Needs Fixing
- Diff: None lines
Changed in ipython: | |
assignee: | nobody → ellisonbg |
importance: | Undecided → Medium |
status: | New → Confirmed |
Changed in ipython: | |
status: | Fix Committed → Fix Released |
This also shows up for the even simpler commands:
str("""a\nb""")
and:
str("a\nb")
I have added tests for these cases and comments in interpreter.py about what lines of code are causing these problem. The difficulty is that some of them look to be a bug in python itself.