summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Backport: Double-fix of crash in Unicode freelist handling.Jeremy Hylton2003-09-171-1/+14
|
* Backport of rhettinger's funcobject.c 2.63, bugfix for SF bug 753451Anthony Baxter2003-07-131-0/+6
| | | | | Check the argument of classmethod is callable. (prevents classmethod(classmethod(func)) from bombing out.
* Backport 2.237 by Guido:Neal Norwitz2003-06-161-5/+14
| | | | | - SF patch 751998 fixes an unwanted side effect of the previous fix for SF bug 742860 (the next item).
* Backport patch 2.206:Barry Warsaw2003-05-291-0/+9
| | | | | | | | | | | | | | | ---------------------------- 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.
* Fix for SF 742911. We now clear the weakrefs *before* calling __del__Guido van Rossum2003-05-291-8/+8
| | | | or emptying __dict__, just as we do for classic classes.
* Backport fix for SF bug 692776.Jeremy Hylton2003-05-221-1/+106
| | | | | | 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.
* PyType_Ready(): Complain if the type is a base type, and gc'able, andTim Peters2003-05-211-2/+32
| | | | | | | | | | | | | | | | | | 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.
* Change docstrings for __(get|set|del)slice__ to note that negative indices ↵Brett Cannon2003-05-201-3/+9
| | | | are not supported.
* Backport fixes to make more types collectable.Jeremy Hylton2003-05-091-8/+44
| | | | classmethod, staticmethod, cPickle.Pickler, cPickle.UNpickler
* Patch #708604: Check more function results.Martin v. Löwis2003-05-031-1/+8
|
* file_truncate(): Backported 2.3 code so that file.truncate(n) works onTim Peters2003-04-301-20/+68
| | | | | | 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.
* Backport the Carlo Verre fix.Guido van Rossum2003-04-251-0/+22
|
* Backport:Neal Norwitz2003-04-112-18/+18
| | | | | | | | | | | 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.
* Backport from trunk:Guido van Rossum2003-04-091-0/+1
| | | | | | 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.
* Added private API function _PyInstance_Lookup(). This is part ofTim Peters2003-04-081-8/+29
| | | | | | 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.
* Remove trailing newline.Fred Drake2003-04-011-1/+0
|
* Backport Tim's checkin 2.218:Neal Norwitz2003-03-231-9/+10
| | | | | slot_sq_contains(): This leaked a reference to the result of calling __contains__().
* Backported fix to [521782] unreliable file.read() error handling.Gustavo Niemeyer2003-03-041-3/+30
|
* Backport of rev 2.199 from trunk.Guido van Rossum2003-02-191-2/+4
| | | | | | | | | | 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!
* Backport: Add more missing PyErr_NoMemory() after failled memory allocsNeal Norwitz2003-02-111-1/+1
|
* backport:Neal Norwitz2003-02-021-10/+13
| | | | | | | | 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.
* backport:Neal Norwitz2003-02-021-14/+13
| | | | | | | | 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.
* backport:Neal Norwitz2003-02-021-0/+5
| | | | | | | | 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.
* backport:Neal Norwitz2003-01-281-1/+4
| | | | | | Fix SF bug# 676155, RuntimeWarning with tp_compare Check return value of PyLong_AsDouble(), it can return an error.
* Backport SF # 669553, fix memory (ref) leaksNeal Norwitz2003-01-191-1/+8
|
* Backport:Neal Norwitz2003-01-131-3/+16
| | | | | | | Fix SF bug #667147, Segmentation fault printing str subclass Fix infinite recursion which occurred when printing an object whose __str__() returned self.
* Backport typeobject.c revision 2.201 plus associated tests from 2.3:Guido van Rossum2003-01-071-1/+36
| | | | | | 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.
* Backport MAL's patch for bug #659709: bogus computation of float lengthRaymond Hettinger2003-01-022-16/+37
|
* SF Bug 645777: list.extend() works with any iterable and is no longerRaymond Hettinger2002-12-291-1/+1
| | | | experimental.
* Fix SF #658106, Setting __class__ to NoneTypeNeal Norwitz2002-12-241-6/+9
| | | | | | | | 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.
* try_3way_compare() was returning -1 in one case where it should returnGuido van Rossum2002-12-161-1/+1
| | | | | | | -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...
* Fix typo in abstract.c which caused __rpow__ to not be invoked.Raymond Hettinger2002-12-071-1/+1
| | | | | Added related testcase. Closes SF bug #643260.
* Backport from head.Tim Peters2002-12-071-3/+3
| | | | | slot_tp_hash(): In the normal path, this leaked a reference to the integer hash object returned by __hash__().
* Backport Neil Schemenauer's fix for SF #529750,Neal Norwitz2002-11-201-2/+0
| | | | | | | 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).
* Backport 2.173:Neal Norwitz2002-11-071-3/+1
| | | | Fix for bug #626172: crash using unicode latin1 single char
* Backport:Neal Norwitz2002-10-181-1/+5
| | | | | | Fix SF # 624982, Potential AV in slot_sq_item, by Greg Chapman Don't crash when getting value of a property raises an exception
* Fix (real! :-) memory leaks in half_cmp and half_binop.Guido van Rossum2002-10-181-1/+4
| | | | Perhaps found by NealN and valgrind. Will forward port.
* Sigh. That wasn't a memory leak, that was Guido committing beforeGuido van Rossum2002-10-181-5/+2
| | | | running tests. Withdraw 2.183 and its backport.
* Backport of 2.183:Guido van Rossum2002-10-181-2/+5
| | | | Fix memory leak in add_subclass() found by NealN with valgrind.
* Darn! Don't divide by zero. Bad fix. :-)Guido van Rossum2002-10-111-1/+1
|
* Backport listobject.c 2.137 and tupleobject.c 2.75:Guido van Rossum2002-10-112-0/+6
| | | | Add checks for size overflow on list*n, list+list, tuple+tuple.
* Backport 2.193:Guido van Rossum2002-10-111-10/+4
| | | | | | | | | 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.
* Backport stringobject.c 2.194 and unicodeobject.c 2.172:Guido van Rossum2002-10-112-4/+12
| | | | | | | | | | | | 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.
* New in 2.2.2!Guido van Rossum2002-10-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | 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.
* Backport the relevant part of 2.192:Guido van Rossum2002-10-111-1/+2
| | | | | | | | | | | 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.
* Backport, at the reqest of Kevin Jacobs:Guido van Rossum2002-10-071-0/+4
| | | | | | | | | | | - 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.
* Backport:Michael W. Hudson2002-10-071-1/+55
| | | | | | | | | | | | | | 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.
* Backport 2.103:Raymond Hettinger2002-10-051-2/+2
| | | | Made conversion failure error messages consistent between types.
* Backport 2.63 and 2.60:Raymond Hettinger2002-10-051-27/+24
| | | | | | | | | | | | 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.
* Fix typo in xreadlines() docstring. This does not apply to the trunk.Fred Drake2002-09-251-1/+1
| | | | Closes SF bug #614542.