Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
fa9ea046
Kaydet (Commit)
fa9ea046
authored
Kas 13, 2015
tarafından
Martin Panter
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #25590: Merge rlcompleter change from 3.4 into 3.5
üst
75559aff
06622ead
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
7 deletions
+26
-7
rlcompleter.py
Lib/rlcompleter.py
+10
-7
test_rlcompleter.py
Lib/test/test_rlcompleter.py
+13
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/rlcompleter.py
Dosyayı görüntüle @
fa9ea046
...
...
@@ -136,20 +136,23 @@ class Completer:
return
[]
# get the content of the object, except __builtins__
words
=
dir
(
thisobject
)
if
"__builtins__"
in
words
:
words
.
remove
(
"__builtins__"
)
words
=
set
(
dir
(
thisobject
))
words
.
discard
(
"__builtins__"
)
if
hasattr
(
thisobject
,
'__class__'
):
words
.
a
ppen
d
(
'__class__'
)
words
.
extend
(
get_class_members
(
thisobject
.
__class__
))
words
.
a
d
d
(
'__class__'
)
words
.
update
(
get_class_members
(
thisobject
.
__class__
))
matches
=
[]
n
=
len
(
attr
)
for
word
in
words
:
if
word
[:
n
]
==
attr
and
hasattr
(
thisobject
,
word
):
val
=
getattr
(
thisobject
,
word
)
if
word
[:
n
]
==
attr
:
try
:
val
=
getattr
(
thisobject
,
word
)
except
Exception
:
continue
# Exclude properties that are not set
word
=
self
.
_callable_postfix
(
val
,
"
%
s.
%
s"
%
(
expr
,
word
))
matches
.
append
(
word
)
matches
.
sort
()
return
matches
def
get_class_members
(
klass
):
...
...
Lib/test/test_rlcompleter.py
Dosyayı görüntüle @
fa9ea046
...
...
@@ -64,6 +64,19 @@ class TestRlcompleter(unittest.TestCase):
[
'egg.{}('
.
format
(
x
)
for
x
in
dir
(
str
)
if
x
.
startswith
(
's'
)])
def
test_excessive_getattr
(
self
):
# Ensure getattr() is invoked no more than once per attribute
class
Foo
:
calls
=
0
@property
def
bar
(
self
):
self
.
calls
+=
1
return
None
f
=
Foo
()
completer
=
rlcompleter
.
Completer
(
dict
(
f
=
f
))
self
.
assertEqual
(
completer
.
complete
(
'f.b'
,
0
),
'f.bar'
)
self
.
assertEqual
(
f
.
calls
,
1
)
def
test_complete
(
self
):
completer
=
rlcompleter
.
Completer
()
self
.
assertEqual
(
completer
.
complete
(
''
,
0
),
'
\t
'
)
...
...
Misc/NEWS
Dosyayı görüntüle @
fa9ea046
...
...
@@ -67,6 +67,9 @@ Core and Builtins
Library
-------
-
Issue
#
25590
:
In
the
Readline
completer
,
only
call
getattr
()
once
per
attribute
.
-
Issue
#
25498
:
Fix
a
crash
when
garbage
-
collecting
ctypes
objects
created
by
wrapping
a
memoryview
.
This
was
a
regression
made
in
3.5
a1
.
Based
on
patch
by
Eryksun
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment