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 henry.precheur
Recipients henry.precheur
Date 2008-08-22.05:41:04
SpamBayes Score 6.090744e-08
Marked as misclassified No
Message-id <1219383669.6.0.427882345707.issue3645@psf.upfronthosting.co.za>
In-reply-to
Content
$ python2.5                                                            
                 
Python 2.5.2 (r252:60911, Jun 16 2008, 15:20:47)                       
                 
[GCC 3.3.5 (propolice)] on openbsd4                                    
                 
Type "help", "copyright", "credits" or "license" for more information. 
                 
>>> def complete(text, state):                                         
                 
...     print 'complete %r %d' % (text, state)                         
                 
...     if text == 'i' and state == 0:                                 
                 
...         return 'import'                                            
                 
...     else:                                                          
                 
...         return None                                                
                 
...                                                                    
                 
>>> import readline; readline.parse_and_bind("tab: complete")
>>> readline.set_completer(complete)                                   
                                     
>>> i<TAB> # <TAB> is press the tab key                                
                 
complete 'i' 0                                                         
                 
complete 'i' 1                                                         
                 
Segmentation fault (core dumped)                                       
                 
                                                                       
                 
The problem is that Python is using a function present in libreadline  
                 
but not declared in readline/readline.h: completion_matches. Instead of
                 
using rl_completion_matches.                                           
                 
                                                                       
                 
Therefor the return type of completion_matches was an int which is     
                 
32bits on amd64 but the function was supposed to returns a pointer which
                
is 64 bits. So when the pointer had a "high" value, it was truncated.  
                 
                                                                       
                 
The problem is fixed by adding libcurses to AC_CHECK_LIB when checking
for functions in libreadline since libreadline depends on curses. This
makes Python use the correct functions declared on readline.h with a   
                       
correct return type.

Patch is attached.

(Others versions of Python should also be affected)
History
Date User Action Args
2008-08-22 05:41:10henry.precheursetrecipients: + henry.precheur
2008-08-22 05:41:09henry.precheursetmessageid: <1219383669.6.0.427882345707.issue3645@psf.upfronthosting.co.za>
2008-08-22 05:41:07henry.precheurlinkissue3645 messages
2008-08-22 05:41:06henry.precheurcreate