Commit Graph

2442 Commits

Author SHA1 Message Date
Victor Stinner 50856d5ae7 sys.setrecursionlimit() now raises RecursionError
Issue #25274: sys.setrecursionlimit() now raises a RecursionError if the new
recursion limit is too low depending at the current recursion depth. Modify
also the "lower-water mark" formula to make it monotonic. This mark is used to
decide when the overflowed flag of the thread state is reset.
2015-10-13 00:11:21 +02:00
Serhiy Storchaka b9d98d532c Issue #24483: C implementation of functools.lru_cache() now calculates key's
hash only once.
2015-10-02 12:47:11 +03: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 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
Larry Hastings 9c51f89cd6 Merge release engineering work from Python 3.5.0. 2015-09-13 15:43:21 +01:00
Larry Hastings 82c0c69011 Post-release updates for Python 3.5.0. 2015-09-13 15:36:07 +01:00
Larry Hastings f92f6c8e56 Version bump for Python 3.5.0 final. 2015-09-12 17:28:39 +01:00
Larry Hastings ded28e3863 Merge Python 3.5.0rc4 back to hg.python.org. 2015-09-09 06:52:38 -07:00
Larry Hastings 03728fac15 Post-release update for Python 3.5.0rc4. 2015-09-09 06:45:19 -07:00
Larry Hastings 1043f95b9b Version bump for Python 3.5.0rc4. 2015-09-08 23:58:10 -07:00
Larry Hastings c8c47f55e6 Merge heads. 2015-09-07 05:16:38 -07:00
Larry Hastings 442c560bd8 Version bump for Python 3.5.0rc3. 2015-09-07 05:12:05 -07:00
Yury Selivanov beaa5094a2 docs: Better comment for tp_as_async slot 2015-08-26 13:03:57 -04:00
Larry Hastings a51812ae98 Post-release updates for Python 3.5.0rc2. 2015-08-25 13:30:58 -07:00
Larry Hastings e6c6f69ac9 Version bump for Python 3.5.0rc2. 2015-08-24 20:31:53 -07:00
R David Murray 803502c56b #21167: Fix definition of NAN when ICC used without -fp-model strict.
Patch from Chris Hogan of Intel, reviewed by Mark Dickinson.
2015-08-15 18:33:45 -04:00
Larry Hastings 2ab6ddb19d Post-release bump for Python 3.5.0rc1. 2015-08-10 18:03:52 -07:00
Larry Hastings 71ea65feed Release bump for Python 3.5.0rc1. 2015-08-09 03:41:04 -07:00
Larry Hastings 3d1dc904f4 Post-release updates for Python 3.5.0b4. 2015-07-26 07:55:08 -07:00
Larry Hastings 164df4e51a Version bump for Python 3.5.0b4. 2015-07-25 14:22:13 -07:00
Larry Hastings b34db6ad9b Post-release fixes for Python 3.5.0b3. 2015-07-05 10:26:00 -07:00
Larry Hastings 9626971c74 Version bump for Python 3.5.0b3 release. 2015-07-04 19:13:02 -07:00
Yury Selivanov f488fb422a Issue #19235: Add new RecursionError exception. Patch by Georg Brandl. 2015-07-03 01:04:23 -04:00
Yury Selivanov 5376ba9630 Issue #24400: Introduce a distinct type for 'async def' coroutines.
Summary of changes:

1. Coroutines now have a distinct, separate from generators
   type at the C level: PyGen_Type, and a new typedef PyCoroObject.
   PyCoroObject shares the initial segment of struct layout with
   PyGenObject, making it possible to reuse existing generators
   machinery.  The new type is exposed as 'types.CoroutineType'.

   As a consequence of having a new type, CO_GENERATOR flag is
   no longer applied to coroutines.

2. Having a separate type for coroutines made it possible to add
   an __await__ method to the type.  Although it is not used by the
   interpreter (see details on that below), it makes coroutines
   naturally (without using __instancecheck__) conform to
   collections.abc.Coroutine and collections.abc.Awaitable ABCs.

   [The __instancecheck__ is still used for generator-based
   coroutines, as we don't want to add __await__ for generators.]

3. Add new opcode: GET_YIELD_FROM_ITER.  The opcode is needed to
   allow passing native coroutines to the YIELD_FROM opcode.

   Before this change, 'yield from o' expression was compiled to:

      (o)
      GET_ITER
      LOAD_CONST
      YIELD_FROM

   Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.

   The reason for adding a new opcode is that GET_ITER is used
   in some contexts (such as 'for .. in' loops) where passing
   a coroutine object is invalid.

4. Add two new introspection functions to the inspec module:
   getcoroutinestate(c) and getcoroutinelocals(c).

5. inspect.iscoroutine(o) is updated to test if 'o' is a native
   coroutine object.  Before this commit it used abc.Coroutine,
   and it was requested to update inspect.isgenerator(o) to use
   abc.Generator; it was decided, however, that inspect functions
   should really be tailored for checking for native types.

6. sys.set_coroutine_wrapper(w) API is updated to work with only
   native coroutines.  Since types.coroutine decorator supports
   any type of callables now, it would be confusing that it does
   not work for all types of coroutines.

7. Exceptions logic in generators C implementation was updated
   to raise clearer messages for coroutines:

   Before: TypeError("generator raised StopIteration")
   After: TypeError("coroutine raised StopIteration")
2015-06-22 12:19:30 -04:00
Serhiy Storchaka 289dd19124 Added the const qualifier for char* argument of Py_EnterRecursiveCall(). 2015-06-21 16:27:09 +03:00
Serhiy Storchaka 5fa22fc088 Added the const qualifier for char* argument of Py_EnterRecursiveCall(). 2015-06-21 16:26:28 +03:00
Serhiy Storchaka ccfdf0923a Issue #24436: Added const qualifiers for char* arguments of _PyTraceback_Add.
Patch by Michael Ensslin.
2015-06-21 16:00:33 +03:00
Serhiy Storchaka 73c95f1949 Issue #24436: Added const qualifiers for char* arguments of _PyTraceback_Add.
Patch by Michael Ensslin.
2015-06-21 15:59:46 +03:00
Yury Selivanov eb698fe68c Issue 24342: No need to use PyAPI_FUNC for _PyEval_ApplyCoroutineWrapper 2015-06-02 22:30:31 -04:00
Yury Selivanov ca82910221 Issue 24365: Conditionalize PEP 489 additions to the stable ABI
Patch by Petr Viktorin.
2015-06-02 19:06:47 -04:00
Yury Selivanov aab3c4a211 Issue 24342: Let wrapper set by sys.set_coroutine_wrapper fail gracefully 2015-06-02 18:43:51 -04:00
Eric Snow a762af74b2 Issue #24347: Set KeyError if PyDict_GetItemWithError returns NULL. 2015-06-01 22:59:08 -06:00
Yury Selivanov d8cf382ee7 Issue 24017: Make PyEval_(Set|Get)CoroutineWrapper private 2015-06-01 12:15:23 -04:00
Benjamin Peterson 0969a9f8ab add Py_tp_finalize slot (closes #24345)
Patch from Petr Viktorin.
2015-06-01 10:12:48 -05:00
Larry Hastings 61eb146b22 Post-release updates for Python 3.5.0b2. 2015-05-31 21:42:35 -07:00
Larry Hastings d200e0c072 Version bump for Python 3.5.0b2. 2015-05-30 17:00:48 -07:00
Eric Snow d0a06455a5 Issue #16991: Drop Py_ODict_GetItemId. 2015-05-30 12:06:03 -06:00
Eric Snow 8c7ed012b8 Issue #16991: Use PyObject_TypeCheck instead of PyObject_IsInstance. 2015-05-30 09:29:53 -06:00
Yury Selivanov 7aa5341164 Reverting my previous commit.
Something went horribly wrong when I was doing `hg rebase`.
2015-05-30 10:57:56 -04:00
Eric Snow 47db71756d Issue #16991: Add a C implementation of collections.OrderedDict. 2015-05-29 22:21:39 -06:00
Benjamin Peterson 0938d98bcc merge 3.5 2015-05-28 14:40:15 -05:00
Benjamin Peterson 264be6f48f remove STORE_MAP, since it's unused 2015-05-28 14:40:08 -05:00
Yury Selivanov ac0bffb962 Issue 24017: Drop getawaitablefunc and friends in favor of unaryfunc. 2015-05-28 11:22:41 -04:00
Yury Selivanov 6ef059097c Issue 24017: Drop getawaitablefunc and friends in favor of unaryfunc. 2015-05-28 11:21:31 -04:00
Serhiy Storchaka e998aad7b3 Issue #24288: Generated opcode.h no longer contains trailing spaces and tabs. 2015-05-27 21:31:50 +03:00
Serhiy Storchaka 3028c955fa Issue #24288: Generated opcode.h no longer contains trailing spaces and tabs. 2015-05-27 21:31:33 +03:00
Larry Hastings d0c2a20b24 Version bump for trunk to 3.6.0a0. Welcome to the future! 2015-05-25 16:49:01 -07:00
Larry Hastings f46aa8e2d1 Post-release fixes for 3.5.0b1. 2015-05-24 16:40:45 -07:00
Larry Hastings 205acde55e Version bump for 3.5.0b1. 2015-05-23 17:43:05 -07:00
Steve Dower 11d7b1423f Issue #24268: Adds PyModuleDef_Init and PyModuleDef_Type to python3.def (stable ABI) 2015-05-23 14:44:37 -07:00