Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipython2/ipython3 prompt crashed when input 「n = collections.namedtuple?」(under Ubuntu_16) #10299

Closed
ming2281 opened this issue Feb 17, 2017 · 1 comment
Milestone

Comments

@ming2281
Copy link

ming2281 commented Feb 17, 2017

Description

Actual

When I input n = collections.namedtuple?, the ipython crashed

Except

The ipython works fine

Reproduce

  1. you must have an ubuntu server 16 x64
  2. input ipython3
  3. input import collections
  4. input n = collections.namedtuple?
  5. then the IPython crashed and exited
  6. input ipython2
  7. do the same thing as above, then the ipython2 crashed and exited

Code

  • My crash code
ipython3
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
Type "copyright", "credits" or "license" for more information.

IPython 5.2.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import collections

In [2]: n = collections.namedtuple?
Signature: collections.namedtuple(typename, field_names, verbose=False, rename=False)
Docstring:
Returns a new subclass of tuple with named fields.

>>> Point = namedtuple('Point', ['x', 'y'])
>>> Point.__doc__                   # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22)             # instantiate with positional args or keywords
>>> p[0] + p[1]                     # indexable like a plain tuple
33
>>> x, y = p                        # unpack like a regular tuple
>>> x, y
(11, 22)
>>> p.x + p.y                       # fields also accessible by name
33
>>> d = p._asdict()                 # convert to a dictionary
>>> d['x']
11
>>> Point(**d)                      # convert from a dictionary
Point(x=11, y=22)
>>> p._replace(x=100)               # _replace() is like str.replace() but targets named fields
Point(x=100, y=22)
File:      /usr/lib/python3.5/collections/__init__.py
Type:      function

In [3]: n = collections.namedtuple?                                                                                                                                                            
Traceback (most recent call last):
  File "/usr/local/bin/ipython3", line 11, in <module>
    sys.exit(start_ipython())
  File "/usr/local/lib/python3.5/dist-packages/IPython/__init__.py", line 119, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/ipapp.py", line 348, in start
    self.shell.mainloop()
  File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/interactiveshell.py", line 455, in mainloop
    self.interact()
  File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/interactiveshell.py", line 438, in interact
    code = self.prompt_for_code()
  File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/interactiveshell.py", line 343, in prompt_for_code
    pre_run=self.pre_prompt, reset_current_buffer=True)
  File "/usr/local/lib/python3.5/dist-packages/prompt_toolkit/interface.py", line 408, in run
    self._pre_run(pre_run)
  File "/usr/local/lib/python3.5/dist-packages/prompt_toolkit/interface.py", line 383, in _pre_run
    pre_run()
  File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/interactiveshell.py", line 425, in pre_prompt
    self.pt_cli.application.buffer.text = cast_unicode_py2(self.rl_next_input)
  File "/usr/local/lib/python3.5/dist-packages/prompt_toolkit/buffer.py", line 371, in text
    assert self.cursor_position <= len(value)
AssertionError

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

Environment

  • Ubuntu Server
Linux VM-54-125-ubuntu 4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • IPython
{'commit_hash': u'5be56c7',
 'commit_source': 'installation',
 'default_encoding': 'ANSI_X3.4-1968',
 'ipython_path': '/usr/local/lib/python2.7/dist-packages/IPython',
 'ipython_version': '5.2.2',
 'os_name': 'posix',
 'platform': 'Linux-4.4.0-53-generic-x86_64-with-Ubuntu-16.04-xenial',
 'sys_executable': '/usr/bin/python',
 'sys_platform': 'linux2',
 'sys_version': '2.7.12 (default, Nov 19 2016, 06:48:10) \n[GCC 5.4.0 20160609]'}
{'commit_hash': '5be56c7',
 'commit_source': 'installation',
 'default_encoding': 'ANSI_X3.4-1968',
 'ipython_path': '/usr/local/lib/python3.5/dist-packages/IPython',
 'ipython_version': '5.2.2',
 'os_name': 'posix',
 'platform': 'Linux-4.4.0-53-generic-x86_64-with-Ubuntu-16.04-xenial',
 'sys_executable': '/usr/bin/python3',
 'sys_platform': 'linux',
 'sys_version': '3.5.2 (default, Nov 17 2016, 17:05:23) \n[GCC 5.4.0 20160609]'}

  • Python
ipython3
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
Type "copyright", "credits" or "license" for more information.

IPython 5.2.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
ipython2
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
Type "copyright", "credits" or "license" for more information.

IPython 5.2.2 -- An enhanced Interactive Python.
@ming2281
Copy link
Author

Duplicate with #10289

@Carreau Carreau modified the milestone: no action May 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants