classification
Title: rlcompleter adds builtins when custom dict is used
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: armandas, eric.araujo, ezio.melotti, maker, mark.dickinson, pitrou, r.david.murray, vstinner
Priority: normal Keywords: needs review, patch

Created on 2009-02-14 00:04 by armandas, last changed 2019-07-29 12:02 by vstinner.

Files
File name Uploaded Description Edit
rlcompleter.patch maker, 2010-08-07 07:27 issue5256 fix + unittests review
rlcompleter_docs.patch maker, 2010-08-07 15:38 issue5256 doc review
issue5256.patch maker, 2012-10-14 20:59
issue5256.1.patch maker, 2012-10-15 20:08
Messages (9)
msg81979 - (view) Author: Armandas (armandas) Date: 2009-02-14 00:04
When custom dictionary is used to create a completer, rlcompleter still
uses __builtins__.__dict__ to search for completions (rlcompleter.py,
global_matches()):

for nspace in [builtins.__dict__, self.namespace]:
...

This behaviour may sometimes be unwanted. It would be nice to have an
option, which when set would tell completer to only use provided dictionary.
msg113154 - (view) Author: Michele Orrù (maker) * Date: 2010-08-07 07:27
The attached patch fixes this issue and provides some tests.
msg113169 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-08-07 12:04
The report says “This behaviour may sometimes be unwanted. It would be nice to have an option”, so I’m requalifying as a RFE and adjusting versions.

The patch changes behavior (search order was builtins, self.namespace and is now reversed), is this wanted?

The patch also needs to update the doc.

Thanks!
msg113180 - (view) Author: Michele Orrù (maker) * Date: 2010-08-07 15:21
Yes, it is. I think the user would expect that kind of behaviour.

The attached patch updates the Doc.
msg172914 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-10-14 20:24
Looks good to me.  I wrote one comment on the doc patch review.
msg172921 - (view) Author: Michele Orrù (maker) * Date: 2012-10-14 20:59
Updated with tip, and merged with documentation.
msg172955 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-10-15 10:37
I would make the argument keyword-only.
Changing the logic to avoid eval() might be OK, but IIUC is not related to this issue, and it should be done separately.
The markup in the doc could be better (`...` should be ``...`` or a more specific directive that generates a link).  A versionchanged should be added as well.
msg172999 - (view) Author: Michele Orrù (maker) * Date: 2012-10-15 20:08
Updated. Note that removing `eval` is necessary for the new logic of the function.
msg348652 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-07-29 12:02
This issue is not newcomer friendly, I remove the easy keyword.
History
Date User Action Args
2019-07-29 12:02:35vstinnersetkeywords: - easy
nosy: + vstinner
messages: + msg348652

2012-10-15 20:08:48makersetfiles: + issue5256.1.patch

messages: + msg172999
2012-10-15 10:37:03ezio.melottisetmessages: + msg172955
2012-10-14 20:59:22makersetfiles: + issue5256.patch

messages: + msg172921
2012-10-14 20:24:35eric.araujosetmessages: + msg172914
2012-10-14 20:19:46eric.araujosetkeywords: + needs review
versions: + Python 3.4, - Python 3.2
2010-08-07 15:38:59makersetfiles: + rlcompleter_docs.patch
2010-08-07 15:38:24makersetfiles: - rlcompleter_docs.patch
2010-08-07 15:21:38makersetfiles: + rlcompleter_docs.patch

messages: + msg113180
2010-08-07 12:04:21eric.araujosetversions: - Python 3.1, Python 2.7
nosy: + eric.araujo

messages: + msg113169

type: behavior -> enhancement
stage: test needed -> patch review
2010-08-07 07:29:29makersetnosy: + mark.dickinson, pitrou, ezio.melotti, r.david.murray
2010-08-07 07:27:07makersetfiles: + rlcompleter.patch

nosy: + maker
messages: + msg113154

keywords: + patch
2010-07-10 16:35:13BreamoreBoysetcomponents: + Library (Lib), - None
versions: + Python 3.1, Python 2.7, Python 3.2, - Python 3.0
2009-04-22 17:18:09ajaksu2setkeywords: + easy
stage: test needed
2009-02-14 00:04:18armandascreate