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
097cd072
Kaydet (Commit)
097cd072
authored
Tem 07, 2009
tarafından
Amaury Forgeot d'Arc
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#6428: py3k requires that __bool__ return a bool (and not an int)
Fix the error message and the documentation.
üst
dd07ebb4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
datamodel.rst
Doc/reference/datamodel.rst
+5
-5
NEWS
Misc/NEWS
+4
-0
typeobject.c
Objects/typeobject.c
+2
-4
No files found.
Doc/reference/datamodel.rst
Dosyayı görüntüle @
097cd072
...
@@ -1254,11 +1254,11 @@ Basic customization
...
@@ -1254,11 +1254,11 @@ Basic customization
.. index:: single: __len__() (mapping object method)
.. index:: single: __len__() (mapping object method)
Called to implement truth value testing and the built-in operation
Called to implement truth value testing and the built-in operation
``bool()``; should return ``False`` or ``True``
, or their integer equivalents
``bool()``; should return ``False`` or ``True``
. When this method is not
``0`` or ``1``. When this method is not defined, :meth:`__len__` is called,
defined, :meth:`__len__` is called, if it is defined, and the object is
if it is defined, and the object is considered true if its result is nonzero.
considered true if its result is nonzero. If a class defines neither
If a class defines neither :meth:`__len__` nor :meth:`__bool__`, all its
:meth:`__len__` nor :meth:`__bool__`, all its instances are considered
instances are considered
true.
true.
.. _attribute-access:
.. _attribute-access:
...
...
Misc/NEWS
Dosyayı görüntüle @
097cd072
...
@@ -12,6 +12,10 @@ What's New in Python 3.2 Alpha 1?
...
@@ -12,6 +12,10 @@ What's New in Python 3.2 Alpha 1?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #6428: Since Python 3.0, the __bool__ method must return a bool
object, and not an int. Fix the corresponding error message, and the
documentation.
- The deprecated PyCObject has been removed.
- The deprecated PyCObject has been removed.
- Issue #6347: Include inttypes.h as well as stdint.h in pyport.h.
- Issue #6347: Include inttypes.h as well as stdint.h in pyport.h.
...
...
Objects/typeobject.c
Dosyayı görüntüle @
097cd072
...
@@ -4807,10 +4807,8 @@ slot_nb_bool(PyObject *self)
...
@@ -4807,10 +4807,8 @@ slot_nb_bool(PyObject *self)
}
}
else
{
else
{
PyErr_Format
(
PyExc_TypeError
,
PyErr_Format
(
PyExc_TypeError
,
"%s should return "
"__bool__ should return "
"bool or int, returned %s"
,
"bool, returned %s"
,
(
using_len
?
"__len__"
:
"__bool__"
),
Py_TYPE
(
temp
)
->
tp_name
);
Py_TYPE
(
temp
)
->
tp_name
);
result
=
-
1
;
result
=
-
1
;
}
}
...
...
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