2504 Commits

Author SHA1 Message Date
Andrew M. Kuchling
ed74a1019d [Patch #708374] Only apply the check for file size if the file is a regular file, not a character or block device. 2003-07-15 13:00:45 +00:00
Fred Drake
68976378f7 Backport Jeremy's patch from the trunk (revision 2.147):
The Unpickler forget about its find_class attribute.

Also make sure we visit and clear self->safe_constructors in the GC
support.
2003-07-11 20:37:13 +00:00
Martin v. Löwis
d3e2b66386 Backport FreeBSD recursion limit. Fixes #553736. 2003-06-14 15:03:06 +00:00
Brett Cannon
b1570d5119 Clarify docstring for symlink. 2003-06-11 00:20:02 +00:00
Neal Norwitz
a4ebef57f0 Backport 1.160:
Fix SF #745055, Memory leak in _tkinter.c/Tkapp_SplitList()

Also fix a memory leak in Tkapp_Split.
2003-05-29 18:58:23 +00:00
Tim Peters
4ab4393526 Squash new compiler wng (mistmatching formal/actual pointer types). 2003-05-22 18:45:47 +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
Jeremy Hylton
d8136b500a Backport fixes to make more types collectable.
classmethod, staticmethod, cPickle.Pickler, cPickle.UNpickler
2003-05-09 18:29:21 +00:00
Tim Peters
c18cc56c21 fsync(): Implemented for Windows, via calling MS _commit. This counts
as "a bug" because there's no other way in core Python to ensure that
bytes written are actually on disk.  At least ZODB wants this guarantee,
for robustness against crashes.
2003-04-23 20:14:12 +00:00
Fred Drake
d065a13a96 Backport reference leak fix from HEAD revision 1.79. 2003-04-09 18:19:24 +00:00
Tim Peters
8998a81937 Fixed the gc-vs-__del__ bugs for new-style classes. That's it for this one. 2003-04-08 20:33:05 +00:00
Tim Peters
539afe0d84 More backporting of gc-vs-__del__ fixes. It should be fixed for instances
of classic classes now.  Alas, new-style classes are still a problem, and
didn't need to be fixed in 2.3 (they were already immune in 2.3 due to the
new-in-2.3 tp_del slot).
2003-04-08 19:13:14 +00:00
Jeremy Hylton
f95350079c Fix memory corruption in garbage collection.
The move_finalizers() routine checks each object in the unreachable
list to see if it has a finalizer.  If it does, it is moved to the
finalizers list.  The collector checks by calling, effectively,
hasattr(obj, "__del__").  The hasattr() call can result in an
arbitrary amount of Python code being run, because it will invoke
getattr hooks on obj.

If a getattr() hook is run from move_finalizers(), it may end up
resurrecting or deallocating objects in the unreachable list.  In
fact, it's possible that the hook causes the next object in the list
to be deallocated.  That is, the object pointed to by gc->gc.gc_next
may be freed before has_finalizer() returns.

The problem with the previous revision is that it followed
gc->gc.gc_next before calling has_finalizer().  If has_finalizer()
gc->happened to deallocate the object FROM_GC(gc->gc.gc_next), then
the next time through the loop gc would point to freed memory.  The
fix is to always follow the next pointer after calling
has_finalizer().

Note that Python 2.3 does not have this problem, because
has_finalizer() checks the tp_del slot and never runs Python code.

Tim, Barry, and I peed away the better part of two days tracking this
down.
2003-04-03 23:02:29 +00:00
Martin v. Löwis
fa8b672c2a Patch #695250: Suppress COPYRIGHT if site.py is not read. Fixes #672614. 2003-03-30 17:00:58 +00:00
Neal Norwitz
80288f4f85 Backport Patch 659834 checked in by GvR on 2002/12/30 16:25:38
Check for readline 2.2 features.  This should make it possible to
compile readline.c again with GNU readline versions 2.0 or 2.1; this
ability was removed in readline.c rev. 2.49.  Apparently the older
versions are still in widespread deployment on older Solaris
installations.  With an older readline, completion behavior is subtly
different (a space is always added).
2003-03-29 22:25:18 +00:00
Tim Peters
58d23ae9a9 SF bug 705836: struct.pack of floats in non-native endian order
pack_float, pack_double, save_float:  All the routines for creating
IEEE-format packed representations of floats and doubles simply ignored
that rounding can (in rare cases) propagate out of a long string of
1 bits.  At worst, the end-off carry can (by mistake) interfere with
the exponent value, and then unpacking yields a result wrong by a factor
of 2.  In less severe cases, it can end up losing more low-order bits
than intended, or fail to catch overflow *caused* by rounding.
2003-03-20 18:31:20 +00:00
Thomas Wouters
c5f77780f0 binascii_a2b_base64: Properly return an empty string if the input was all
invalid, rather than returning a string of random garbage of the
    estimated result length. Closes SF patch #703471 by Hye-Shik Chang.

Backport from 2.3.
2003-03-17 11:34:43 +00:00
Fred Drake
2c3d827248 Backport patch from revision 2.80:
Fix memory leak: free memory storing the content model passed to the
ElementDeclHandler by Expat.
Fixes SF bug #676990.
2003-03-06 16:27:58 +00:00
Neal Norwitz
5eb8227235 get_completer() takes no args 2003-03-01 15:19:49 +00:00
Guido van Rossum
e0cf01371f - Backported SF patch #676342: after using pdb, the readline command
completion was botched.
2003-03-01 02:14:53 +00:00
Neal Norwitz
9aa5027699 Backport: Add more missing PyErr_NoMemory() after failled memory allocs 2003-02-11 23:19:35 +00:00
Tim Peters
ea57ec8169 SF bug 684667: Modules/selectmodule.c returns NULL without exception set.
Backport of fix from head.
2003-02-11 18:05:44 +00:00
Neal Norwitz
c31c0dfba3 Partial backport for changes to fix SF bug #678518 (assert & global). 2003-02-10 01:57:51 +00:00
Neal Norwitz
909be5a7f4 SF patch #682514, mmapmodule.c write fix for LP64 executables
Make length an int so we get the right value from
PyArg_ParseTuple(args, "s#", &str, &length)
2003-02-07 19:46:44 +00:00