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
70deb3de
Kaydet (Commit)
70deb3de
authored
Mar 31, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #13872: socket.detach() now marks the socket closed (as mirrored in the socket repr()).
Patch by Matt Joiner.
üst
6211b881
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
socket.py
Lib/socket.py
+11
-0
test_socket.py
Lib/test/test_socket.py
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/socket.py
Dosyayı görüntüle @
70deb3de
...
@@ -197,6 +197,17 @@ class socket(_socket.socket):
...
@@ -197,6 +197,17 @@ class socket(_socket.socket):
if
self
.
_io_refs
<=
0
:
if
self
.
_io_refs
<=
0
:
self
.
_real_close
()
self
.
_real_close
()
def
detach
(
self
):
"""detach() -> file descriptor
Close the socket object without closing the underlying file descriptor.
The object cannot be used after this call, but the file descriptor
can be reused for other purposes. The file descriptor is returned.
"""
self
.
_closed
=
True
return
super
()
.
detach
()
def
fromfd
(
fd
,
family
,
type
,
proto
=
0
):
def
fromfd
(
fd
,
family
,
type
,
proto
=
0
):
""" fromfd(fd, family, type[, proto]) -> socket object
""" fromfd(fd, family, type[, proto]) -> socket object
...
...
Lib/test/test_socket.py
Dosyayı görüntüle @
70deb3de
...
@@ -951,6 +951,7 @@ class BasicTCPTest(SocketConnectedTest):
...
@@ -951,6 +951,7 @@ class BasicTCPTest(SocketConnectedTest):
f
=
self
.
cli_conn
.
detach
()
f
=
self
.
cli_conn
.
detach
()
self
.
assertEqual
(
f
,
fileno
)
self
.
assertEqual
(
f
,
fileno
)
# cli_conn cannot be used anymore...
# cli_conn cannot be used anymore...
self
.
assertTrue
(
self
.
cli_conn
.
_closed
)
self
.
assertRaises
(
socket
.
error
,
self
.
cli_conn
.
recv
,
1024
)
self
.
assertRaises
(
socket
.
error
,
self
.
cli_conn
.
recv
,
1024
)
self
.
cli_conn
.
close
()
self
.
cli_conn
.
close
()
# ...but we can create another socket using the (still open)
# ...but we can create another socket using the (still open)
...
...
Misc/NEWS
Dosyayı görüntüle @
70deb3de
...
@@ -31,6 +31,9 @@ Core and Builtins
...
@@ -31,6 +31,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #13872: socket.detach() now marks the socket closed (as mirrored
in the socket repr()). Patch by Matt Joiner.
- Issue #14406: Fix a race condition when using ``concurrent.futures.wait(
- Issue #14406: Fix a race condition when using ``concurrent.futures.wait(
return_when=ALL_COMPLETED)``. Patch by Matt Joiner.
return_when=ALL_COMPLETED)``. Patch by Matt Joiner.
...
...
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