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
38fbd799
Kaydet (Commit)
38fbd799
authored
May 16, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #14829: Fix bisect issues under 64-bit Windows.
üst
4cf3f692
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
4 deletions
+47
-4
test_bisect.py
Lib/test/test_bisect.py
+44
-3
NEWS
Misc/NEWS
+2
-0
_bisectmodule.c
Modules/_bisectmodule.c
+1
-1
No files found.
Lib/test/test_bisect.py
Dosyayı görüntüle @
38fbd799
...
...
@@ -23,6 +23,28 @@ del sys.modules['bisect']
import
bisect
as
c_bisect
class
Range
(
object
):
"""A trivial xrange()-like object without any integer width limitations."""
def
__init__
(
self
,
start
,
stop
):
self
.
start
=
start
self
.
stop
=
stop
self
.
last_insert
=
None
def
__len__
(
self
):
return
self
.
stop
-
self
.
start
def
__getitem__
(
self
,
idx
):
n
=
self
.
stop
-
self
.
start
if
idx
<
0
:
idx
+=
n
if
idx
>=
n
:
raise
IndexError
(
idx
)
return
self
.
start
+
idx
def
insert
(
self
,
idx
,
item
):
self
.
last_insert
=
idx
,
item
class
TestBisect
(
unittest
.
TestCase
):
module
=
None
...
...
@@ -125,12 +147,31 @@ class TestBisect(unittest.TestCase):
def
test_large_range
(
self
):
# Issue 13496
mod
=
self
.
module
n
=
sys
.
maxsize
try
:
data
=
xrange
(
sys
.
maxsize
-
1
)
data
=
xrange
(
n
-
1
)
except
OverflowError
:
self
.
skipTest
(
"can't create a xrange() object of size `sys.maxsize`"
)
self
.
assertEqual
(
mod
.
bisect_left
(
data
,
sys
.
maxsize
-
3
),
sys
.
maxsize
-
3
)
self
.
assertEqual
(
mod
.
bisect_right
(
data
,
sys
.
maxsize
-
3
),
sys
.
maxsize
-
2
)
self
.
assertEqual
(
mod
.
bisect_left
(
data
,
n
-
3
),
n
-
3
)
self
.
assertEqual
(
mod
.
bisect_right
(
data
,
n
-
3
),
n
-
2
)
self
.
assertEqual
(
mod
.
bisect_left
(
data
,
n
-
3
,
n
-
10
,
n
),
n
-
3
)
self
.
assertEqual
(
mod
.
bisect_right
(
data
,
n
-
3
,
n
-
10
,
n
),
n
-
2
)
def
test_large_pyrange
(
self
):
# Same as above, but without C-imposed limits on range() parameters
mod
=
self
.
module
n
=
sys
.
maxsize
data
=
Range
(
0
,
n
-
1
)
self
.
assertEqual
(
mod
.
bisect_left
(
data
,
n
-
3
),
n
-
3
)
self
.
assertEqual
(
mod
.
bisect_right
(
data
,
n
-
3
),
n
-
2
)
self
.
assertEqual
(
mod
.
bisect_left
(
data
,
n
-
3
,
n
-
10
,
n
),
n
-
3
)
self
.
assertEqual
(
mod
.
bisect_right
(
data
,
n
-
3
,
n
-
10
,
n
),
n
-
2
)
x
=
n
-
100
mod
.
insort_left
(
data
,
x
,
x
-
50
,
x
+
50
)
self
.
assertEqual
(
data
.
last_insert
,
(
x
,
x
))
x
=
n
-
200
mod
.
insort_right
(
data
,
x
,
x
-
50
,
x
+
50
)
self
.
assertEqual
(
data
.
last_insert
,
(
x
+
1
,
x
))
def
test_random
(
self
,
n
=
25
):
from
random
import
randrange
...
...
Misc/NEWS
Dosyayı görüntüle @
38fbd799
...
...
@@ -60,6 +60,8 @@ Core and Builtins
Library
-------
-
Issue
#
14829
:
Fix
bisect
issues
under
64
-
bit
Windows
.
-
Issue
#
14777
:
tkinter
may
return
undecoded
UTF
-
8
bytes
as
a
string
when
accessing
the
Tk
clipboard
.
Modify
clipboad_get
()
to
first
request
type
UTF8_STRING
when
no
specific
type
is
requested
in
an
X11
windowing
...
...
Modules/_bisectmodule.c
Dosyayı görüntüle @
38fbd799
...
...
@@ -195,7 +195,7 @@ insort_left(PyObject *self, PyObject *args, PyObject *kw)
if
(
PyList_Insert
(
list
,
index
,
item
)
<
0
)
return
NULL
;
}
else
{
result
=
PyObject_CallMethod
(
list
,
"insert"
,
"
i
O"
,
result
=
PyObject_CallMethod
(
list
,
"insert"
,
"
n
O"
,
index
,
item
);
if
(
result
==
NULL
)
return
NULL
;
...
...
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