Commit Graph

2422 Commits

Author SHA1 Message Date
Victor Stinner fa09beb150 Issue #23485: Add _PyTime_FromMillisecondsObject() function 2015-03-30 21:36:10 +02:00
Larry Hastings a52f31dfe2 Fix PY_VERSION in Include/patchlevel.h to reflect our post-3.5.0a3 state. 2015-03-30 01:56:27 -07:00
Larry Hastings 09dab7a87e Merge 3.5.0a3 release engineering changes back into trunk. 2015-03-30 01:50:00 -07:00
Victor Stinner e134a7fe36 Issue #23752: _Py_fstat() is now responsible to raise the Python exception
Add _Py_fstat_noraise() function when a Python exception is not welcome.
2015-03-30 10:09:31 +02:00
Victor Stinner a695f83f0d Issue #22117: Remove _PyTime_ROUND_DOWN and _PyTime_ROUND_UP rounding methods
Use _PyTime_ROUND_FLOOR and _PyTime_ROUND_CEILING instead.
2015-03-30 03:57:14 +02:00
Victor Stinner bcdd777d3c Issue #22117: Add _PyTime_ROUND_CEILING rounding method for timestamps
Add also more tests for ROUNd_FLOOR.
2015-03-30 03:52:49 +02:00
Victor Stinner ea9c0dd2c2 Issue #22117: Fix usage of _PyTime_AsTimeval()
Add _PyTime_AsTimeval_noraise() function. Call it when it's not possible (or
not useful) to raise a Python exception on overflow.
2015-03-30 02:51:13 +02:00
Larry Hastings 02d1db9f46 Release bump for Python 3.5.0a3. 2015-03-29 15:34:26 -07:00
Victor Stinner 1bd18ba9a7 Issue #22117: Cleanup pytime.c/.h 2015-03-30 00:25:38 +02:00
Victor Stinner 09e5cf28ae Issue #22117: Use the _PyTime_t API in _datetime.datetime() constructor
* Remove _PyTime_gettimeofday()
* Add _PyTime_GetSystemClock()
2015-03-30 00:09:18 +02:00
Victor Stinner 02937aab13 Issue #22117: Add the new _PyTime_ROUND_FLOOR rounding method for the datetime
module. time.clock_settime() now uses this rounding method instead of
_PyTime_ROUND_DOWN to handle correctly dates before 1970.
2015-03-28 05:02:39 +01:00
Victor Stinner b3b4544070 Issue #22117: Use the _PyTime_t API for time.clock_settime()
Remove also the now unused _PyTime_AddDouble() function.
2015-03-28 04:09:41 +01:00
Victor Stinner c337838af7 Issue #22117: Use the new _PyTime_t API in the select module 2015-03-28 05:07:51 +01:00
Victor Stinner f5faad2bf0 Issue #22117: The thread module uses the new _PyTime_t timestamp API
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.
2015-03-28 03:52:05 +01:00
Victor Stinner b28e91633a Issue #22117: remove _PyTime_INTERVAL() macro 2015-03-28 01:32:13 +01:00
Victor Stinner 95e9cef6f0 Issue #22117: Write unit tests for _PyTime_AsTimeval()
* _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
2015-03-28 01:26:47 +01:00
Victor Stinner 34dc0f46ae Issue #22117: The signal modules uses the new _PyTime_t API
* Add _PyTime_AsTimespec()
* Add unit tests for _PyTime_AsTimespec()
2015-03-27 18:19:03 +01:00
Victor Stinner a47b881d86 Issue #22117: time.time() now uses the new _PyTime_t API
* Add _PyTime_GetSystemClockWithInfo()
2015-03-27 18:16:17 +01:00
Victor Stinner 4bfb460d88 Issue #22117: time.monotonic() now uses the new _PyTime_t API
* Add _PyTime_FromNanoseconds()
* Add _PyTime_AsSecondsDouble()
* Add unit tests for _PyTime_AsSecondsDouble()
2015-03-27 22:27:24 +01:00
Victor Stinner 992c43fec9 Issue #22117: Fix rounding in _PyTime_FromSecondsObject()
* Rename _PyTime_FromObject() to _PyTime_FromSecondsObject()
* Add _PyTime_AsNanosecondsObject() and _testcapi.pytime_fromsecondsobject()
* Add unit tests
2015-03-27 17:12:45 +01:00
Victor Stinner cb29f0177c Issue #22117: Add a new Python timestamp format _PyTime_t to pytime.h
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.
2015-03-27 13:31:18 +01:00
Victor Stinner 91afbb6088 Issue #23753: Move _Py_wstat() from Python/fileutils.c to Modules/getpath.c
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.
2015-03-24 12:16:28 +01:00
Victor Stinner f329878e74 Issue #23753: Python doesn't support anymore platforms without stat() or
fstat(), these functions are always required.

Remove HAVE_STAT and HAVE_FSTAT defines, and stop supporting DONT_HAVE_STAT and
DONT_HAVE_FSTAT.
2015-03-24 10:27:50 +01:00
Victor Stinner efde146b0c Issue #23571: _Py_CheckFunctionResult() now gives the name of the function
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.
2015-03-21 15:04:43 +01:00
Serhiy Storchaka f402775e5d Removed trailing tabs. 2015-03-21 09:25:53 +02:00
Victor Stinner 9a8089b32a Issue #23646: Enhance precision of time.sleep() and socket timeout when
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.
2015-03-20 01:42:20 +01:00
Victor Stinner 66aab0c4b5 Issue #23708: Add _Py_read() and _Py_write() functions to factorize code handle
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.
2015-03-19 22:53:20 +01:00
Serhiy Storchaka 009b811d67 Removed unintentional trailing spaces in non-external and non-generated C files. 2015-03-18 21:53:15 +02:00
Victor Stinner a555cfcb73 Issue #23694: Enhance _Py_open(), it now raises exceptions
* _Py_open() now raises exceptions on error. If open() fails, it raises an
  OSError with the filename.
* _Py_open() now releases the GIL while calling open()
* Add _Py_open_noraise() when _Py_open() cannot be used because the GIL is not
  held
2015-03-18 00:22:14 +01:00
Victor Stinner 6562b29e13 Issue #23644: Fix issues with C++ when compiling Python extensions
Disable completly pyatomic.h on C++, because <stdatomic.h> is not compatible with C++.

<pyatomic.h> is only needed by the optimized PyThreadState_GET() macro in
pystate.h. Instead, declare PyThreadState_GET() as an alias to
PyThreadState_Get(), as done for limited API.
2015-03-17 22:53:27 +01:00
Victor Stinner 3b6d0ae8fe Issue #23644, #22038: Move #include <stdatomic.c> inside the extern "C" { ... }
block in pyatomic.h
2015-03-12 16:04:41 +01:00
Larry Hastings cfac654165 Post-release changes for 3.5.0a2. 2015-03-09 02:39:47 -07:00
Larry Hastings 6003ac5267 Release bump for 3.5.0a2. 2015-03-08 00:24:34 -08:00
Victor Stinner 4a7cc88472 Issue #23571: PyObject_Call(), PyCFunction_Call() and call_function() now
raise a SystemError if a function returns a result and raises an exception.
The SystemError is chained to the previous exception.

Refactor also PyObject_Call() and PyCFunction_Call() to make them more readable.

Remove some checks which became useless (duplicate checks).

Change reviewed by Serhiy Storchaka.
2015-03-06 23:35:27 +01:00
Steve Dower d81431f587 Issue #23524: Replace _PyVerify_fd function with calling _set_thread_local_invalid_parameter_handler on every thread. 2015-03-06 14:47:02 -08:00
Serhiy Storchaka 06a13f81ea Issue #23152: Move declarations back to posixmodule.c.
Declarations of Windows-specific auxilary functions need Windows types
from windows.h.  Instead of including windows.h in Python.h and making
it available to all Windows users, it is simpler and safer just move
declarations to the single file that needs them.
2015-02-22 21:34:54 +02:00
Serhiy Storchaka 12ebbc74f1 Issue #23152: Move declaration into a header and exclude from stable API. 2015-02-22 19:39:36 +02:00
Steve Dower f2f373f593 Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
2015-02-21 08:44:05 -08:00
Victor Stinner ce2c584ea5 Merge 3.4 (typo) 2015-02-11 18:18:10 +01:00
Victor Stinner 22fabe218d Fix typo: PyMem_Alloc => PyMem_Malloc 2015-02-11 18:17:56 +01:00
Larry Hastings f77232b04e Post-release updates for Python 3.5.0a1. 2015-02-08 14:07:14 -08:00
Larry Hastings 833d1925c7 Post-release updates for Python 3.4.3rc1. 2015-02-08 14:04:36 -08:00
Larry Hastings b06f142f5f Release bump for 3.5.0a1. 2015-02-07 16:00:55 -08:00
Larry Hastings e5529063b2 Version bump for 3.4.3rc1. 2015-02-07 16:00:45 -08:00
Serhiy Storchaka 3dd3e26680 Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
2015-02-03 01:25:42 +02:00
Raymond Hettinger 91496a08d4 merge 2015-01-29 22:02:17 -08:00
Raymond Hettinger c5644126a2 Move the set search finger before the smalltable. 2015-01-29 22:00:32 -08:00
Stefan Krah f5324d7074 Closes #22668: Merge from 3.4. 2015-01-29 14:29:51 +01:00
Stefan Krah fa5d6a5ff3 Issue #22668: Ensure that format strings survive slicing after casting. 2015-01-29 14:27:23 +01:00
Raymond Hettinger a5ebbf6295 Remove unneeded dummy test from the set search loop (when the hashes match we know the key is not a dummy). 2015-01-26 21:54:35 -08:00
Raymond Hettinger 93035c44fd Issue #23119: Simplify setobject by inlining the special case for unicode equality testing. 2015-01-25 16:12:49 -08:00
Ethan Furman b95b56150f Issue20284: Implement PEP461 2015-01-23 20:05:18 -08:00
Raymond Hettinger 1202a4733e Issue 23261: Clean-up the hack to store the set.pop() search finger in a hash field instead of the setobject. 2015-01-18 13:12:42 -08:00
Benjamin Peterson 610bc6a211 merge 3.4 (#23221) 2015-01-13 09:20:31 -05:00
Benjamin Peterson 82f34ada45 fix instances of consecutive articles (closes #23221)
Patch by Karan Goel.
2015-01-13 09:17:24 -05:00
Victor Stinner 4f5366e65a Issue #22038: pyatomic.h now uses stdatomic.h or GCC built-in functions for
atomic memory access if available. Patch written by Vitor de Lima and Gustavo
Temple.
2015-01-09 02:13:19 +01:00
Raymond Hettinger 3f063a54ce Minor comment clean-up 2014-12-28 17:15:12 -08:00
Raymond Hettinger 404a45d91a Neaten-up setobject.h
- Move all Py_LIMITED_API exclusions together under one #ifndef
- Group PyAPI_FUNC functions and PyAPI_DATA together.
- Bring related comments together and put them in the appropriate section.
2014-12-26 17:28:16 -08:00
Serhiy Storchaka b757c83ec6 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:25:22 +02:00
Serhiy Storchaka 92bf919ed0 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:26:10 +02:00
Serhiy Storchaka 166ebc4e5d Issue #19676: Added the "namereplace" error handler. 2014-11-25 13:57:17 +02:00
Nick Coghlan d600951748 Issue #22869: Split pythonrun into two modules
- interpreter startup and shutdown code moved to a new
  pylifecycle.c module
- Py_OptimizeFlag moved into the new module with the other
  global flags
2014-11-20 21:39:37 +10:00
Serhiy Storchaka df4518ca4b Issue #22453: Removed non-documented macro PyObject_REPR(). 2014-11-18 23:34:33 +02:00
Serhiy Storchaka 1eba04663e Issue #18637: Fixed an error in _PyNode_SizeOf declaration.
Patch by Roumen Petrov.
2014-11-18 17:30:50 +02:00
Serhiy Storchaka 60fe569673 Issue #18637: Fixed an error in _PyNode_SizeOf declaration.
Patch by Roumen Petrov.
2014-11-18 17:30:15 +02:00
Serhiy Storchaka 42826566f5 Issue #22193: Fixed integer overflow error in sys.getsizeof().
Fixed an error in _PySys_GetSizeOf declaration.
2014-11-15 13:22:27 +02:00
Serhiy Storchaka 030e92d1a5 Issue #22193: Fixed integer overflow error in sys.getsizeof().
Fixed an error in _PySys_GetSizeOf declaration.
2014-11-15 13:21:37 +02:00
Serhiy Storchaka 81f68a7d4b Issue #22453: Warn against the use of leaking macro PyObject_REPR(). 2014-11-19 00:08:38 +02:00
Victor Stinner b71c7dc9dd Issue #22591: Drop support of MS-DOS
Drop support of MS-DOS, especially of the DJGPP compiler (MS-DOS port of GCC).

Today is a sad day. Good bye MS-DOS, good bye my friend :'-(
2014-10-10 11:55:41 +02:00
Serhiy Storchaka 78184af9b5 Issue #21715: Extracted shared complicated code in the _io module to new
_PyErr_ChainExceptions() function.
2014-10-08 22:32:50 +03:00
Serhiy Storchaka e2bd2a7186 Issue #21715: Extracted shared complicated code in the _io module to new
_PyErr_ChainExceptions() function.
2014-10-08 22:31:52 +03:00
Antoine Pitrou 94262ebc9c Issue #22462: Fix pyexpat's creation of a dummy frame to make it appear in exception tracebacks.
Initial patch by Mark Shannon.
2014-10-08 20:02:40 +02:00
Antoine Pitrou 0ddbf4795f Issue #22462: Fix pyexpat's creation of a dummy frame to make it appear in exception tracebacks.
Initial patch by Mark Shannon.
2014-10-08 20:00:09 +02:00
Larry Hastings adeb140cb3 Post-release changes after 3.4.2 final. 2014-10-08 02:40:43 -07:00
Larry Hastings dbb126103e Release bump for 3.4.2 final. 2014-10-05 19:05:50 -07:00
Antoine Pitrou 0676a406bf Issue #18711: Add a new `PyErr_FormatV` function, similar to `PyErr_Format` but accepting a `va_list` argument. 2014-09-30 21:16:27 +02:00
Larry Hastings 03776e33a9 Bump version number for 3.4.2rc1 release. 2014-09-21 00:09:56 +01:00
Nick Coghlan a0f33759fa Merge fix for issue #22166 from 3.4 2014-09-15 23:55:16 +12:00
Nick Coghlan 8fad1676a2 Issue #22166: clear codec caches in test_codecs 2014-09-15 23:50:44 +12:00
Victor Stinner ae58649721 Issue #22043: time.monotonic() is now always available
threading.Lock.acquire(), threading.RLock.acquire() and socket operations now
use a monotonic clock, instead of the system clock, when a timeout is used.
2014-09-02 23:18:25 +02:00
Victor Stinner 5791a5403b pytime.h: remove duplicated "#ifndef Py_LIMITED_API" 2014-08-31 15:48:55 +02:00
Victor Stinner 0011124dc2 Issue #22043: _PyTime_Init() now checks if the system clock works.
Other changes:

* The whole _PyTime API is private (not defined if Py_LIMITED_API is set)
* _PyTime_gettimeofday_info() also returns -1 on error
* Simplify PyTime_gettimeofday(): only use clock_gettime(CLOCK_REALTIME) or
  gettimeofday() on UNIX. Don't fallback to ftime() or time() anymore.
2014-08-29 16:31:59 +02:00
Serhiy Storchaka 121be0d64b Issue #22193: Added private function _PySys_GetSizeOf() needed to implement
some __sizeof__() methods.
2014-08-14 22:22:35 +03:00
Serhiy Storchaka 547d3bc3a6 Issue #22193: Added private function _PySys_GetSizeOf() needed to implement
some __sizeof__() methods.
2014-08-14 22:21:18 +03:00
Antoine Pitrou b349e4c929 Issue #22116: C functions and methods (of the 'builtin_function_or_method' type) can now be weakref'ed. Patch by Wei Wu. 2014-08-06 19:31:40 -04:00
Victor Stinner f6a271ae98 Issue #18395: Rename ``_Py_char2wchar()`` to :c:func:`Py_DecodeLocale`, rename
``_Py_wchar2char()`` to :c:func:`Py_EncodeLocale`, and document these
functions.
2014-08-01 12:28:48 +02:00
Victor Stinner 1db9e7bb19 Issue #22054: Add os.get_blocking() and os.set_blocking() functions to get and
set the blocking mode of a file descriptor (False if the O_NONBLOCK flag is
set, True otherwise). These functions are not available on Windows.
2014-07-29 22:32:47 +02:00
Martin v. Löwis 7252a6e81e Issue #20179: Apply Argument Clinic to bytes and bytearray.
Patch by Tal Einat.
2014-07-27 16:25:09 +02:00
Antoine Pitrou 1eee8e5207 Issue #21803: remove macro indirections in complexobject.h 2014-07-07 18:49:30 -04:00
Victor Stinner 40ee30181f Issue #21205: Add a new ``__qualname__`` attribute to generator, the qualified
name, and use it in the representation of a generator (``repr(gen)``). The
default name of the generator (``__name__`` attribute) is now get from the
function instead of the code. Use ``gen.gi_code.co_name`` to get the name of
the code.
2014-06-16 15:59:28 +02:00
Larry Hastings 8c3ec536e9 Merge 3.4.3 release engineering changes back into 3.4. 2015-02-26 05:58:48 -08:00
Larry Hastings e287746401 Post-release changes for 3.4.3. 2015-02-26 05:56:32 -08:00
Larry Hastings fc8eda5ad8 Release bump for 3.4.3 final. 2015-02-22 23:55:39 -08:00
Victor Stinner d8f0d922d5 Issue #21233: Rename the C structure "PyMemAllocator" to "PyMemAllocatorEx" to
make sure that the code using it will be adapted for the new "calloc" field
(instead of crashing).
2014-06-02 21:57:10 +02:00
Benjamin Peterson c7ceefc1a2 a post 3.4.1 world 2014-05-26 15:53:27 -07:00
Benjamin Peterson c12318a7fd merge 3.4 (#21587) 2014-05-26 15:12:43 -07:00
Benjamin Peterson 1a2cf9aba7 remove tab (closes #21587) 2014-05-26 15:12:28 -07:00
Larry Hastings 5c26a8afbb Version bump for 3.4.1. 2014-05-17 21:46:35 -07:00
Larry Hastings 2110603344 Post-release version bump for 3.4.1rc1. Sorry it's late! 2014-05-17 20:54:44 -07:00
Victor Stinner 45e8e2f218 Issue #21490: Add new C macros: Py_ABS() and Py_STRINGIFY()
Keep _Py_STRINGIZE() in PC/pyconfig.h to not introduce a dependency between
pyconfig.h and pymacros.h.
2014-05-14 17:24:35 +02:00