Commit Graph

414 Commits

Author SHA1 Message Date
Serhiy Storchaka
c7797dc748 Issue #19543: Emit deprecation warning for known non-text encodings.
Backported issues #19619: encode() and decode() methods and constructors
of str, unicode and bytearray classes now emit deprecation warning for known
non-text encodings when Python is ran with the -3 option.

Backported issues #20404: io.TextIOWrapper (and hence io.open()) now uses the
internal codec marking system added to emit deprecation warning for known non-text
encodings at stream construction time when Python is ran with the -3 option.
2015-05-31 20:21:00 +03:00
Benjamin Peterson
f8c4b3a730 fix overflow checking in PyString_Repr (closes #22519) 2014-09-29 19:01:18 -04:00
Benjamin Peterson
1643d5cb08 give exception a nice message (closes #22379)
Patch by Yongzhi Pan.
2014-09-28 12:48:46 -04:00
Kristján Valur Jónsson
be580f2e48 Issue #20434 Correct error handlin of _PyString_Resize and _PyBytes_Resize 2014-04-25 09:51:21 +00:00
Benjamin Peterson
8312eccd34 add braces and fix indentation 2014-03-30 19:23:24 -04:00
Benjamin Peterson
0e431b9311 fix indentation and add braces 2014-03-30 19:16:44 -04:00
Raymond Hettinger
0e413bd288 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 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:34:49 -07:00
Ronald Oussoren
3687e8055c Issue #18427: str.replace could crash the interpreter with huge strings.
This fixes two places where 'int'  was used to represent
the size of strings, instead of 'Py_ssize_t'.

(The issue is not present in the corresponding code in the 3.x branches)

Fixes #18427
2013-07-11 13:33:55 +02:00
Benjamin Peterson
da2c7ebd23 allow any type with __getitem__ to be a mapping for the purposes of % (#15801) 2013-03-23 22:32:00 -05:00
Serhiy Storchaka
a8d64ae304 Issue #17034: Use Py_CLEAR() in stringobject.c. 2013-02-02 18:43:58 +02:00
Serhiy Storchaka
01b3a08f5e Issue #16975: Fix error handling bug in the escape-decode decoder. 2013-01-25 23:30:50 +02:00
Serhiy Storchaka
926f3a37de Issue #15989: Fix possible integer overflow in str formatting as in unicode formatting. 2013-01-19 23:35:46 +02:00
Benjamin Peterson
8f53ded1ee untabify 2013-01-02 12:25:15 -06:00
Benjamin Peterson
a708adfcf6 call PyErr_Clear() when ignoring error from PyNumber_Int (closes #15516)
Patch from Tom Tromey.
2013-01-02 12:21:32 -06:00
Mark Dickinson
75d3600466 Issue #14700: Fix buggy overflow checks for large precision and width in new-style and old-style formatting. 2012-10-28 10:00:46 +00:00
Chris Jerdonek
ad4b000179 Issue #14783: Backport changes from 3.2. 2012-10-07 20:37:54 -07:00
Benjamin Peterson
23d49d3e7e use the stricter PyMapping_Check (closes #15801) 2012-08-28 17:55:35 -04:00
Raymond Hettinger
aad5b02e62 Improve tooltips for splitlines() by showing that the default for keepends is False. 2012-06-02 01:42:58 -04:00
Benjamin Peterson
f51c384a0a fix build without Py_DEBUG and DNDEBUG (closes #14509) 2012-04-09 14:53:07 -04:00
Benjamin Peterson
9d7601fcea merge 2.6 2012-02-21 11:24:21 -05:00
Benjamin Peterson
26da920001 ensure no one tries to hash things before the random seed is found 2012-02-21 11:08:50 -05:00
Benjamin Peterson
aee9dfba4a merge 2.6 with hash randomization fix 2012-02-20 21:44:56 -05:00
Barry Warsaw
1e13eb084f - Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
environment variable, to provide an opt-in way to protect against denial of
  service attacks due to hash collisions within the dict and set types.  Patch
  by David Malcolm, based on work by Victor Stinner.
2012-02-20 20:42:21 -05:00
Senthil Kumaran
5e3a19d806 merge from 3.2 - Fix closes Issue12621 - Fix docstrings of find and rfind methods of bytes/bytearry/unicodeobject. 2011-07-27 23:36:51 +08:00
Mark Dickinson
cb9bf1ac9c Issue #12164: Document (in docstring) that str.translate accepts None for the first argument. 2011-06-25 11:00:12 +02:00