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.

Author ned.deily
Recipients ned.deily, ronaldoussoren
Date 2010-09-20.21:36:45
SpamBayes Score 0.0
Marked as misclassified No
Message-id <1285018607.7.0.0427821796342.issue9907@psf.upfronthosting.co.za>
In-reply-to
Content
When building Python on OS X, there is now support for linking Python with the readline compatibility interface of the OS X supplied BSD editline library rather than using the GNU readline library.  Because of deficiencies in the version in earlier OS X releases, this support is only enabled for builds with a deployment target of 10.5 or higher.  With the python 2.7 release, for the first time a python.org installer for OS X is available that uses this capability: the 10.5 and higher 32-bit/64-bit version. The 10.3 and higher 32-bit-only installer uses GNU readline as do previous installers.  There is a behavior regression in the editline-linked versions: when started in interactive mode, the TAB key does not insert, rather it inserts a "./" file spec in the command buffer and a second TAB causes a completion search of files in the current directory.

With readline and typing <TAB> <CR>:

  $ unset PYTHONSTARTUP 
  $ python2.7
  Python 2.7 (r27:82508, Jul  3 2010, 20:17:05) 
  [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>>     
  ... 
  $ 

With editline and <TAB> <CR>:

  $ unset PYTHONSTARTUP 
  $ python2.7
  Python 2.7 (r27:82508, Jul  3 2010, 21:12:11) 
  [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> ./
    File "<stdin>", line 1
      ./
      ^
  SyntaxError: invalid syntax
  >>> ^D

Two workarounds for python2.7 until the problem is addressed in a future installer:

   (1) either install the 10.3 and up python 2.7

or (2) add or edit a python startup file for python2.7:

       $ cat > $HOME/.pystartup
       import readline
       if 'libedit' in readline.__doc__:
           readline.parse_and_bind("bind ^I ed-insert")
       ^D
       $ export PYTHONSTARTUP=$HOME/.pystartup


Since whitespace is significant in Python, Modules/readline.c initialization attempts to override TAB behavior by forcing TAB to "insert" by default (unless overridden by later readline module calls).  Somehow that is failing when going through editline's readline compatibility layer.
History
Date User Action Args
2010-09-20 21:36:47ned.deilysetrecipients: + ned.deily, ronaldoussoren
2010-09-20 21:36:47ned.deilysetmessageid: <1285018607.7.0.0427821796342.issue9907@psf.upfronthosting.co.za>
2010-09-20 21:36:46ned.deilylinkissue9907 messages
2010-09-20 21:36:45ned.deilycreate