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
77cddc31
Kaydet (Commit)
77cddc31
authored
Eki 01, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge
üst
c1948849
219c7b90
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
bz2.py
Lib/bz2.py
+12
-12
test_threaded_import.py
Lib/test/test_threaded_import.py
+1
-3
No files found.
Lib/bz2.py
Dosyayı görüntüle @
77cddc31
...
@@ -159,21 +159,18 @@ class BZ2File(io.BufferedIOBase):
...
@@ -159,21 +159,18 @@ class BZ2File(io.BufferedIOBase):
raise
ValueError
(
"I/O operation on closed file"
)
raise
ValueError
(
"I/O operation on closed file"
)
def
_check_can_read
(
self
):
def
_check_can_read
(
self
):
if
self
.
closed
:
raise
ValueError
(
"I/O operation on closed file"
)
if
self
.
_mode
not
in
(
_MODE_READ
,
_MODE_READ_EOF
):
if
self
.
_mode
not
in
(
_MODE_READ
,
_MODE_READ_EOF
):
self
.
_check_not_closed
()
raise
io
.
UnsupportedOperation
(
"File not open for reading"
)
raise
io
.
UnsupportedOperation
(
"File not open for reading"
)
def
_check_can_write
(
self
):
def
_check_can_write
(
self
):
if
self
.
closed
:
raise
ValueError
(
"I/O operation on closed file"
)
if
self
.
_mode
!=
_MODE_WRITE
:
if
self
.
_mode
!=
_MODE_WRITE
:
self
.
_check_not_closed
()
raise
io
.
UnsupportedOperation
(
"File not open for writing"
)
raise
io
.
UnsupportedOperation
(
"File not open for writing"
)
def
_check_can_seek
(
self
):
def
_check_can_seek
(
self
):
if
self
.
closed
:
raise
ValueError
(
"I/O operation on closed file"
)
if
self
.
_mode
not
in
(
_MODE_READ
,
_MODE_READ_EOF
):
if
self
.
_mode
not
in
(
_MODE_READ
,
_MODE_READ_EOF
):
self
.
_check_not_closed
()
raise
io
.
UnsupportedOperation
(
"Seeking is only supported "
raise
io
.
UnsupportedOperation
(
"Seeking is only supported "
"on files open for reading"
)
"on files open for reading"
)
if
not
self
.
_fp
.
seekable
():
if
not
self
.
_fp
.
seekable
():
...
@@ -322,10 +319,12 @@ class BZ2File(io.BufferedIOBase):
...
@@ -322,10 +319,12 @@ class BZ2File(io.BufferedIOBase):
non-negative, no more than size bytes will be read (in which
non-negative, no more than size bytes will be read (in which
case the line may be incomplete). Returns b'' if already at EOF.
case the line may be incomplete). Returns b'' if already at EOF.
"""
"""
if
not
hasattr
(
size
,
"__index__"
):
if
not
isinstance
(
size
,
int
):
raise
TypeError
(
"Integer argument expected"
)
if
not
hasattr
(
size
,
"__index__"
):
size
=
size
.
__index__
()
raise
TypeError
(
"Integer argument expected"
)
size
=
size
.
__index__
()
with
self
.
_lock
:
with
self
.
_lock
:
self
.
_check_can_read
()
# Shortcut for the common case - the whole line is in the buffer.
# Shortcut for the common case - the whole line is in the buffer.
if
size
<
0
:
if
size
<
0
:
end
=
self
.
_buffer
.
find
(
b
"
\n
"
,
self
.
_buffer_offset
)
+
1
end
=
self
.
_buffer
.
find
(
b
"
\n
"
,
self
.
_buffer_offset
)
+
1
...
@@ -343,9 +342,10 @@ class BZ2File(io.BufferedIOBase):
...
@@ -343,9 +342,10 @@ class BZ2File(io.BufferedIOBase):
further lines will be read once the total size of the lines read
further lines will be read once the total size of the lines read
so far equals or exceeds size.
so far equals or exceeds size.
"""
"""
if
not
hasattr
(
size
,
"__index__"
):
if
not
isinstance
(
size
,
int
):
raise
TypeError
(
"Integer argument expected"
)
if
not
hasattr
(
size
,
"__index__"
):
size
=
size
.
__index__
()
raise
TypeError
(
"Integer argument expected"
)
size
=
size
.
__index__
()
with
self
.
_lock
:
with
self
.
_lock
:
return
io
.
BufferedIOBase
.
readlines
(
self
,
size
)
return
io
.
BufferedIOBase
.
readlines
(
self
,
size
)
...
...
Lib/test/test_threaded_import.py
Dosyayı görüntüle @
77cddc31
...
@@ -225,11 +225,9 @@ class ThreadedImportTests(unittest.TestCase):
...
@@ -225,11 +225,9 @@ class ThreadedImportTests(unittest.TestCase):
@reap_threads
@reap_threads
def
test_main
():
def
test_main
():
old_switchinterval
=
None
old_switchinterval
=
None
# Issue #15599: FreeBSD/KVM cannot handle gil_interval == 1.
new_switchinterval
=
0.00001
if
'freebsd'
in
sys
.
platform
else
0.00000001
try
:
try
:
old_switchinterval
=
sys
.
getswitchinterval
()
old_switchinterval
=
sys
.
getswitchinterval
()
sys
.
setswitchinterval
(
new_switchinterval
)
sys
.
setswitchinterval
(
1e-5
)
except
AttributeError
:
except
AttributeError
:
pass
pass
try
:
try
:
...
...
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