1481 Commits

Author SHA1 Message Date
Jeremy Hylton
886849a282 Backport: Double-fix of crash in Unicode freelist handling. 2003-09-17 03:32:41 +00:00
Anthony Baxter
0a8f2996a5 Backport of rhettinger's funcobject.c 2.63, bugfix for SF bug 753451
Check the argument of classmethod is callable. (prevents
classmethod(classmethod(func)) from bombing out.
2003-07-13 13:54:34 +00:00
Neal Norwitz
dad043e364 Backport 2.237 by Guido:
- SF patch 751998 fixes an unwanted side effect of the previous fix
  for SF bug 742860 (the next item).
2003-06-16 23:38:00 +00:00
Barry Warsaw
1345877de6 Backport patch 2.206:
----------------------------
    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.
2003-05-29 15:13:18 +00:00
Guido van Rossum
f9622d1cf0 Fix for SF 742911. We now clear the weakrefs *before* calling __del__
or emptying __dict__, just as we do for classic classes.
2003-05-29 14:28:22 +00:00
Jeremy Hylton
826f68b25b Backport fix for SF bug 692776.
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.
2003-05-22 18:11:20 +00:00
Tim Peters
97719c9ce5 PyType_Ready(): Complain if the type is a base type, and gc'able, and
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.
2003-05-21 20:43:10 +00:00
Brett Cannon
a63d35f486 Change docstrings for __(get|set|del)slice__ to note that negative indices are not supported. 2003-05-20 02:42:04 +00:00
Jeremy Hylton
d8136b500a Backport fixes to make more types collectable.
classmethod, staticmethod, cPickle.Pickler, cPickle.UNpickler
2003-05-09 18:29:21 +00:00
Martin v. Löwis
7aed4a33ac Patch #708604: Check more function results. 2003-05-03 10:53:51 +00:00
Tim Peters
fa90c3e468 file_truncate(): Backported 2.3 code so that file.truncate(n) works on
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.
2003-04-30 19:24:59 +00:00
Guido van Rossum
4f017eb311 Backport the Carlo Verre fix. 2003-04-25 05:40:32 +00:00
Neal Norwitz
9976fdf83c Backport:
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.
2003-04-11 18:21:22 +00:00
Guido van Rossum
c927c8a3ea Backport from trunk:
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.
2003-04-09 17:06:31 +00:00
Tim Peters
82550d5b86 Added private API function _PyInstance_Lookup(). This is part of
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.
2003-04-08 19:02:34 +00:00
Fred Drake
62ed948c2b Remove trailing newline. 2003-04-01 15:40:07 +00:00
Neal Norwitz
0dc63d404a Backport Tim's checkin 2.218:
slot_sq_contains():  This leaked a reference to the result of calling
    __contains__().
2003-03-23 14:36:50 +00:00
Gustavo Niemeyer
fac559c533 Backported fix to [521782] unreliable file.read() error handling. 2003-03-04 00:50:24 +00:00
Guido van Rossum
2f3fe91ddc Backport of rev 2.199 from trunk.
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!
2003-02-19 03:21:21 +00:00
Neal Norwitz
9aa5027699 Backport: Add more missing PyErr_NoMemory() after failled memory allocs 2003-02-11 23:19:35 +00:00
Neal Norwitz
e8c4f9457e backport:
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.
2003-02-02 19:59:59 +00:00
Neal Norwitz
949954706b backport:
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.
2003-02-02 19:37:32 +00:00
Neal Norwitz
6b5140f992 backport:
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.
2003-02-02 19:25:22 +00:00
Neal Norwitz
89d08cbd39 backport:
Fix SF bug# 676155, RuntimeWarning with tp_compare

Check return value of PyLong_AsDouble(), it can return an error.
2003-01-28 19:40:35 +00:00
Neal Norwitz
583b86bd2c Backport SF # 669553, fix memory (ref) leaks 2003-01-19 15:48:38 +00:00