Mark Dickinson
bcf6b18eb7
A few more minor fixes in longobject.c
2009-02-15 15:48:39 +00:00
Mark Dickinson
2ffb26fb83
Issue #5260 : Various portability and standards compliance fixes, optimizations
...
and cleanups in Objects/longobject.c. The most significant change is that
longs now use less memory: average savings are 2 bytes per long on 32-bit
systems and 6 bytes per long on 64-bit systems. (This memory saving already
exists in py3k.)
2009-02-15 10:13:41 +00:00
Antoine Pitrou
9e8a250ed9
Fix compiler warning (gcc)
2009-02-13 13:57:40 +00:00
Antoine Pitrou
76a4b896c4
Issue #5186 : Reduce hash collisions for objects with no __hash__ method by
...
rotating the object pointer by 4 bits to the right.
2009-02-13 13:52:33 +00:00
Georg Brandl
cbb4958cd8
Fix warnings GCC emits where the argument of PyErr_Format is a single variable.
2009-02-13 11:06:59 +00:00
Mark Dickinson
4015f62e39
Issue #5175 : PyLong_AsUnsignedLongLong now raises OverflowError for
...
negative arguments. Previously, it raised TypeError.
Thanks Lisandro Dalcin.
2009-02-10 15:46:50 +00:00
Kristján Valur Jónsson
6a743d3694
Issue 4804. Add a function to test the validity of file descriptors on Windows, and stop using global runtime settings to silence the warnings / assertions.
2009-02-10 13:32:24 +00:00
Mark Dickinson
10fe877dcd
Issue #789290 : make sure that hash(2**63) == hash(2.**63) on 64-bit
...
platforms. The previous code was fragile, depending on the twin
accidents that:
(1) in C, casting the double value 2.**63 to long returns the integer
value -2**63, and
(2) in Python, hash(-2**63) == hash(2**63).
There's already a test for this in test_hash.
2009-02-08 14:42:28 +00:00
Mark Dickinson
b91d2f5bd3
Remove redundant assignment in _PyObject_LengthHint
2009-02-08 13:58:10 +00:00
Kristján Valur Jónsson
fd4c872726
issue 4804: Provide checks for the format string of strftime, and for the "mode" string of fopen on Windows. These strings are user provided from python and so we can avoid invoking the C runtime invalid parameter handler by first checking that they are valid.
2009-02-04 10:05:25 +00:00
Raymond Hettinger
d6fc2623c5
Validate that __length_hint__ returns a usable result.
2009-02-03 02:23:19 +00:00
Raymond Hettinger
b516370bcb
Issue 1242657: list(obj) can swallow KeyboardInterrupt.
2009-02-02 21:50:13 +00:00
Benjamin Peterson
1c5d21d644
fix indentation in comment
2009-01-31 22:33:02 +00:00
Benjamin Peterson
be1399e39a
fix indentation; looks like all I managed to do the first time is make things uglier
2009-01-31 22:03:19 +00:00
Benjamin Peterson
d17fec74e5
fix indentation
2009-01-31 21:47:42 +00:00
Benjamin Peterson
857ce15791
completely detabify unicodeobject.c
2009-01-31 16:29:18 +00:00
Mark Dickinson
a0eae0398c
Fix comment.
2009-01-26 21:40:08 +00:00
Mark Dickinson
6ffa4a2a7d
Fix undefined behaviour (left shift of negative value) in long_hash. Also,
...
rewrap a line of length > 79, and update comments.
2009-01-26 21:36:30 +00:00
Mark Dickinson
1afe6ddd07
No need for carry to be type twodigits in _PyLong_AsByteArray; digit is large enough.
...
This change should silence a compiler warning on Windows.
2009-01-25 22:12:31 +00:00
Hirokazu Yamamoto
1e234e8c19
Fixed compile error on windows.
2009-01-25 17:46:48 +00:00
Benjamin Peterson
78821ddf8c
fix building the core with --disable-unicode
...
I changed some bytearray methods to use strings instead of unicode like bytes_repr
Also, bytearray.fromhex() can take strings as well as unicode
2009-01-25 17:15:10 +00:00
Mark Dickinson
ff84aa87b4
Issue #4393 : fix 3 classes of potential portability problems in longobject.c:
...
- fix some places where counters into ob_digit were declared as
int instead of Py_ssize_t
- add (twodigit) casts where necessary
- fix code in _PyLong_AsByteArray that uses << on negative values
2009-01-24 15:27:44 +00:00
Benjamin Peterson
e548d2487d
fix url
2009-01-20 18:58:27 +00:00
Amaury Forgeot d'Arc
59ce042766
#4077 : No need to append \n when calling Py_FatalError
...
+ fix a declaration to make it match the one in pythonrun.h
2009-01-17 20:18:59 +00:00
Amaury Forgeot d'Arc
bd55c52565
#4930 : Slightly cleaner (and faster) code in type creation:
...
compare slots by address, not by name.
2009-01-17 17:11:50 +00:00
Antoine Pitrou
c2f02216b6
Issue #4935 : The overflow checking code in the expandtabs() method common
...
to str, bytes and bytearray could be optimized away by the compiler, letting
the interpreter segfault instead of raising an error.
2009-01-13 23:13:52 +00:00
Amaury Forgeot d'Arc
a40d573664
#3720 : Interpreter crashes when an evil iterator removes its own next function.
...
Now the slot is filled with a function that always raises.
Will not backport: extensions compiled with 2.6.x would not run on 2.6.0.
2009-01-12 23:36:55 +00:00
Martin v. Löwis
b90304acb9
Issue #4850 : Change COUNT_ALLOCS variables to Py_ssize_t.
2009-01-07 18:40:40 +00:00
Antoine Pitrou
aa687902f2
Issue #3680 : Reference cycles created through a dict, set or deque iterator did not get collected.
2009-01-01 14:11:22 +00:00
Nick Coghlan
180e400766
Issue #4701 : implicitly call PyType_Ready from PyObject_Hash
2008-12-30 01:18:48 +00:00
Benjamin Peterson
fe231b07e4
#4764 set IOError.filename when trying to open a directory on POSIX platforms
2008-12-29 17:47:42 +00:00
Georg Brandl
6425a2fa8f
Backport r67974:
...
#4759 : allow None as first argument of bytearray.translate(), for consistency with bytes.translate().
Also fix segfault for bytearray.translate(x, None) -- will backport this part to 3.0 and 2.6.
2008-12-28 11:54:53 +00:00
Alexandre Vassalotti
034e08ce8d
Remove unnecessary casts related to unicode_decode_call_errorhandler.
...
Make the _PyUnicode_Resize macro a static function.
These changes are needed to avoid breaking strict aliasing rules.
2008-12-27 06:36:10 +00:00
Benjamin Peterson
f09925da67
add py3k warnings to frame.f_exc_*
2008-12-22 20:16:25 +00:00
Mark Dickinson
1a707981c8
Issue #3439 : add bit_length method to int and long.
...
Thanks Fredrik Johansson and Victor Stinner for code,
Raymond Hettinger for review.
2008-12-17 16:14:37 +00:00
Amaury Forgeot d'Arc
3538a3107a
#3632 : the "pyo" macro from gdbinit can now run when the GIL is released.
...
Patch by haypo.
2008-12-15 22:29:14 +00:00
Antoine Pitrou
ae5beceb35
Issue #4509 : bugs in bytearray with exports (buffer protocol)
2008-12-06 21:29:24 +00:00
Mark Dickinson
826f3fefe5
Issue #4445 : save 3 bytes (on average, on a typical machine) per
...
string allocation.
2008-12-05 21:55:28 +00:00
Raymond Hettinger
7989a4dccb
Backport r67478
2008-12-03 15:42:10 +00:00
Amaury Forgeot d'Arc
2a1fd05971
Fix a small typo in docstring
2008-11-29 02:03:32 +00:00
Benjamin Peterson
46cc6d1102
make sure that bytearray methods return a new bytearray even if there is no change
...
Fixes #4348
Reviewed by Brett
2008-11-19 21:49:09 +00:00
Benjamin Peterson
273c233c78
when __getattr__ is a descriptor, call it correctly; fixes #4230
...
patch from Ziga Seilnacht
2008-11-17 22:39:09 +00:00
Amaury Forgeot d'Arc
d78b9dcbc3
#4069 : aSet.remove(otherSet) would always report the empty frozenset([]) as the missing key.
...
Now it correctly refers to the initial otherset.
Reviewed by Raymond. Will backport to 2.6.
2008-10-07 20:32:10 +00:00
Andrew M. Kuchling
a4127173f8
Punctuation fix; expand dict.update docstring to be clearer
2008-10-04 21:51:59 +00:00
Andrew M. Kuchling
efeb43eb31
Docstring change for *partition: use same tense as other docstrings.
...
Hyphenate left- and right-justified.
Fix 'registerd' typo
2008-10-04 01:05:56 +00:00
Andrew M. Kuchling
d810cdf849
Docstring changes: Specify exceptions raised
2008-10-04 01:04:24 +00:00
Andrew M. Kuchling
b15d6fb9a7
Docstring change: Specify exception raised
2008-10-04 01:03:42 +00:00
Andrew M. Kuchling
bd7c4ca569
Use correct capitalization of NaN
2008-10-04 01:02:29 +00:00
Andrew M. Kuchling
d7b7dde98e
Mention exception in docstring
2008-10-03 16:29:19 +00:00
Christian Heimes
32a66a0410
Fixed a couple more C99 comments and one occurence of inline.
2008-10-02 19:47:50 +00:00