| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
In addition, long_pow() skipped a necessary (albeit extremely unlikely
to trigger) error check when converting an int modulus to long.
Alas, I was unable to write a test case that crashed due to either
cause.
Bugfix candidate.
|
|
|
|
|
|
|
| |
[ 1229429 ] missing Py_DECREF in PyObject_CallMethod
Add a test in test_enumerate, which is a bit random, but suffices
(reversed_new calls PyObject_CallMethod under some circumstances).
|
|
|
|
|
|
|
|
|
|
| |
managed by C, because it's possible for the block to be smaller than the
new requested size, and at the end of allocated VM. Trying to copy over
nbytes bytes to a Python small-object block can segfault then, and there's
no portable way to avoid this (we would have to know how many bytes
starting at p are addressable, and std C has no means to determine that).
Bugfix candidate. Should be backported to 2.4, but I'm out of time.
|
|
|
|
|
|
| |
float y = x;
when x is a double. Go figure.
|
|
|
|
| |
Hex longs now print with lowercase letters like their int counterparts.
|
| |
|
|
|
|
|
| |
Reverts 1.26 and 1.27.
And adds cycle testing.
|
|
|
|
| |
backport candidate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[ 1181301 ] make float packing copy bytes when they can
which hasn't been reviewed, despite numerous threats to check it in
anyway if noone reviews it. Please read the diff on the checkin list,
at least!
The basic idea is to examine the bytes of some 'probe values' to see if
the current platform is a IEEE 754-ish platform, and if so
_PyFloat_{Pack,Unpack}{4,8} just copy bytes around.
The rest is hair for testing, and tests.
|
|
|
|
| |
278. Closes bug 967182.
|
| |
|
|
|
|
| |
(Contributed by Barry Warsaw and Matt Messier.)
|
|
|
|
|
|
|
| |
conversion using the proper magic slot (e.g., __int__()). Also move conversion
code out of PyNumber_*() functions in the C API into the nb_* function.
Applied patch #1109424. Thanks Walter Doewald.
|
|
|
|
|
| |
now raise AttributeError instead of TypeError, for consistency with their
pure-Python equivalent.
|
| |
|
|
|
|
|
|
|
|
|
| |
[ 1165306 ] Property access with decorator makes interpreter crash
Don't allow the creation of unbound methods with NULL im_class, because
attempting to call such crashes.
Backport candidate.
|
| |
|
| |
|
|
|
|
|
| |
numbers in PyLong_AsLongLong, and update test suite accordingly.
Backported to 2.4.
|
|
|
|
| |
* Speed-up str.count() by using memchr() to fly between first char matches.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Speed-up "x in y" where x has more than one character.
The existing code made excessive calls to the expensive memcmp() function.
The new code uses memchr() to rapidly find a start point for memcmp().
In addition to knowing that the first character is a match, the new code
also checks that the last character is a match. This significantly reduces
the incidence of false starts (saving memcmp() calls and making quadratic
behavior less likely).
Improves the timings on:
python -m timeit -r7 -s"x='a'*1000" "'ab' in x"
python -m timeit -r7 -s"x='a'*1000" "'bc' in x"
Once this code has proven itself, then string_find_internal() should refer
to it rather than running its own version. Also, something similar may
apply to unicode objects.
|
|
|
|
|
|
|
|
| |
[ 1124295 ] Function's __name__ no longer accessible in restricted mode
which I introduced with a bit of mindless copy-paste when making
__name__ writable. You can't assign to __name__ in restricted mode,
which I'm going to pretend was intentional :)
|
| |
|
|
|
|
| |
This should go on whatever bugfix branches the other fetches up on.
|
|
|
|
|
| |
a minor change after the coercion, to accept two objects not necessarily of
the same type but with the same tp_compare.
|
| |
|
|
|
|
| |
unsized iterable inputs.
|
| |
|
|
|
|
|
|
|
| |
* Added missing error checks.
* Fixed O(n**2) growth pattern. Modeled after lists to achieve linear
amortized resizing. Improves construction of "tuple(it)" when "it" is
large and does not have a __len__ method. Other cases are unaffected.
|
| |
|
|
|
|
|
|
|
|
| |
and its usage in PyLocale_strcoll().
Clarify the documentation on this.
Thanks to Andreas Degert for pointing this out.
|
|
|
|
| |
Support automatic pickling of dictionaries in instance of set subclasses.
|
|
|
|
|
| |
stderr. close() can fail if the user is out-of-quota, for example.
Fixes #959379.
|
|
|
|
|
|
|
|
| |
In cyclic gc, clear weakrefs to unreachable objects before allowing any
Python code (weakref callbacks or __del__ methods) to run.
This is a critical bugfix, affecting all versions of Python since weakrefs
were introduced. I'll backport to 2.3.
|
|
|
|
|
|
|
|
|
|
| |
exposed in header files. Fixed a few comments in these headers.
As we might have expected, writing down invariants systematically exposed a
(minor) bug. In this case, function objects have a writeable func_code
attribute, which could be set to code objects with the wrong number of
free variables. Calling the resulting function segfaulted the interpreter.
Added a corresponding test.
|
|
|
|
|
| |
_PyString_Resize() readied strings for mutation but did not invalidate
the cached hash value.
|
|
|
|
| |
Python 2.3.x candidate.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also, add a testcase.
Formerly, the list_extend() code used several local variables to remember
its state across iterations. Since an iteration could call arbitrary
Python code, it was possible for the list state to be changed. The new
code uses dynamic structure references instead of C locals. So, they
are always up-to-date.
After list_resize() is called, its size has been updated but the new
cells are filled with NULLs. These needed to be filled before arbitrary
iteration code was called; otherwise, that code could attempt to modify
a list that was in a semi-invalid state. The solution was to change
the ob->size field back to a value reflecting the actual number of valid
cells.
|
| |
|
|
|
|
|
| |
buffers, compute the new buffer size based on the old buffer size.
Fixes SF bug #1034242.
|
|
|
|
|
| |
'base'). Fixes SF bug #1033720. Move offset sanity checking to
buffer_from_memory().
|
|
|
|
|
| |
platforms where that macro works, NaN compared to an int or long works
the same as NaN compared to a finite float.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When an integer is compared to a float now, the int isn't coerced to float.
This avoids spurious overflow exceptions and insane results. This should
compute correct results, without raising spurious exceptions, in all cases
now -- although I expect that what happens when an int/long is compared to
a NaN is still a platform accident.
Note that we had potential problems here even with "short" ints, on boxes
where sizeof(long)==8. There's #ifdef'ed code here to handle that, but
I can't test it as intended. I tested it by changing the #ifdef to
trigger on my 32-bit box instead.
I suppose this is a bugfix candidate, but I won't backport it. It's
long-winded (for speed) and messy (because the problem is messy). Note
that this also depends on a previous 2.4 patch that introduced
_Py_SwappedOp[] as an extern.
|
|
|
|
|
| |
I need to define it again. Bite the bullet and define it once as an
extern, _Py_SwappedOp[].
|
| |
|
|
|
|
|
|
| |
Make PySequence_Check() and PyMapping_Check() handle NULL inputs. This
goes beyond what most of the other checks do, but it is nice defensive
programming and solves the OP's problem.
|
| |
|
| |
|