61 Commits

Author SHA1 Message Date
Guido van Rossum
c1f6e8cbc1 - The repr() of a weakref object now shows the __name__ attribute of
the referenced object, if it has one.

Also use %p to format pointers consistently, and use <weakproxy ...>
in proxy_repr(), to match the type name.
2003-04-16 21:13:23 +00:00
Fred Drake
f16c3dc81b Add support for the iterator protocol to weakref proxy objects.
Part of fixing SF bug #591704.
2002-08-09 18:34:16 +00:00
Neil Schemenauer
38a8916134 Remove weakref free list. This has the side effect of fixing a memory
management bug.  Also, move some duplicated code into the new_weakref
fucntion.
2002-03-27 15:18:21 +00:00
Fred Drake
2a908f6b7b proxy_compare(): Make sure that we unwrap both objects being compared if
both are proxy objects.
2001-12-19 16:44:30 +00:00
Fred Drake
ef8ebd1e74 Make sure that when we invoke callback functions associated with weak
references, we do not allow any outstanding exceptions "leak" into the
callback's execution state.
This closes SF bug #478534.
2001-12-10 23:44:54 +00:00
Barry Warsaw
d586756dc5 weakref_repr(), proxy_repr(): Conversion of sprintf() to
PyOS_snprintf() for buffer overrun avoidance.
2001-11-28 21:01:56 +00:00
Marc-André Lemburg
d4c0a9c59b Fixes for possible buffer overflows in sprintf() usages. 2001-11-28 11:47:00 +00:00
Jeremy Hylton
996fad315c Referencable is not a word, so don't use it in an error message <wink>. 2001-10-22 16:31:40 +00:00
Fred Drake
31f4d1fa4b Remove an unnecessary check for NULL. 2001-10-18 19:21:46 +00:00
Fred Drake
73006d0237 When weakref proxies are involved in binary & ternary slot operations,
the left-hand operand may not be the proxy in all cases.  If it isn't,
we end up doing two things: a) unwrapping something that isn't a
PyWeakReference (later resulting in a core dump) and b) passing a
proxy as the right-hand operand anyway, even though that can't be
handled by the actual handler (maybe eventually causing a core dump).

This is fixed by always unwrapping all the proxies involved before
passing anything to the actual handler.
2001-10-18 18:04:18 +00:00
Fred Drake
8844d5264f The weak reference implementation, separated from the weakref module. 2001-10-05 21:52:26 +00:00