Gregory P. Smith
27cbcd6241
Fix the internals of our hash functions to used unsigned values during hash
...
computation as the overflow behavior of signed integers is undefined.
In practice we require compiling everything with -fwrapv which forces overflow
to be defined as twos compliment but this keeps the code cleaner for checkers
or in the case where someone has compiled it without -fwrapv or their
compiler's equivalent.
Found by Clang trunk's Undefined Behavior Sanitizer (UBSan).
Cleanup only - no functionality or hash values change.
2012-12-10 18:15:46 -08:00
Benjamin Peterson
ca819c3c9d
merge 3.1 ( #14509 )
2012-04-09 15:01:02 -04:00
Benjamin Peterson
f6622c8a3e
fix build without Py_DEBUG and DNDEBUG ( closes #14509 )
2012-04-09 14:53:07 -04:00
Benjamin Peterson
e249dcab7a
merge 3.2
2012-02-21 11:09:13 -05:00
Benjamin Peterson
69e9727657
ensure no one tries to hash things before the random seed is found
2012-02-21 11:08:50 -05:00
Georg Brandl
09a7c72cad
Merge from 3.1: Issue #13703 : add a way to randomize the hash values of basic types (str, bytes, datetime)
...
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.
The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 21:31:46 +01:00
Georg Brandl
2daf6ae249
Issue #13703 : add a way to randomize the hash values of basic types (str, bytes, datetime)
...
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.
The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 19:54:16 +01:00
Georg Brandl
beca27a394
Fix #13834 : strip() strips leading and trailing whitespace.
2012-01-22 21:31:21 +01:00
Gregory P. Smith
63e6c3222f
Consolidate the occurrances of the prime used as the multiplier when hashing
...
to a single #define instead of having several copies in several files.
This excludes the Modules/ tree (datetime and expat both have a copy
for their own purposes with no need for it to be the same).
2012-01-14 15:31:34 -08:00
Victor Stinner
bb2e9c477d
Issue #11231 : Fix bytes and bytearray docstrings
...
Patch written by Brice Berna.
2011-12-17 23:18:07 +01:00
Senthil Kumaran
53516a82df
Fix closes Issue12621 - Fix docstrings of find and rfind methods of bytes/bytearry/unicodeobject.
2011-07-27 23:33:54 +08:00
Ezio Melotti
f2b3f780a1
#6780 : merge with 3.1.
2011-04-26 06:40:59 +03:00
Ezio Melotti
ba42fd5801
#6780 : fix starts/endswith error message to mention that tuples are accepted too.
2011-04-26 06:09:45 +03:00
Jesus Cea
6159ee3cf5
MERGE: startswith and endswith don't accept None as slice index. Patch by Torsten Becker. ( closes #11828 )
2011-04-20 17:42:50 +02:00
Jesus Cea
ac4515063c
startswith and endswith don't accept None as slice index. Patch by Torsten Becker. ( closes #11828 )
2011-04-20 17:09:23 +02:00
Ezio Melotti
4969f709cc
#11515 : Merge with 3.1.
2011-03-15 05:59:46 +02:00
Ezio Melotti
42da663e6f
#11515 : fix several typos. Patch by Piotr Kasprzyk.
2011-03-15 05:18:48 +02:00
Benjamin Peterson
28a4dce6a8
remove (un)transform methods
2010-12-12 01:33:04 +00:00
Martin v. Löwis
4d0d471a80
Merge branches/pep-0384.
2010-12-03 20:14:31 +00:00
Georg Brandl
02524629f3
#7475 : add (un)transform method to bytes/bytearray and str, add back codecs that can be used with them from Python 2.
2010-12-02 18:06:51 +00:00
Victor Stinner
c911bbfd5d
str, bytes, bytearray docstring: remove unnecessary [...]
2010-11-07 19:04:46 +00:00
Victor Stinner
e14e212221
Fix encode/decode method doc of str, bytes, bytearray types
...
* Specify the default encoding: write 'utf-8' instead of
sys.getdefaultencoding(), because the default encoding is now constant
* Specify the default errors value
2010-11-07 18:41:46 +00:00
David Malcolm
9696088b6d
Issue #10288 : The deprecated family of "char"-handling macros
...
(ISLOWER()/ISUPPER()/etc) have now been removed: use Py_ISLOWER() etc
instead.
2010-11-05 17:23:41 +00:00
Benjamin Peterson
8f67d0893f
make hashes always the size of pointers; introduce Py_hash_t #9778
2010-10-17 20:54:53 +00:00
Senthil Kumaran
f77342076e
Merged revisions 84629 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84629 | senthil.kumaran | 2010-09-08 18:20:29 +0530 (Wed, 08 Sep 2010) | 3 lines
Revert the doc change done in r83880. str.replace with negative count value is not a feature.
........
2010-09-08 13:00:07 +00:00
Senthil Kumaran
9a9dd1c140
Revert the doc change done in r83880. str.replace with negative count value is not a feature.
2010-09-08 12:50:29 +00:00
Antoine Pitrou
bc760d9f45
Merged revisions 84070,84074 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84070 | antoine.pitrou | 2010-08-15 19:12:55 +0200 (dim., 15 août 2010) | 5 lines
Fix some compilation warnings under 64-bit Windows (issue #9566 ).
Some of these are genuine bugs with objects bigger than 2GB, but
my system doesn't allow me to write tests for it.
........
r84074 | antoine.pitrou | 2010-08-15 19:41:31 +0200 (dim., 15 août 2010) | 3 lines
Fix (harmless) warning with MSVC.
........
2010-08-15 17:46:50 +00:00
Antoine Pitrou
0010d37a43
Fix some compilation warnings under 64-bit Windows (issue #9566 ).
...
Some of these are genuine bugs with objects bigger than 2GB, but
my system doesn't allow me to write tests for it.
2010-08-15 17:12:55 +00:00
Alexander Belopolsky
f0f45142d5
Issue #2443 : Added a new macro, Py_VA_COPY, which is equivalent to C99
...
va_copy, but available on all python platforms. Untabified a few
unrelated files.
2010-08-11 17:31:17 +00:00
Mark Dickinson
cf940c701f
Issue #9530 : Fix undefined-behaviour-inducing overflow checks in bytes and bytearray implementations.
2010-08-10 18:35:01 +00:00
Senthil Kumaran
c3ce882c75
Merged revisions 83882 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r83882 | senthil.kumaran | 2010-08-09 14:33:57 +0530 (Mon, 09 Aug 2010) | 3 lines
spelling mistake.
........
2010-08-09 09:06:23 +00:00
Senthil Kumaran
f2de1ffc88
spelling mistake.
2010-08-09 09:03:57 +00:00
Senthil Kumaran
a3aee53776
Merged revisions 83880 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r83880 | senthil.kumaran | 2010-08-09 14:26:25 +0530 (Mon, 09 Aug 2010) | 3 lines
Fix Issue5416 - explain negative value for count in bytes object replace.
........
2010-08-09 09:02:18 +00:00
Senthil Kumaran
77210b4fa9
Fix Issue5416 - explain negative value for count in bytes object replace.
2010-08-09 08:56:25 +00:00
Antoine Pitrou
a57aae7d47
Merged revisions 81862 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r81862 | antoine.pitrou | 2010-06-09 18:38:55 +0200 (mer., 09 juin 2010) | 9 lines
Merged revisions 81860 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81860 | antoine.pitrou | 2010-06-09 18:24:00 +0200 (mer., 09 juin 2010) | 3 lines
Issue #8930 : fix some C code indentation
........
................
2010-06-09 16:58:35 +00:00
Antoine Pitrou
d118856049
Merged revisions 81860 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81860 | antoine.pitrou | 2010-06-09 18:24:00 +0200 (mer., 09 juin 2010) | 3 lines
Issue #8930 : fix some C code indentation
........
2010-06-09 16:38:55 +00:00
Antoine Pitrou
7f14f0d8a0
Recorded merge of revisions 81032 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines
Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
................
2010-05-09 16:14:21 +00:00
Antoine Pitrou
f95a1b3c53
Recorded merge of revisions 81029 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Benjamin Peterson
0ff8a505c6
Merged revisions 80125,80128,80130 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r80125 | benjamin.peterson | 2010-04-16 17:35:32 -0500 (Fri, 16 Apr 2010) | 13 lines
Merged revisions 80123-80124 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80123 | benjamin.peterson | 2010-04-16 17:24:16 -0500 (Fri, 16 Apr 2010) | 1 line
bytearray -> type2test
........
r80124 | benjamin.peterson | 2010-04-16 17:25:57 -0500 (Fri, 16 Apr 2010) | 1 line
fix typo
........
................
r80128 | benjamin.peterson | 2010-04-16 17:51:37 -0500 (Fri, 16 Apr 2010) | 9 lines
Merged revisions 80126 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80126 | benjamin.peterson | 2010-04-16 17:35:38 -0500 (Fri, 16 Apr 2010) | 1 line
have a clear error when passing something > sys.maxsize to bytearray
........
................
r80130 | benjamin.peterson | 2010-04-16 18:00:53 -0500 (Fri, 16 Apr 2010) | 9 lines
Merged revisions 80129 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80129 | benjamin.peterson | 2010-04-16 17:52:44 -0500 (Fri, 16 Apr 2010) | 1 line
tiny simplification
........
................
2010-04-16 23:19:11 +00:00
Benjamin Peterson
8380dd5aa4
Merged revisions 80126 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80126 | benjamin.peterson | 2010-04-16 17:35:38 -0500 (Fri, 16 Apr 2010) | 1 line
have a clear error when passing something > sys.maxsize to bytearray
........
2010-04-16 22:51:37 +00:00
Ezio Melotti
4c81fbb118
Merged revisions 77745 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r77745 | ezio.melotti | 2010-01-25 13:58:28 +0200 (Mon, 25 Jan 2010) | 9 lines
Merged revisions 77743 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77743 | ezio.melotti | 2010-01-25 13:24:37 +0200 (Mon, 25 Jan 2010) | 1 line
#7775 : fixed docstring for rpartition
........
................
2010-01-25 12:02:24 +00:00
Ezio Melotti
5b2b242f07
Merged revisions 77743 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77743 | ezio.melotti | 2010-01-25 13:24:37 +0200 (Mon, 25 Jan 2010) | 1 line
#7775 : fixed docstring for rpartition
........
2010-01-25 11:58:28 +00:00
Antoine Pitrou
f2c5484f9e
Merged revisions 77461 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77461 | antoine.pitrou | 2010-01-13 08:55:48 +0100 (mer., 13 janv. 2010) | 5 lines
Issue #7622 : Improve the split(), rsplit(), splitlines() and replace()
methods of bytes, bytearray and unicode objects by using a common
implementation based on stringlib's fast search. Patch by Florent Xicluna.
........
2010-01-13 08:07:53 +00:00
Alexandre Vassalotti
41f58a70ac
Issue #7382 : Fix bytes.__getnewargs__.
2010-01-12 01:23:09 +00:00
Alexandre Vassalotti
a5c565a534
Issue #6688 : Optimize PyBytes_FromObject().
...
- Add special-cases for list and tuple objects.
- Use _PyObject_LengthHint() instead of an arbitrary value for the
size of the initial buffer of the returned object.
2010-01-09 22:14:46 +00:00
Alexandre Vassalotti
eb6f8de8bf
Issue #6687 : Moved the special-case for integers out of PyBytes_FromObject.
2009-12-31 03:56:09 +00:00
Eric Smith
0f78bff646
Issue #5748 : bytesobject.c should not have its own private defines for stringlib macros. Also removed unused defines and include for localutil.h.
2009-11-30 01:01:42 +00:00
Benjamin Peterson
308d637c94
Merged revisions 74929 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74929 | benjamin.peterson | 2009-09-18 16:14:55 -0500 (Fri, 18 Sep 2009) | 1 line
add keyword arguments support to str/unicode encode and decode #6300
........
2009-09-18 21:42:35 +00:00
Benjamin Peterson
80688efd6c
rename internal methods of the bytes object to bytes_
2009-04-18 15:17:02 +00:00
Eric Smith
0923d1d8d7
The other half of Issue #1580 : use short float repr where possible.
...
Addresses the float -> string conversion, using David Gay's code which
was added in Mark Dickinson's checkin r71663.
Also addresses these, which are intertwined with the short repr
changes:
- Issue #5772 : format(1e100, '<') produces '1e+100', not '1.0e+100'
- Issue #5515 : 'n' formatting with commas no longer works poorly
with leading zeros.
- PEP 378 Format Specifier for Thousands Separator: implemented
for floats.
2009-04-16 20:16:10 +00:00