py-indent-or-complete at the very end of a line produces weird backtrace

Bug #1508179 reported by deuscovrigus@gmail.com
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Undecided
Unassigned

Bug Description

For the simple code block with the cursor placed on the last parenthesis of line 3, invoking py-indent-or-complete gives me a weird error;

import numpy as np
for i in xrange(0,10):
    b = np.arange(0,i)

Click <mouse-2> on a completion to select it.
In this buffer, type M-x choose-completion to select the completion near point.

Possible completions are:

--> 265 l = line if cursor_pos is None else line[:cursor_pos]
    266 return self._delim_re.split(l)[-1]
    267

TypeError: 'NoneType' object has no attribute '__getitem__

--> 658 return self.complete(text)[1]
    659
    660 def _clean_glob(self,text):

/usr/local/lib/python2.7/dist-packages/IPython/core/completer.pyc in complete(self, text, line_buffer, cursor_pos)
   1159 # if text is either None or an empty string, rely on the line buffer
   1160 if not text:
-> 1161 text = self.splitter.split_line(line_buffer, cursor_pos)
   1162
   1163 # If no line buffer is given, assume the input text is all there was

/usr/local/lib/python2.7/dist-packages/IPython/core/completer.pyc in split_line(self, line, cursor_pos)
    263 """Split a line of text with a cursor at the given position.
    264 ""
'.join(get_ipython().Completer.all_completions(''))) #PYTHON-MODE SILENT

/usr/local/lib/python2.7/dist-packages/IPython/core/completer.pyc in all_completions(self, text)
    656 and pydb.
    657 ""
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-8-8e220300697e> in <module>()
----> 1 print('

So I don't really know where this comes from, I can report in on my ubuntu machine, I couldn't repoduce this on my OS X. Is it maybe my python interpreter?

Btw gratz on releasing 6.2.1!

Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 1508179] [NEW] py-indent-or-complete at the very end of a line produces weird backtrace

  On 20.10.2015 21:41, <email address hidden> wrote:
> Public bug reported:
>
> For the simple code block with the cursor placed on the last parenthesis
> of line 3, invoking py-indent-or-complete gives me a weird error;
>
> import numpy as np
> for i in xrange(0,10):
> b = np.arange(0,i)
>
> Click<mouse-2> on a completion to select it.
> In this buffer, type M-x choose-completion to select the completion near point.
>
> Possible completions are:
>
> --> 265 l = line if cursor_pos is None else line[:cursor_pos]
> 266 return self._delim_re.split(l)[-1]
> 267
>
> TypeError: 'NoneType' object has no attribute '__getitem__
>
> --> 658 return self.complete(text)[1]
> 659
> 660 def _clean_glob(self,text):
>
> /usr/local/lib/python2.7/dist-packages/IPython/core/completer.pyc in complete(self, text, line_buffer, cursor_pos)
> 1159 # if text is either None or an empty string, rely on the line buffer
> 1160 if not text:
> -> 1161 text = self.splitter.split_line(line_buffer, cursor_pos)
> 1162
> 1163 # If no line buffer is given, assume the input text is all there was
>
> /usr/local/lib/python2.7/dist-packages/IPython/core/completer.pyc in split_line(self, line, cursor_pos)
> 263 """Split a line of text with a cursor at the given position.
> 264 ""
> '.join(get_ipython().Completer.all_completions(''))) #PYTHON-MODE SILENT
>
> /usr/local/lib/python2.7/dist-packages/IPython/core/completer.pyc in all_completions(self, text)
> 656 and pydb.
> 657 ""
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call last)
> <ipython-input-8-8e220300697e> in<module>()
> ----> 1 print('
>
> So I don't really know where this comes from, I can report in on my
> ubuntu machine, I couldn't repoduce this on my OS X. Is it maybe my
> python interpreter?
>
> Btw gratz on releasing 6.2.1!
>
> ** Affects: python-mode
> Importance: Undecided
> Status: New
>

Thanks reporting. Will look for it ASAP.

Changed in python-mode:
status: New → Fix Committed
Revision history for this message
deuscovrigus@gmail.com (deuscovrigus) wrote :

It works now after the latest commit! Thanks!

Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.