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
8e42a0a0
Kaydet (Commit)
8e42a0a0
authored
Kas 08, 2007
tarafından
Christian Heimes
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed bug #1081: file.seek allows float arguments
üst
8bd14fb3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
io.py
Lib/io.py
+2
-0
test_io.py
Lib/test/test_io.py
+4
-0
_fileio.c
Modules/_fileio.c
+4
-0
No files found.
Lib/io.py
Dosyayı görüntüle @
8e42a0a0
...
...
@@ -694,6 +694,8 @@ class BytesIO(BufferedIOBase):
return
n
def
seek
(
self
,
pos
,
whence
=
0
):
if
not
isinstance
(
pos
,
int
):
raise
TypeError
(
"an integer is required"
)
if
whence
==
0
:
self
.
_pos
=
max
(
0
,
pos
)
elif
whence
==
1
:
...
...
Lib/test/test_io.py
Dosyayı görüntüle @
8e42a0a0
...
...
@@ -95,6 +95,7 @@ class IOTest(unittest.TestCase):
self
.
assertEqual
(
f
.
tell
(),
13
)
self
.
assertEqual
(
f
.
truncate
(
12
),
12
)
self
.
assertEqual
(
f
.
tell
(),
13
)
self
.
assertRaises
(
TypeError
,
f
.
seek
,
0.0
)
def
read_ops
(
self
,
f
,
buffered
=
False
):
data
=
f
.
read
(
5
)
...
...
@@ -116,6 +117,7 @@ class IOTest(unittest.TestCase):
self
.
assertEqual
(
f
.
seek
(
-
6
,
1
),
5
)
self
.
assertEqual
(
f
.
read
(
5
),
b
" worl"
)
self
.
assertEqual
(
f
.
tell
(),
10
)
self
.
assertRaises
(
TypeError
,
f
.
seek
,
0.0
)
if
buffered
:
f
.
seek
(
0
)
self
.
assertEqual
(
f
.
read
(),
b
"hello world
\n
"
)
...
...
@@ -296,6 +298,7 @@ class MemorySeekTestMixin:
bytesIo
.
seek
(
3
)
self
.
assertEquals
(
buf
[
3
:],
bytesIo
.
read
())
self
.
assertRaises
(
TypeError
,
bytesIo
.
seek
,
0.0
)
def
testTell
(
self
):
buf
=
self
.
buftype
(
"1234567890"
)
...
...
@@ -481,6 +484,7 @@ class BufferedRandomTest(unittest.TestCase):
rw
.
seek
(
2
,
1
)
self
.
assertEquals
(
7
,
rw
.
tell
())
self
.
assertEquals
(
b
"fl"
,
rw
.
read
(
11
))
self
.
assertRaises
(
TypeError
,
rw
.
seek
,
0.0
)
class
TextIOWrapperTest
(
unittest
.
TestCase
):
...
...
Modules/_fileio.c
Dosyayı görüntüle @
8e42a0a0
...
...
@@ -556,6 +556,10 @@ portable_lseek(int fd, PyObject *posobj, int whence)
if
(
posobj
==
NULL
)
pos
=
0
;
else
{
if
(
PyFloat_Check
(
posobj
))
{
PyErr_SetString
(
PyExc_TypeError
,
"an integer is required"
);
return
NULL
;
}
#if !defined(HAVE_LARGEFILE_SUPPORT)
pos
=
PyInt_AsLong
(
posobj
);
#else
...
...
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