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
94f55837
Kaydet (Commit)
94f55837
authored
Haz 12, 2009
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix SystemError and a wasps nest of ref counting issues.
üst
83eacca7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
8 deletions
+33
-8
test_range.py
Lib/test/test_range.py
+7
-0
NEWS
Misc/NEWS
+2
-0
rangeobject.c
Objects/rangeobject.c
+24
-8
No files found.
Lib/test/test_range.py
Dosyayı görüntüle @
94f55837
...
@@ -71,6 +71,13 @@ class RangeTest(unittest.TestCase):
...
@@ -71,6 +71,13 @@ class RangeTest(unittest.TestCase):
self
.
assertEquals
(
list
(
pickle
.
loads
(
pickle
.
dumps
(
r
,
proto
))),
self
.
assertEquals
(
list
(
pickle
.
loads
(
pickle
.
dumps
(
r
,
proto
))),
list
(
r
))
list
(
r
))
def
test_odd_bug
(
self
):
# This used to raise a "SystemError: NULL result without error"
# because the range validation step was eating the exception
# before NULL was returned.
with
self
.
assertRaises
(
TypeError
):
range
([],
1
,
-
1
)
def
test_main
():
def
test_main
():
test
.
support
.
run_unittest
(
RangeTest
)
test
.
support
.
run_unittest
(
RangeTest
)
...
...
Misc/NEWS
Dosyayı görüntüle @
94f55837
...
@@ -12,6 +12,8 @@ What's New in Python 3.1 Release Candidate 2?
...
@@ -12,6 +12,8 @@ What's New in Python 3.1 Release Candidate 2?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Fixed SystemError triggered by "range([], 1, -1)".
- Issue #5924: On Windows, a large PYTHONPATH environment variable
- Issue #5924: On Windows, a large PYTHONPATH environment variable
(more than 255 characters) would be completely ignored.
(more than 255 characters) would be completely ignored.
...
...
Objects/rangeobject.c
Dosyayı görüntüle @
94f55837
...
@@ -59,26 +59,42 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw)
...
@@ -59,26 +59,42 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw)
if
(
PyTuple_Size
(
args
)
<=
1
)
{
if
(
PyTuple_Size
(
args
)
<=
1
)
{
if
(
!
PyArg_UnpackTuple
(
args
,
"range"
,
1
,
1
,
&
stop
))
if
(
!
PyArg_UnpackTuple
(
args
,
"range"
,
1
,
1
,
&
stop
))
goto
Fail
;
return
NULL
;
stop
=
PyNumber_Index
(
stop
);
stop
=
PyNumber_Index
(
stop
);
if
(
!
stop
)
if
(
!
stop
)
goto
Fail
;
return
NULL
;
start
=
PyLong_FromLong
(
0
);
start
=
PyLong_FromLong
(
0
);
if
(
!
start
)
{
Py_DECREF
(
stop
);
return
NULL
;
}
step
=
PyLong_FromLong
(
1
);
step
=
PyLong_FromLong
(
1
);
if
(
!
start
||
!
step
)
if
(
!
step
)
{
goto
Fail
;
Py_DECREF
(
stop
);
Py_DECREF
(
start
);
return
NULL
;
}
}
}
else
{
else
{
if
(
!
PyArg_UnpackTuple
(
args
,
"range"
,
2
,
3
,
if
(
!
PyArg_UnpackTuple
(
args
,
"range"
,
2
,
3
,
&
start
,
&
stop
,
&
step
))
&
start
,
&
stop
,
&
step
))
goto
Fail
;
return
NULL
;
/* Convert borrowed refs to owned refs */
/* Convert borrowed refs to owned refs */
start
=
PyNumber_Index
(
start
);
start
=
PyNumber_Index
(
start
);
if
(
!
start
)
return
NULL
;
stop
=
PyNumber_Index
(
stop
);
stop
=
PyNumber_Index
(
stop
);
step
=
validate_step
(
step
);
if
(
!
stop
)
{
if
(
!
start
||
!
stop
||
!
step
)
Py_DECREF
(
start
);
goto
Fail
;
return
NULL
;
}
step
=
validate_step
(
step
);
/* Caution, this can clear exceptions */
if
(
!
step
)
{
Py_DECREF
(
start
);
Py_DECREF
(
stop
);
return
NULL
;
}
}
}
obj
=
PyObject_New
(
rangeobject
,
&
PyRange_Type
);
obj
=
PyObject_New
(
rangeobject
,
&
PyRange_Type
);
...
...
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