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
bcc17eef
Kaydet (Commit)
bcc17eef
authored
Nis 20, 2012
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #14630: Fix an incorrect access of ob_digit[0] for a zero instance of an int subclass.
üst
63674f4b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
test_long.py
Lib/test/test_long.py
+14
-0
NEWS
Misc/NEWS
+3
-0
longobject.c
Objects/longobject.c
+1
-3
No files found.
Lib/test/test_long.py
Dosyayı görüntüle @
bcc17eef
...
@@ -1148,6 +1148,20 @@ class LongTest(unittest.TestCase):
...
@@ -1148,6 +1148,20 @@ class LongTest(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
myint
.
from_bytes
,
0
,
'big'
)
self
.
assertRaises
(
TypeError
,
myint
.
from_bytes
,
0
,
'big'
)
self
.
assertRaises
(
TypeError
,
int
.
from_bytes
,
0
,
'big'
,
True
)
self
.
assertRaises
(
TypeError
,
int
.
from_bytes
,
0
,
'big'
,
True
)
def
test_access_to_nonexistent_digit_0
(
self
):
# http://bugs.python.org/issue14630: A bug in _PyLong_Copy meant that
# ob_digit[0] was being incorrectly accessed for instances of a
# subclass of int, with value 0.
class
Integer
(
int
):
def
__new__
(
cls
,
value
=
0
):
self
=
int
.
__new__
(
cls
,
value
)
self
.
foo
=
'foo'
return
self
integers
=
[
Integer
(
0
)
for
i
in
range
(
1000
)]
for
n
in
map
(
int
,
integers
):
self
.
assertEqual
(
n
,
0
)
def
test_main
():
def
test_main
():
support
.
run_unittest
(
LongTest
)
support
.
run_unittest
(
LongTest
)
...
...
Misc/NEWS
Dosyayı görüntüle @
bcc17eef
...
@@ -10,6 +10,9 @@ What's New in Python 3.2.4
...
@@ -10,6 +10,9 @@ What's New in Python 3.2.4
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #14630: Fix a memory access bug for instances of a subclass of int
with value 0.
- Issue #14612: Fix jumping around with blocks by setting f_lineno.
- Issue #14612: Fix jumping around with blocks by setting f_lineno.
- Issue #14607: Fix keyword-only arguments which started with ``__``.
- Issue #14607: Fix keyword-only arguments which started with ``__``.
...
...
Objects/longobject.c
Dosyayı görüntüle @
bcc17eef
...
@@ -156,9 +156,7 @@ _PyLong_Copy(PyLongObject *src)
...
@@ -156,9 +156,7 @@ _PyLong_Copy(PyLongObject *src)
if
(
i
<
0
)
if
(
i
<
0
)
i
=
-
(
i
);
i
=
-
(
i
);
if
(
i
<
2
)
{
if
(
i
<
2
)
{
sdigit
ival
=
src
->
ob_digit
[
0
];
sdigit
ival
=
MEDIUM_VALUE
(
src
);
if
(
Py_SIZE
(
src
)
<
0
)
ival
=
-
ival
;
CHECK_SMALL_INT
(
ival
);
CHECK_SMALL_INT
(
ival
);
}
}
result
=
_PyLong_New
(
i
);
result
=
_PyLong_New
(
i
);
...
...
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