Skip to content

Commit 2ecdf34

Browse files
parens unsafely added to attribute completions
1 parent 2a9b51f commit 2ecdf34

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

bpython/autocomplete.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,10 @@ def matches(self, cursor_offset, line, **kwargs):
253253
matches = set(''.join([r.word[:-i], m])
254254
for m in self.attr_matches(methodtext, locals_))
255255

256-
# TODO add open paren for methods via _callable_prefix (or decide not
257-
# to) unless the first character is a _ filter out all attributes
256+
# TODO add open paren for methods via _callable_prefix
257+
matches = set(_callable_postfix(eval(m, locals_), m)
258+
for m in matches)
259+
# unless the first character is a _ filter out all attributes
258260
# starting with a _
259261
if r.word.split('.')[-1].startswith('__'):
260262
pass

bpython/test/test_autocomplete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def setUpClass(cls):
242242

243243
def test_att_matches_found_on_instance(self):
244244
self.assertSetEqual(self.com.matches(2, 'a.', locals_={'a': Foo()}),
245-
set(['a.method', 'a.a', 'a.b']))
245+
set(['a.method(', 'a.a', 'a.b']))
246246

247247
@skip_old_style
248248
def test_att_matches_found_on_old_style_instance(self):

0 commit comments

Comments
 (0)