Victor Stinner [Fri, 18 Sep 2015 13:38:37 +0000 (15:38 +0200)]
Issue #25003: On Solaris 11.3 or newer, os.urandom() now uses the getrandom()
function instead of the getentropy() function. The getentropy() function is
blocking to generate very good quality entropy, os.urandom() doesn't need such
high-quality entropy.
Victor Stinner [Fri, 18 Sep 2015 13:06:34 +0000 (15:06 +0200)]
Issue #25150: Hide the private _Py_atomic_xxx symbols from the public
Python.h header to fix a compilation error with OpenMP. PyThreadState_GET()
becomes an alias to PyThreadState_Get() to avoid ABI incompatibilies.
It is important that the _PyThreadState_Current variable is always accessed
with the same implementation of pyatomic.h. Use the PyThreadState_Get()
function so extension modules will all reuse the same implementation.
Victor Stinner [Fri, 18 Sep 2015 12:42:05 +0000 (14:42 +0200)]
Issue #23517: Fix rounding in fromtimestamp() and utcfromtimestamp() methods
of datetime.datetime: microseconds are now rounded to nearest with ties going
to nearest even integer (ROUND_HALF_EVEN), instead of being rounding towards
zero (ROUND_DOWN). It's important that these methods use the same rounding
mode than datetime.timedelta to keep the property:
Victor Stinner [Fri, 18 Sep 2015 11:36:17 +0000 (13:36 +0200)]
Issue #25155: Add _PyTime_AsTimevalTime_t() function
On Windows, the tv_sec field of the timeval structure has the type C long,
whereas it has the type C time_t on all other platforms. A C long has a size of
32 bits (signed inter, 1 bit for the sign, 31 bits for the value) which is not
enough to store an Epoch timestamp after the year 2038.
Add the _PyTime_AsTimevalTime_t() function written for datetime.datetime.now():
convert a _PyTime_t timestamp to a (secs, us) tuple where secs type is time_t.
It allows to support dates after the year 2038 on Windows.
Enhance also _PyTime_AsTimeval_impl() to detect overflow on the number of
seconds when rounding the number of microseconds.
Victor Stinner [Fri, 18 Sep 2015 11:23:02 +0000 (13:23 +0200)]
Issue #25155: Add _PyTime_AsTimevalTime_t() function
On Windows, the tv_sec field of the timeval structure has the type C long,
whereas it has the type C time_t on all other platforms. A C long has a size of
32 bits (signed inter, 1 bit for the sign, 31 bits for the value) which is not
enough to store an Epoch timestamp after the year 2038.
Add the _PyTime_AsTimevalTime_t() function written for datetime.datetime.now():
convert a _PyTime_t timestamp to a (secs, us) tuple where secs type is time_t.
It allows to support dates after the year 2038 on Windows.
Enhance also _PyTime_AsTimeval_impl() to detect overflow on the number of
seconds when rounding the number of microseconds.
Victor Stinner [Fri, 18 Sep 2015 09:29:16 +0000 (11:29 +0200)]
Issue #25122: sync test_eintr with Python 3.6
* test_eintr: support verbose mode, don't redirect eintr_tester output into
a pipe
* eintr_tester: replace os.fork() with subprocess to have a cleaner child
process (ex: don't inherit setitimer())
* eintr_tester: kill the process if the unit test fails
* test_open/test_os_open(): write support.PIPE_MAX_SIZE bytes instead of
support.PIPE_MAX_SIZE*3 bytes
Victor Stinner [Fri, 18 Sep 2015 09:23:42 +0000 (11:23 +0200)]
Issue #25122: Fix test_eintr.test_open() on FreeBSD
Skip test_open() and test_os_open(): both tests uses a FIFO and signals, but
there is a bug in the FreeBSD kernel which blocks the test. Skip the tests
until the bug is fixed in FreeBSD kernel.
Remove also debug traces from test_eintr:
* stop using faulthandler to have a timeout
* remove print()
Write also open and close on two lines in test_open() and test_os_open()
tests. If these tests block again, we can know if the test is stuck at open or
close.
test_eintr: don't always run the test in debug mode.
Victor Stinner [Tue, 15 Sep 2015 20:38:09 +0000 (22:38 +0200)]
Issue #25122: Fix test_eintr, kill child process on error
Some test_eintr hangs on waiting for the child process completion if an error
occurred on the parent. Kill the child process on error (in the parent)
to avoid the hang.
Victor Stinner [Tue, 15 Sep 2015 10:15:59 +0000 (12:15 +0200)]
Issue #25122: try to debug test_eintr hang on FreeBSD
* Add verbose mode to test_eintr
* Always enable verbose mode in test_eintr
* Use faulthandler.dump_traceback_later() with a timeout of 15 minutes in
eintr_tester.py