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
Victor Stinner
f81f0f9c63
Issue #22117 : Fix rounding and implement _PyTime_ROUND_FLOOR in:
...
- _PyTime_ObjectToTime_t()
- _PyTime_ObjectToTimespec()
- _PyTime_ObjectToTimeval()
2015-03-30 00:44:06 +02: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
cb0c60258b
Issue #22117 : Fix _PyTime_GetMonotonicClock() and
...
_PyTime_GetSystemClockWithInfo() to not raise an exception and return 0 on
error (it should never occur)
2015-03-28 05:24:19 +01: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
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
eb352295fd
Issue #23451 , #22117 : Python 3.5 now requires Windows Vista or newer, so
...
GetTickCount64() is now always available.
2015-03-27 14:12:08 +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
81f241ab2e
Issue #23571 : If io.TextIOWrapper constructor fails in _Py_DisplaySourceLine(),
...
close the binary file to fix a resource warning.
2015-03-25 02:25:25 +01:00
Victor Stinner
84092ac370
Issue #23571 : Fix reentrant call to Py_FatalError()
...
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.
2015-03-25 01:54:46 +01:00
Victor Stinner
ec4f9592f5
Issue #23571 : Py_FatalError() now tries to flush sys.stdout and 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.
2015-03-24 13:44:35 +01:00
Victor Stinner
0e98a76b65
Issue #23571 : Enhance Py_FatalError()
...
* 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
2015-03-24 11:24:06 +01:00
Victor Stinner
39183dfc68
Merge 3.4 (traceback)
2015-03-25 02:30:01 +01:00
Victor Stinner
53345a40bc
(Merge 3.4) Issue #23571 : Fix reentrant call to Py_FatalError()
...
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.
2015-03-25 01:55:14 +01:00
Victor Stinner
e0deff31d3
(Merge 3.4) Issue #23571 : Py_FatalError() now tries to flush sys.stdout and
...
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.
2015-03-24 13:46:18 +01:00
Victor Stinner
de821befd4
Issue #23571 : PyErr_FormatV() and PyErr_SetObject() now always clear the
...
current exception because they can run arbitrary Python code and so no
exception must be set.
2015-03-24 12:41:23 +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
10dc48497e
(Merge 3.4) Issue #23571 : Enhance Py_FatalError()
...
* 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
2015-03-24 12:01:30 +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
Victor Stinner
a3c0202eb5
Issue #23708 : Save/restore errno in _Py_read() and _Py_write()
...
Save and then restore errno because PyErr_CheckSignals() and
PyErr_SetFromErrno() can modify it.
2015-03-20 11:58:18 +01:00
Victor Stinner
7f04d4d4b7
Issue #23708 : Split assertion expression in two assertions in _Py_read() and
...
_Py_write() to know which test failed on the buildbot "AMD64 Snow Leop 3.x".
2015-03-20 11:21:41 +01:00
Victor Stinner
580ef1345a
Cleanup pytime.c: add XXX_TO_YYY constants (ex: SEC_TO_US)
2015-03-20 01:55:04 +01: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
c1cf4f7ef9
Issue #23708 : Fix _Py_read() compilation error on Windows
...
Fix typo: self->fd => fd
2015-03-19 23:53:04 +01:00
Victor Stinner
c9382eb7ae
Issue #23707 : On UNIX, os.urandom() now calls the Python signal handler when
...
read() is interrupted by a signal.
dev_urandom_python() now calls _Py_read() helper instead of calling directly
read().
2015-03-19 23:36:33 +01:00
Victor Stinner
c7cd12da60
Issue #22181 : Fix dev_urandom_noraise(), try calling py_getrandom() before
...
opening /dev/urandom.
2015-03-19 23:24:45 +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
Victor Stinner
9eb57c5fa5
Issue #22181 : The availability of the getrandom() is now checked in configure,
...
and stored in pyconfig.h as the new HAVE_GETRANDOM_SYSCALL define.
Fix os.urandom() tests using file descriptors if os.urandom() uses getrandom().
2015-03-19 22:21:49 +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
0c39b1b970
Initialize variables to prevent GCC warnings
2015-03-18 15:02:06 +01:00
Victor Stinner
938b0b9fee
Fix compiler warning in dtoa.c
2015-03-18 15:01:44 +01:00
Victor Stinner
59f7fb29ec
Issue #22181 : On Linux, os.urandom() now uses the new getrandom() syscall if
...
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.
2015-03-18 14:39:33 +01:00
Victor Stinner
5200f55024
Issue #19428 : Handle PyMarshal_Read*() errors in run_pyc_file()
...
Detect also earlier PyMarshal_Read*() errors in zipimport.
2015-03-18 13:56:25 +01:00
Victor Stinner
a47fc5c2dd
Issue #23694 : Handle EINTR in _Py_open() and _Py_fopen_obj()
...
Retry open()/fopen() if it fails with EINTR and the Python signal handler
doesn't raise an exception.
2015-03-18 09:52:54 +01:00
Victor Stinner
e42ccd2bfd
Issue #23694 : Enhance _Py_fopen(), it now raises an exception on error
...
* If fopen() fails, OSError is raised with the original filename object.
* The GIL is now released while calling fopen()
2015-03-18 01:39:23 +01: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
59b356d659
Issue #23571 : Restore removed assert(!PyErr_Occurred()); in
...
PyEval_CallObjectWithKeywords()
Sorry Serhiy, I missed your explanation because the review email was moved to
my Spam folder :-(
2015-03-16 11:52:32 +01:00
Steve Dower
9aa31d5479
Fixes incorrect use of GetLastError where errno should be used.
2015-03-14 11:39:18 -07:00
Steve Dower
41e7244c06
Fixes incorrect use of GetLastError where errno should be used.
2015-03-14 11:38:27 -07:00
Serhiy Storchaka
91427733ea
Issue #23192 : Fixed generator lambdas. Patch by Bruno Cauet.
2015-03-11 18:22:29 +02:00
Serhiy Storchaka
c775ad615a
Issue #23192 : Fixed generator lambdas. Patch by Bruno Cauet.
2015-03-11 18:20:35 +02:00
Steve Dower
8acde7dcce
Issue #23524 : Change back to using Windows errors for _Py_fstat instead of the errno shim.
2015-03-07 18:14:07 -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
Steve Dower
3e96f324dc
Issue #23451 : Update pyconfig.h for Windows to require Vista headers and remove unnecessary version checks.
2015-03-02 08:01:10 -08:00
Steve Dower
bf1f376b3e
Issue #23152 : Renames time_t_to_FILE_TIME to _Py_time_t_to_FILE_TIME, removes unused struct win32_stat and return value
2015-02-21 15:26:02 -08:00
Steve Dower
a2af1a5a5a
Issue #23152 : Renames attribute_data_to_stat to _Py_attribute_data_to_stat
2015-02-21 10:04:10 -08: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
Serhiy Storchaka
483405bcca
Issue #22883 : Got rid of outdated references to PyInt and PyString in comments.
2015-02-17 10:14:30 +02:00
Serhiy Storchaka
67559bf8f1
Issue #23450 : Silenced compiler warnings and added asserts in peephole optimizer.
2015-02-16 21:13:24 +02:00
Serhiy Storchaka
26861b0b29
Issue #23450 : Fixed possible integer overflows.
2015-02-16 20:52:17 +02:00
Serhiy Storchaka
4d0d982985
Issue #23446 : Use PyMem_New instead of PyMem_Malloc to avoid possible integer
...
overflows. Added few missed PyErr_NoMemory().
2015-02-16 13:33:32 +02:00
Serhiy Storchaka
1a1ff29659
Issue #23446 : Use PyMem_New instead of PyMem_Malloc to avoid possible integer
...
overflows. Added few missed PyErr_NoMemory().
2015-02-16 13:28:22 +02:00
Serhiy Storchaka
53fa8b2a4b
Fixed few compiler warnings.
2015-02-16 09:40:12 +02:00
Benjamin Peterson
f80ccf27cb
merge 3.4 ( #22633 )
2015-02-14 15:17:47 -05:00
Benjamin Peterson
2476b98acf
avoid reading unallocated memory when argc == 0 ( closes #22633 )
2015-02-14 15:16:32 -05:00
Serhiy Storchaka
c07422c119
Splitted the WFILE structure to WFILE and RFILE.
2015-02-11 16:18:09 +02:00
Serhiy Storchaka
c1efe5f039
Issue #23344 : marshal.dumps() is now 20-25% faster on average.
2015-02-11 15:54:54 +02:00
Serhiy Storchaka
ce921c62cc
Issue #20416 : marshal.dumps() with protocols 3 and 4 is now 40-50% faster on
...
average.
2015-02-11 15:53:31 +02:00
Serhiy Storchaka
3dd3e26680
Issue #22896 : Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
...
and PyObject_AsWriteBuffer().
2015-02-03 01:25:42 +02:00
Serhiy Storchaka
4fdb68491e
Issue #22896 : Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
...
and PyObject_AsWriteBuffer().
2015-02-03 01:21:08 +02:00
Benjamin Peterson
f86d1fdab7
merge 3.4 ( #21295 )
2015-02-02 10:52:56 -05:00
Benjamin Peterson
7a66fc22ad
revert lineno and col_offset changes from #16795 ( closes #21295 )
2015-02-02 10:51:20 -05:00
Victor Stinner
13a1c6022b
Merge 3.4 (generator)
2015-01-31 11:08:40 +01:00
Victor Stinner
26f7b8acdc
Issue #23353 : Fix the exception handling of generators in PyEval_EvalFrameEx().
...
At entry, save or swap the exception state even if PyEval_EvalFrameEx() is
called with throwflag=0. At exit, the exception state is now always restored or
swapped, not only if why is WHY_YIELD or WHY_RETURN. Patch co-written with
Antoine Pitrou.
2015-01-31 10:29:47 +01:00
Serhiy Storchaka
aaef05f003
Fixed memory leak in marshal.
2015-01-28 17:11:12 +02:00
Serhiy Storchaka
000daaee57
Fixed memory leak in marshal.
2015-01-28 17:10:48 +02:00
Serhiy Storchaka
07985ef387
Issue #22286 : The "backslashreplace" error handlers now works with
...
decoding and translating.
2015-01-25 22:56:57 +02:00
Serhiy Storchaka
82e07b92b3
Issue #23181 : More "codepoint" -> "code point".
2015-01-18 11:33:31 +02:00
Serhiy Storchaka
d3faf43f9b
Issue #23181 : More "codepoint" -> "code point".
2015-01-18 11:28:37 +02:00
Brett Cannon
02d8454002
Issue #23014 : Make importlib.abc.Loader.create_module() required when
...
importlib.abc.Loader.exec_module() is also defined.
Before this change, create_module() was optional **and** could return
None to trigger default semantics. This change now reduces the
options for choosing default semantics to one and in the most
backporting-friendly way (define create_module() to return None).
2015-01-09 11:39:21 -05:00
Benjamin Peterson
f8693416b5
merge 3.4 ( #23165 )
2015-01-04 16:06:14 -06:00
Benjamin Peterson
10ecaa2416
merge 3.3 ( closes #23165 )
2015-01-04 16:05:39 -06:00
Benjamin Peterson
72c2a0f60a
merge 3.2 ( closes #23165 )
2015-01-04 16:03:59 -06:00
Benjamin Peterson
f18bf6fd2d
add some overflow checks before multiplying ( closes #23165 )
2015-01-04 16:03:17 -06:00
Benjamin Peterson
52074ac866
merge 3.4
2014-12-31 18:11:34 -06:00
Benjamin Peterson
a453749a78
merge 3.3
2014-12-31 18:11:22 -06:00
Benjamin Peterson
7919acb920
merge 3.2
2014-12-31 18:10:13 -06:00
Benjamin Peterson
47e782a67a
update for copyright for 2015
2014-12-31 18:09:36 -06:00
Victor Stinner
fe02e39029
Issue #22585 : On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(),
...
instead of reading /dev/urandom, to get pseudo-random bytes.
2014-12-21 01:16:38 +01:00
Victor Stinner
4d6a3d6c01
Issue #22585 : On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(),
...
instead of reading /dev/urandom, to get pseudo-random bytes.
2014-12-21 01:16:38 +01:00
Steve Dower
03a144bb6a
#22980 Adds platform and version tags to .pyd files
2014-12-15 20:45:23 -08:00
Zachary Ware
cd441c4a79
Update Python/importlib.h
2014-12-15 12:30:23 -06:00
Benjamin Peterson
7ced53cc63
merge 3.4 ( #23048 )
2014-12-13 16:08:15 -05:00
Benjamin Peterson
3cda0ed062
pop the loop block even for infinite while loops ( closes #23048 )
2014-12-13 16:06:19 -05:00
Victor Stinner
0b881dd50f
Issue #18028 : Fix aliasing issue in READ_TIMESTAMP() of ceval.c on x86_64,
...
when Python is configure with --with-tsc. Patch written by Christian Heimes.
2014-12-12 13:17:41 +01:00
Serhiy Storchaka
b757c83ec6
Issue #22581 : Use more "bytes-like object" throughout the docs and comments.
2014-12-05 22:25:22 +02:00
Barry Warsaw
9e4db75426
- Issue #22966 : Fix __pycache__ pyc file name clobber when pyc_compile is
...
asked to compile a source file containing multiple dots in the source file
name.
2014-12-01 17:23:55 -05:00
Barry Warsaw
2a413853f1
- Issue #22966 : Fix __pycache__ pyc file name clobber when pyc_compile is
...
asked to compile a source file containing multiple dots in the source file
name.
2014-12-01 17:10:10 -05:00
Serhiy Storchaka
56a6d855e2
Removed duplicated words in in comments and docs.
2014-12-01 18:28:43 +02:00
Victor Stinner
60b33cc6a5
Merge 3.4 (ceval.c)
2014-12-12 13:19:48 +01:00
Antoine Pitrou
5db1bb81ff
Issue #22696 : Add function :func:`sys.is_finalizing` to know about interpreter shutdown.
2014-12-07 01:28:27 +01:00
Serhiy Storchaka
92bf919ed0
Issue #22581 : Use more "bytes-like object" throughout the docs and comments.
2014-12-05 22:26:10 +02:00
Barry Warsaw
d32d4ae4ca
- Issue #22966 : Fix __pycache__ pyc file name clobber when pyc_compile is
...
asked to compile a source file containing multiple dots in the source file
name.
2014-12-01 17:52:43 -05:00
Serhiy Storchaka
83000a490a
Removed duplicated words in in comments and docs.
2014-12-01 18:30:14 +02:00
Benjamin Peterson
3663b58664
correct assertion
2014-11-26 14:39:54 -06:00
Benjamin Peterson
810aa6db34
fix variable name
2014-11-26 14:20:51 -06:00
Serhiy Storchaka
aacfcccdc3
Issue #19676 : Fixed integer overflow issue in "namereplace" error handler.
2014-11-26 12:11:40 +02:00
Serhiy Storchaka
166ebc4e5d
Issue #19676 : Added the "namereplace" error handler.
2014-11-25 13:57:17 +02:00
Berker Peksag
da8cef40e5
Issue #22934 : Update the comment to mention Programs/_freeze_importlib.c.
2014-11-24 23:26:08 +02:00
Antoine Pitrou
d3c53b6048
Update importlib.h
2014-11-23 16:01:20 +01:00
Zachary Ware
c4821d62b4
Closes #22869 : Move PyOS_CheckStack back to pythonrun.c
2014-11-21 23:35:12 -06:00
Steve Dower
9b59dd4781
Issue #22869 : Remove duplicate stack check from pythonrun.c
2014-11-21 20:33:12 -08:00
Brett Cannon
b6e2556d8f
Issue #22834 : Have import suppress FileNotFoundError when the current
...
working directory no longer exists.
Thanks to Martin Panter for the bug report.
2014-11-21 12:19:28 -05: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
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
Victor Stinner
a5b335e62f
Issue #20597 , #21274 : Remove unused definition of PATH_MAX on GNU/Hurd,
...
MAXPATHLEN is now preferred.
2014-11-05 15:13:51 +01:00
Victor Stinner
ce43f38ace
Issue #20597 : Remove unused definition of PATH_MAX on Windows, MAXPATHLEN is
...
now preferred. Patch written by Jeffrey Armstrong.
2014-11-05 15:11:34 +01:00
Steve Dower
f6c69e6cc9
#22734 marshal needs a lower stack depth for debug builds on Windows
2014-11-01 15:15:16 -07:00
Victor Stinner
3188f828bb
(Merge 3.4) Issue #22762 : Fix _Py_DisplaySourceLine(), clear the exception if
...
PyFile_GetLine() failed. Patch written by Xavier de Gaye.
2014-10-30 10:17:59 +01:00
Victor Stinner
5e78f4daa8
Issue #22762 : Fix _Py_DisplaySourceLine(), clear the exception if
...
PyFile_GetLine() failed. Patch written by Xavier de Gaye.
2014-10-30 10:17:27 +01:00
Serhiy Storchaka
81f68a7d4b
Issue #22453 : Warn against the use of leaking macro PyObject_REPR().
2014-11-19 00:08:38 +02:00
Antoine Pitrou
0373a106a1
Issue #17636 : Circular imports involving relative imports are now supported.
2014-10-13 20:19:45 +02:00
Brett Cannon
5e8b04eefb
Issue #21052 : Don't raise ImportWarning for sys.meta_path or
...
sys.path_hooks when set to None during interpreter shutdown.
Thanks to Martin Panter for the initial bug report.
2014-10-10 10:54:28 -04: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
R David Murray
861470c836
#16518 : Bring error messages in harmony with docs ("bytes-like object")
...
Some time ago we changed the docs to consistently use the term 'bytes-like
object' in all the contexts where bytes, bytearray, memoryview, etc are used.
This patch (by Ezio Melotti) completes that work by changing the error
messages that previously reported that certain types did "not support the
buffer interface" to instead say that a bytes-like object is required. (The
glossary entry for bytes-like object references the discussion of the buffer
protocol in the docs.)
2014-10-05 11:47:01 -04:00
Georg Brandl
edc3cbaaba
Copyright year update, add version to licenses.
2014-10-04 14:16:59 +02:00
Serhiy Storchaka
8d1e18ef1f
Issue #22518 : Fixed integer overflow issues in "backslashreplace",
...
"xmlcharrefreplace", and "surrogatepass" error handlers.
2014-10-04 14:17:50 +03:00
Serhiy Storchaka
4b1681832b
Issue #22518 : Fixed integer overflow issues in "backslashreplace",
...
"xmlcharrefreplace", and "surrogatepass" error handlers.
2014-10-04 14:15:49 +03:00
Serhiy Storchaka
2e374098ff
Issue #22518 : Fixed integer overflow issues in "backslashreplace",
...
"xmlcharrefreplace", and "surrogatepass" error handlers.
2014-10-04 14:15:49 +03:00
Victor Stinner
b86f08f743
faulthandler: enhance dump_ascii() to escape also non-printable ASCII
...
characters (U+0000..U+001f and U+007f).
2014-10-03 14:18:09 +02: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
Serhiy Storchaka
20b39b27d9
Removed redundant casts to `char *`.
...
Corresponding functions now accept `const char *` (issue #1772673 ).
2014-09-28 11:27:24 +03:00
Georg Brandl
daa910acde
Update importlib.h frozen bytecode (changed due to commit c0ca9d32aed4).
2014-09-24 09:08:12 +02:00
Serhiy Storchaka
cbcbfdf19f
Fixed reference leak in the "backslashreplace" error handler.
2014-09-23 19:59:34 +03:00
Serhiy Storchaka
8aa8c47db2
Fixed reference leak in the "backslashreplace" error handler.
2014-09-23 19:59:09 +03:00
Antoine Pitrou
e7811fca5e
Closes #11471 : avoid generating a JUMP_FORWARD instruction at the end of an if-block if there is no else-clause.
...
Original patch by Eugene Toder.
2014-09-18 03:06:50 +02:00
Antoine Pitrou
87538e7bc4
Issue #4180 : The warnings registries are now reset when the filters are modified.
2014-09-18 02:42:05 +02:00
Antoine Pitrou
cb0a006fd1
Issue #4180 : The warnings registries are now reset when the filters are modified.
2014-09-18 02:40:46 +02: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
Serhiy Storchaka
d8a1447c99
Issue #22215 : Now ValueError is raised instead of TypeError when str or bytes
...
argument contains not permitted null character or byte.
2014-09-06 20:07:17 +03:00
Victor Stinner
5789cfbb56
Issue #22043 : Fix pymonotonic(), use tv_usec=-1 as a marker to skip
...
the monotonic test
2014-09-03 09:43:48 +02: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
9bb758cee7
Issue #22043 : Fix _PyTime_gettimeofday() if HAVE_GETTIMEOFDAY
...
Ensure also that the tv_usec field is consistent: in range [0; 999999].
2014-09-02 23:01:40 +02:00
Victor Stinner
282124b8c4
Closes #22258 : Fix the the internal function set_inheritable() on Illumos.
...
This platform exposes the function ioctl(FIOCLEX), but calling it fails with
errno is ENOTTY: "Inappropriate ioctl for device". set_inheritable() now falls
back to the slower fcntl() (F_GETFD and then F_SETFD).
2014-09-02 11:41:04 +02:00
Victor Stinner
8257b6283e
(Merge 3.4) Closes #22258 : Fix the the internal function set_inheritable() on
...
Illumos. This platform exposes the function ioctl(FIOCLEX), but calling it
fails with errno is ENOTTY: "Inappropriate ioctl for device". set_inheritable()
now falls back to the slower fcntl() (F_GETFD and then F_SETFD).
2014-09-02 11:49:48 +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
Victor Stinner
7efb83393c
Issue #22287 : On UNIX, _PyTime_gettimeofday() now uses
...
clock_gettime(CLOCK_REALTIME) if available. As a side effect, Python now
depends on the librt library on Solaris and on Linux (only with glibc older
than 2.17).
2014-08-29 15:41:08 +02:00
Victor Stinner
049e509a9f
Issue #22207 : Fix "comparison between signed and unsigned integers" warning in
...
test checking for integer overflow on Py_ssize_t type: cast explicitly to
size_t.
2014-08-17 22:20:00 +02:00
Victor Stinner
daca3d7e9b
Issue #22206 : Using pthread, PyThread_create_key() now sets errno to ENOMEM and
...
returns -1 (error) on integer overflow.
2014-08-17 22:11:06 +02:00
Nick Coghlan
f9e227e5a9
Issue #20184 : Add signature introspection for 30 of the builtins
...
Also adds a test to test_inspect to track progress on builtin
introspection support, to ensure it doesn't regress in the future.
2014-08-17 14:01:19 +10:00
Victor Stinner
98ea54c35c
Issue #22156 : Fix "comparison between signed and unsigned integers" compiler
...
warnings in the Python/ subdirectory.
2014-08-15 23:30:40 +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
Zachary Ware
1151c8b7bf
Closes #22146 : Merge with 3.4
2014-08-05 14:02:11 -05:00
Zachary Ware
9b33872812
Issue #22146 : Fix typo in __build_class__ error message
2014-08-05 14:01:10 -05: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
Nick Coghlan
973fe0ba7a
Issue #18093 : Factor out the programs that embed the runtime
2014-07-25 21:52:14 +10:00
Berker Peksag
d8089e0d04
Issue #16382 : Improve exception message of warnings.warn() for bad category.
...
Initial patch by Phil Elson.
2014-07-11 19:50:25 +03:00
Victor Stinner
ac7d80c7d0
(Merge 3.4) Issue #21925 : PyImport_Cleanup(): Remove unused parameter in
...
PySys_FormatStderr() call
2014-07-07 23:07:27 +02:00
Victor Stinner
ab826d11a3
Issue #21925 : PyImport_Cleanup(): Remove unused parameter in
...
PySys_FormatStderr() call
2014-07-07 23:06:15 +02:00
Ned Deily
744a1193aa
Issue #21891 : remove extraneous semicolon.
2014-06-30 23:31:33 -07:00
Ned Deily
529ea5d184
Issue #21891 : remove extraneous semicolon.
2014-06-30 23:31:14 -07:00
Benjamin Peterson
450c1586c0
merge 3.4
2014-06-17 00:34:56 -07:00
Benjamin Peterson
59830b6ec4
revert tstate_delete_common, since it's pretty much wrong
2014-06-17 00:34:46 -07:00
Benjamin Peterson
89cef795eb
merge 3.4
2014-06-16 23:49:09 -07:00
Benjamin Peterson
95d75194ac
remove extra call to tstate_delete_common (merge artifact)
2014-06-16 23:49:02 -07:00
Benjamin Peterson
7258e6da3b
merge 3.4
2014-06-16 23:08:29 -07:00
Benjamin Peterson
068f81e115
avoid a deadlock with the interpreter head lock and the GIL during finalization
2014-06-16 23:07:49 -07:00
Benjamin Peterson
e6bfdb9ca5
merge 3.4
2014-06-16 23:07:15 -07:00
Benjamin Peterson
17548dda51
check if the thread is finalizing after retaking the GIL
2014-06-16 22:59:07 -07: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
Terry Jan Reedy
4a518f02e2
Merge with 3.4
2014-06-16 03:05:53 -04:00
Terry Jan Reedy
f2fb73f675
Issue #19362 : Tweek len() doc and docstring to expand the indicated range of
...
arguments. Original patch by Gareth Rees.
2014-06-16 03:05:37 -04:00
Brett Cannon
42535f0104
Fix a parameter name to make sense again
2014-05-30 16:28:00 -04:00
Brett Cannon
2a17bde930
Issue #20383 : Introduce importlib.util.module_from_spec().
...
Along the way, dismantle importlib._bootstrap._SpecMethods as it was
no longer relevant and constructing the new function required
partially dismantling the class anyway.
2014-05-30 14:55:29 -04:00
Brett Cannon
fd4d0504df
Move import.c to use Clinic file output.
2014-05-30 11:21:14 -04:00
Eric Snow
12c5247be9
Issue #21226 : Merge from 3.4.
2014-05-29 12:32:39 -06:00
Eric Snow
58cfdd8af8
Issue #21226 : fix a ref leak.
2014-05-29 12:31:39 -06:00
Antoine Pitrou
5c8008e59d
Issue #21523 : Fix over-pessimistic computation of the stack effect of some opcodes in the compiler.
...
This also fixes a quadratic compilation time issue noticeable when compiling
code with a large number of "and" and "or" operators.
2014-05-23 11:47:32 +02:00
Antoine Pitrou
9961405ed1
Issue #21523 : Fix over-pessimistic computation of the stack effect of some opcodes in the compiler.
...
This also fixes a quadratic compilation time issue noticeable when compiling
code with a large number of "and" and "or" operators.
2014-05-23 11:46:03 +02:00
Raymond Hettinger
d4d84accb3
merge
2014-05-19 22:21:24 +01:00
Raymond Hettinger
2a54582d72
Issue 20620: Update the min()/max() docs for the new default argument.
...
Patch provided by Berker Peksag.
2014-05-19 22:20:52 +01:00
Victor Stinner
0d4e01ca07
Issue #13916 : Fix surrogatepass error handler on Windows
2014-05-16 14:46:20 +02:00
Serhiy Storchaka
88d8fb6af6
Issue #13916 : Disallowed the surrogatepass error handler for non UTF-*
...
encodings.
2014-05-15 14:37:42 +03: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
Eric Snow
b7f1be309e
Merge from 3.4 (for #21226 ).
2014-05-12 18:25:00 -06:00
Eric Snow
08197a4616
Issue #21226 : Set all attrs in PyImport_ExecCodeModuleObject.
2014-05-12 17:54:55 -06:00
Antoine Pitrou
1c33280c95
Issue #21425 : Fix flushing of standard streams in the interactive interpreter.
2014-05-11 13:43:31 +02:00
Antoine Pitrou
9845c7ebc5
Issue #21425 : Fix flushing of standard streams in the interactive interpreter.
2014-05-11 13:42:17 +02:00
Kristján Valur Jónsson
5b74badc8d
Merging from 3.3: The PyCOND_TIMEDWAIT must use microseconds for the timeout argument
...
in order to have the same resolution as pthreads condition variables.
At the same time, it must be large enough to accept 31 bits of
milliseconds, which is the maximum timeout value in the windows API.
A PY_LONG_LONG of microseconds fullfills both requirements.
This closes issue #20737
2014-05-08 10:59:52 +00:00
Kristján Valur Jónsson
ddf343855d
The PyCOND_TIMEDWAIT must use microseconds for the timeout argument
...
in order to have the same resolution as pthreads condition variables.
At the same time, it must be large enough to accept 31 bits of
milliseconds, which is the maximum timeout value in the windows API.
A PY_LONG_LONG of microseconds fullfills both requirements.
This closes issue #20737
2014-05-08 10:36:27 +00:00
Kristján Valur Jónsson
33096fe829
The PyCOND_TIMEDWAIT must use microseconds for the timeout argument
...
in order to have the same resolution as pthreads condition variables.
At the same time, it must be large enough to accept 31 bits of
milliseconds, which is the maximum timeout value in the windows API.
A PY_LONG_LONG of microseconds fullfills both requirements.
This closes issue #20737
2014-05-08 10:36:27 +00:00
Tim Golden
b8ac3e1a20
Issue21393 Use CryptReleaseContext to release Crypt handle on Windows
2014-05-06 13:29:45 +01:00
Victor Stinner
d50c3f3f3a
Issue #21393 : random.c: on Windows, close the hCryptProv handle at exit
2014-05-02 22:06:44 +02:00
Antoine Pitrou
285a163a4c
Issue #21312 : Update the thread_foobar.h template file to include newer threading APIs. Patch by Jack McCracken.
2014-04-28 21:12:11 +02:00
Antoine Pitrou
3a74ce2088
Issue #13204 : Calling sys.flags.__new__ would crash the interpreter, now it raises a TypeError.
2014-04-28 13:08:28 +02:00
Antoine Pitrou
871dfc41d3
Issue #13204 : Calling sys.flags.__new__ would crash the interpreter, now it raises a TypeError.
2014-04-28 13:07:06 +02:00
Antoine Pitrou
4432cf45c6
Issue #21207 : Detect when the os.urandom cached fd has been closed or replaced, and open it anew.
2014-04-26 14:35:19 +02:00
Antoine Pitrou
e472aeafc3
Issue #21207 : Detect when the os.urandom cached fd has been closed or replaced, and open it anew.
2014-04-26 14:33:03 +02:00
Benjamin Peterson
5edbb7b7a4
correct len signature in docstring ( closes #21294 )
2014-04-18 01:03:59 -04:00
doko@ubuntu.com
4a173bc4ed
Fixes for KFreeBSD and the Hurd:
...
- Issue #21274 : Define PATH_MAX for GNU/Hurd in Python/pythonrun.c.
- Issue #21276 : posixmodule: Don't define USE_XATTRS on KFreeBSD and the Hurd.
- Issue #21275 : Fix a socket test on KFreeBSD.
2014-04-17 19:47:16 +02:00
Benjamin Peterson
e83236f396
merge 3.4
2014-04-18 01:04:07 -04:00
doko@ubuntu.com
dc282134ee
- Merge 3.4
2014-04-17 19:49:00 +02:00
Eric V. Smith
a12572ff3a
Close issue #8931 : Make alternate formatting for 'c' raise an exception. Patch by Torsten Landschoff.
2014-04-15 22:37:55 -04:00
Vinay Sajip
809f90f369
Reverted 16efa8d27e4c after discussion with Eric.
2014-04-15 13:52:21 +01:00
Eric V. Smith
a0d107324d
Closed issue #8931 : Make alternate formatting for 'c' raise an exception. Patch by Torsten Landschoff.
2014-04-15 03:05:02 -04:00
Eric V. Smith
280c458f9e
Closes issue #12546 : Allow \x00 as a fill character for builtin type __format__ methods.
2014-04-14 12:08:21 -04:00
Eric V. Smith
2ea9712ee9
Issue #12546 : Allow \x00 as a fill character for builtin type __format__ methods.
2014-04-14 11:55:10 -04:00
Benjamin Peterson
a548a30fed
merge 3.4 ( #21209 )
2014-04-13 23:52:43 -04:00
Benjamin Peterson
f6e50b4a81
fix sending tuples to custom generator objects with yield from ( closes #21209 )
...
Debugged by Victor.
2014-04-13 23:52:01 -04:00
Benjamin Peterson
d51374ed78
PEP 465: a dedicated infix operator for matrix multiplication ( closes #21176 )
2014-04-09 23:55:56 -04:00
Brett Cannon
e7ef805833
merge of fix for issue #20942
2014-04-04 10:03:42 -04:00
Brett Cannon
18fc4e70f3
Issue #20942 : PyImport_ImportFrozenModuleObject() no longer sets
...
__file__.
This causes _frozen_importlib to no longer have __file__ set as well
as any frozen module imported using imp.init_frozen() (which is
deprecated).
2014-04-04 10:01:46 -04:00
Benjamin Peterson
9effd1f5fb
merge 3.4 ( #21089 )
2014-03-28 18:55:04 -04:00
Benjamin Peterson
9381343948
undefine SET_SYS_FROM_STRING_BORROW after its done being used ( closes #21089 )
2014-03-28 18:52:45 -04:00
Victor Stinner
518e610977
Issue #19977 , #19036 : Always include <locale.h> in pythonrun.c
...
to get LC_CTYPE constant on Windows.
2014-03-18 02:06:38 +01:00
Victor Stinner
7143029d43
Issue #19977 : When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale),
...
:py:data:`sys.stdin` and :py:data:`sys.stdout` are now using the
``surrogateescape`` error handler, instead of the ``strict`` error handler.
2014-03-18 01:18:21 +01:00
Georg Brandl
2fc8f773e1
Issue #20404 : reject non-text encodings early in TextIOWrapper.
2014-03-02 09:18:31 +01:00
Brett Cannon
d3acef9bf4
Issue #20763 : Fix importlib.machinery.PathFinder to support
...
PathEntryFinder instances which only define find_module().
Reported by Yukihiro Nakadaira.
2014-02-26 18:26:49 -05:00
Serhiy Storchaka
94ee389308
Issue #19619 : Blacklist non-text codecs in method API
...
str.encode, bytes.decode and bytearray.decode now use an
internal API to throw LookupError for known non-text encodings,
rather than attempting the encoding or decoding operation and
then throwing a TypeError for an unexpected output type.
The latter mechanism remains in place for third party non-text
encodings.
Backported changeset d68df99d7a57.
2014-02-24 14:43:03 +02:00
Benjamin Peterson
45d8e7b920
update magic number for #20625
2014-02-19 18:05:36 -05:00
Victor Stinner
065efc3072
Issue #20625 : Fix compilation issue
2014-02-18 22:07:56 +01:00
Yury Selivanov
34ce99f66d
Mangle __parameters in __annotations__ dict properly. Issue #20625 .
2014-02-18 12:49:41 -05:00
Victor Stinner
3c1b379ebd
Issue #20320 : select.select() and select.kqueue.control() now round the timeout
...
aways from zero, instead of rounding towards zero.
It should make test_asyncio more reliable, especially test_timeout_rounding() test.
2014-02-17 00:02:43 +01:00
Benjamin Peterson
0714b8b6ab
set line and column numbers for keyword-only arg nodes ( closes #20619 )
2014-02-13 19:22:14 -05:00
Victor Stinner
15054c16c8
Issue #20526 , #19466 : Revert changes of issue #19466 which introduces a
...
regression: don't clear anymore the state of Python threads early during the
Python shutdown.
2014-02-13 12:48:54 +01:00
Benjamin Peterson
40be9e5100
remove dynamic initializer lists for c89 compliance ( closes #20595 )
2014-02-11 10:09:27 -05:00
Benjamin Peterson
42ec031fe7
merge 3.3 ( #20588 )
2014-02-10 22:41:40 -05:00
Benjamin Peterson
c2f665e721
don't put runtime values in array initializer for C89 compliance ( closes #20588 )
2014-02-10 22:19:02 -05:00
Serhiy Storchaka
d667d72cb7
Temporary silence test broken by issue19255.
...
Remove unused variables.
2014-02-10 19:09:19 +02:00
Serhiy Storchaka
87a5c515d0
Issue #19255 : The builtins module is restored to initial value before
...
cleaning other modules. The sys and builtins modules are cleaned last.
2014-02-10 18:21:34 +02:00
Larry Hastings
8f9f0f12e8
Issue #20517 : Removed unnecessary new (short-lived) functions from PyErr.
2014-02-10 03:43:57 -08:00
Larry Hastings
b082731fbb
Issue #20517 : Functions in the os module that accept two filenames
...
now register both filenames in the exception on failure.
This required adding new C API functions allowing OSError exceptions
to reference two filenames instead of one.
2014-02-09 22:05:19 -08:00
Benjamin Peterson
665a2bcdf8
bump Python-ast.c
2014-02-19 23:05:26 -05:00
Serhiy Storchaka
dfe98a102e
Issue #20437 : Fixed 22 potential bugs when deleting objects references.
2014-02-09 13:46:20 +02:00
Serhiy Storchaka
505ff755d7
Issue #20437 : Fixed 21 potential bugs when deleting objects references.
2014-02-09 13:33:53 +02:00
Larry Hastings
2623c8c23c
Issue #20530 : Argument Clinic's signature format has been revised again.
...
The new syntax is highly human readable while still preventing false
positives. The syntax also extends Python syntax to denote "self" and
positional-only parameters, allowing inspect.Signature objects to be
totally accurate for all supported builtins in Python 3.4.
2014-02-08 22:15:29 -08:00
Nick Coghlan
d979e4335d
Close #20500 : Don't trigger PyObject_Str assertion at shutdown
2014-02-09 10:43:21 +10:00
Nick Coghlan
a9b15241c6
Close #20404 : blacklist non-text encodings in io.TextIOWrapper
...
- io.TextIOWrapper (and hence the open() builtin) now use the
internal codec marking system added for issue #19619
- also tweaked the C code to only look up the encoding once,
rather than multiple times
- the existing output type checks remain in place to deal with
unmarked third party codecs.
2014-02-04 22:11:18 +10:00
Larry Hastings
7726ac9163
#Issue 20456: Several improvements and bugfixes for Argument Clinic,
...
including correctly generating code for Clinic blocks inside C
preprocessor conditional blocks.
2014-01-31 22:03:12 -08:00
Victor Stinner
a17b6bb5fe
Issue #20162 : Fix an alignment issue in the siphash24() hash function which
...
caused a crash on PowerPC 64-bit (ppc64).
2014-02-01 03:38:56 +01:00
Larry Hastings
581ee3618c
Issue #20326 : Argument Clinic now uses a simple, unique signature to
...
annotate text signatures in docstrings, resulting in fewer false
positives. "self" parameters are also explicitly marked, allowing
inspect.Signature() to authoritatively detect (and skip) said parameters.
Issue #20326 : Argument Clinic now generates separate checksums for the
input and output sections of the block, allowing external tools to verify
that the input has not changed (and thus the output is not out-of-date).
2014-01-28 05:00:08 -08:00
Larry Hastings
5c66189e88
Issue #20189 : Four additional builtin types (PyTypeObject,
...
PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type)
have been modified to provide introspection information for builtins.
Also: many additional Lib, test suite, and Argument Clinic fixes.
2014-01-24 06:17:25 -08:00
Serhiy Storchaka
2bd59daf58
Issue #2382 : SyntaxError cursor "^" now is written at correct position in most
...
cases when multibyte characters are in line (before "^"). This still not
works correctly with wide East Asian characters.
2014-01-21 22:29:47 +02:00
Serhiy Storchaka
65fd0592fb
Issue #2382 : SyntaxError cursor "^" now is written at correct position in most
...
cases when multibyte characters are in line (before "^"). This still not
works correctly with wide East Asian characters.
2014-01-21 22:26:52 +02:00
Victor Stinner
2d854c8e7b
Issue #20024 : Py_BuildValue() now saves/restores the current exception before
...
building an item if the build of a previous item failed.
2014-01-21 20:52:17 +01:00
Stefan Krah
34e4628453
Merge from 3.3.
2014-01-20 15:35:38 +01:00
Stefan Krah
6c01e38677
Issue #19036 : Including locale.h should not depend on HAVE_LANGINFO_H.
2014-01-20 15:31:08 +01:00
Larry Hastings
b7ccb20423
Issue #20294 : Argument Clinic now supports argument parsing for __new__ and
...
__init__ functions.
2014-01-18 23:50:21 -08:00
Larry Hastings
bebf73511a
Issue #20287 : Argument Clinic's output is now configurable, allowing
...
delaying its output or even redirecting it to a separate file.
2014-01-17 17:47:17 -08:00
Brett Cannon
a6dec2e744
Remove an unneeded cast.
2014-01-10 07:43:55 -05:00
Brett Cannon
4caa61d20e
Issue #20152 : import.c now uses Argument Clinic.
2014-01-09 19:03:32 -05:00
Eric Snow
e4314e05d5
Issue 19713: Remove PEP 451-related code that should have been factored out.
...
This code was an artifact of issuing a DeprecationWarning for the lack
of loader.exec_module(). However, we have deferred such warnings to
later Python versions.
2014-01-07 23:29:19 -07:00
Larry Hastings
77561cccb2
Issue #20141 : Improved Argument Clinic's support for the PyArg_Parse "O!"
...
format unit.
2014-01-07 12:13:13 -08:00
Eric Snow
1500d49c22
Issue 19713: Add PEP 451-related deprecations.
2014-01-06 20:49:04 -07:00
Eric Snow
d749c7ae68
Issue #19927 : Add __eq__ to path-based loaders in importlib.
2014-01-04 15:06:49 -07:00
Eric Snow
fbc785188d
Issue #20097 : Fix bad use of "self" in importlib's WindowsRegistryFinder.
2014-01-02 22:25:00 -07:00
Benjamin Peterson
a015bb1e2b
merge 3.3
2013-12-31 22:02:41 -06:00
Benjamin Peterson
fa10ae0978
update copyright year
2013-12-31 22:02:22 -06:00
Christian Heimes
af01f66817
Issue #16136 : Remove VMS support and VMS-related code
2013-12-21 16:19:10 +01:00
Victor Stinner
ed0b87d73c
Fix the C definition of the sys._debugmallocstats() function: the function has
...
no parameter
2013-12-19 17:16:42 +01:00