Issue547176
Created on 2002年04月22日 17:39 by schiekjd, last changed 2022年04月10日 16:05 by admin. This issue is now closed.
Files |
File name |
Uploaded |
Description |
Edit |
rlcompleter.diff
|
schiekjd,
2002年04月22日 17:39
|
diff for fix on v1.11 from CVS |
Messages (5) |
msg39679 - (view) |
Author: wortelslaai (schiekjd) |
Date: 2002年04月22日 17:39 |
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
|
msg39680 - (view) |
Author: Michael Stone (mbrierst) |
Date: 2003年02月04日 20:26 |
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.
|
msg39681 - (view) |
Author: Brett Cannon (brett.cannon) * (Python committer) |
Date: 2003年05月17日 02:02 |
Logged In: YES
user_id=357491
Making this a patch since one is included.
|
msg39682 - (view) |
Author: Georg Brandl (georg.brandl) * (Python committer) |
Date: 2005年02月23日 18:27 |
Logged In: YES
user_id=1188172
As the other commentors point out, this easily leads to
execution of arbitrary code via __getitem__, which is IMHO a
too big side effect of completing (though IPython does
this). Recommend reject.
|
msg39683 - (view) |
Author: Michael Hudson (mwh) (Python committer) |
Date: 2005年02月23日 18:56 |
Logged In: YES
user_id=6656
Closing. If you want a richer completion environment you can use IPython
or rlcompleter2.
|
History
|
---|
Date |
User |
Action |
Args |
2022年04月10日 16:05:15 | admin | set | github: 36484 |
2002年04月22日 17:39:43 | schiekjd | create |