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
949d8c98
Kaydet (Commit)
949d8c98
authored
May 30, 2012
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Close #14690: Use monotonic clock instead of system clock in the sched,
subprocess and trace modules.
üst
5e92a1ef
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
8 deletions
+23
-8
sched.py
Lib/sched.py
+5
-1
subprocess.py
Lib/subprocess.py
+8
-4
trace.py
Lib/trace.py
+7
-3
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/sched.py
Dosyayı görüntüle @
949d8c98
...
@@ -35,6 +35,10 @@ try:
...
@@ -35,6 +35,10 @@ try:
import
threading
import
threading
except
ImportError
:
except
ImportError
:
import
dummy_threading
as
threading
import
dummy_threading
as
threading
try
:
from
time
import
monotonic
as
_time
except
ImportError
:
from
time
import
time
as
_time
__all__
=
[
"scheduler"
]
__all__
=
[
"scheduler"
]
...
@@ -48,7 +52,7 @@ class Event(namedtuple('Event', 'time, priority, action, argument, kwargs')):
...
@@ -48,7 +52,7 @@ class Event(namedtuple('Event', 'time, priority, action, argument, kwargs')):
class
scheduler
:
class
scheduler
:
def
__init__
(
self
,
timefunc
=
time
.
time
,
delayfunc
=
time
.
sleep
):
def
__init__
(
self
,
timefunc
=
_
time
,
delayfunc
=
time
.
sleep
):
"""Initialize a new instance, passing the time and delay
"""Initialize a new instance, passing the time and delay
functions"""
functions"""
self
.
_queue
=
[]
self
.
_queue
=
[]
...
...
Lib/subprocess.py
Dosyayı görüntüle @
949d8c98
...
@@ -349,6 +349,10 @@ import signal
...
@@ -349,6 +349,10 @@ import signal
import
builtins
import
builtins
import
warnings
import
warnings
import
errno
import
errno
try
:
from
time
import
monotonic
as
_time
except
ImportError
:
from
time
import
time
as
_time
# Exception classes used by this module.
# Exception classes used by this module.
class
SubprocessError
(
Exception
):
pass
class
SubprocessError
(
Exception
):
pass
...
@@ -894,7 +898,7 @@ class Popen(object):
...
@@ -894,7 +898,7 @@ class Popen(object):
self
.
wait
()
self
.
wait
()
else
:
else
:
if
timeout
is
not
None
:
if
timeout
is
not
None
:
endtime
=
time
.
time
()
+
timeout
endtime
=
_
time
()
+
timeout
else
:
else
:
endtime
=
None
endtime
=
None
...
@@ -917,14 +921,14 @@ class Popen(object):
...
@@ -917,14 +921,14 @@ class Popen(object):
if
endtime
is
None
:
if
endtime
is
None
:
return
None
return
None
else
:
else
:
return
endtime
-
time
.
time
()
return
endtime
-
_
time
()
def
_check_timeout
(
self
,
endtime
,
orig_timeout
):
def
_check_timeout
(
self
,
endtime
,
orig_timeout
):
"""Convenience for checking if a timeout has expired."""
"""Convenience for checking if a timeout has expired."""
if
endtime
is
None
:
if
endtime
is
None
:
return
return
if
time
.
time
()
>
endtime
:
if
_
time
()
>
endtime
:
raise
TimeoutExpired
(
self
.
args
,
orig_timeout
)
raise
TimeoutExpired
(
self
.
args
,
orig_timeout
)
...
@@ -1471,7 +1475,7 @@ class Popen(object):
...
@@ -1471,7 +1475,7 @@ class Popen(object):
# printing.
# printing.
if
endtime
is
not
None
or
timeout
is
not
None
:
if
endtime
is
not
None
or
timeout
is
not
None
:
if
endtime
is
None
:
if
endtime
is
None
:
endtime
=
time
.
time
()
+
timeout
endtime
=
_
time
()
+
timeout
elif
timeout
is
None
:
elif
timeout
is
None
:
timeout
=
self
.
_remaining_time
(
endtime
)
timeout
=
self
.
_remaining_time
(
endtime
)
...
...
Lib/trace.py
Dosyayı görüntüle @
949d8c98
...
@@ -61,6 +61,10 @@ import gc
...
@@ -61,6 +61,10 @@ import gc
import
dis
import
dis
import
pickle
import
pickle
from
warnings
import
warn
as
_warn
from
warnings
import
warn
as
_warn
try
:
from
time
import
monotonic
as
_time
except
ImportError
:
from
time
import
time
as
_time
try
:
try
:
import
threading
import
threading
...
@@ -476,7 +480,7 @@ class Trace:
...
@@ -476,7 +480,7 @@ class Trace:
self
.
_caller_cache
=
{}
self
.
_caller_cache
=
{}
self
.
start_time
=
None
self
.
start_time
=
None
if
timing
:
if
timing
:
self
.
start_time
=
time
.
time
()
self
.
start_time
=
_
time
()
if
countcallers
:
if
countcallers
:
self
.
globaltrace
=
self
.
globaltrace_trackcallers
self
.
globaltrace
=
self
.
globaltrace_trackcallers
elif
countfuncs
:
elif
countfuncs
:
...
@@ -614,7 +618,7 @@ class Trace:
...
@@ -614,7 +618,7 @@ class Trace:
self
.
counts
[
key
]
=
self
.
counts
.
get
(
key
,
0
)
+
1
self
.
counts
[
key
]
=
self
.
counts
.
get
(
key
,
0
)
+
1
if
self
.
start_time
:
if
self
.
start_time
:
print
(
'
%.2
f'
%
(
time
.
time
()
-
self
.
start_time
),
end
=
' '
)
print
(
'
%.2
f'
%
(
_
time
()
-
self
.
start_time
),
end
=
' '
)
bname
=
os
.
path
.
basename
(
filename
)
bname
=
os
.
path
.
basename
(
filename
)
print
(
"
%
s(
%
d):
%
s"
%
(
bname
,
lineno
,
print
(
"
%
s(
%
d):
%
s"
%
(
bname
,
lineno
,
linecache
.
getline
(
filename
,
lineno
)),
end
=
''
)
linecache
.
getline
(
filename
,
lineno
)),
end
=
''
)
...
@@ -627,7 +631,7 @@ class Trace:
...
@@ -627,7 +631,7 @@ class Trace:
lineno
=
frame
.
f_lineno
lineno
=
frame
.
f_lineno
if
self
.
start_time
:
if
self
.
start_time
:
print
(
'
%.2
f'
%
(
time
.
time
()
-
self
.
start_time
),
end
=
' '
)
print
(
'
%.2
f'
%
(
_
time
()
-
self
.
start_time
),
end
=
' '
)
bname
=
os
.
path
.
basename
(
filename
)
bname
=
os
.
path
.
basename
(
filename
)
print
(
"
%
s(
%
d):
%
s"
%
(
bname
,
lineno
,
print
(
"
%
s(
%
d):
%
s"
%
(
bname
,
lineno
,
linecache
.
getline
(
filename
,
lineno
)),
end
=
''
)
linecache
.
getline
(
filename
,
lineno
)),
end
=
''
)
...
...
Misc/NEWS
Dosyayı görüntüle @
949d8c98
...
@@ -60,6 +60,9 @@ Core and Builtins
...
@@ -60,6 +60,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #14690: Use monotonic clock instead of system clock in the sched,
subprocess and trace modules.
- Issue #14958: Change IDLE systax highlighting to recognize all string and
- Issue #14958: Change IDLE systax highlighting to recognize all string and
byte literals supported in Python 3.3.
byte literals supported in Python 3.3.
...
...
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