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
193a3605
Kaydet (Commit)
193a3605
authored
Eki 18, 2016
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.6 (issue #28471)
üst
62cca920
fa22b299
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
9 deletions
+27
-9
test_socket.py
Lib/test/test_socket.py
+12
-0
socketmodule.c
Modules/socketmodule.c
+15
-9
No files found.
Lib/test/test_socket.py
Dosyayı görüntüle @
193a3605
...
...
@@ -4562,6 +4562,18 @@ class TestExceptions(unittest.TestCase):
self
.
assertTrue
(
issubclass
(
socket
.
gaierror
,
OSError
))
self
.
assertTrue
(
issubclass
(
socket
.
timeout
,
OSError
))
def
test_setblocking_invalidfd
(
self
):
# Regression test for issue #28471
sock0
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
,
0
)
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
,
0
,
sock0
.
fileno
())
sock0
.
close
()
with
self
.
assertRaises
(
OSError
):
sock
.
setblocking
(
False
)
@unittest.skipUnless
(
sys
.
platform
==
'linux'
,
'Linux specific test'
)
class
TestLinuxAbstractNamespace
(
unittest
.
TestCase
):
...
...
Modules/socketmodule.c
Dosyayı görüntüle @
193a3605
...
...
@@ -622,6 +622,7 @@ set_gaierror(int error)
static
int
internal_setblocking
(
PySocketSockObject
*
s
,
int
block
)
{
int
result
=
-
1
;
#ifdef MS_WINDOWS
u_long
arg
;
#endif
...
...
@@ -641,34 +642,39 @@ internal_setblocking(PySocketSockObject *s, int block)
#if (defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO))
block
=
!
block
;
if
(
ioctl
(
s
->
sock_fd
,
FIONBIO
,
(
unsigned
int
*
)
&
block
)
==
-
1
)
goto
error
;
goto
done
;
#else
delay_flag
=
fcntl
(
s
->
sock_fd
,
F_GETFL
,
0
);
if
(
delay_flag
==
-
1
)
goto
error
;
goto
done
;
if
(
block
)
new_delay_flag
=
delay_flag
&
(
~
O_NONBLOCK
);
else
new_delay_flag
=
delay_flag
|
O_NONBLOCK
;
if
(
new_delay_flag
!=
delay_flag
)
if
(
fcntl
(
s
->
sock_fd
,
F_SETFL
,
new_delay_flag
)
==
-
1
)
goto
error
;
goto
done
;
#endif
#else
/* MS_WINDOWS */
arg
=
!
block
;
if
(
ioctlsocket
(
s
->
sock_fd
,
FIONBIO
,
&
arg
)
!=
0
)
goto
error
;
goto
done
;
#endif
/* MS_WINDOWS */
result
=
0
;
done:
Py_END_ALLOW_THREADS
return
0
;
error:
if
(
result
)
{
#ifndef MS_WINDOWS
PyErr_SetFromErrno
(
PyExc_OSError
);
PyErr_SetFromErrno
(
PyExc_OSError
);
#else
PyErr_SetExcFromWindowsErr
(
PyExc_OSError
,
WSAGetLastError
());
PyErr_SetExcFromWindowsErr
(
PyExc_OSError
,
WSAGetLastError
());
#endif
return
-
1
;
}
return
result
;
}
static
int
...
...
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