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
2a1d5160
Kaydet (Commit)
2a1d5160
authored
Ock 21, 2003
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix from Vinaj for the "writing to closed file" errors. SF 670390.
üst
81d40d6f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
test_logging
Lib/test/output/test_logging
+0
-1
test_logging.py
Lib/test/test_logging.py
+14
-10
No files found.
Lib/test/output/test_logging
Dosyayı görüntüle @
2a1d5160
test_logging
About to start TCP server...
-- log_test0 begin ---------------------------------------------------
CRITICAL:ERR:Message 0
ERROR:ERR:Message 1
...
...
Lib/test/test_logging.py
Dosyayı görüntüle @
2a1d5160
...
...
@@ -24,7 +24,7 @@
Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved.
"""
from
select
import
select
import
select
import
os
,
sys
,
string
,
struct
,
types
,
cPickle
,
cStringIO
import
socket
,
threading
,
time
,
locale
import
logging
,
logging
.
handlers
,
logging
.
config
...
...
@@ -64,7 +64,6 @@ class LogRecordStreamHandler(StreamRequestHandler):
if
len
(
chunk
)
<
4
:
break
slen
=
struct
.
unpack
(
">L"
,
chunk
)[
0
]
#print slen
chunk
=
self
.
connection
.
recv
(
slen
)
while
len
(
chunk
)
<
slen
:
chunk
=
chunk
+
self
.
connection
.
recv
(
slen
-
len
(
chunk
))
...
...
@@ -102,13 +101,19 @@ class LogRecordSocketReceiver(ThreadingTCPServer):
def
serve_until_stopped
(
self
):
abort
=
0
while
not
abort
:
rd
,
wr
,
ex
=
select
([
self
.
socket
.
fileno
()],
rd
,
wr
,
ex
=
select
.
select
([
self
.
socket
.
fileno
()],
[],
[],
self
.
timeout
)
if
rd
:
self
.
handle_request
()
abort
=
self
.
abort
def
process_request
(
self
,
request
,
client_address
):
#import threading
t
=
threading
.
Thread
(
target
=
self
.
finish_request
,
args
=
(
request
,
client_address
))
t
.
start
()
def
runTCP
(
tcpserver
):
tcpserver
.
serve_until_stopped
()
...
...
@@ -421,7 +426,7 @@ def test_main():
#Set up servers
threads
=
[]
tcpserver
=
LogRecordSocketReceiver
()
sys
.
stdout
.
write
(
"About to start TCP server...
\n
"
)
#
sys.stdout.write("About to start TCP server...\n")
threads
.
append
(
threading
.
Thread
(
target
=
runTCP
,
args
=
(
tcpserver
,)))
for
thread
in
threads
:
...
...
@@ -447,18 +452,17 @@ def test_main():
test3
()
banner
(
"log_test3"
,
"end"
)
banner
(
"logrecv output"
,
"begin"
)
sys
.
stdout
.
write
(
sockOut
.
getvalue
())
sockOut
.
close
()
banner
(
"logrecv output"
,
"end"
)
finally
:
#shut down server
tcpserver
.
abort
=
1
for
thread
in
threads
:
thread
.
join
()
banner
(
"logrecv output"
,
"begin"
)
sys
.
stdout
.
write
(
sockOut
.
getvalue
())
sockOut
.
close
()
banner
(
"logrecv output"
,
"end"
)
sys
.
stdout
.
flush
()
if
__name__
==
"__main__"
:
sys
.
stdout
.
write
(
"test_logging
\n
"
)
test_main
()
sys
.
stdout
.
flush
()
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