Commit graph

4490 commits

Author SHA1 Message Date
Benjamin Peterson
42ff105539 fix overflow checking in PyBytes_Repr (closes #22519) 2014-09-29 19:01:18 -04:00
Benjamin Peterson
a1c1be4e03 cleanup overflowing handling in unicode_decode_call_errorhandler and unicode_encode_ucs1 (closes #22518) 2014-09-29 18:18:57 -04:00
Benjamin Peterson
0ad6098b67 merge 3.2 2014-03-30 19:52:22 -04:00
Benjamin Peterson
23cf403ca1 fix expandtabs overflow detection to be consistent and not rely on signed overflow 2014-03-30 19:47:57 -04:00
Benjamin Peterson
4a42cd48d5 avoid referencing past the bounds of an array 2014-03-15 12:21:28 -05:00
Benjamin Peterson
ef87f8cb57 avoid referencing out-of-bounds memory 2014-03-14 21:54:31 -05:00
Benjamin Peterson
45c9dceb56 fix c89 declaration order 2014-03-14 21:53:51 -05:00
Benjamin Peterson
041c38a790 don't do pointer arithmetic with signed numbers 2014-03-14 21:47:23 -05:00
Kristján Valur Jónsson
25dded041f Make the various iterators' "setstate" sliently and consistently clip the
index.  This avoids the possibility of setting an iterator to an invalid
state.
2014-03-05 13:47:57 +00:00
Kristján Valur Jónsson
4ca688edeb Fix pickling of rangeiter. rangeiter_setstate would not allow setting it
to the exhausted state.
2014-03-04 23:19:24 +00: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
9743b2c2b5 give non-iterable TypeError a message (closes #20507) 2014-02-15 13:02:52 -05:00
Serhiy Storchaka
1f9d11b986 Issue #19255: Clear error after failed PyDict_SetItem() on shutdown.
This silences a Coverity complain.
2014-02-12 09:55:01 +02:00
Serhiy Storchaka
505ff755d7 Issue #20437: Fixed 21 potential bugs when deleting objects references. 2014-02-09 13:33:53 +02:00
Serhiy Storchaka
016a3f33a5 Issue #20538: UTF-7 incremental decoder produced inconsistant string when
input was truncated in BASE64 section.
2014-02-08 14:01:29 +02:00
Serhiy Storchaka
b992a0e102 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang line to use python3 executable in the unittestgui script.
2014-01-16 17:15:49 +02:00
Serhiy Storchaka
c836a28cc1 Issue #17576: Removed deprecation warnings added in changeset 618cca51a27e. 2013-12-14 21:07:09 +02:00
Victor Stinner
c9362cf86a Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c"
argument is not in range [0; 255].
2013-12-13 12:14:44 +01:00
Victor Stinner
1310510793 Issue #14432: Generator now clears the borrowed reference to the thread state
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:17:29 +01:00
Serhiy Storchaka
31a655411a Issue #17576: Deprecation warning emitted now when __int__() or __index__()
return not int instance.  Introduced _PyLong_FromNbInt() and refactored
PyLong_As*() functions.
2013-12-11 21:07:54 +02:00
Alexandre Vassalotti
65846c6c51 Issue #6477: Keep PyNotImplemented_Type and PyNone_Type private. 2013-11-30 17:55:48 -08:00
Alexandre Vassalotti
19b6fa6ebb Issue #6477: Added support for pickling the types of built-in singletons. 2013-11-30 16:06:39 -08:00
Alexandre Vassalotti
1a83070d9e Issue #19088: Fix incorrect caching of the copyreg module.
This fix does not cause any degradation in performance.
2013-11-30 00:53:09 -08:00
Benjamin Peterson
0ee22bf774 fix format spec recursive expansion (closes #19729) 2013-11-26 19:22:36 -06:00
Gregory P. Smith
0e524047e2 Remove an errant extra \ within a docstring. 2013-11-25 00:30:56 -08:00
Raymond Hettinger
97fc2ba6bf Document that @property can incorporate a docstring from the getter method. Improve readabilty with additional whitespace. 2013-11-24 14:53:29 -08:00
Serhiy Storchaka
35804e4c63 Issue #19279: UTF-7 decoder no more produces illegal strings. 2013-10-19 20:38:19 +03:00
Tim Peters
81a93159d7 Issue #19171: speed some cases of 3-argument long pow().
Reduce the base by the modulus when the base is larger than
the modulus.  This can unboundedly speed the "startup costs"
of doing modular exponentiation, particularly in cases where
the base is much larger than the modulus.  Original patch
by Armin Rigo, inspired by https://github.com/pyca/ed25519.
2013-10-05 16:53:52 -05:00
Ezio Melotti
7760b4eb4b #19069: use imperative mood in float object docstrings. Patch by Marco Buttu. 2013-10-06 00:45:11 +03:00
Ezio Melotti
488d244e1a #19068: use imperative mood in complex object docstrings. Patch by Marco Buttu. 2013-10-06 00:39:18 +03:00
Ezio Melotti
5792ce151c #19067: use imperative mood in range object docstrings. Patch by Marco Buttu. 2013-10-06 00:36:45 +03:00
Antoine Pitrou
60b183407c Issue #19014: memoryview.cast() is now allowed on zero-length views. 2013-10-03 19:55:41 +02:00
Raymond Hettinger
2ff2190b62 Issue #18594: Fix the fast path for collections.Counter().
The path wasn't being taken due to an over-restrictive type check.
2013-10-01 00:55:43 -07:00
Tim Peters
eaa3bcc370 Issue #18942: sys._debugmallocstats() output was damaged on Windows.
_PyDebugAllocatorStats() called PyOS_snprintf() with a %zd format
code, but MS doesn't support that code.  Interpolated
PY_FORMAT_SIZE_T in place of the "z".
2013-09-05 22:57:04 -05:00
Serhiy Storchaka
9594942716 Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 19:40:23 +03:00
Tim Peters
ec8147ba55 Various clarifications based on feedback & questions over the years.
(grafted from 23181bf411a16287a0a54e910fc0f9ecd2764bf0)
2013-08-24 15:15:19 -05:00
Tim Peters
01e75a699d Add line explaining the "%sort" test.
(grafted from 1ea833ecaf5a9d43a886e9e73b4e2551d0d5b548)
2013-08-22 18:32:53 -05:00
Raymond Hettinger
b1b915c796 Issue 18719: Remove a false optimization
Remove an unused early-out test from the critical path for
dict and set lookups.

When the strings already have matching lengths, kinds, and hashes,
there is no additional information gained by checking the first
characters (the probability of a mismatch is already known to
be less than 1 in 2**64).
2013-08-13 18:16:34 -07:00
Raymond Hettinger
c86d7e989c Silence compiler warning for an unused declaration 2013-08-04 12:00:36 -07:00
Raymond Hettinger
e56666d17f Silence compiler warning about an uninitialized variable 2013-08-04 11:51:03 -07:00
Serhiy Storchaka
f6d0aeeadc Issue #16741: Fix an error reporting in int(). 2013-08-03 20:55:06 +03:00
Christian Heimes
c731bbe665 Propagate error when PyByteArray_Resize() fails in bytearray_translate()
CID 715334
2013-07-21 02:04:35 +02:00
Christian Heimes
26532f7519 Check return value of PyType_Ready(&EncodingMapType)
CID 486654
2013-07-20 14:57:16 +02:00
Serhiy Storchaka
8eeae2126c Issue #18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise
OverflowError when an argument of %c format is out of range.
2013-06-23 20:12:14 +03:00
Benjamin Peterson
7e30373126 remove MAX_MAXCHAR because it's unsafe for computing maximum codepoitn value (see #18183) 2013-06-10 09:19:46 -07:00
Benjamin Peterson
d2b58a9880 only recursively expand in the format spec (closes #17644) 2013-05-17 17:34:30 -05:00
Raymond Hettinger
36f74aa7f7 Issue #17563: Fix dict resize performance regression. 2013-05-17 03:01:13 -07:00
Benjamin Peterson
e1b4cbc422 when arguments are cells clear the locals slot (backport of #17927) 2013-05-14 22:31:26 -05:00
Antoine Pitrou
8b0e98426d Issue #17237: Fix crash in the ASCII decoder on m68k. 2013-05-11 15:58:34 +02:00
Antoine Pitrou
957a23b088 Issue #17408: Avoid using an obsolete instance of the copyreg module when the interpreter is shutdown and then started again. 2013-05-04 20:45:02 +02:00