This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: site.py does not handle readline.__doc__ being None
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, ned.deily, pitrou, python-dev, r.david.murray, theller
Priority: normal Keywords: 3.3regression, easy, patch

Created on 2013-08-27 13:15 by theller, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue18852.diff berker.peksag, 2013-08-30 17:28 review
Messages (8)
msg196285 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2013-08-27 13:15
In site.py, line 477, I find this code:

        # Reading the initialization (config) file may not be enough to set a
        # completion key, so we set one first and then read the file
        if 'libedit' in getattr(readline, '__doc__', ''):
            readline.parse_and_bind('bind ^I rl_complete')

I am using pyreadline on Windows, where readline.__doc__ is None.

So the above code crashes with this exception:

Python 3.4.0a1 (v3.4.0a1:46535f65e7f3, Aug  3 2013, 22:57:30) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Failed calling sys.__interactivehook__
Traceback (most recent call last):
  File "C:\Python34-64\lib\site.py", line 477, in register_readline
    if 'libedit' in getattr(readline, '__doc__', ''):
TypeError: argument of type 'NoneType' is not iterable
msg196293 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-08-27 14:15
I don't think __doc__ can ever not exist, so that code is just wrong :)
msg196563 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2013-08-30 17:28
Here's a patch with a comment about using pyreadline on Windows.

Should the note in the readline documentation[1] be updated?

[1] http://docs.python.org/3.4/library/readline.html

(See also issue 5845 and msg123703)
msg196568 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-08-30 18:20
The use of libedit is not restricted to OS X; in particular, some other BSD-derived distributions use it.  There are some other open issues regarding generalization of support for libedit.  So I don't think the proposed comments should be added to site.py.  The docs for the readline module do not give a detailed code example (yet) so there's nothing to update there (yet).
msg197067 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2013-09-06 13:33
I suggest to remove the comment part from the patch and then apply it.
msg197082 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-09-06 17:09
New changeset 3070fdd58645 by R David Murray in branch 'default':
#18852: Handle readline.__doc__ being None in site.py readline activation.
http://hg.python.org/cpython/rev/3070fdd58645
msg197083 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-09-06 17:10
Done.  Thanks, Berker.
msg197084 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-09-06 17:10
Thanks David! I had forgotten about the issue.
History
Date User Action Args
2022-04-11 14:57:50adminsetgithub: 63052
2013-09-06 17:10:31pitrousetmessages: + msg197084
2013-09-06 17:10:15r.david.murraysetstatus: open -> closed
type: behavior
messages: + msg197083

resolution: fixed
stage: patch review -> resolved
2013-09-06 17:09:14python-devsetnosy: + python-dev
messages: + msg197082
2013-09-06 13:33:46thellersetmessages: + msg197067
2013-08-30 18:20:44ned.deilysetnosy: + ned.deily
messages: + msg196568
2013-08-30 17:28:11berker.peksagsetfiles: + issue18852.diff
keywords: + patch
messages: + msg196563

stage: needs patch -> patch review
2013-08-30 12:51:56berker.peksagsetnosy: + berker.peksag
2013-08-27 14:15:18r.david.murraysetnosy: + r.david.murray
title: Problem with pyreadline -> site.py does not handle readline.__doc__ being None
messages: + msg196293

keywords: + easy
stage: needs patch
2013-08-27 13:31:09serhiy.storchakasetnosy: + pitrou
2013-08-27 13:15:07thellercreate