summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* Issue #23485: Add _PyTime_FromMillisecondsObject() functionVictor Stinner2015-03-301-5/+18
|
* (Merge 3.4) Issue #22585: os.urandom() now releases the GIL when theVictor Stinner2015-03-301-6/+14
|\ | | | | | | getentropy() is used (OpenBSD 5.6+).
| * Issue #22585: os.urandom() now releases the GIL when the getentropy() is usedVictor Stinner2015-03-301-6/+14
| | | | | | | | (OpenBSD 5.6+).
* | Issue #22181: os.urandom() now releases the GIL when the getrandom()Victor Stinner2015-03-301-2/+11
| | | | | | | | implementation is used.
* | Issue #22117: Try to fix rounding in conversion from Python double to _PyTime_tVictor Stinner2015-03-301-1/+2
| | | | | | | | using the C volatile keyword.
* | Issue #23752: _Py_fstat() is now responsible to raise the Python exceptionVictor Stinner2015-03-305-23/+56
| | | | | | | | Add _Py_fstat_noraise() function when a Python exception is not welcome.
* | Issue #22117: Remove _PyTime_ROUND_DOWN and _PyTime_ROUND_UP rounding methodsVictor Stinner2015-03-301-15/+5
| | | | | | | | Use _PyTime_ROUND_FLOOR and _PyTime_ROUND_CEILING instead.
* | Issue #22117: Add _PyTime_ROUND_CEILING rounding method for timestampsVictor Stinner2015-03-301-0/+2
| | | | | | | | Add also more tests for ROUNd_FLOOR.
* | Issue #22117: Add assertions to _PyTime_AsTimeval() and _PyTime_AsTimespec() toVictor Stinner2015-03-301-0/+4
| | | | | | | | check that microseconds and nanoseconds fits into the specified range.
* | Issue #22117: Fix usage of _PyTime_AsTimeval()Victor Stinner2015-03-301-2/+17
| | | | | | | | | | Add _PyTime_AsTimeval_noraise() function. Call it when it's not possible (or not useful) to raise a Python exception on overflow.
* | Issue #22117: Fix rounding and implement _PyTime_ROUND_FLOOR in:Victor Stinner2015-03-291-24/+20
| | | | | | | | | | | | - _PyTime_ObjectToTime_t() - _PyTime_ObjectToTimespec() - _PyTime_ObjectToTimeval()
* | Issue #22117: Cleanup pytime.c/.hVictor Stinner2015-03-291-7/+5
| |
* | Issue #22117: Use the _PyTime_t API in _datetime.datetime() constructorVictor Stinner2015-03-291-105/+14
| | | | | | | | | | * Remove _PyTime_gettimeofday() * Add _PyTime_GetSystemClock()
* | Issue #22117: Fix _PyTime_GetMonotonicClock() andVictor Stinner2015-03-281-12/+20
| | | | | | | | | | _PyTime_GetSystemClockWithInfo() to not raise an exception and return 0 on error (it should never occur)
* | Issue #22117: Add the new _PyTime_ROUND_FLOOR rounding method for the datetimeVictor Stinner2015-03-281-3/+12
| | | | | | | | | | module. time.clock_settime() now uses this rounding method instead of _PyTime_ROUND_DOWN to handle correctly dates before 1970.
* | Issue #22117: Use the _PyTime_t API for time.clock_settime()Victor Stinner2015-03-281-17/+0
| | | | | | | | Remove also the now unused _PyTime_AddDouble() function.
* | Issue #22117: Use the new _PyTime_t API in the select moduleVictor Stinner2015-03-281-1/+1
| |
* | Issue #22117: The thread module uses the new _PyTime_t timestamp APIVictor Stinner2015-03-281-126/+6
| | | | | | | | | | | | | | | | | | Add also a new _PyTime_AsMicroseconds() function. threading.TIMEOUT_MAX is now be smaller: only 292 years instead of 292,271 years on 64-bit system for example. Sorry, your threads will hang a *little bit* shorter. Call me if you want to ensure that your locks wait longer, I can share some tricks with you.
* | Issue #22117: Write unit tests for _PyTime_AsTimeval()Victor Stinner2015-03-281-13/+27
| | | | | | | | | | | | | | * _PyTime_AsTimeval() now ensures that tv_usec is always positive * _PyTime_AsTimespec() now ensures that tv_nsec is always positive * _PyTime_AsTimeval() now returns an integer on overflow instead of raising an exception
* | Issue #22117: The signal modules uses the new _PyTime_t APIVictor Stinner2015-03-271-0/+21
| | | | | | | | | | * Add _PyTime_AsTimespec() * Add unit tests for _PyTime_AsTimespec()
* | Issue #22117: time.time() now uses the new _PyTime_t APIVictor Stinner2015-03-271-9/+120
| | | | | | | | * Add _PyTime_GetSystemClockWithInfo()
* | Issue #22117: time.monotonic() now uses the new _PyTime_t APIVictor Stinner2015-03-271-0/+26
| | | | | | | | | | | | * Add _PyTime_FromNanoseconds() * Add _PyTime_AsSecondsDouble() * Add unit tests for _PyTime_AsSecondsDouble()
* | Issue #22117: Fix rounding in _PyTime_FromSecondsObject()Victor Stinner2015-03-271-3/+14
| | | | | | | | | | | | * Rename _PyTime_FromObject() to _PyTime_FromSecondsObject() * Add _PyTime_AsNanosecondsObject() and _testcapi.pytime_fromsecondsobject() * Add unit tests
* | Issue #23451, #22117: Python 3.5 now requires Windows Vista or newer, soVictor Stinner2015-03-271-47/+2
| | | | | | | | GetTickCount64() is now always available.
* | Issue #22117: Add a new Python timestamp format _PyTime_t to pytime.hVictor Stinner2015-03-271-1/+310
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In practice, _PyTime_t is a number of nanoseconds. Its C type is a 64-bit signed number. It's integer value is in the range [-2^63; 2^63-1]. In seconds, the range is around [-292 years; +292 years]. In term of Epoch timestamp (1970-01-01), it can store a date between 1677-09-21 and 2262-04-11. The API has a resolution of 1 nanosecond and use integer number. With a resolution on 1 nanosecond, 64-bit IEEE 754 floating point numbers loose precision after 194 days. It's not the case with this API. The drawback is overflow for values outside [-2^63; 2^63-1], but these values are unlikely for most Python modules, except of the datetime module. New functions: - _PyTime_GetMonotonicClock() - _PyTime_FromObject() - _PyTime_AsMilliseconds() - _PyTime_AsTimeval() This change uses these new functions in time.sleep() to avoid rounding issues. The new API will be extended step by step, and the old API will be removed step by step. Currently, some code is duplicated just to be able to move incrementally, instead of pushing a large change at once.
* | Merge 3.4 (traceback)Victor Stinner2015-03-251-1/+8
|\ \ | |/
| * Issue #23571: If io.TextIOWrapper constructor fails in _Py_DisplaySourceLine(),Victor Stinner2015-03-251-1/+8
| | | | | | | | close the binary file to fix a resource warning.
* | (Merge 3.4) Issue #23571: Fix reentrant call to Py_FatalError()Victor Stinner2015-03-251-17/+28
|\ \ | |/ | | | | | | | | Flushing sys.stdout and sys.stderr in Py_FatalError() can call again Py_FatalError(). Add a reentrant flag to detect this case and just abort at the second call.
| * Issue #23571: Fix reentrant call to Py_FatalError()Victor Stinner2015-03-251-17/+28
| | | | | | | | | | | | Flushing sys.stdout and sys.stderr in Py_FatalError() can call again Py_FatalError(). Add a reentrant flag to detect this case and just abort at the second call.
* | (Merge 3.4) Issue #23571: Py_FatalError() now tries to flush sys.stdout andVictor Stinner2015-03-241-4/+26
|\ \ | |/ | | | | | | | | | | sys.stderr It should help to see exceptions when stderr if buffered: PyErr_Display() calls sys.stderr.write(), it doesn't write into stderr file descriptor directly.
| * Issue #23571: Py_FatalError() now tries to flush sys.stdout and sys.stderrVictor Stinner2015-03-241-4/+26
| | | | | | | | | | It should help to see exceptions when stderr if buffered: PyErr_Display() calls sys.stderr.write(), it doesn't write into stderr file descriptor directly.
* | Issue #23571: PyErr_FormatV() and PyErr_SetObject() now always clear theVictor Stinner2015-03-241-8/+7
| | | | | | | | | | current exception because they can run arbitrary Python code and so no exception must be set.
* | Issue #23753: Move _Py_wstat() from Python/fileutils.c to Modules/getpath.cVictor Stinner2015-03-241-17/+0
| | | | | | | | | | | | | | I expected more users of _Py_wstat(), but in practice it's only used by Modules/getpath.c. Move the function because it's not needed on Windows. Windows uses PC/getpathp.c which uses the Win32 API (ex: GetFileAttributesW()) not the POSIX API.
* | (Merge 3.4) Issue #23571: Enhance Py_FatalError()Victor Stinner2015-03-241-13/+59
|\ \ | |/ | | | | | | | | | | | | | | * Display the current Python stack if an exception was raised but the exception has no traceback * Disable faulthandler if an exception was raised (before it was only disabled if no exception was raised) * To display the current Python stack, call PyGILState_GetThisThreadState() which works even if the GIL was released
| * Issue #23571: Enhance Py_FatalError()Victor Stinner2015-03-241-13/+60
| | | | | | | | | | | | | | | | | | * Display the current Python stack if an exception was raised but the exception has no traceback * Disable faulthandler if an exception was raised (before it was only disabled if no exception was raised) * To display the current Python stack, call PyGILState_GetThisThreadState() which works even if the GIL was released
* | Issue #23753: Python doesn't support anymore platforms without stat() orVictor Stinner2015-03-242-20/+0
| | | | | | | | | | | | | | fstat(), these functions are always required. Remove HAVE_STAT and HAVE_FSTAT defines, and stop supporting DONT_HAVE_STAT and DONT_HAVE_FSTAT.
* | Issue #23571: _Py_CheckFunctionResult() now gives the name of the functionVictor Stinner2015-03-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | which returned an invalid result (result+error or no result without error) in the exception message. Add also unit test to check that the exception contains the name of the function. Special case: the final _PyEval_EvalFrameEx() check doesn't mention the function since it didn't execute a single function but a whole frame.
* | Issue #23708: Save/restore errno in _Py_read() and _Py_write()Victor Stinner2015-03-201-15/+21
| | | | | | | | | | Save and then restore errno because PyErr_CheckSignals() and PyErr_SetFromErrno() can modify it.
* | Issue #23708: Split assertion expression in two assertions in _Py_read() andVictor Stinner2015-03-201-2/+4
| | | | | | | | _Py_write() to know which test failed on the buildbot "AMD64 Snow Leop 3.x".
* | Cleanup pytime.c: add XXX_TO_YYY constants (ex: SEC_TO_US)Victor Stinner2015-03-201-13/+19
| |
* | Issue #23646: Enhance precision of time.sleep() and socket timeout whenVictor Stinner2015-03-201-0/+17
| | | | | | | | | | | | | | | | interrupted by a signal Add a new _PyTime_AddDouble() function and remove _PyTime_ADD_SECONDS() macro. The _PyTime_ADD_SECONDS only supported an integer number of seconds, the _PyTime_AddDouble() has subsecond resolution.
* | Issue #23708: Fix _Py_read() compilation error on WindowsVictor Stinner2015-03-191-1/+1
| | | | | | | | Fix typo: self->fd => fd
* | Issue #23707: On UNIX, os.urandom() now calls the Python signal handler whenVictor Stinner2015-03-191-19/+11
| | | | | | | | | | | | | | read() is interrupted by a signal. dev_urandom_python() now calls _Py_read() helper instead of calling directly read().
* | Issue #22181: Fix dev_urandom_noraise(), try calling py_getrandom() beforeVictor Stinner2015-03-191-4/+4
| | | | | | | | opening /dev/urandom.
* | Issue #23708: Add _Py_read() and _Py_write() functions to factorize code handleVictor Stinner2015-03-191-0/+149
| | | | | | | | | | | | | | | | EINTR error and special cases for Windows. These functions now truncate the length to PY_SSIZE_T_MAX to have a portable and reliable behaviour. For example, read() result is undefined if counter is greater than PY_SSIZE_T_MAX on Linux.
* | Issue #22181: The availability of the getrandom() is now checked in configure,Victor Stinner2015-03-191-8/+5
| | | | | | | | | | | | and stored in pyconfig.h as the new HAVE_GETRANDOM_SYSCALL define. Fix os.urandom() tests using file descriptors if os.urandom() uses getrandom().
* | Removed unintentional trailing spaces in non-external and non-generated C files.Serhiy Storchaka2015-03-184-12/+12
| |
* | Initialize variables to prevent GCC warningsVictor Stinner2015-03-182-3/+5
| |
* | Fix compiler warning in dtoa.cVictor Stinner2015-03-181-2/+2
| |
* | Issue #22181: On Linux, os.urandom() now uses the new getrandom() syscall ifVictor Stinner2015-03-181-6/+84
| | | | | | | | | | | | available, syscall introduced in the Linux kernel 3.17. It is more reliable and more secure, because it avoids the need of a file descriptor and waits until the kernel has enough entropy.