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
7c95bb35
Kaydet (Commit)
7c95bb35
authored
Eyl 27, 2012
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #16060: Fix a double DECREF in int() implementation. Thanks Serhiy Storchaka.
üst
3658cb30
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
+18
-4
test_int.py
Lib/test/test_int.py
+12
-0
NEWS
Misc/NEWS
+3
-0
abstract.c
Objects/abstract.c
+3
-4
No files found.
Lib/test/test_int.py
Dosyayı görüntüle @
7c95bb35
...
@@ -305,6 +305,18 @@ class IntTestCases(unittest.TestCase):
...
@@ -305,6 +305,18 @@ class IntTestCases(unittest.TestCase):
self
.
fail
(
"Failed to raise TypeError with
%
s"
%
self
.
fail
(
"Failed to raise TypeError with
%
s"
%
((
base
,
trunc_result_base
),))
((
base
,
trunc_result_base
),))
# Regression test for bugs.python.org/issue16060.
class
BadInt
(
trunc_result_base
):
def
__int__
(
self
):
return
42.0
class
TruncReturnsBadInt
(
base
):
def
__trunc__
(
self
):
return
BadInt
()
with
self
.
assertRaises
(
TypeError
):
int
(
TruncReturnsBadInt
())
def
test_error_message
(
self
):
def
test_error_message
(
self
):
testlist
=
(
'
\xbd
'
,
'123
\xbd
'
,
' 123 456 '
)
testlist
=
(
'
\xbd
'
,
'123
\xbd
'
,
' 123 456 '
)
for
s
in
testlist
:
for
s
in
testlist
:
...
...
Misc/NEWS
Dosyayı görüntüle @
7c95bb35
...
@@ -10,6 +10,9 @@ What's New in Python 3.3.1?
...
@@ -10,6 +10,9 @@ What's New in Python 3.3.1?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #16060: Fix refcounting bug when __trunc__ returns an object
whose __int__ gives a non-integer. Patch by Serhiy Storchaka.
- Issue #16046: Fix loading sourceless legacy pyos.
- Issue #16046: Fix loading sourceless legacy pyos.
- Issue #15379: Fix passing of non-BMP characters as integers for the charmap
- Issue #15379: Fix passing of non-BMP characters as integers for the charmap
...
...
Objects/abstract.c
Dosyayı görüntüle @
7c95bb35
...
@@ -1228,11 +1228,10 @@ convert_integral_to_int(PyObject *integral, const char *error_format)
...
@@ -1228,11 +1228,10 @@ convert_integral_to_int(PyObject *integral, const char *error_format)
nb
=
Py_TYPE
(
integral
)
->
tp_as_number
;
nb
=
Py_TYPE
(
integral
)
->
tp_as_number
;
if
(
nb
->
nb_int
)
{
if
(
nb
->
nb_int
)
{
PyObject
*
as_int
=
nb
->
nb_int
(
integral
);
PyObject
*
as_int
=
nb
->
nb_int
(
integral
);
Py_DECREF
(
integral
);
if
(
!
as_int
||
PyLong_Check
(
as_int
))
{
if
(
!
as_int
)
Py_DECREF
(
integral
);
return
NULL
;
if
(
PyLong_Check
(
as_int
))
return
as_int
;
return
as_int
;
}
Py_DECREF
(
as_int
);
Py_DECREF
(
as_int
);
}
}
PyErr_Format
(
PyExc_TypeError
,
error_format
,
Py_TYPE
(
integral
)
->
tp_name
);
PyErr_Format
(
PyExc_TypeError
,
error_format
,
Py_TYPE
(
integral
)
->
tp_name
);
...
...
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