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
Victor Stinner
5272fa9c57
Fix _Py_DisplaySourceLine(), if PyTokenizer_FindEncodingFilename() fails, clear
...
the exception to not call open() with an exception set.
2013-12-19 13:39:32 +01:00
Eric Snow
61e851baca
Remove some dead code in importlib, introduced with the PEP 451 patch.
...
Early in the PEP 451 implementation some of the importlib loaders had
their own _get_spec() methods to simplify accommodating them. However,
later implementations removed the need. They simply failed to remove
this code at the same time. :)
2013-12-18 23:35:15 -07:00
Serhiy Storchaka
85c2497950
Issue #16404 : Add checks for return value of PyLong_FromLong() in
...
sys.getwindowsversion() and ossaudiodev.setparameters().
Reported by Ned Batchelder.
2013-12-17 15:12:46 +02:00
Serhiy Storchaka
48d761e2b4
Issue #16404 : Add checks for return value of PyLong_FromLong() in
...
sys.getwindowsversion() and ossaudiodev.setparameters().
Reported by Ned Batchelder.
2013-12-17 15:11:24 +02:00
Serhiy Storchaka
11ee080ea7
Fixed leak in sys.flags initialization.
2013-12-17 15:00:53 +02:00
Serhiy Storchaka
87a854dc73
Fixed leak in sys.flags initialization.
2013-12-17 14:59:42 +02:00
Victor Stinner
590cebe391
Issue #19787 : PyThread_set_key_value() now always set the value
...
In Python 3.3, PyThread_set_key_value() did nothing if the key already exists
(if the current value is a non-NULL pointer).
When _PyGILState_NoteThreadState() is called twice on the same thread with a
different Python thread state, it still keeps the old Python thread state to
keep the old behaviour. Replacing the Python thread state with the new state
introduces new bugs: see issues #10915 and #15751 .
2013-12-13 11:08:56 +01:00
Victor Stinner
441adb8c57
Backout changeset 46393019b650
...
test_capi is failing and the fix is not trivial, I prefer to revert
2013-12-13 04:14:41 +01:00
Victor Stinner
cd0cb8ccd3
Close #19787 : PyThread_set_key_value() now always set the value. In Python 3.3,
...
the function did nothing if the key already exists (if the current value is a
non-NULL pointer).
_testcapi.run_in_subinterp() now correctly sets the new Python thread state of
the current thread when a subinterpreter is created.
2013-12-13 03:22:00 +01:00
Victor Stinner
fdeb6ec45a
Issue #14432 : Remove the thread state field from the frame structure. Fix a
...
crash when a generator is created in a C thread that is destroyed while the
generator is still used. The issue was that a generator contains a frame, and
the frame kept a reference to the Python state of the destroyed C thread. The
crash occurs when a trace function is setup.
2013-12-13 02:01:38 +01:00
Victor Stinner
62ca10051b
Close #19576 : PyGILState_Ensure() now initializes threads. At startup, Python
...
has no concrete GIL. If PyGILState_Ensure() is called from a new thread for the
first time and PyEval_InitThreads() was not called yet, a GIL needs to be
created.
2013-12-13 01:46:43 +01:00
Eric Snow
b282b3d804
Issue #18864 : Add a setter for ModuleSpec.has_location.
2013-12-10 22:16:41 -07:00
Victor Stinner
52ce3b04d0
Issue #19817 : Fix print_exception(), clear the exception on error
2013-12-09 02:10:08 +01:00
Benjamin Peterson
d45a46b60d
merge 3.3 ( #19910 )
2013-12-06 20:12:51 -05:00
Benjamin Peterson
933142a8f2
document that compile() can take bytes ( closes #19910 )
2013-12-06 20:12:39 -05:00
Christian Heimes
724b828e79
upcast int to size_t to silence two autological-constant-out-of-range-compare warnings with clang.
2013-12-04 08:42:46 +01:00
Victor Stinner
be0708f066
Closes #19831 : Stop tracemalloc later at Python shutdown to be able to use
...
tracemalloc in objects destructor
Replace atexit handler with an harcoded C function _PyTraceMalloc_Fini().
2013-12-01 10:03:26 +01:00
Brett Cannon
d2476c6e4b
Issue #19698 : Remove exec_module() from the built-in and extension
...
module loaders.
Due to the fact that the call signatures for extension modules and
built-in modules does not allow for the specifying of what module to
initialize and that on Windows all extension modules are built-in
modules, work to clean up built-in and extension module initialization
will have to wait until Python 3.5. Because of this the semantics of
exec_module() would be incorrect, so removing the methods for now is
the best option; load_module() is still used as a fallback by
importlib and so this won't affect semantics.
2013-11-29 11:00:11 -05:00
Mark Dickinson
1df88677e9
Issue #19638 : Merge from 3.3
2013-11-26 16:19:38 +00:00
Mark Dickinson
f45bbb6211
Issue #19638 : Raise ValueError instead of crashing when converting billion character strings to float.
2013-11-26 16:19:13 +00:00
Zachary Ware
a4b7a7548c
Issue #3158 : doctest can now find doctests in functions and methods
...
written in C.
As a part of this, a few doctests have been added to the builtins module
(on hex(), oct(), and bin()), a doctest has been fixed (hopefully on all
platforms) on float, and test_builtins now runs doctests in builtins.
2013-11-24 01:19:09 -06:00
Larry Hastings
3a9079742f
Issue #19722 : Added opcode.stack_effect(), which accurately
...
computes the stack effect of bytecode instructions.
2013-11-23 14:49:22 -08:00
Antoine Pitrou
8933521b3d
Fix refleak introduced by 4f730c045f5f (issue #18408 ) and unveiled by 95eea8624d05 (issue #16596 ).
2013-11-23 14:05:23 +01:00
Victor Stinner
ed3b0bca3e
Issue #18874 : Implement the PEP 454 (tracemalloc)
2013-11-23 12:27:24 +01:00
Brett Cannon
224b261258
User the repr for a module name in more places
2013-11-22 14:52:36 -05:00
Brett Cannon
175e7257b1
Remove a commented-out line
2013-11-22 12:07:43 -05:00
Brett Cannon
fddc311fe8
Don't assume trying to find a builtin will succeed (e.g. posix isn't on Windows)
2013-11-22 11:58:17 -05:00
Eric Snow
b523f8433a
Implement PEP 451 (ModuleSpec).
2013-11-22 09:05:39 -07:00
Nick Coghlan
c72e4e6dcc
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.
2013-11-22 22:39:36 +10:00
Guido van Rossum
8820c239f7
Better behavior when stepping over yield[from]. Fixes issue 16596. By Xavier de Gaye.
2013-11-21 11:30:06 -08:00
Christian Heimes
a5bcd7c0ee
Issue #19183 : too many tests depend on the sort order of repr().
...
The bitshift and xor op for 32bit builds has changed the order of hash values.
2013-11-20 12:49:05 +01:00
Christian Heimes
985ecdcfc2
ssue #19183 : Implement PEP 456 'secure and interchangeable hash algorithm'.
...
Python now uses SipHash24 on all major platforms.
2013-11-20 11:46:18 +01:00
Victor Stinner
f8e3221fa5
Issue #9566 , #19617 : Fix more compiler warnings in compile.c on Windows 64-bit
2013-11-19 23:56:34 +01:00
Victor Stinner
85fe8a645e
Issue #9566 , #19617 : New try to fix compilation on Windows
...
Some compilers (ex: Visual Studio) decode -2147483648 as a unsigned integer
instead of an signed integer.
2013-11-19 23:03:25 +01:00
Victor Stinner
b679a2eb78
Issue #9566 , #19617 : Fix compilation on Windows
...
INT32_MIN and INT32_MAX constants are unknown on Windows.
2013-11-19 22:28:01 +01:00
Victor Stinner
ad9a066050
Issue #9566 : compile.c uses Py_ssize_t instead of int to store sizes to fix
...
compiler warnings on Windows 64-bit. Use Py_SAFE_DOWNCAST() where the final
downcast is needed.
The bytecode doesn't support integer parameters larger than 32-bit yet.
2013-11-19 22:23:20 +01:00
Victor Stinner
4a58707a34
Add _PyUnicodeWriter_WriteASCIIString() function
2013-11-19 12:54:53 +01:00
Serhiy Storchaka
58cf607d13
Issue #12892 : The utf-16* and utf-32* codecs now reject (lone) surrogates.
...
The utf-16* and utf-32* encoders no longer allow surrogate code points
(U+D800-U+DFFF) to be encoded.
The utf-32* decoders no longer decode byte sequences that correspond to
surrogate code points.
The surrogatepass error handler now works with the utf-16* and utf-32* codecs.
Based on patches by Victor Stinner and Kang-Hao (Kenny) Lu.
2013-11-19 11:32:41 +02:00
Victor Stinner
cb29ec5f74
PY_FORMAT_SIZE_T should not be used with PyErr_Format(), PyErr_Format("%zd") is
...
portable
2013-11-18 02:05:31 +01:00
Victor Stinner
74387f5cac
Use Py_ssize_t type for sizes in getargs.c
...
Fix compiler warnings on Windows 64-bit
2013-11-18 01:21:12 +01:00
Victor Stinner
b11d6cb711
fileutils.c: use MAXPATHLEN instead of PATH_MAX
...
PATH_MAX is not declared on IRIX nor Windows.
2013-11-15 18:14:11 +01:00
Victor Stinner
2384714819
sysmodule.c: fix sys_update_path(), use Py_ARRAY_LENGTH() to get the size of
...
the fullpath buffer, not PATH_MAX. fullpath is declared using MAXPATHLEN or
MAX_PATH depending on the OS, and PATH_MAX is not declared on IRIX.
2013-11-15 17:33:43 +01:00
Victor Stinner
2f5bbc6a12
pythonrun.c: fix Py_GetPythonHome(), use Py_ARRAY_LENGTH() to get the size of
...
the env_home buffer, not PATH_MAX+1. env_home is declared using MAXPATHLEN+1,
and PATH_MAX is not declared on IRIX.
2013-11-15 17:09:24 +01:00
Victor Stinner
da062558db
Fix compiler warning (on Windows 64-bit): explicit cast Py_ssize_t to unsigned
...
char, n is in range [0; 255] (a tuple cannot have a negative length)
2013-11-16 00:13:29 +01:00
Victor Stinner
0c083461a5
Fix compiler warning in win32_urandom(): explicit cast to DWORD in
...
CryptGenRandom()
2013-11-15 23:26:25 +01:00
Victor Stinner
c31ebb60f9
(Merge 3.3) fileutils.c: use MAXPATHLEN instead of PATH_MAX
...
PATH_MAX is not declared on IRIX nor Windows.
2013-11-15 18:14:33 +01:00
Victor Stinner
50e0157013
(Merge 3.3) sysmodule.c: fix sys_update_path(), use Py_ARRAY_LENGTH() to get
...
the size of the fullpath buffer, not PATH_MAX. fullpath is declared using
MAXPATHLEN or MAX_PATH depending on the OS, and PATH_MAX is not declared on
IRIX.
2013-11-15 17:35:31 +01:00
Victor Stinner
b5a7a0aa3f
(Merge 3.3) pythonrun.c: fix Py_GetPythonHome(), use Py_ARRAY_LENGTH() to get
...
the size of the env_home buffer, not PATH_MAX+1. env_home is declared using
MAXPATHLEN+1, and PATH_MAX is not declared on IRIX.
2013-11-15 17:12:14 +01:00
Nick Coghlan
c4c2580d43
Close 19609: narrow scope of codec exc chaining
2013-11-15 21:47:37 +10:00
Victor Stinner
5eb4f59cd9
Issue #19437 : Fix init_builtin(), handle _PyImport_FindExtensionObject()
...
failure
2013-11-14 22:38:52 +01:00
Stefan Krah
49d0479357
Add unused third arg for the benefit of Valgrind.
2013-11-14 15:35:47 +01:00
Victor Stinner
c82729e44f
Issue #19437 : Fix fold_unaryops_on_constants() of the peephole optimizer, clear
...
the exception when PyList_Append() fails
2013-11-14 01:21:00 +01:00
Nick Coghlan
8b097b4ed7
Close #17828 : better handling of codec errors
...
- output type errors now redirect users to the type-neutral
convenience functions in the codecs module
- stateless errors that occur during encoding and decoding
will now be automatically wrapped in exceptions that give
the name of the codec involved
2013-11-13 23:49:21 +10:00
Victor Stinner
22af2599a9
Issue #19437 : Fix PyImport_ImportModuleLevelObject(), handle
...
PyUnicode_Substring() failure (ex: MemoryError)
2013-11-13 12:11:36 +01:00
Victor Stinner
3f36a5736b
Issue #19515 : Remove identifiers duplicated in the same file.
...
Patch written by Andrei Dorian Duma.
2013-11-12 21:39:02 +01:00
Victor Stinner
dcf17f8a55
Issue #19466 : Fix typo. Patch written by Vajrasky Kok.
2013-11-12 17:18:51 +01:00
Victor Stinner
45956b9a33
Close #19466 : Clear the frames of daemon threads earlier during the Python
...
shutdown to call objects destructors. So "unclosed file" resource warnings are
now corretly emitted for daemon threads.
2013-11-12 16:37:55 +01:00
Victor Stinner
bd303c165b
Issue #19512 , #19515 : remove shared identifiers, move identifiers where they
...
are used.
Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
2013-11-07 23:07:29 +01:00
Victor Stinner
efa7a0e155
print_error_text() doesn't encode the filename anymore
...
Use aslo PyUnicode_FromFormat() to format the line so only one call to
PyFile_WriteObject() is needed. tb_displayline() of Python/traceback.c has
similar implementation.
2013-11-07 12:37:56 +01:00
Victor Stinner
79ed4c744a
remove an outdated comment
...
The comment is meaningless since changeset 4e985a96a612.
2013-11-07 00:53:56 +01:00
Victor Stinner
53e9ec48e5
Issue #19512 : Use the new _PyId_builtins identifier
2013-11-07 00:43:05 +01:00
Victor Stinner
ad14ccd047
Issue #19512 : add _PyUnicode_CompareWithId() function
...
_PyUnicode_CompareWithId() is faster than PyUnicode_CompareWithASCIIString()
when both strings are equal and interned.
Add also _PyId_builtins identifier for "builtins" common string.
2013-11-07 00:46:04 +01:00
Victor Stinner
937114f704
print_exception(): don't encode the module name to UTF-8
...
Replace _PyUnicode_AsString()+strcmp() with PyUnicode_CompareWithASCIIString().
2013-11-07 00:12:30 +01:00
Victor Stinner
eaa2883d15
Issue #19512 : builtin print() function uses an identifier instead of literal
...
string "flush" to call the flush method
2013-11-07 00:01:51 +01:00
Victor Stinner
ae9f161b43
Issue #19512 : __build_class() builtin now uses an identifier for the "metaclass" string
2013-11-06 22:46:51 +01:00
Victor Stinner
090543736f
Issue #19512 : add some common identifiers to only create common strings once,
...
instead of creating temporary Unicode string objects
Add also more identifiers in pythonrun.c to avoid temporary Unicode string
objets for the interactive interpreter.
2013-11-06 22:41:44 +01:00
Victor Stinner
cab75e3e1e
Issue #19512 : PRINT_EXPR bytecode now uses an identifier to get sys.displayhook
...
to only create the "displayhook" string once
2013-11-06 22:38:37 +01:00
Victor Stinner
d67bd45537
Issue #19512 : Add _PySys_GetObjectId() and _PySys_SetObjectId() functions
2013-11-06 22:36:40 +01:00
Victor Stinner
b44562b6b9
Issue #19512 : eval() and exec() now use an identifier for "__builtins__" string
2013-11-06 19:03:11 +01:00
Victor Stinner
95701bdf40
Issue #19512 : Add PyRun_InteractiveOneObject() function
...
Only decode the filename once. PyRun_InteractiveOneObject() uses an identifier
for "<string>" string, so the byte string is only decoded once.
2013-11-06 18:41:07 +01:00
Victor Stinner
4ee41c5839
Issue #19512 : _print_total_refs() now uses an identifier to get "showrefcount"
...
key from sys._xoptions
2013-11-06 18:28:21 +01:00
Victor Stinner
d02fbb8f71
Issue #19512 : sys_displayhook() now uses an identifier for "builtins"
...
dictionary key and only decodes "\n" string once to write a newline.
So "builtins" and "\n" are only decoded once from UTF-8, at the first call.
2013-11-06 18:27:13 +01:00
Victor Stinner
98e818b8e3
Issue #19437 : Fix compiler_class(), handle compiler_lookup_arg() failure
2013-11-05 18:07:34 +01:00
Brett Cannon
2b8fc303ad
Abstract out stat calls in importlib for easier experimentation.
2013-11-01 14:04:24 -04:00
Brett Cannon
f6901c8baa
Issue #19410 : Put back in special-casing of '' for
...
importlib.machinery.FileFinder.
While originally moved to stop special-casing '' as PathFinder farther
up the typical call chain now uses the cwd in the instance of '', it
was deemed an unnecessary risk to breaking subclasses of FileFinder to
take the special-casing out.
2013-11-01 10:37:57 -04:00
Eric Snow
cdf601281f
Issue #19413 : Restore pre-3.3 reload() semantics of re-finding modules.
2013-10-31 22:22:15 -06:00
Victor Stinner
dcdd05b0b4
Close #19442 : warn_explicit() does nothing when called late during Python shutdown
...
After more tests, I now think that it is the safest option.
2013-11-01 00:55:30 +01:00
Victor Stinner
359fabc19f
Issue #19437 : Cleanup r_ref() of the marshal module
2013-10-31 17:09:01 +01:00
Victor Stinner
d5cae6f143
Issue #19437 : Fix r_object() of marshal module, handle PyDict_SetItem() failure
...
for TYPE_DICT and stop immedialty on first r_object() failure
2013-10-31 17:14:52 +01:00
Victor Stinner
b1b7b1834b
Issue #19437 : Fix r_object() of marshal module, handle r_byte() failure for
...
TYPE_SMALL_TUPLE
2013-10-31 17:07:08 +01:00
Victor Stinner
763b0d19c9
Issue #19437 : Fix r_PyLong() of marshal module, stop immediatly at first
...
failure, don't read any more data
2013-10-31 16:56:38 +01:00
Victor Stinner
ae233eab5c
Issue #19437 : Fix show_warning() of _warnings, stop at the first error to not
...
call a Python function with an exception set
2013-10-31 14:51:38 +01:00
Victor Stinner
3cd04aa1b2
Issue #19437 : Fix get_filter() from _warnings, don't call PyObject_IsSubclass()
...
with an exception set
2013-10-31 14:46:00 +01:00
Benjamin Peterson
472805df59
merge 3.3
2013-10-31 01:21:06 -04:00
Benjamin Peterson
7f69dcac16
make string literal const
2013-10-31 01:20:58 -04:00
Benjamin Peterson
96c03df771
merge 3.3
2013-10-29 22:25:55 -04:00
Benjamin Peterson
8f169489c4
update comment
2013-10-29 22:25:06 -04:00
Victor Stinner
856f45f09c
Issue #19442 : Fix warnings emitted during Python shutdown
...
Warnings may be emitted during Python shutdown, like "unclosed file XXX".
During shutdown, globals()['__main__'] may be None.
2013-10-30 00:04:59 +01:00
Victor Stinner
a4c704b260
Issue #19424 : Fix the warnings module to accept filename containing surrogate
...
characters.
2013-10-29 23:43:41 +01:00
Victor Stinner
41bb43a71e
Issue #18408 : Add a new PyFrame_FastToLocalsWithError() function to handle
...
exceptions when merging fast locals into f_locals of a frame.
PyEval_GetLocals() now raises an exception and return NULL on failure.
2013-10-29 01:19:37 +01:00
Victor Stinner
ce5f4fba11
Issue #19421 : fix a check in warnings.warn() to be able to use it during Python
...
finalization.
sys.argv is set to None during Python finalization: add PyList_Check() to avoid
a crash in PyList_Size().
2013-10-28 18:47:22 +01:00
Victor Stinner
8fea252a50
Issue #18520 : fix reference leak in _PySys_Init()
2013-10-27 17:15:42 +01:00
Christian Heimes
efa48676d5
Issue #18603 : Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the
...
Python executable and not removed by the linker's optimizer.
2013-10-22 10:23:12 +02:00
Christian Heimes
49e61806f5
Issue #18603 : Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the
...
Python executable and not removed by the linker's optimizer.
2013-10-22 10:22:29 +02:00
Guido van Rossum
7be5d7d0e0
Issue 19306: Add extra hints to faulthandler stack dumps that they are upside down.
2013-10-20 18:21:02 -07:00
Benjamin Peterson
6b4f7803f8
cleanup the construction of __qualname__ ( closes #19301 again)
2013-10-20 17:50:28 -04:00
Nick Coghlan
6de9200e57
Close #19313 : remove no longer needed Py_XINCREF
...
Eliminates a refleak introduced in commit b4a325275fb0
2013-10-20 22:43:53 +10:00
Benjamin Peterson
34d33a595b
removal u_qualname, since compiler_scope_qualname is only ever called once
2013-10-19 16:15:58 -04:00
Benjamin Peterson
a8a38b8e4f
strengthen condition and add assertion
2013-10-19 16:14:39 -04:00
Benjamin Peterson
3d9e481ece
give explicitly global functions and classes a global __qualname__ ( closes #19301 )
2013-10-19 16:01:13 -04:00
Serhiy Storchaka
c679227e31
Issue #1772673 : The type of `char*` arguments now changed to `const char*`.
2013-10-19 21:03:34 +03:00
Brett Cannon
58f5680462
Issue #18810 : Be optimistic with stat calls when seeing if a directory
...
exists when checking for a package.
Before there was an isdir check and then various isfile checks for
possible __init__ files when looking for a package.
This change drops the isdir check by leaning
on the assumption that a directory will not contain something named
after the module being imported which is not a directory. If the module
is a package then it saves a stat call. If there is nothing in the
directory with the potential package name it also saves a stat call.
Only if there is something in the directory named the same thing as
the potential package will the number of stat calls increase
(due to more wasteful __init__ checks).
Semantically there is no change as the isdir check moved
down so that namespace packages continue to have no chance of
accidentally collecting non-existent directories.
2013-10-18 13:24:13 -04:00
Brett Cannon
bb9e481efa
Issue #18416 : Fix various os calls in importlib.machinery.FileFinder
...
now that self.path is no longer forced to '.'.
2013-10-18 12:01:06 -04:00
Brett Cannon
27e27f7ee1
Issue #18416 : Have importlib.machinery.PathFinder treat '' as the cwd
...
and stop importlib.machinery.FileFinder treating '' as '.'.
Previous PathFinder transformed '' into '.' which led to __file__ for
modules imported from the cwd to always be relative paths. This meant
the values of the attribute were wrong as soon as the cwd changed.
This change now means that as long as the site module is run (which
makes all entries in sys.path absolute) then all values for __file__
will also be absolute unless it's for __main__ when specified by file
path in a relative way (modules imported by runpy will have an
absolute path).
Now that PathFinder is no longer treating '' as '.' it only makes
sense for FileFinder to stop doing so as well. Now no transformation
is performed for the directory given to the __init__ method.
Thanks to Madison May for the initial patch.
2013-10-18 11:39:04 -04:00
Nick Coghlan
1805a62f1f
Issue #16129 : Py_SetStandardStreamEncoding cleanups
...
- don't call PyErr_NoMemory with interpreter is not initialised
- note that it's OK to call _PyMem_RawStrDup here
- don't include this in the limited API
- capitalise "IO"
- be explicit that a non-zero return indicates an error
- include versionadded marker in docs
2013-10-18 23:11:47 +10:00
Nick Coghlan
7d270ee05d
Issue #16129 : Add `Py_SetStandardStreamEncoding`
...
This new pre-initialization API allows embedding
applications like Blender to force a particular
encoding and error handler for the standard IO streams.
Also refactors Modules/_testembed.c to let us start
testing multiple embedding scenarios.
(Initial patch by Bastien Montagne)
2013-10-17 22:35:35 +10:00
Antoine Pitrou
42c25f5581
Close #19260 : remove outdated comment in marshal.c
2013-10-14 20:50:32 +02:00
Georg Brandl
142ad666dc
Re #18521 : move array bounds check before array access.
2013-10-14 07:01:11 +02:00
Georg Brandl
6083a4bc1c
Re #18521 : remove assignments of variables that are immediately reassigned.
2013-10-14 06:51:46 +02:00
Antoine Pitrou
6039db8de3
Issue #18776 : atexit callbacks now display their full traceback when they raise an exception.
2013-10-13 21:54:15 +02:00