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
bcfb35f8
Kaydet (Commit)
bcfb35f8
authored
Eyl 17, 2016
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #26384: Fix UnboundLocalError in socket._sendfile_use_sendfile
üst
9a1c91a1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
socket.py
Lib/socket.py
+1
-1
test_socket.py
Lib/test/test_socket.py
+19
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/socket.py
Dosyayı görüntüle @
bcfb35f8
...
...
@@ -258,7 +258,7 @@ class socket(_socket.socket):
raise
_GiveupOnSendfile
(
err
)
# not a regular file
try
:
fsize
=
os
.
fstat
(
fileno
)
.
st_size
except
OSError
:
except
OSError
as
err
:
raise
_GiveupOnSendfile
(
err
)
# not a regular file
if
not
fsize
:
return
0
# empty file
...
...
Lib/test/test_socket.py
Dosyayı görüntüle @
bcfb35f8
...
...
@@ -1447,6 +1447,25 @@ class GeneralModuleTests(unittest.TestCase):
self
.
assertEqual
(
s
.
family
,
42424
)
self
.
assertEqual
(
s
.
type
,
13331
)
@unittest.skipUnless
(
hasattr
(
os
,
'sendfile'
),
'test needs os.sendfile()'
)
def
test__sendfile_use_sendfile
(
self
):
class
File
:
def
__init__
(
self
,
fd
):
self
.
fd
=
fd
def
fileno
(
self
):
return
self
.
fd
with
socket
.
socket
()
as
sock
:
fd
=
os
.
open
(
os
.
curdir
,
os
.
O_RDONLY
)
os
.
close
(
fd
)
with
self
.
assertRaises
(
socket
.
_GiveupOnSendfile
):
sock
.
_sendfile_use_sendfile
(
File
(
fd
))
with
self
.
assertRaises
(
OverflowError
):
sock
.
_sendfile_use_sendfile
(
File
(
2
**
1000
))
with
self
.
assertRaises
(
TypeError
):
sock
.
_sendfile_use_sendfile
(
File
(
None
))
@unittest.skipUnless
(
HAVE_SOCKET_CAN
,
'SocketCan required for this test.'
)
class
BasicCANTest
(
unittest
.
TestCase
):
...
...
Misc/NEWS
Dosyayı görüntüle @
bcfb35f8
...
...
@@ -71,6 +71,8 @@ Core and Builtins
Library
-------
- Fix UnboundLocalError in socket._sendfile_use_sendfile.
- Issue #28075: Check for ERROR_ACCESS_DENIED in Windows implementation of
os.stat(). Patch by Eryk Sun.
...
...
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