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
98041d7b
Kaydet (Commit)
98041d7b
authored
Eki 04, 2006
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix integer negation and absolute value to not rely
on undefined behaviour of the C compiler anymore.
üst
e346a732
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
test_builtin.py
Lib/test/test_builtin.py
+1
-0
NEWS
Misc/NEWS
+3
-0
intobject.c
Objects/intobject.c
+3
-4
No files found.
Lib/test/test_builtin.py
Dosyayı görüntüle @
98041d7b
...
...
@@ -101,6 +101,7 @@ class BuiltinTest(unittest.TestCase):
self
.
assertEqual
(
abs
(
0
),
0
)
self
.
assertEqual
(
abs
(
1234
),
1234
)
self
.
assertEqual
(
abs
(
-
1234
),
1234
)
self
.
assertTrue
(
abs
(
-
sys
.
maxint
-
1
)
>
0
)
# float
self
.
assertEqual
(
abs
(
0.0
),
0.0
)
self
.
assertEqual
(
abs
(
3.14
),
3.14
)
...
...
Misc/NEWS
Dosyayı görüntüle @
98041d7b
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.4.4c1?
Core and builtins
-----------------
- Integer negation and absolute value were fixed to not rely
on undefined behaviour of the C compiler anymore.
- Patch #1567691: super() and new.instancemethod() now don'
t
accept
keyword
arguments
any
more
(
previously
they
accepted
them
,
but
didn
't
use them).
...
...
Objects/intobject.c
Dosyayı görüntüle @
98041d7b
...
...
@@ -674,10 +674,9 @@ int_pow(PyIntObject *v, PyIntObject *w, PyIntObject *z)
static
PyObject
*
int_neg
(
PyIntObject
*
v
)
{
register
long
a
,
x
;
register
long
a
;
a
=
v
->
ob_ival
;
x
=
-
a
;
if
(
a
<
0
&&
x
<
0
)
{
if
(
a
<
0
&&
(
unsigned
long
)
a
==
0
-
(
unsigned
long
)
a
)
{
PyObject
*
o
=
PyLong_FromLong
(
a
);
if
(
o
!=
NULL
)
{
PyObject
*
result
=
PyNumber_Negative
(
o
);
...
...
@@ -686,7 +685,7 @@ int_neg(PyIntObject *v)
}
return
NULL
;
}
return
PyInt_FromLong
(
x
);
return
PyInt_FromLong
(
-
a
);
}
static
PyObject
*
...
...
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