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
7963a35b
Kaydet (Commit)
7963a35b
authored
May 23, 2011
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
correctly lookup __dir__
üst
2cca0572
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
test_descr.py
Lib/test/test_descr.py
+1
-0
NEWS
Misc/NEWS
+3
-0
object.c
Objects/object.c
+6
-5
No files found.
Lib/test/test_descr.py
Dosyayı görüntüle @
7963a35b
...
...
@@ -1595,6 +1595,7 @@ order (MRO) for bases """
# probably not worth it.
# ("__enter__", run_context, iden),
# ("__exit__", run_context, iden),
(
"__dir__"
,
dir
,
empty_seq
,
set
(),
{}),
]
class
Checker
(
object
):
...
...
Misc/NEWS
Dosyayı görüntüle @
7963a35b
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.1.4?
Core and Builtins
-----------------
- Correct lookup of __dir__ on objects. Among other things, this causes errors
besides AttributeError found on lookup to be propagated.
- Issue #12060: Use sig_atomic_t type and volatile keyword in the signal
module. Patch written by Charles-François Natali.
...
...
Objects/object.c
Dosyayı görüntüle @
7963a35b
...
...
@@ -1348,14 +1348,15 @@ error:
static
PyObject
*
_dir_object
(
PyObject
*
obj
)
{
PyObject
*
result
=
NULL
;
PyObject
*
dirfunc
=
PyObject_GetAttrString
((
PyObject
*
)
obj
->
ob_type
,
"__dir__"
);
PyObject
*
result
=
NULL
;
static
PyObject
*
dir_str
=
NULL
;
PyObject
*
dirfunc
=
_PyObject_LookupSpecial
(
obj
,
"__dir__"
,
&
dir_str
);
assert
(
obj
);
if
(
dirfunc
==
NULL
)
{
if
(
PyErr_Occurred
())
return
NULL
;
/* use default implementation */
PyErr_Clear
();
if
(
PyModule_Check
(
obj
))
result
=
_specialized_dir_module
(
obj
);
else
if
(
PyType_Check
(
obj
))
...
...
@@ -1365,7 +1366,7 @@ _dir_object(PyObject *obj)
}
else
{
/* use __dir__ */
result
=
PyObject_CallFunctionObjArgs
(
dirfunc
,
obj
,
NULL
);
result
=
PyObject_CallFunctionObjArgs
(
dirfunc
,
NULL
);
Py_DECREF
(
dirfunc
);
if
(
result
==
NULL
)
return
NULL
;
...
...
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