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
0b4b57df
Kaydet (Commit)
0b4b57df
authored
Haz 01, 2017
tarafından
Xiang Zhang
Kaydeden (comit)
GitHub
Haz 01, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-30378: Fix the problem that SysLogHandler can't handle IPv6 addresses (#1676)
üst
4e624ca5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
7 deletions
+43
-7
handlers.py
Lib/logging/handlers.py
+20
-5
test_logging.py
Lib/test/test_logging.py
+20
-2
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/logging/handlers.py
Dosyayı görüntüle @
0b4b57df
...
@@ -827,11 +827,26 @@ class SysLogHandler(logging.Handler):
...
@@ -827,11 +827,26 @@ class SysLogHandler(logging.Handler):
self
.
unixsocket
=
False
self
.
unixsocket
=
False
if
socktype
is
None
:
if
socktype
is
None
:
socktype
=
socket
.
SOCK_DGRAM
socktype
=
socket
.
SOCK_DGRAM
self
.
socket
=
socket
.
socket
(
socket
.
AF_INET
,
socktype
)
host
,
port
=
address
if
socktype
==
socket
.
SOCK_STREAM
:
ress
=
socket
.
getaddrinfo
(
host
,
port
,
0
,
socktype
)
self
.
socket
.
connect
(
address
)
if
not
ress
:
raise
OSError
(
"getaddrinfo returns an empty list"
)
for
res
in
ress
:
af
,
socktype
,
proto
,
_
,
sa
=
res
err
=
sock
=
None
try
:
sock
=
socket
.
socket
(
af
,
socktype
,
proto
)
if
socktype
==
socket
.
SOCK_STREAM
:
sock
.
connect
(
sa
)
break
except
OSError
as
exc
:
err
=
exc
if
sock
is
not
None
:
sock
.
close
()
if
err
is
not
None
:
raise
err
self
.
socket
=
sock
self
.
socktype
=
socktype
self
.
socktype
=
socktype
self
.
formatter
=
None
def
_connect_unixsocket
(
self
,
address
):
def
_connect_unixsocket
(
self
,
address
):
use_socktype
=
self
.
socktype
use_socktype
=
self
.
socktype
...
@@ -870,7 +885,7 @@ class SysLogHandler(logging.Handler):
...
@@ -870,7 +885,7 @@ class SysLogHandler(logging.Handler):
priority
=
self
.
priority_names
[
priority
]
priority
=
self
.
priority_names
[
priority
]
return
(
facility
<<
3
)
|
priority
return
(
facility
<<
3
)
|
priority
def
close
(
self
):
def
close
(
self
):
"""
"""
Closes the socket.
Closes the socket.
"""
"""
...
...
Lib/test/test_logging.py
Dosyayı görüntüle @
0b4b57df
...
@@ -1678,7 +1678,7 @@ class SysLogHandlerTest(BaseTest):
...
@@ -1678,7 +1678,7 @@ class SysLogHandlerTest(BaseTest):
server
.
ready
.
wait
()
server
.
ready
.
wait
()
hcls
=
logging
.
handlers
.
SysLogHandler
hcls
=
logging
.
handlers
.
SysLogHandler
if
isinstance
(
server
.
server_address
,
tuple
):
if
isinstance
(
server
.
server_address
,
tuple
):
self
.
sl_hdlr
=
hcls
((
'localhost'
,
server
.
port
))
self
.
sl_hdlr
=
hcls
((
server
.
server_address
[
0
]
,
server
.
port
))
else
:
else
:
self
.
sl_hdlr
=
hcls
(
server
.
server_address
)
self
.
sl_hdlr
=
hcls
(
server
.
server_address
)
self
.
log_output
=
''
self
.
log_output
=
''
...
@@ -1738,6 +1738,24 @@ class UnixSysLogHandlerTest(SysLogHandlerTest):
...
@@ -1738,6 +1738,24 @@ class UnixSysLogHandlerTest(SysLogHandlerTest):
SysLogHandlerTest
.
tearDown
(
self
)
SysLogHandlerTest
.
tearDown
(
self
)
support
.
unlink
(
self
.
address
)
support
.
unlink
(
self
.
address
)
@unittest.skipUnless
(
support
.
IPV6_ENABLED
,
'IPv6 support required for this test.'
)
@unittest.skipUnless
(
threading
,
'Threading required for this test.'
)
class
IPv6SysLogHandlerTest
(
SysLogHandlerTest
):
"""Test for SysLogHandler with IPv6 host."""
server_class
=
TestUDPServer
address
=
(
'::1'
,
0
)
def
setUp
(
self
):
self
.
server_class
.
address_family
=
socket
.
AF_INET6
super
(
IPv6SysLogHandlerTest
,
self
)
.
setUp
()
def
tearDown
(
self
):
self
.
server_class
.
address_family
=
socket
.
AF_INET
super
(
IPv6SysLogHandlerTest
,
self
)
.
tearDown
()
@unittest.skipUnless
(
threading
,
'Threading required for this test.'
)
@unittest.skipUnless
(
threading
,
'Threading required for this test.'
)
class
HTTPHandlerTest
(
BaseTest
):
class
HTTPHandlerTest
(
BaseTest
):
"""Test for HTTPHandler."""
"""Test for HTTPHandler."""
...
@@ -4404,7 +4422,7 @@ def test_main():
...
@@ -4404,7 +4422,7 @@ def test_main():
QueueHandlerTest
,
ShutdownTest
,
ModuleLevelMiscTest
,
BasicConfigTest
,
QueueHandlerTest
,
ShutdownTest
,
ModuleLevelMiscTest
,
BasicConfigTest
,
LoggerAdapterTest
,
LoggerTest
,
SMTPHandlerTest
,
FileHandlerTest
,
LoggerAdapterTest
,
LoggerTest
,
SMTPHandlerTest
,
FileHandlerTest
,
RotatingFileHandlerTest
,
LastResortTest
,
LogRecordTest
,
RotatingFileHandlerTest
,
LastResortTest
,
LogRecordTest
,
ExceptionTest
,
SysLogHandlerTest
,
HTTPHandlerTest
,
ExceptionTest
,
SysLogHandlerTest
,
IPv6SysLogHandlerTest
,
HTTPHandlerTest
,
NTEventLogHandlerTest
,
TimedRotatingFileHandlerTest
,
NTEventLogHandlerTest
,
TimedRotatingFileHandlerTest
,
UnixSocketHandlerTest
,
UnixDatagramHandlerTest
,
UnixSysLogHandlerTest
,
UnixSocketHandlerTest
,
UnixDatagramHandlerTest
,
UnixSysLogHandlerTest
,
MiscTestCase
MiscTestCase
...
...
Misc/NEWS
Dosyayı görüntüle @
0b4b57df
...
@@ -345,6 +345,9 @@ Extension Modules
...
@@ -345,6 +345,9 @@ Extension Modules
Library
Library
-------
-------
- bpo-30378: Fix the problem that logging.handlers.SysLogHandler cannot
handle IPv6 addresses.
- bpo-16500: Allow registering at-fork handlers.
- bpo-16500: Allow registering at-fork handlers.
- bpo-30470: Deprecate invalid ctypes call protection on Windows. Patch by
- bpo-30470: Deprecate invalid ctypes call protection on Windows. Patch by
...
...
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