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
c836a28c
Kaydet (Commit)
c836a28c
authored
Ara 14, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17576: Removed deprecation warnings added in changeset 618cca51a27e.
üst
84d28b4e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
45 deletions
+12
-45
test_getargs2.py
Lib/test/test_getargs2.py
+8
-16
test_index.py
Lib/test/test_index.py
+1
-2
test_int.py
Lib/test/test_int.py
+3
-6
NEWS
Misc/NEWS
+0
-3
abstract.c
Objects/abstract.c
+0
-9
longobject.c
Objects/longobject.c
+0
-9
No files found.
Lib/test/test_getargs2.py
Dosyayı görüntüle @
c836a28c
...
...
@@ -75,8 +75,7 @@ class Unsigned_TestCase(unittest.TestCase):
self
.
assertEqual
(
99
,
getargs_b
(
Int
()))
self
.
assertEqual
(
0
,
getargs_b
(
IntSubclass
()))
self
.
assertRaises
(
TypeError
,
getargs_b
,
BadInt
())
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertEqual
(
1
,
getargs_b
(
BadInt2
()))
self
.
assertEqual
(
1
,
getargs_b
(
BadInt2
()))
self
.
assertEqual
(
0
,
getargs_b
(
BadInt3
()))
self
.
assertRaises
(
OverflowError
,
getargs_b
,
-
1
)
...
...
@@ -94,8 +93,7 @@ class Unsigned_TestCase(unittest.TestCase):
self
.
assertEqual
(
99
,
getargs_B
(
Int
()))
self
.
assertEqual
(
0
,
getargs_B
(
IntSubclass
()))
self
.
assertRaises
(
TypeError
,
getargs_B
,
BadInt
())
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertEqual
(
1
,
getargs_B
(
BadInt2
()))
self
.
assertEqual
(
1
,
getargs_B
(
BadInt2
()))
self
.
assertEqual
(
0
,
getargs_B
(
BadInt3
()))
self
.
assertEqual
(
UCHAR_MAX
,
getargs_B
(
-
1
))
...
...
@@ -113,8 +111,7 @@ class Unsigned_TestCase(unittest.TestCase):
self
.
assertEqual
(
99
,
getargs_H
(
Int
()))
self
.
assertEqual
(
0
,
getargs_H
(
IntSubclass
()))
self
.
assertRaises
(
TypeError
,
getargs_H
,
BadInt
())
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertEqual
(
1
,
getargs_H
(
BadInt2
()))
self
.
assertEqual
(
1
,
getargs_H
(
BadInt2
()))
self
.
assertEqual
(
0
,
getargs_H
(
BadInt3
()))
self
.
assertEqual
(
USHRT_MAX
,
getargs_H
(
-
1
))
...
...
@@ -133,8 +130,7 @@ class Unsigned_TestCase(unittest.TestCase):
self
.
assertEqual
(
99
,
getargs_I
(
Int
()))
self
.
assertEqual
(
0
,
getargs_I
(
IntSubclass
()))
self
.
assertRaises
(
TypeError
,
getargs_I
,
BadInt
())
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertEqual
(
1
,
getargs_I
(
BadInt2
()))
self
.
assertEqual
(
1
,
getargs_I
(
BadInt2
()))
self
.
assertEqual
(
0
,
getargs_I
(
BadInt3
()))
self
.
assertEqual
(
UINT_MAX
,
getargs_I
(
-
1
))
...
...
@@ -174,8 +170,7 @@ class Signed_TestCase(unittest.TestCase):
self
.
assertEqual
(
99
,
getargs_h
(
Int
()))
self
.
assertEqual
(
0
,
getargs_h
(
IntSubclass
()))
self
.
assertRaises
(
TypeError
,
getargs_h
,
BadInt
())
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertEqual
(
1
,
getargs_h
(
BadInt2
()))
self
.
assertEqual
(
1
,
getargs_h
(
BadInt2
()))
self
.
assertEqual
(
0
,
getargs_h
(
BadInt3
()))
self
.
assertRaises
(
OverflowError
,
getargs_h
,
SHRT_MIN
-
1
)
...
...
@@ -193,8 +188,7 @@ class Signed_TestCase(unittest.TestCase):
self
.
assertEqual
(
99
,
getargs_i
(
Int
()))
self
.
assertEqual
(
0
,
getargs_i
(
IntSubclass
()))
self
.
assertRaises
(
TypeError
,
getargs_i
,
BadInt
())
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertEqual
(
1
,
getargs_i
(
BadInt2
()))
self
.
assertEqual
(
1
,
getargs_i
(
BadInt2
()))
self
.
assertEqual
(
0
,
getargs_i
(
BadInt3
()))
self
.
assertRaises
(
OverflowError
,
getargs_i
,
INT_MIN
-
1
)
...
...
@@ -212,8 +206,7 @@ class Signed_TestCase(unittest.TestCase):
self
.
assertEqual
(
99
,
getargs_l
(
Int
()))
self
.
assertEqual
(
0
,
getargs_l
(
IntSubclass
()))
self
.
assertRaises
(
TypeError
,
getargs_l
,
BadInt
())
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertEqual
(
1
,
getargs_l
(
BadInt2
()))
self
.
assertEqual
(
1
,
getargs_l
(
BadInt2
()))
self
.
assertEqual
(
0
,
getargs_l
(
BadInt3
()))
self
.
assertRaises
(
OverflowError
,
getargs_l
,
LONG_MIN
-
1
)
...
...
@@ -254,8 +247,7 @@ class LongLong_TestCase(unittest.TestCase):
self
.
assertEqual
(
99
,
getargs_L
(
Int
()))
self
.
assertEqual
(
0
,
getargs_L
(
IntSubclass
()))
self
.
assertRaises
(
TypeError
,
getargs_L
,
BadInt
())
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertEqual
(
1
,
getargs_L
(
BadInt2
()))
self
.
assertEqual
(
1
,
getargs_L
(
BadInt2
()))
self
.
assertEqual
(
0
,
getargs_L
(
BadInt3
()))
self
.
assertRaises
(
OverflowError
,
getargs_L
,
LLONG_MIN
-
1
)
...
...
Lib/test/test_index.py
Dosyayı görüntüle @
c836a28c
...
...
@@ -81,8 +81,7 @@ class BaseTestCase(unittest.TestCase):
return
True
bad_int
=
BadInt
()
with
self
.
assertWarns
(
DeprecationWarning
):
n
=
operator
.
index
(
bad_int
)
n
=
operator
.
index
(
bad_int
)
self
.
assertEqual
(
n
,
1
)
bad_int
=
BadInt2
()
...
...
Lib/test/test_int.py
Dosyayı görüntüle @
c836a28c
...
...
@@ -359,18 +359,15 @@ class IntTestCases(unittest.TestCase):
return
True
bad_int
=
BadInt
()
with
self
.
assertWarns
(
DeprecationWarning
):
n
=
int
(
bad_int
)
n
=
int
(
bad_int
)
self
.
assertEqual
(
n
,
1
)
bad_int
=
BadInt2
()
with
self
.
assertWarns
(
DeprecationWarning
):
n
=
int
(
bad_int
)
n
=
int
(
bad_int
)
self
.
assertEqual
(
n
,
1
)
bad_int
=
TruncReturnsBadInt
()
with
self
.
assertWarns
(
DeprecationWarning
):
n
=
int
(
bad_int
)
n
=
int
(
bad_int
)
self
.
assertEqual
(
n
,
1
)
good_int
=
TruncReturnsIntSubclass
()
...
...
Misc/NEWS
Dosyayı görüntüle @
c836a28c
...
...
@@ -19,9 +19,6 @@ Core and Builtins
contains a frame, and the frame kept a reference to the Python state of the
destroyed C thread. The crash occurs when a trace function is setup.
- Issue #17576: Deprecation warning emitted now when __int__() or __index__()
return not int instance.
- Issue #19932: Fix typo in import.h, missing whitespaces in function prototypes.
- Issue #19729: In str.format(), fix recursive expansion in format spec.
...
...
Objects/abstract.c
Dosyayı görüntüle @
c836a28c
...
...
@@ -1162,15 +1162,6 @@ PyNumber_Index(PyObject *item)
Py_DECREF
(
result
);
return
NULL
;
}
/* Issue #17576: warn if 'result' not of exact type int. */
if
(
PyErr_WarnFormat
(
PyExc_DeprecationWarning
,
1
,
"__index__ returned non-int (type %.200s). "
"The ability to return an instance of a strict subclass of int "
"is deprecated, and may be removed in a future version of Python."
,
result
->
ob_type
->
tp_name
))
{
Py_DECREF
(
result
);
return
NULL
;
}
return
result
;
}
...
...
Objects/longobject.c
Dosyayı görüntüle @
c836a28c
...
...
@@ -153,15 +153,6 @@ _PyLong_FromNbInt(PyObject *integral)
Py_DECREF
(
result
);
return
NULL
;
}
/* Issue #17576: warn if 'result' not of exact type int. */
if
(
PyErr_WarnFormat
(
PyExc_DeprecationWarning
,
1
,
"__int__ returned non-int (type %.200s). "
"The ability to return an instance of a strict subclass of int "
"is deprecated, and may be removed in a future version of Python."
,
result
->
ob_type
->
tp_name
))
{
Py_DECREF
(
result
);
return
NULL
;
}
return
(
PyLongObject
*
)
result
;
}
...
...
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