| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
| |
Check the argument of classmethod is callable. (prevents
classmethod(classmethod(func)) from bombing out.
|
| |
|
|
|
| |
- SF patch 751998 fixes an unwanted side effect of the previous fix
for SF bug 742860 (the next item).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
----------------------------
revision 2.206
date: 2003/02/11 16:25:43; author: gvanrossum; state: Exp; lines: +9 -0
Add basic arg sanity checking to wrap_descr_get(). This is called
when Python code calls a descriptor's __get__ method. It should
translate None to NULL in both argument positions, and insist that at
least one of the argument positions is not NULL after this
transformation.
----------------------------
which fixes SF bug # 736892, forcing function to act like an unbound
method dumps core.
|
| |
|
|
| |
or emptying __dict__, just as we do for classic classes.
|
| |
|
|
|
|
| |
Add a tp_new slot to function objects that handles the case of a
function requiring a closure. Put the function type in the new
module, rather than having a function new.function(). Add tests.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tp_free is NULL or PyObject_Del at the end. Because it's a base type
it must call tp_free in its dealloc function, and because it's gc'able
it must not call PyObject_Del.
inherit_slots(): Don't inherit tp_free unless the type and its base
agree about whether they're gc'able. If the type is gc'able and the
base is not, and the base uses the default PyObject_Del for its
tp_free, give the type PyObject_GC_Del for its tp_free (the appropriate
default for a gc'able type).
cPickle.c: The Pickler and Unpickler types claim to be base classes
and gc'able, but their dealloc functions didn't call tp_free.
Repaired that. Also call PyType_Ready() on these typeobjects, so
that the correct (PyObject_GC_Del) default memory-freeing function
gets plugged into these types' tp_free slots.
|
| |
|
|
| |
are not supported.
|
| |
|
|
| |
classmethod, staticmethod, cPickle.Pickler, cPickle.UNpickler
|
| | |
|
| |
|
|
|
|
| |
Windows when n is too big to fit in a 32-bit int. This was a hole in
2.2's large file support on Windows, and turns out it's a bad hole at
least for ZODB.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
Fix SF bug #697220, string.strip implementation/doc mismatch
Attempt to make all the various string/unicode *strip methods the same.
* Doc - add doc for when functions were added
* UserString
* string/unicode object methods
* string module functions
'chars' is used for the last parameter everywhere.
|
| |
|
|
|
|
| |
property_traverse() should also traverse into prop_doc -- there's no
typecheck that guarantees it's a string, and BTW string subclasses
could hide references.
|
| |
|
|
|
|
| |
backporting fixes so that garbage collection doesn't have to trigger
execution of arbitrary Python code just to figure out whether
an object has a __del__ method.
|
| | |
|
| |
|
|
|
| |
slot_sq_contains(): This leaked a reference to the result of calling
__contains__().
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
PyObject_Generic{Get,Set}Attr:
Don't access tp_descr_{get,set} of a descriptor without checking the
flag bits of the descriptor's type. While we know that the main type
(the type of the object whose attribute is being accessed) has all the
right flag bits (or else PyObject_Generic{Get,Set}Attr wouldn't be
called), we don't know that for its class attributes!
|
| | |
|
| |
|
|
|
|
|
|
| |
revision 2.196
date: 2002/12/07 21:39:16; author: tim_one; state: Exp; lines: +27 -28
slot_nb_nonzero(): Another leak uncovered by the sandbox datetime
tests. I found the logic too confusing to follow here, so rewrote more
than was likely absolutely necessary.
|
| |
|
|
|
|
|
|
| |
revision 2.164
date: 2002/10/29 18:36:40; author: gvanrossum; state: Exp; lines: +12 -13
Since properties are supported here, is possible that
instance_getattr2() raises an exception. Fix all code that made this
assumption.
|
| |
|
|
|
|
|
|
| |
revision 1.11
date: 2002/12/18 23:20:39; author: nnorwitz; state: Exp; lines: +6 -2
SF # 654974, fix unchecked return values in structseq
Check return values after memory allocation.
|
| |
|
|
|
|
| |
Fix SF bug# 676155, RuntimeWarning with tp_compare
Check return value of PyLong_AsDouble(), it can return an error.
|
| | |
|
| |
|
|
|
|
|
| |
Fix SF bug #667147, Segmentation fault printing str subclass
Fix infinite recursion which occurred when printing an object
whose __str__() returned self.
|
| |
|
|
|
|
| |
Add a refinement to SLOT1BINFULL() that fixes the problem reported in
SF bug #623669: only try (e.g.) __rdiv__ before __div__ if the right
class actually overrides it.
|
| | |
|
| |
|
|
| |
experimental.
|
| |
|
|
|
|
|
|
| |
Backport Guido's checkin 2.171:
Disallow class assignment completely unless both old and new are heap
types. This prevents nonsense like 2.__class__ = bool or
True.__class__ = int.
|
| |
|
|
|
|
|
| |
-2 (i.e. an exception was set). (This was already fixed in 2.3
through a different refactoring.)
Worth the release of Pyton 2.2.3? Eventually, I guess...
|
| |
|
|
|
| |
Added related testcase.
Closes SF bug #643260.
|
| |
|
|
|
| |
slot_tp_hash(): In the normal path, this leaked a reference to the
integer hash object returned by __hash__().
|
| |
|
|
|
|
|
| |
Circular reference makes Py_Init crash
Modified to keep _Py_ResetReferences() API, but make it a no-op.
It's not called now (for 2.3 it was completely removed).
|
| |
|
|
| |
Fix for bug #626172: crash using unicode latin1 single char
|
| |
|
|
|
|
| |
Fix SF # 624982, Potential AV in slot_sq_item, by Greg Chapman
Don't crash when getting value of a property raises an exception
|
| |
|
|
| |
Perhaps found by NealN and valgrind. Will forward port.
|
| |
|
|
| |
running tests. Withdraw 2.183 and its backport.
|
| |
|
|
| |
Fix memory leak in add_subclass() found by NealN with valgrind.
|
| | |
|
| |
|
|
| |
Add checks for size overflow on list*n, list+list, tuple+tuple.
|
| |
|
|
|
|
|
|
|
| |
PyObject_Init[Var] is almost always called from the PyObject_NEW[_VAR]
macros. The 'op' argument is then the result from PyObject_MALLOC,
and that can of course be NULL. In that case, PyObject_Init[Var]
would raise a SystemError with "NULL object passed to
PyObject_Init[Var]". But there's nothing the caller of the macro can
do about this. So PyObject_Init[Var] should call just PyErr_NoMemory.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Fix a nasty endcase reported by Armin Rigo in SF bug 618623:
'%2147483647d' % -123 segfaults. This was because an integer overflow
in a comparison caused the string resize to be skipped. After fixing
the overflow, this could call _PyString_Resize() with a negative size,
so I (1) test for that and raise MemoryError instead; (2) also added a
test for negative newsize to _PyString_Resize(), raising SystemError
as for all bad arguments.
An identical bug existed in unicodeobject.c, of course.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In inherit_slots(), get rid of the COPYSLOT(tp_dictoffset). Copying
the offset from a non-dominant base makes no sense: either the
non-dominant base has a nonzero tp_dictoffset, and then we should have
already copied it from the dominant base (at the very end of
inherit_special()), or the non-dominant base has no tp_dictoffset and
for some reason type_new() decided not to add one. The tp_dictoffset
from a non-dominant base is likely to conflict with the instance
layout of the dominant base, so copying the tp_dictoffset from the
non-dominant base would be a really bad idea in that case. This bug
can only be triggered by multiple inheritance from an extension class
that doesn't set tp_dictoffset and a new-style user-level class that
does have one. There are no such extension classes in the
distribution, but there are 3rd party ones. (Zope3 now has one,
that's how I found this. :-)
I've asked a few heavy users of new-style classes, extension classes
and metaclasses (David Abrahams and Kevin Jacobs), and neither of them
found any problems in their test suite after applying this fix, so I
assume it's safe.
|
| |
|
|
|
|
|
|
|
|
|
| |
The string formatting code has a test to switch to Unicode when %s
sees a Unicode argument. Unfortunately this test was also executed
for %r, because %s and %r share almost all of their code. This meant
that, if u is a unicode object while repr(u) is an 8-bit string
containing ASCII characters, '%r' % u is a *unicode* string containing
only ASCII characters!
Fixed by executing the test only for %s.
|
| |
|
|
|
|
|
|
|
|
|
| |
- Changed new-style class instantiation so that when C's __new__
method returns something that's not a C instance, its __init__ is
not called. [SF bug #537450]
XXX This is arguably a semantic change, but it's hard to imagine a
reason for wanting to depend on the old behavior. If problems with
this are reported within a week of the release of 2.2.2 beta 1, we may
revert this change.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
2002/08/11 12:23:04 lemburg Python/bltinmodule.c 2.262
2002/08/11 12:23:04 lemburg Objects/unicodeobject.c 2.162
2002/08/11 12:23:03 lemburg Misc/NEWS 1.461
2002/08/11 12:23:03 lemburg Lib/test/test_unicode.py 1.65
2002/08/11 12:23:03 lemburg Include/unicodeobject.h 2.39
Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level.
u'%c' will now raise a ValueError in case the argument is an
integer outside the valid range of Unicode code point ordinals.
Closes SF bug #593581.
|
| |
|
|
| |
Made conversion failure error messages consistent between types.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Call me anal, but there was a particular phrase that was speading to
comments everywhere that bugged me: /* Foo is inlined */ instead of
/* Inline Foo */. Somehow the "is inlined" phrase always confused me
for half a second (thinking, "No it isn't" until I added the missing
"here"). The new phrase is hopefully unambiguous.
Close SF bug 563740. complex() now finds __complex__() in new style classes.
Made conversion failure error messages consistent between types.
Added related unittests.
|
| |
|
|
| |
Closes SF bug #614542.
|