Commit graph

20595 commits

Author SHA1 Message Date
Antoine Pitrou
d6362db83d Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar(). 2015-06-23 14:39:57 +02:00
Antoine Pitrou
a72f0cdaea Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar(). 2015-06-23 14:38:13 +02:00
Antoine Pitrou
6bc217dd3d Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar(). 2015-06-23 14:31:11 +02:00
Yury Selivanov
6edc2f7549 Issue #24400: Merge 3.5 2015-06-22 12:31:24 -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
Jason R. Coombs
b6d1cdda8e Issue #20387: Correct test to properly capture expectation. 2015-06-25 22:42:24 -04:00
Jason R. Coombs
5713b3c5bf Issue #20387: Add test capturing failure to roundtrip indented code in tokenize module. 2015-06-20 19:52:22 -04:00
Jason R. Coombs
7cf36387e4 Remove unused import and remove doctest-only import into doctests. 2015-06-20 19:13:50 -04:00
Victor Stinner
138adb8d05 (Merge 3.4) Issue #15745: Rewrite os.utime() tests in test_os
* Don't use the timestamp of an existing file anymore, only use fixed
  timestamp
* Enhance the code checking the resolution of the filesystem timestamps.
* Check timestamps with a resolution of 1 microsecond instead of 1 millisecond
* When os.utime() uses the current system clock, tolerate a delta of 20 ms.
  Before some os.utime() tolerated a different of 10 seconds.
* Merge duplicated tests and simplify the code
2015-06-12 22:01:54 +02:00
Victor Stinner
e12e7aa3fd Issue #15745: Rewrite os.utime() tests in test_os
* Don't use the timestamp of an existing file anymore, only use fixed
  timestamp
* Enhance the code checking the resolution of the filesystem timestamps.
* Check timestamps with a resolution of 1 microsecond instead of 1 millisecond
* When os.utime() uses the current system clock, tolerate a delta of 20 ms.
  Before some os.utime() tolerated a different of 10 seconds.
* Merge duplicated tests and simplify the code
2015-06-12 21:58:00 +02:00
Victor Stinner
cf05970307 Remove unused import on test_os 2015-06-12 21:57:50 +02:00
Victor Stinner
47aacc8f69 Issue #15745: Rewrite os.utime() tests in test_os
* Don't use the timestamp of an existing file anymore, only use fixed
  timestamp
* Enhance the code checking the resolution of the filesystem timestamps.
* Check timestamps with a resolution of 1 microsecond instead of 1 millisecond
* When os.utime() uses the current system clock, tolerate a delta of 20 ms.
  Before some os.utime() tolerated a different of 10 seconds.
* Merge duplicated tests and simplify the code
2015-06-12 17:26:23 +02:00
Serhiy Storchaka
c5d2d40238 Issue #24299: Fixed test__locale on Solaris. 2015-06-08 18:50:28 +03:00
Serhiy Storchaka
23e6109112 Issue #24299: Fixed test__locale on Solaris. 2015-06-08 18:50:18 +03:00
Serhiy Storchaka
07c002573a Issue #24299: Fixed test__locale on Solaris. 2015-06-08 18:48:33 +03:00
Serhiy Storchaka
29e26a72d7 Issue #14373: Other attempt to fix threaded test for lru_cache(). 2015-06-08 12:44:43 +03:00
Serhiy Storchaka
391af751f2 Issue #14373: Other attempt to fix threaded test for lru_cache(). 2015-06-08 12:44:18 +03:00
Serhiy Storchaka
40e74006ad Issue #14373: C implementation of functools.lru_cache() now can be used with
methods.
2015-06-08 11:20:22 +03:00
Serhiy Storchaka
e7070f09bc Issue #14373: C implementation of functools.lru_cache() now can be used with
methods.
2015-06-08 11:19:24 +03:00
Serhiy Storchaka
df2cbbcb55 Issue #14373: Fixed threaded test for lru_cache(). Added new threaded test. 2015-06-08 11:15:36 +03:00
Serhiy Storchaka
77cb197aaa Issue #14373: Fixed threaded test for lru_cache(). Added new threaded test. 2015-06-08 11:14:31 +03:00
Guido van Rossum
79e434d9e5 Mapping key type is invariant. 2015-06-07 13:36:19 -07:00
Yury Selivanov
0c9c4610cb Issue 24374: Plug refleak in set_coroutine_wrapper
(Merge 3.5)
2015-06-04 10:17:25 -04:00
Yury Selivanov
94c2263005 Issue 24374: Plug refleak in set_coroutine_wrapper 2015-06-04 10:16:51 -04:00
Eric Snow
f02dcc8803 Merge from 3.5. 2015-06-04 00:12:14 -06:00
Eric Snow
4fabf02633 Issue #24369: Defend against key-changes during iteration. 2015-06-04 00:09:56 -06:00
Guido van Rossum
43a79cc552 Update typing.py: remove isinstance() support (Mark struck it from the PEP). 2015-06-03 19:04:42 -07:00
Eric Snow
d14de5e22d Merge from 3.5. 2015-06-02 20:43:37 -06:00
Eric Snow
ac02ef373f Issue #24368: Support keyword arguments in OrderedDict methods. 2015-06-02 20:42:14 -06:00
Yury Selivanov
082332ce37 Issue 24342: Let wrapper set by sys.set_coroutine_wrapper fail gracefully
(Merge 3.5)
2015-06-02 18:45:11 -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
Donald Stufft
75124e08c5 Merge the fix for #24267 2015-06-02 10:38:21 -04:00
Donald Stufft
67872ba91a Merge the fix for #24267 2015-06-02 10:38:01 -04:00
Donald Stufft
71a8589ddc Closes #24267 - Does not check version on ensurepip uninstall
Ensure that the uninstall helper for Windows passes the proper
flags to pip to prevent it from checking PyPI if the pip that
we're currently attempting to uninstall is the latest verison.
2015-06-02 10:37:08 -04:00
Eric Snow
ec6cd162de Merge from 3.5. 2015-06-01 23:35:40 -06:00
Eric Snow
b952ab43f2 Issue #24359: Check for changed OrderedDict size during iteration. 2015-06-01 23:35:13 -06:00
Eric Snow
e9dd08d08c Merge from 3.5. 2015-06-01 23:14:26 -06:00
Eric Snow
d171975609 Issue #24348: Drop superfluous increfs/decrefs. 2015-06-01 23:12:13 -06:00
Eric Snow
c976b73002 Merge from 3.5. 2015-06-01 23:06:20 -06:00
Eric Snow
a762af74b2 Issue #24347: Set KeyError if PyDict_GetItemWithError returns NULL. 2015-06-01 22:59:08 -06:00
Yury Selivanov
9f59b0dcf2 Issue 24017: Add a test for CoroWrapper and 'async def' coroutines 2015-05-31 21:44:15 -04:00
Yury Selivanov
e42cc38639 Issue 24017: Add a test for CoroWrapper and 'async def' coroutines 2015-05-31 21:44:05 -04:00
Tal Einat
bc8db8fa1b Issue #19543: Implementation of isclose as per PEP 485
For details, see:
PEP 0485 -- A Function for testing approximate equality

Functions added: math.isclose() and cmath.isclose().

Original code by Chris Barker. Patch by Tal Einat.

(merge 3.5)
2015-05-31 22:15:11 +03:00
Tal Einat
d5519ed7f4 Issue #19543: Implementation of isclose as per PEP 485
For details, see:
PEP 0485 -- A Function for testing approximate equality

Functions added: math.isclose() and cmath.isclose().

Original code by Chris Barker. Patch by Tal Einat.
2015-05-31 22:05:00 +03:00
Yury Selivanov
eb141c48af Issue 24004: Fix DeprecationWarning in a unittest
(Merge from 3.5)
2015-05-31 11:28:57 -04:00
Yury Selivanov
439c5fe3ae Issue 24004: Fix DeprecationWarning in a unittest 2015-05-31 11:28:35 -04:00
Serhiy Storchaka
442a894d1e Issue #24284: The startswith and endswith methods of the str class no longer
return True when finding the empty string and the indexes are completely out
of range.
2015-05-31 09:16:13 +03:00
Serhiy Storchaka
d4ea03c785 Issue #24284: The startswith and endswith methods of the str class no longer
return True when finding the empty string and the indexes are completely out
of range.
2015-05-31 09:15:51 +03:00
Yury Selivanov
23f8d52087 Issue 24004: Add a unittest for @asyncio.coroutine supporting Awaitables
(Merge 3.5)
2015-05-30 21:04:58 -04:00
Yury Selivanov
ad583a8e6d Issue 24004: Add a unittest for @asyncio.coroutine supporting Awaitables 2015-05-30 21:04:37 -04:00