Commit Graph

430 Commits

Author SHA1 Message Date
Jay Bosamiya c3c9db8927 [2.7] bpo-30657: Check & prevent integer overflow in PyString_DecodeEscape (#2174) 2017-06-18 19:41:03 +03:00
Serhiy Storchaka 5e79321742 bpo-30074: Fix compile warnings of _PySlice_Unpack and convert missed (#1154)
PySlice_GetIndicesEx in _ctypes.c.
2017-04-15 20:11:12 +03:00
Serhiy Storchaka e41390aca5 bpo-27867: Expand the PySlice_GetIndicesEx macro. (#1023) (#1046)
(cherry picked from commit b879fe8)
2017-04-08 11:48:57 +03:00
Xiang Zhang 7bdb516059 Issue #29145: Fix overflow checks in string, bytearray and unicode.
Patch by jan matejek and Xiang Zhang.
2017-01-09 11:13:20 +08:00
Serhiy Storchaka c30f27d1f2 Issue #11145: Fixed miscellaneous issues with C-style formatting of types
with custom __oct__ and __hex__.
2016-12-01 10:27:11 +02:00
Martin Panter ca56dd4767 Issue #28139: Fix messed up indentation
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
2016-09-17 07:54:55 +00:00
Martin Panter 440bbd0e38 Correct occurance → occurrence; extracted from patch by Georg Brandl 2016-09-08 05:22:16 +00:00
Martin Panter 3d36f0f712 Spelling and grammar fixes in code comments and documentation 2016-07-28 02:37:04 +00:00
Serhiy Storchaka 373773d5b2 Issue #27473: Fixed possible integer overflow in str, unicode and bytearray
concatenations and repetitions.  Based on patch by Xiang Zhang.
2016-07-12 15:46:57 +03:00
Martin Panter 646b528467 Issue #22463: Backport compiler warning fixes and workarounds
* Set but unused variable in Parser/pgen.c in non-debug builds. Patch by
  Christian Heimes.
* Unused static function in Modules/readline.c. Patch by Georg Brandl.
* main_window unused in Modules/tkappinit.c. Patch by Gregory P. Smith.
* Dead assignment in Modules/_ctypes/cfield.c. Extracted from patch by Brett
  Cannon.
* Expression result unused in PyObject_INIT macro expansions. Based on
  patches by Christian Heimes.
* Load expat_config.h and therefore pyconfig.h before C stdlib headers are
  loaded. This silences pre-processor warnings including '_POSIX_C_SOURCE
  redefined'. Extracted from patch by Christian Heimes.
2016-06-21 23:58:05 +00:00
Martin Panter 200a615774 Issue #27125: Remove duplicated words from documentation and comments 2016-05-30 04:04:50 +00:00
Martin Panter b1d867f149 Issue #27076: Doc, comment and test function name spelling fixes
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
2016-05-26 05:28:50 +00:00
Serhiy Storchaka 763a61ca95 Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
in places where Py_DECREF was used.
2016-04-10 18:05:12 +03:00
Serhiy Storchaka bc62af1bbe Issue #22570: Renamed Py_SETREF to Py_XSETREF. 2016-04-06 09:51:18 +03:00
Serhiy Storchaka 5951f2300f Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
2015-12-24 10:35:35 +02:00
Serhiy Storchaka 8d30ad7c8a Issue #24731: Fixed crash on converting objects with special methods
__str__, __trunc__, and __float__ returning instances of subclasses of
str, long, and float to subclasses of str, long, and float correspondingly.
2015-11-25 15:55:54 +02:00
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
Ezio Melotti e3685f6b1b #6780: fix starts/endswith error message to mention that tuples are accepted too. 2011-04-26 05:12:51 +03:00
Jesus Cea 44e81687a2 startswith and endswith don't accept None as slice index. Patch by Torsten Becker. (closes #11828) 2011-04-20 16:39:15 +02:00
Eli Bendersky 72de205895 Issue #11634: Remove misleading paragraph from a comment 2011-03-24 22:38:25 +02:00
Ezio Melotti 24b07bcba3 #11515: fix several typos. Patch by Piotr Kasprzyk. 2011-03-15 18:55:01 +02:00
Eric Smith 6c84085cfb Improved docstrings for str and unicode methods format and __format__. 2010-11-06 19:43:44 +00:00
Georg Brandl c5356994ed Merged revisions 83354,83365 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/release27-maint

........
  r83354 | georg.brandl | 2010-07-31 21:07:37 +0200 (Sa, 31 Jul 2010) | 1 line

  #9328: string format methods return strings.
........
  r83365 | georg.brandl | 2010-07-31 23:22:36 +0200 (Sa, 31 Jul 2010) | 1 line

  #1019882: if start() and stop() were not in the same stack frame, stats.load() would crash with IndexError.
........
2010-08-01 22:02:09 +00:00
Georg Brandl 05f819b6e9 #9328: string format methods return strings. 2010-07-31 19:07:37 +00:00
Ezio Melotti 6327bf1c6a Merged revisions 82248 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82248 | ezio.melotti | 2010-06-26 21:44:42 +0300 (Sat, 26 Jun 2010) | 1 line

  Fix extra space.
........
2010-06-26 18:47:01 +00:00
Ezio Melotti 2f06b78d61 Fix extra space. 2010-06-26 18:44:42 +00:00