[Patches] [ python-Patches-547176 ] rlcompleter does not expand on [ ]

SourceForge.net noreply@sourceforge.net
Fri, 16 May 2003 19:02:20 -0700


Patches item #547176, was opened at 2002-04-22 10:39
Message generated for change (Comment added) made by bcannon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=547176&group_id=5470

>Category: None
>Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jaco Schieke (schiekjd)
Assigned to: Nobody/Anonymous (nobody)
Summary: rlcompleter does not expand on [ ]

Initial Comment:
A thread on comp.lang.python details the problem:

http://groups.google.com/groups?
hl=en&threadm=b5ddd682.0204180902.2866a9c0%
40posting.google.com&rnum=1&prev=/groups%3Fhl%3Den%
26selm%3Db5ddd682.0204180902.2866a9c0%
2540posting.google.com

rlcompleter.py does not expand correctly on something 
like:
>>> sim[0].<tab>
since
  m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text)
does not allow for brackets in the match.

I propose:
  m = re.match(r"([\w\[\]]+(\.[\w\[\]]+)*)\.(\w*)", 
text)

to fix this on line 127 in cvs version 1.11




----------------------------------------------------------------------

>Comment By: Brett Cannon (bcannon)
Date: 2003-05-16 19:02

Message:
Logged In: YES 
user_id=357491

Making this a patch since one is included.

----------------------------------------------------------------------

Comment By: Michael Stone (mbrierst)
Date: 2003-02-04 12:26

Message:
Logged In: YES 
user_id=670441

This isn't really a bug, as (at least currently) this behavior is mentioned in the documentation for rlcompleter (at least it's in the docstring).  

The reason a[0].<tab> isn't completed is that we want to avoid executing arbitrary code.  The current completion mechanism is already a bit dangerous as an object's getattr could be called to execute code with unknown side effects while completing.  It just seems to dangerous to allow indexing, as lots of objects use this for their own purposes.

If this behavior is determined desirable despite the danger, someone with commit privileges should say so, and then someone can submit a patch (I could do it).
Probably this bug should just be closed.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=547176&group_id=5470