Commit Graph

4722 Commits

Author SHA1 Message Date
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