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
e39ebe45
Kaydet (Commit)
e39ebe45
authored
Ock 18, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge
üst
2c085604
855889b4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
9 deletions
+96
-9
time.rst
Doc/library/time.rst
+12
-0
webbrowser.rst
Doc/library/webbrowser.rst
+5
-2
3.3.rst
Doc/whatsnew/3.3.rst
+7
-5
bz2.py
Lib/bz2.py
+6
-2
test_bz2.py
Lib/test/test_bz2.py
+7
-0
test_time.py
Lib/test/test_time.py
+7
-0
NEWS
Misc/NEWS
+5
-0
timemodule.c
Modules/timemodule.c
+47
-0
No files found.
Doc/library/time.rst
Dosyayı görüntüle @
e39ebe45
...
...
@@ -183,6 +183,18 @@ The module defines the following functions and data items:
.. versionadded:: 3.3
.. function:: wallclock()
.. index::
single: Wallclock
single: benchmarking
Return the current time in fractions of a second to the system's best ability.
Use this when the most accurate representation of wall-clock is required, i.e.
when "processor time" is inappropriate. The reference point of the returned
value is undefined so only the difference of consecutive calls is valid.
.. versionadded: 3.3
.. function:: ctime([secs])
...
...
Doc/library/webbrowser.rst
Dosyayı görüntüle @
e39ebe45
...
...
@@ -164,12 +164,15 @@ Notes:
(4)
Only on Mac OS X platform.
.. versionadded:: 3.3
Support for Chrome/Chromium has been added.
Here are some simple examples::
url = 'http://
www
.python.org/'
url = 'http://
docs
.python.org/'
# Open URL in a new tab, if a browser window is already open.
webbrowser.open_new_tab(url
+ 'doc/'
)
webbrowser.open_new_tab(url)
# Open URL in new window, raising the window if possible.
webbrowser.open_new(url)
...
...
Doc/whatsnew/3.3.rst
Dosyayı görüntüle @
e39ebe45
...
...
@@ -396,12 +396,14 @@ New module: :mod:`faulthandler`.
time
----
* The :mod:`time` module has new :func:`~time.clock_getres` and
:func:`~time.clock_gettime` functions and ``CLOCK_xxx`` constants.
:func:`~time.clock_gettime` can be used with :data:`time.CLOCK_MONOTONIC` to
get a monotonic clock.
The :mod:`time` module has new functions:
(Contributed by Victor Stinner in :issue:`10278`)
* :func:`~time.clock_getres` and :func:`~time.clock_gettime` functions and
``CLOCK_xxx`` constants. :func:`~time.clock_gettime` can be used with
:data:`time.CLOCK_MONOTONIC` to get a monotonic clock.
* :func:`~time.wallclock`: monotonic clock.
(Contributed by Victor Stinner in :issue:`10278`)
ftplib
...
...
Lib/bz2.py
Dosyayı görüntüle @
e39ebe45
...
...
@@ -10,9 +10,13 @@ __all__ = ["BZ2File", "BZ2Compressor", "BZ2Decompressor", "compress",
__author__
=
"Nadeem Vawda <nadeem.vawda@gmail.com>"
import
io
import
threading
import
warnings
try
:
from
threading
import
RLock
except
ImportError
:
from
dummy_threading
import
RLock
from
_bz2
import
BZ2Compressor
,
BZ2Decompressor
...
...
@@ -53,7 +57,7 @@ class BZ2File(io.BufferedIOBase):
"""
# This lock must be recursive, so that BufferedIOBase's
# readline(), readlines() and writelines() don't deadlock.
self
.
_lock
=
threading
.
RLock
()
self
.
_lock
=
RLock
()
self
.
_fp
=
None
self
.
_closefp
=
False
self
.
_mode
=
_MODE_CLOSED
...
...
Lib/test/test_bz2.py
Dosyayı görüntüle @
e39ebe45
...
...
@@ -463,6 +463,13 @@ class BZ2FileTest(BaseTest):
for
t
in
threads
:
t
.
join
()
def
testWithoutThreading
(
self
):
bz2
=
support
.
import_fresh_module
(
"bz2"
,
blocked
=
(
"threading"
,))
with
bz2
.
BZ2File
(
self
.
filename
,
"wb"
)
as
f
:
f
.
write
(
b
"abc"
)
with
bz2
.
BZ2File
(
self
.
filename
,
"rb"
)
as
f
:
self
.
assertEqual
(
f
.
read
(),
b
"abc"
)
def
testMixedIterationAndReads
(
self
):
self
.
createTempFile
()
linelen
=
len
(
self
.
TEXT_LINES
[
0
])
...
...
Lib/test/test_time.py
Dosyayı görüntüle @
e39ebe45
...
...
@@ -332,6 +332,13 @@ class TimeTestCase(unittest.TestCase):
self
.
assertEqual
(
time
.
strftime
(
'
%
Z'
,
tt
),
tzname
)
def
test_wallclock
(
self
):
t0
=
time
.
wallclock
()
time
.
sleep
(
0.1
)
t1
=
time
.
wallclock
()
t
=
t1
-
t0
self
.
assertAlmostEqual
(
t
,
0.1
,
places
=
2
)
class
TestLocale
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
oldloc
=
locale
.
setlocale
(
locale
.
LC_ALL
)
...
...
Misc/NEWS
Dosyayı görüntüle @
e39ebe45
...
...
@@ -447,6 +447,11 @@ Core and Builtins
Library
-------
-
Issue
#
10278
:
Add
time
.
wallclock
()
function
,
monotonic
clock
.
-
Issue
#
13809
:
Fix
regression
where
bz2
module
wouldn
't work when threads are
disabled. Original patch by Amaury Forgeot d'
Arc
.
-
Issue
#
13589
:
Fix
some
serialization
primitives
in
the
aifc
module
.
Patch
by
Oleg
Plakhotnyuk
.
...
...
Modules/timemodule.c
Dosyayı görüntüle @
e39ebe45
...
...
@@ -737,6 +737,52 @@ the local timezone used by methods such as localtime, but this behaviour\n\
should not be relied on."
);
#endif
/* HAVE_WORKING_TZSET */
static
PyObject
*
time_wallclock
(
PyObject
*
self
,
PyObject
*
unused
)
{
#if defined(MS_WINDOWS) && !defined(__BORLANDC__)
return
time_clock
(
self
,
NULL
);
#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
static
int
clk_index
=
0
;
clockid_t
clk_ids
[]
=
{
#ifdef CLOCK_MONOTONIC_RAW
CLOCK_MONOTONIC_RAW
,
#endif
CLOCK_MONOTONIC
#ifdef CLOCK_REALTIME
/* On Linux, CLOCK_REALTIME uses the same clock than gettimeofday(),
but clock_gettime() has a nanosecond resolution. */
,
CLOCK_REALTIME
#endif
};
int
ret
;
struct
timespec
tp
;
while
(
0
<=
clk_index
)
{
clockid_t
clk_id
=
clk_ids
[
clk_index
];
ret
=
clock_gettime
(
clk_id
,
&
tp
);
if
(
ret
==
0
)
return
PyFloat_FromDouble
(
tp
.
tv_sec
+
tp
.
tv_nsec
*
1e-9
);
clk_index
++
;
if
(
Py_ARRAY_LENGTH
(
clk_ids
)
<=
clk_index
)
clk_index
=
-
1
;
}
return
time_time
(
self
,
NULL
);
#else
return
time_time
(
self
,
NULL
);
#endif
}
PyDoc_STRVAR
(
wallclock_doc
,
"wallclock() -> float
\n
\
\n
\
Return the current time in fractions of a second to the system's best
\n
\
ability. Use this when the most accurate representation of wall-clock is
\n
\
required, i.e. when
\"
processor time
\"
is inappropriate. The reference point
\n
\
of the returned value is undefined so only the difference of consecutive
\n
\
calls is valid."
);
static
void
PyInit_timezone
(
PyObject
*
m
)
{
/* This code moved from PyInit_time wholesale to allow calling it from
...
...
@@ -872,6 +918,7 @@ static PyMethodDef time_methods[] = {
#ifdef HAVE_WORKING_TZSET
{
"tzset"
,
time_tzset
,
METH_NOARGS
,
tzset_doc
},
#endif
{
"wallclock"
,
time_wallclock
,
METH_NOARGS
,
wallclock_doc
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
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