Yury Selivanov
14acf5f41d
Issue #24791 : Fix grammar regression for call syntax: 'g(*a or b)'.
2015-08-05 17:54:10 -04:00
Victor Stinner
f716e74d5a
Merge 3.5 (os.urandom)
2015-07-30 10:14:52 +02:00
Victor Stinner
61d5aab9b9
py_getrandom(): getrandom() *can* return EINTR
...
See the latest version of getrandom() manual page:
http://man7.org/linux/man-pages/man2/getrandom.2.html#NOTES
The behavior when a call to getrandom() that is blocked while reading from
/dev/urandom is interrupted by a signal handler depends on the
initialization state of the entropy buffer and on the request size, buflen.
If the entropy is not yet initialized, then the call will fail with the
EINTR error. If the entropy pool has been initialized and the request size
is large (buflen > 256), the call either succeeds, returning a partially
filled buffer, or fails with the error EINTR. If the entropy pool has been
initialized and the request size is small (buflen <= 256), then getrandom()
will not fail with EINTR. Instead, it will return all of the bytes that
have been requested.
Note: py_getrandom() calls getrandom() with flags=0.
2015-07-30 10:13:52 +02:00
Berker Peksag
0bd5fb0112
Issue #24728 : Fix building without threads.
...
Patch by Louis Dassy.
2015-07-27 16:46:11 +03:00
Stefan Krah
ff9fe230d0
Fix refleak.
2015-07-27 12:57:21 +02:00
Stefan Krah
c0cbed1554
Fix refleak.
2015-07-27 12:56:49 +02:00
Yury Selivanov
6d35043e49
Merge 3.5 (Issue #24687 )
2015-07-23 09:11:13 +03:00
Yury Selivanov
f315c1c016
Issue #24687 : Plug refleak on SyntaxError in function parameters annotations.
2015-07-23 09:10:44 +03:00
Yury Selivanov
0811c5d7ba
Merge 3.5 (Issue #24619 )
2015-07-22 14:49:13 +03:00
Yury Selivanov
b7666a3093
Issue #24619 : More tests; fix nits in compiler.c
2015-07-22 14:48:57 +03:00
Benjamin Peterson
9f71cb0fee
merge 3.5 ( #24569 )
2015-07-05 10:38:05 -05:00
Benjamin Peterson
d5d77aac60
set items in dict displays from left to right ( closes #24569 )
2015-07-05 10:37:25 -05:00
Yury Selivanov
bb215e2300
Merge 3.5 (Issue #19235 )
2015-07-03 01:10:11 -04:00
Yury Selivanov
f488fb422a
Issue #19235 : Add new RecursionError exception. Patch by Georg Brandl.
2015-07-03 01:04:23 -04:00
Yury Selivanov
3bd2b98c29
Merge 3.5 (Issue #24528 )
2015-06-30 12:49:18 -04:00
Yury Selivanov
9dec03571f
Issue #24528 : Improve error message for awaits in comprehensions
2015-06-30 12:49:04 -04: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
Serhiy Storchaka
dcbff7d4e1
Added the const qualifier for char* argument of Py_EnterRecursiveCall().
2015-06-21 16:27:36 +03: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
86621ae19b
Issue #24436 : Added const qualifiers for char* arguments of _PyTraceback_Add.
...
Patch by Michael Ensslin.
2015-06-21 16:00:58 +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
Serhiy Storchaka
ec466a15d9
Fixed indentation of Python examples in C comments.
2015-06-11 00:09:32 +03:00
Serhiy Storchaka
553e156921
Fixed indentation of Python examples in C comments.
2015-06-11 00:07:47 +03:00
Serhiy Storchaka
d741a88049
Fixed indentation of Python examples in C comments.
2015-06-11 00:06:39 +03:00
Yury Selivanov
94c2263005
Issue 24374: Plug refleak in set_coroutine_wrapper
2015-06-04 10:16:51 -04: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
72ea27c89b
Issue 24366: Merge 3.4
2015-06-02 18:54:31 -04:00
Yury Selivanov
e12685757f
Issue 24366: Merge 3.3
2015-06-02 18:54:09 -04:00
Yury Selivanov
614bfcc953
Issue 24366: Indent code (thanks to li4ick for reporting).
2015-06-02 18:53:46 -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
Yury Selivanov
d8cf382ee7
Issue 24017: Make PyEval_(Set|Get)CoroutineWrapper private
2015-06-01 12:15:23 -04:00
Serhiy Storchaka
ac5569b1fa
Issue #24115 : Update uses of PyObject_IsTrue(), PyObject_Not(),
...
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
2015-05-30 17:48:19 +03:00
Serhiy Storchaka
fa494fd883
Issue #24115 : Update uses of PyObject_IsTrue(), PyObject_Not(),
...
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
2015-05-30 17:45:22 +03:00
Serhiy Storchaka
8b2e8b6cce
Specify default values of semantic booleans in Argument Clinic generated signatures as booleans.
2015-05-30 11:30:39 +03:00
Serhiy Storchaka
7e810a6e3d
Use converter names instead of format units in Argument Clinic descriptions
...
in builtin and _crypt modules.
2015-05-30 11:09:35 +03:00
Benjamin Peterson
e20056c8f7
fix importing one char extension modules ( closes #24328 )
2015-05-29 17:10:30 -05:00
Benjamin Peterson
264be6f48f
remove STORE_MAP, since it's unused
2015-05-28 14:40:08 -05:00
Benjamin Peterson
ee85339cc6
in dict displays, evaluate the key before the value ( closes #11205 )
...
Patch partially by Steve Dougherty.
2015-05-28 14:30:26 -05:00
Yury Selivanov
6ef059097c
Issue 24017: Drop getawaitablefunc and friends in favor of unaryfunc.
2015-05-28 11:21:31 -04:00
Nick Coghlan
55871f04bf
Issue #24285 : fix importing extensions from packages
2015-05-26 21:48:17 +10:00
Steve Dower
adc2fb8a6a
Issue #24268 : Fix import naming when loading extension modules. Patch by Petr Viktorin.
2015-05-23 14:13:41 -07:00
Steve Dower
7689154f58
Issue #24268 : Fixes generation of init import name on Windows.
2015-05-23 08:59:25 -07:00
Nick Coghlan
d5cacbb1d9
PEP 489: Multi-phase extension module initialization
...
Known limitations of the current implementation:
- documentation changes are incomplete
- there's a reference leak I haven't tracked down yet
The leak is most visible by running:
./python -m test -R3:3 test_importlib
However, you can also see it by running:
./python -X showrefcount
Importing the array or _testmultiphase modules, and
then deleting them from both sys.modules and the local
namespace shows significant increases in the total
number of active references each cycle. By contrast,
with _testcapi (which continues to use single-phase
initialisation) the global refcounts stabilise after
a couple of cycles.
2015-05-23 22:24:10 +10:00
Serhiy Storchaka
c0937f79ec
Issue #24102 : Fixed exception type checking in standard error handlers.
2015-05-18 16:10:40 +03:00
Serhiy Storchaka
ca7fecb038
Issue #24102 : Fixed exception type checking in standard error handlers.
2015-05-18 16:08:52 +03:00
Benjamin Peterson
de12b79cd6
allow test node after ** in calls ( closes #24176 )
2015-05-16 09:44:45 -04:00
Eric Snow
183a941bc1
Issue #24192 : Fix namespace package imports.
2015-05-15 21:54:59 -06:00
Nick Coghlan
baaadbf70d
Issue 24017: fix for "async with" refcounting
...
* adds missing INCREF in WITH_CLEANUP_START
* adds missing DECREF in WITH_CLEANUP_FINISH
* adds several new tests Yury created while investigating this
2015-05-13 15:54:02 +10:00
Benjamin Peterson
baa2e562ce
use our normal bracing style
2015-05-12 11:32:41 -04:00
Yury Selivanov
1dde177f82
Issue #24017 : Plug ref leak.
2015-05-12 11:30:14 -04:00
Yury Selivanov
f487a005d6
Fix warnings for PyEval_GetCoroutineWrapper
2015-05-11 23:19:34 -04:00
Yury Selivanov
7544508f02
PEP 0492 -- Coroutines with async and await syntax. Issue #24017 .
2015-05-11 22:57:16 -04:00
Yury Selivanov
8170e8c0d1
PEP 479: Change StopIteration handling inside generators.
...
Closes issue #22906 .
2015-05-09 11:44:30 -04:00
Benjamin Peterson
95283fb589
Merge 3.4
2015-05-07 18:42:16 -04:00
Benjamin Peterson
9e77f72fb2
shorten capsule name macro; it doesn't need to be so long
2015-05-07 18:41:47 -04:00
Benjamin Peterson
025e9ebd0a
PEP 448: additional unpacking generalizations ( closes #2292 )
...
Patch by Neil Girdhar.
2015-05-05 20:16:41 -04:00
Benjamin Peterson
63a6a6fd41
merge 3.4 ( #24096 )
2015-05-03 11:29:58 -04:00
Benjamin Peterson
8c59816b70
merge 3.3 ( #24096 )
2015-05-03 11:28:46 -04:00
Benjamin Peterson
deff2b76ec
be more robust against the filters list changing under us ( closes #24096 )
2015-05-03 11:23:37 -04:00
Eric Snow
32439d6eb6
Issue #23911 : Move path-based bootstrap code to a separate frozen module.
2015-05-02 19:15:18 -06:00
Benjamin Peterson
1dfd247c1b
remove the concept of an unoptimized function scope from the compiler, since it can't happen anymore
2015-04-27 21:44:22 -04:00
Gregory P. Smith
f789465eed
Silence a gcc "may be used uninitialized" compiler warning. Not true.
...
Initializing retval prevents the naive warning.
2015-04-25 23:51:39 -07:00
Gregory P. Smith
5d0ccd2f91
Add missing PyAPI_FUNC macro's to the public functions as other .c files do
...
in hopes that this fixes the windows extension module link error for modules
trying to call _Py_strhex functions. issue9951.
2015-04-26 04:59:52 +00:00
Gregory P. Smith
e3f6393b52
Add the files missing from c9f1630cf2b1 for issue9951.
...
hg status should be my friend more often...
2015-04-26 00:41:00 +00:00
Benjamin Peterson
51f58059f6
merge 3.4 ( #24049 )
2015-04-24 12:02:53 -04:00
Benjamin Peterson
9bdd61338d
remove dead *-import checking code ( closes #24049 )
2015-04-24 12:02:29 -04:00
Serhiy Storchaka
247789cee9
Issue #24007 : Argument Clinic now writes the format of PyArg_Parse*() at the
...
same line as function name.
2015-04-24 00:40:51 +03:00
Christian Heimes
1a084a882b
Issue #23998 : PyImport_ReInitLock() now checks for lock allocation error
2015-04-19 21:15:02 +02:00
Christian Heimes
e0ac2beb4f
Issue #23998 : PyImport_ReInitLock() now checks for lock allocation error
2015-04-19 21:12:14 +02:00
Christian Heimes
418fd74f87
Issue #23998 : PyImport_ReInitLock() now checks for lock allocation error
2015-04-19 21:08:42 +02:00
Serhiy Storchaka
db46fea8b6
Fixed error message for the "u#" format code.
2015-04-19 21:13:00 +03:00
Serhiy Storchaka
d6e53dab86
Fixed error message for the "u#" format code.
2015-04-19 21:11:30 +03:00
Christian Heimes
e8e4283cec
Remove redundant check for tb != NULL to shut up Coverity . It has been set to Py_None a couple of lines earlier.
...
CID 1291697 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking tb suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
2015-04-16 17:25:45 +02:00
R David Murray
4171bbe687
#23949 : Improve tuple unpacking error messages.
...
Patch by Arnon Yaari.
2015-04-15 17:08:45 -04:00
Larry Hastings
89964c48d1
Issue #23944 : Argument Clinic now wraps long impl prototypes at column 78.
2015-04-14 18:07:59 -04:00
Brett Cannon
f299abdafa
Issue #23731 : Implement PEP 488.
...
The concept of .pyo files no longer exists. Now .pyc files have an
optional `opt-` tag which specifies if any extra optimizations beyond
the peepholer were applied.
2015-04-13 14:21:02 -04:00
Steve Dower
8fc8980c96
Issue #23524 : Replace _PyVerify_fd function with calls to _set_thread_local_invalid_parameter_handler.
2015-04-12 00:26:27 -04:00
Benjamin Peterson
55c14355ac
fix building without threads ( closes #23877 )
2015-04-06 09:59:23 -04:00
Serhiy Storchaka
92e8af67a8
Issue #23492 : Argument Clinic now generates argument parsing code with
...
PyArg_Parse instead of PyArg_ParseTuple if possible.
2015-04-04 00:12:11 +03:00
Serhiy Storchaka
1009bf18b3
Issue #23501 : Argumen Clinic now generates code into separate files by default.
2015-04-03 23:53:51 +03:00
Victor Stinner
13019fdef3
Issue #22117 : Add a new _PyTime_FromSeconds() function
...
Fix also _Py_InitializeEx_Private(): initialize time before initializing
import, import_init() uses the _PyTime API (for thread locks).
2015-04-03 13:10:54 +02:00
Serhiy Storchaka
1399a01b90
Issue #22977 : Fixed formatting Windows error messages on Wine.
...
Patch by Martin Panter.
2015-04-02 09:50:06 +03:00
Serhiy Storchaka
f41f8f9974
Issue #22977 : Fixed formatting Windows error messages on Wine.
...
Patch by Martin Panter.
2015-04-02 09:47:27 +03:00
Victor Stinner
97f86b82b7
Issue #23836 : Use _Py_write_noraise() to retry on EINTR in _Py_DumpTraceback()
...
and _Py_DumpTracebackThreads(). Document also these functions to explain that
the caller is responsible to call PyErr_CheckSignals().
2015-04-01 18:38:01 +02:00
Victor Stinner
6f4fae8a95
Issue #23836 : Document functions releasing the GIL in fileutils.c
2015-04-01 18:34:32 +02:00
Victor Stinner
82c3e4599d
Issue #23836 : Add _Py_write_noraise() function
...
Helper to write() which retries write() if it is interrupted by a signal (fails
with EINTR).
2015-04-01 18:34:45 +02:00
Victor Stinner
62d1c70eff
Issue #22117 , issue #23485 : Fix _PyTime_AsMilliseconds() and
...
_PyTime_AsMicroseconds() rounding.
Add also unit tests.
2015-04-01 17:47:07 +02:00
Victor Stinner
fa09beb150
Issue #23485 : Add _PyTime_FromMillisecondsObject() function
2015-03-30 21:36:10 +02:00
Victor Stinner
81c6df5c0f
(Merge 3.4) Issue #22585 : os.urandom() now releases the GIL when the
...
getentropy() is used (OpenBSD 5.6+).
2015-03-30 11:19:07 +02:00
Victor Stinner
9aa1331c6f
Issue #22585 : os.urandom() now releases the GIL when the getentropy() is used
...
(OpenBSD 5.6+).
2015-03-30 11:18:30 +02:00
Victor Stinner
79b74aeb20
Issue #22181 : os.urandom() now releases the GIL when the getrandom()
...
implementation is used.
2015-03-30 11:16:40 +02:00
Victor Stinner
45cff0c0e6
Issue #22117 : Try to fix rounding in conversion from Python double to _PyTime_t
...
using the C volatile keyword.
2015-03-30 10:22:16 +02: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
edddf991d9
Issue #22117 : Add assertions to _PyTime_AsTimeval() and _PyTime_AsTimespec() to
...
check that microseconds and nanoseconds fits into the specified range.
2015-03-30 02:54:57 +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