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: Export Readline version and expect ANSI sequence for version < 0x0600
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, David.Edelsohn, ned.deily, pitrou, python-dev, vstinner
Priority: normal Keywords:

Created on 2014-10-31 14:01 by David.Edelsohn, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Issue22773.txt David.Edelsohn, 2014-10-31 14:02 review
Issue22773.txt David.Edelsohn, 2014-10-31 14:13 v2 review
Issue22773.txt David.Edelsohn, 2014-10-31 21:09 v3 review
Issue22773.txt David.Edelsohn, 2014-10-31 22:26 v4 review
Messages (19)
msg230340 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2014-10-31 14:01
The patch for Issue19884 to set enable-meta-key to "off" does not work when readline-devel package is libreadline5, which includes SLES 11.
msg230341 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2014-10-31 14:02
Patch attached to export version and skip test if version less than 0x600.
msg230342 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2014-10-31 14:13
Revised patch with leading underscores to make version objects private.
msg230344 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-10-31 14:27
I would prefer to see the bug fixed instead of being skipped :-/ Is there a way to fix the issue, but differently on readline < 6.0?
msg230346 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2014-10-31 14:46
The portion of the patch to skip the test is necessary because, as mentioned in Issue19884, setting enable-meta-key does not work in older releases of libreadline. The particular combination of default TERM and libreadline is rare in old OS versions and can be worked around by setting TERM=dummy.
msg230347 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-10-31 14:54
+1 for the patch.
msg230366 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2014-10-31 18:30
Naming it _READLINE_BUILDTIME_VERSION instead of _READLINE_VERSION would avoid ambiguity.
msg230368 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2014-10-31 18:37
I am trying to follow the precedent of zlibmodule with the naming so that users of Python modules have as consistent an experience and user interface as possible.
msg230371 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-10-31 18:39
Indeed, I think there's no ambiguity here. Victor, are you ok with the patch?
msg230382 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-10-31 20:22
The patch doesn't take into account that the readline module may be linked with BSD libedit (as is the default on OS X and is preferred by some third-party distributors) rather than GNU readline.  The patch causes the test to be incorrectly skipped on those platforms.

>>> readline._READLINE_VERSION
1026

The documented way of differentiating the two cases is by checking the __doc__ string for "readline" or "libedit":

>>> readline.__doc__
'Importing this module enables command line editing using libedit readline.'

vs.

>>> readline.__doc__
'Importing this module enables command line editing using GNU readline.'
msg230383 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-10-31 20:25
Make that: The documented way of differentiating the two cases is by checking the __doc__ string for "libedit".
msg230384 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-10-31 20:34
In the past, I added sys.thread_info to be able to skip tests on some old platforms. Maybe we need something similar: an object with runtime version, build version, implementation name, etc.
msg230386 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2014-10-31 20:42
@ned.deily Can you offer a suggestion of how you you like the skipIf test modified to check __doc__ for "libedit"?
msg230387 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-10-31 20:58
Something like:

    @unittest.skipIf(("libedit" not in readline.__doc__)
                         and (readline._READLINE_VERSION < 0x6000),
                     "not supported in this library version")

should work.
msg230388 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2014-10-31 21:09
Okay, grouping was wrong in my initial attempt.  New patch attached.
msg230392 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-10-31 21:35
The test works OK with libedit now, thanks.  But are you sure about the readline version test?  Testing with a GNU readline 6.3:

>>> print('%x' % readline._READLINE_RUNTIME_VERSION)
603

so the test_readline check:

   readline._READLINE_VERSION < 0x6000

causes the test to be incorrectly skipped.  What does _READLINE_RUNTIME_VERSION look like for an older version of readline?
msg230404 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2014-10-31 22:26
The test should be 0x0600.
msg230621 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-11-04 13:53
New changeset c4b5a5d44254 by Antoine Pitrou in branch '3.4':
Issue #22773: fix failing test with old readline versions due to issue #19884.
https://hg.python.org/cpython/rev/c4b5a5d44254

New changeset be374b8c40c8 by Antoine Pitrou in branch 'default':
Issue #22773: fix failing test with old readline versions due to issue #19884.
https://hg.python.org/cpython/rev/be374b8c40c8
msg230623 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-11-04 13:56
New changeset eba6e68e818c by Antoine Pitrou in branch '2.7':
Issue #22773: fix failing test with old readline versions due to issue #19884.
https://hg.python.org/cpython/rev/eba6e68e818c
History
Date User Action Args
2022-04-11 14:58:09adminsetgithub: 66962
2014-11-04 14:14:52pitrousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2014-11-04 13:56:46python-devsetmessages: + msg230623
2014-11-04 13:53:12python-devsetnosy: + python-dev
messages: + msg230621
2014-11-01 21:49:50David.Edelsohnsettitle: Export Readline version and expect ANSI sequence for version < 0x6000 -> Export Readline version and expect ANSI sequence for version < 0x0600
2014-10-31 22:26:20David.Edelsohnsetfiles: + Issue22773.txt

messages: + msg230404
2014-10-31 21:35:31ned.deilysetmessages: + msg230392
2014-10-31 21:09:37David.Edelsohnsetfiles: + Issue22773.txt

messages: + msg230388
2014-10-31 20:58:58ned.deilysetmessages: + msg230387
2014-10-31 20:42:51David.Edelsohnsetmessages: + msg230386
2014-10-31 20:34:42vstinnersetmessages: + msg230384
2014-10-31 20:25:06ned.deilysetmessages: + msg230383
2014-10-31 20:22:26ned.deilysetnosy: + ned.deily
messages: + msg230382
2014-10-31 18:39:36pitrousetmessages: + msg230371
2014-10-31 18:37:05David.Edelsohnsetmessages: + msg230368
2014-10-31 18:30:40Arfreversetnosy: + Arfrever
messages: + msg230366
2014-10-31 14:54:29pitrousetstage: patch review
messages: + msg230347
versions: + Python 2.7, Python 3.4, Python 3.5
2014-10-31 14:46:21David.Edelsohnsetmessages: + msg230346
2014-10-31 14:27:59vstinnersetmessages: + msg230344
2014-10-31 14:13:52David.Edelsohnsetfiles: + Issue22773.txt

messages: + msg230342
2014-10-31 14:02:49David.Edelsohnsetfiles: + Issue22773.txt
type: behavior
messages: + msg230341
2014-10-31 14:01:28David.Edelsohncreate