Commit graph

91167 commits

Author SHA1 Message Date
Victor Stinner
3abf44e48f 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.
2015-09-18 15:38:37 +02:00
Victor Stinner
258f17c96d Merge 3.5 2015-09-18 15:08:14 +02:00
Victor Stinner
6df29ada02 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.
2015-09-18 15:06:34 +02:00
Victor Stinner
4298afe9f0 Null merge 3.5: datetime was already fixed, but with a very different implementation 2015-09-18 14:58:09 +02:00
Victor Stinner
5ebfe42cdf Oops, fix test_microsecond_rounding()
Test self.theclass, not datetime. Regression introduced by manual tests.
2015-09-18 14:52:15 +02:00
Victor Stinner
84ff4abd79 Merge 3.4 (datetime rounding) 2015-09-18 14:50:18 +02:00
Victor Stinner
511491ade0 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:

   (datetime(1970,1,1) + timedelta(seconds=t)) == datetime.utcfromtimestamp(t)

It also the rounding mode used by round(float) for example.

Add more unit tests on the rounding mode in test_datetime.
2015-09-18 14:42:05 +02:00
Victor Stinner
13c15ca9cf Merge 3.5 (pytime) 2015-09-18 14:21:55 +02:00
Victor Stinner
ec26f83f2e Issue #25155: Fix _PyTime_Divide() rounding
_PyTime_Divide() rounding was wrong: copy code from Python default which has
now much better unit tests.
2015-09-18 14:21:14 +02:00
Victor Stinner
cdf9b789ee Merge 3.5 (NEWS) 2015-09-18 13:59:30 +02:00
Victor Stinner
02d6a25bea Issue #25155: document the bugfix in Misc/NEWS
Oops, I forgot to document my change.
2015-09-18 13:59:09 +02:00
Victor Stinner
058258652a Merge 3.5 (pytime, odict) 2015-09-18 13:55:15 +02:00
Victor Stinner
4a0d1e7c36 odictobject.c: fix compiler warning
PyObject_Length() returns a P_ssize_t, not an int. Use a Py_ssize_t to avoid
overflow.
2015-09-18 13:44:11 +02:00
Victor Stinner
9a8b177e60 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.
2015-09-18 13:36:17 +02:00
Victor Stinner
1e2b6882fc 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.
2015-09-18 13:23:02 +02:00
Victor Stinner
1bd0b54c74 Null merge 3.5 2015-09-18 11:30:42 +02:00
Victor Stinner
4b352171d2 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
2015-09-18 11:29:16 +02:00
Victor Stinner
baab5f7341 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.
2015-09-18 11:23:42 +02:00
Victor Stinner
3e30fd7c59 Merge 3.5 (imp/_imp) 2015-09-18 09:12:08 +02:00
Victor Stinner
cd6e69439c Issue #25160: Fix import_init() comments and messages
import_init() imports the "_imp" module, not the "imp" module.
2015-09-18 09:11:57 +02:00
Serhiy Storchaka
ff6cae38a2 Null merge 2015-09-18 10:09:18 +03:00
Serhiy Storchaka
d8f5fb4611 Null merge 2015-09-18 10:09:06 +03:00
Serhiy Storchaka
e3bcbd2bba Issue #25108: Backported tests for traceback functions print_stack(),
format_stack(), and extract_stack() called without arguments.
2015-09-18 10:07:18 +03:00
Serhiy Storchaka
4ebf9d3a21 Issue #25108: Omitted internal frames in traceback functions print_stack(),
format_stack(), and extract_stack() called without arguments.
2015-09-18 10:06:23 +03:00
Serhiy Storchaka
e953ba794c Issue #25108: Omitted internal frames in traceback functions print_stack(),
format_stack(), and extract_stack() called without arguments.
2015-09-18 10:04:47 +03:00
Ethan Furman
c791507e1f Issue 25147: add reason for using _collections 2015-09-17 22:55:40 -07:00
Ethan Furman
b134a2a5ae Close issue24756: clarify usage of run_docstring_examples() 2015-09-17 22:22:20 -07:00
Ethan Furman
7b51a55ecd Issue24756: clarify usage of run_docstring_examples() 2015-09-17 22:21:36 -07:00
Ethan Furman
2a5f9da56c Issue24756: clarify usage of run_docstring_examples() 2015-09-17 22:20:41 -07:00
Ethan Furman
e5754ab0c4 Close issue25147: use C implementation of OrderedDict 2015-09-17 22:03:52 -07:00
Ethan Furman
6db1fd5fb8 Close issue24840: Enum._value_ is queried for bool(); original patch by Mike Lundy 2015-09-17 21:49:12 -07:00
Yury Selivanov
b1a3d9ae56 Merge 3.5 2015-09-16 12:18:55 -04:00
Yury Selivanov
8e3b04c70b whatsnew/3.5: Reword bytes*.hex message 2015-09-16 12:18:29 -04:00
Victor Stinner
e41b4712fe Issue #25122: add debug traces to test_eintr.test_open() 2015-09-16 09:23:28 +02:00
Victor Stinner
1e0f8ecdd8 Issue #25122: optimize test_eintr
Fix test_write(): copy support.PIPE_MAX_SIZE bytes, not support.PIPE_MAX_SIZE*3
bytes.
2015-09-15 23:59:00 +02:00
Victor Stinner
3731bbe8b1 Issue #25122: test_eintr: don't redirect stdout to stderr
sys.stderr is sometimes a StringIO. The redirection was just a hack to see
eintr_tester.py output in red in the buildbot output.
2015-09-15 22:55:52 +02:00
Victor Stinner
334536fb60 Merge 3.5 (asyncio doc) 2015-09-15 22:43:05 +02:00
Victor Stinner
60208a161d Issue #25134: Update asyncio doc for SSL on Windows
ProactorEventLoop now supports SSL.
2015-09-15 22:41:52 +02:00
Victor Stinner
44879a0b18 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.
2015-09-15 22:38:09 +02:00
Berker Peksag
d7bf45f5f7 whatsnew/3.5: Add missing word "class" 2015-09-15 20:06:48 +03:00
Berker Peksag
878bc871b4 whatsnew/3.5: Add missing word "class" 2015-09-15 20:06:28 +03:00
Berker Peksag
768e0c129d Issue #25127: Fix typo in concurrent.futures.rst
Reported by Jakub Wilk.
2015-09-15 19:59:46 +03:00
Berker Peksag
61ea0aadee Issue #25127: Fix typo in concurrent.futures.rst
Reported by Jakub Wilk.
2015-09-15 19:59:26 +03:00
Berker Peksag
0b0c3b6624 Issue #25127: Fix typo in concurrent.futures.rst
Reported by Jakub Wilk.
2015-09-15 19:59:03 +03:00
Berker Peksag
9289e9038f Issue #25105: Update susp-ignored.csv to avoid false positives 2015-09-15 19:43:26 +03:00
Berker Peksag
055395eed2 Issue #25105: Update susp-ignored.csv to avoid false positives 2015-09-15 19:43:04 +03:00
Victor Stinner
f11d0d2c0d 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
2015-09-15 12:15:59 +02:00
Victor Stinner
024364a89a Merge 3.5 (os.waitpid) 2015-09-15 10:24:27 +02:00
Victor Stinner
d3ffd32767 Issue #25118: Fix a regression of Python 3.5.0 in os.waitpid() on Windows.
Add an unit test on os.waitpid()
2015-09-15 10:11:03 +02:00
Victor Stinner
13e457c808 Merge 3.5 (test_gdb) 2015-09-15 00:23:20 +02:00