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
24d659da
Kaydet (Commit)
24d659da
authored
Eki 23, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use InterruptedError instead of checking for EINTR
üst
dcbb822c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
38 deletions
+17
-38
_pyio.py
Lib/_pyio.py
+4
-13
asyncore.py
Lib/asyncore.py
+4
-9
util.py
Lib/multiprocessing/util.py
+3
-6
socket.py
Lib/socket.py
+3
-5
subprocess.py
Lib/subprocess.py
+2
-4
test_socket.py
Lib/test/test_socket.py
+1
-1
No files found.
Lib/_pyio.py
Dosyayı görüntüle @
24d659da
...
...
@@ -14,7 +14,6 @@ except ImportError:
import
io
from
io
import
(
__all__
,
SEEK_SET
,
SEEK_CUR
,
SEEK_END
)
from
errno
import
EINTR
# open() uses st_blksize whenever we can
DEFAULT_BUFFER_SIZE
=
8
*
1024
# bytes
...
...
@@ -948,9 +947,7 @@ class BufferedReader(_BufferedIOMixin):
# Read until EOF or until read() would block.
try
:
chunk
=
self
.
raw
.
read
()
except
IOError
as
e
:
if
e
.
errno
!=
EINTR
:
raise
except
InterruptedError
:
continue
if
chunk
in
empty_values
:
nodata_val
=
chunk
...
...
@@ -972,9 +969,7 @@ class BufferedReader(_BufferedIOMixin):
while
avail
<
n
:
try
:
chunk
=
self
.
raw
.
read
(
wanted
)
except
IOError
as
e
:
if
e
.
errno
!=
EINTR
:
raise
except
InterruptedError
:
continue
if
chunk
in
empty_values
:
nodata_val
=
chunk
...
...
@@ -1007,9 +1002,7 @@ class BufferedReader(_BufferedIOMixin):
while
True
:
try
:
current
=
self
.
raw
.
read
(
to_read
)
except
IOError
as
e
:
if
e
.
errno
!=
EINTR
:
raise
except
InterruptedError
:
continue
break
if
current
:
...
...
@@ -1120,9 +1113,7 @@ class BufferedWriter(_BufferedIOMixin):
while
self
.
_write_buf
:
try
:
n
=
self
.
raw
.
write
(
self
.
_write_buf
)
except
IOError
as
e
:
if
e
.
errno
!=
EINTR
:
raise
except
InterruptedError
:
continue
if
n
>
len
(
self
.
_write_buf
)
or
n
<
0
:
raise
IOError
(
"write() returned incorrect number of bytes"
)
...
...
Lib/asyncore.py
Dosyayı görüntüle @
24d659da
...
...
@@ -54,7 +54,7 @@ import warnings
import
os
from
errno
import
EALREADY
,
EINPROGRESS
,
EWOULDBLOCK
,
ECONNRESET
,
EINVAL
,
\
ENOTCONN
,
ESHUTDOWN
,
EI
NTR
,
EI
SCONN
,
EBADF
,
ECONNABORTED
,
EPIPE
,
EAGAIN
,
\
ENOTCONN
,
ESHUTDOWN
,
EISCONN
,
EBADF
,
ECONNABORTED
,
EPIPE
,
EAGAIN
,
\
errorcode
_DISCONNECTED
=
frozenset
((
ECONNRESET
,
ENOTCONN
,
ESHUTDOWN
,
ECONNABORTED
,
EPIPE
,
...
...
@@ -143,11 +143,8 @@ def poll(timeout=0.0, map=None):
try
:
r
,
w
,
e
=
select
.
select
(
r
,
w
,
e
,
timeout
)
except
select
.
error
as
err
:
if
err
.
args
[
0
]
!=
EINTR
:
raise
else
:
return
except
InterruptedError
:
return
for
fd
in
r
:
obj
=
map
.
get
(
fd
)
...
...
@@ -190,9 +187,7 @@ def poll2(timeout=0.0, map=None):
pollster
.
register
(
fd
,
flags
)
try
:
r
=
pollster
.
poll
(
timeout
)
except
select
.
error
as
err
:
if
err
.
args
[
0
]
!=
EINTR
:
raise
except
InterruptedError
:
r
=
[]
for
fd
,
flags
in
r
:
obj
=
map
.
get
(
fd
)
...
...
Lib/multiprocessing/util.py
Dosyayı görüntüle @
24d659da
...
...
@@ -327,15 +327,12 @@ class ForkAwareLocal(threading.local):
# Automatic retry after EINTR
#
def
_eintr_retry
(
func
,
_errors
=
(
EnvironmentError
,
select
.
error
)
):
def
_eintr_retry
(
func
):
@functools.wraps
(
func
)
def
wrapped
(
*
args
,
**
kwargs
):
while
True
:
try
:
return
func
(
*
args
,
**
kwargs
)
except
_errors
as
e
:
# select.error has no `errno` attribute
if
e
.
args
[
0
]
==
errno
.
EINTR
:
continue
raise
except
InterruptedError
:
continue
return
wrapped
Lib/socket.py
Dosyayı görüntüle @
24d659da
...
...
@@ -53,7 +53,6 @@ try:
except
ImportError
:
errno
=
None
EBADF
=
getattr
(
errno
,
'EBADF'
,
9
)
EINTR
=
getattr
(
errno
,
'EINTR'
,
4
)
EAGAIN
=
getattr
(
errno
,
'EAGAIN'
,
11
)
EWOULDBLOCK
=
getattr
(
errno
,
'EWOULDBLOCK'
,
11
)
...
...
@@ -280,11 +279,10 @@ class SocketIO(io.RawIOBase):
except
timeout
:
self
.
_timeout_occurred
=
True
raise
except
InterruptedError
:
continue
except
error
as
e
:
n
=
e
.
args
[
0
]
if
n
==
EINTR
:
continue
if
n
in
_blocking_errnos
:
if
e
.
args
[
0
]
in
_blocking_errnos
:
return
None
raise
...
...
Lib/subprocess.py
Dosyayı görüntüle @
24d659da
...
...
@@ -450,10 +450,8 @@ def _eintr_retry_call(func, *args):
while
True
:
try
:
return
func
(
*
args
)
except
(
OSError
,
IOError
)
as
e
:
if
e
.
errno
==
errno
.
EINTR
:
continue
raise
except
InterruptedError
:
continue
def
call
(
*
popenargs
,
timeout
=
None
,
**
kwargs
):
...
...
Lib/test/test_socket.py
Dosyayı görüntüle @
24d659da
...
...
@@ -3584,7 +3584,7 @@ class FileObjectInterruptedTestCase(unittest.TestCase):
@staticmethod
def
_raise_eintr
():
raise
socket
.
error
(
errno
.
EINTR
)
raise
socket
.
error
(
errno
.
EINTR
,
"interrupted"
)
def
_textiowrap_mock_socket
(
self
,
mock
,
buffering
=-
1
):
raw
=
socket
.
SocketIO
(
mock
,
"r"
)
...
...
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