summaryrefslogtreecommitdiffstats
path: root/Objects/weakrefobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Untabify C files. Will watch buildbots.Antoine Pitrou2010-05-091-55/+55
|
* #5037 proxy __unicode__ correctlyBenjamin Peterson2009-11-191-0/+17
|
* Fix #3634 invalid return value from _weakref.ref(Exception).__init__Benjamin Peterson2008-09-091-1/+1
| | | | Reviewers: Amaury, Antoine, Benjamin
* Issue 3110: Crash with weakref subclass,Amaury Forgeot d'Arc2008-06-161-4/+12
| | | | | | | | | seen after a "import multiprocessing.reduction" An instance of a weakref subclass can have attributes. If such a weakref holds the only strong reference to the object, deleting the weakref will delete the object. In this case, the callback must not be called, because the ref object is being deleted!
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-4/+4
| | | | | | | http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-4/+4
|
* #2592: delegate nb_index and the floor/truediv slots in weakref.proxy.Georg Brandl2008-05-201-0/+10
|
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-12/+12
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-18/+15
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Fix crasher for when an object's __del__ creates a new weakref to itself.Brett Cannon2007-01-231-0/+3
| | | | | | Patch only fixes new-style classes; classic classes still buggy. Closes bug #1377858. Already backported.
* _PyWeakref_GetWeakrefCount() now returns a Py_ssize_t instead of long.Neal Norwitz2006-08-021-2/+2
|
* Replace PyObject_CallFunction calls with only object argsGeorg Brandl2006-05-251-1/+1
| | | | with PyObject_CallFunctionObjArgs, which is 30% faster.
* Use Py_VISIT in all tp_traverse methods, instead of traversing manually orThomas Wouters2006-04-151-2/+1
| | | | | | | | using a custom, nearly-identical macro. This probably changes how some of these functions are compiled, which may result in fractionally slower (or faster) execution. Considering the nature of traversal, visiting much of the address space in unpredictable patterns, I'd argue the code readability and maintainability is well worth it ;P
* Remove unnecessary casts in type object initializers.Georg Brandl2006-03-301-44/+44
|
* SF #1444030: Fix several potential defects found by Coverity.Hye-Shik Chang2006-03-071-1/+8
| | | | (reviewed by Neal Norwitz)
* Revert backwards-incompatible const changes.Martin v. Löwis2006-02-271-2/+2
|
* Merge ssize_t branch.Martin v. Löwis2006-02-151-9/+9
|
* Remove some shadowed variablesNeal Norwitz2006-01-081-2/+2
|
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-1/+1
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* SF bug #1770766: weakref proxy has incorrect __nonzero__ behavior.Raymond Hettinger2005-03-271-5/+1
|
* SF 1055820: weakref callback vs gc vs threadsTim Peters2004-10-301-1/+3
| | | | | | | | In cyclic gc, clear weakrefs to unreachable objects before allowing any Python code (weakref callbacks or __del__ methods) to run. This is a critical bugfix, affecting all versions of Python since weakrefs were introduced. I'll backport to 2.3.
* Be more careful about maintaining the invariants; it was actuallyFred Drake2004-08-031-3/+25
| | | | | possible that the callback-less flavors of the ref or proxy could have been added during GC, so we don't want to replace them.
* SF bug #978308, Spurious errors taking bool of dead proNeal Norwitz2004-07-081-1/+1
| | | | | | Need to return -1 on error. Needs backport.
* Make weak references subclassable:Fred Drake2004-07-021-68/+180
| | | | | | | | | | | | | | | | | | | | | | - weakref.ref and weakref.ReferenceType will become aliases for each other - weakref.ref will be a modern, new-style class with proper __new__ and __init__ methods - weakref.WeakValueDictionary will have a lighter memory footprint, using a new weakref.ref subclass to associate the key with the value, allowing us to have only a single object of overhead for each dictionary entry (currently, there are 3 objects of overhead per entry: a weakref to the value, a weakref to the dictionary, and a function object used as a weakref callback; the weakref to the dictionary could be avoided without this change) - a new macro, PyWeakref_CheckRefExact(), will be added - PyWeakref_CheckRef() will check for subclasses of weakref.ref This closes SF patch #983019.
* Allocating a new weakref object can cause existing weakref objects forFred Drake2004-02-041-3/+16
| | | | | | | | | the same object to be collected by the cyclic GC support if they are only referenced by a cycle. If the weakref being collected was one of the weakrefs without callbacks, some local variables for the constructor became invalid and have to be re-computed. The test caused a segfault under a debug build without the fix applied.
* Fix bug in interpretation of the "callback" argument in the constructors forFred Drake2004-02-031-1/+5
| | | | | weakref ref and proxy objects; None was not being treated as identical to NULL, though it was documented as equivalent.
* SF bug 839548: Bug in type's GC handling causes segfaults.Tim Peters2003-11-201-4/+30
| | | | | | | | Also SF patch 843455. This is a critical bugfix. I'll backport to 2.3 maint, but not beyond that. The bugs this fixes have been there since weakrefs were introduced.
* Remove proxy_print(), since that caused an inconsistency betweenFred Drake2003-07-141-10/+2
| | | | | "print repr(proxy(a))" and "proxy(a)" at an interactive prompt. Closes SF bug #722763.
* Fix SF 762891: "del p[key]" on proxy object raises SystemError()Raymond Hettinger2003-06-301-1/+5
|
* - The repr() of a weakref object now shows the __name__ attribute ofGuido van Rossum2003-04-161-6/+15
| | | | | | | 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.
* Add support for the iterator protocol to weakref proxy objects.Fred Drake2002-08-091-38/+64
| | | | Part of fixing SF bug #591704.
* Remove weakref free list. This has the side effect of fixing a memoryNeil Schemenauer2002-03-271-26/+11
| | | | | management bug. Also, move some duplicated code into the new_weakref fucntion.
* proxy_compare(): Make sure that we unwrap both objects being compared ifFred Drake2001-12-191-6/+13
| | | | both are proxy objects.
* Make sure that when we invoke callback functions associated with weakFred Drake2001-12-101-20/+24
| | | | | | references, we do not allow any outstanding exceptions "leak" into the callback's execution state. This closes SF bug #478534.
* weakref_repr(), proxy_repr(): Conversion of sprintf() toBarry Warsaw2001-11-281-8/+11
| | | | PyOS_snprintf() for buffer overrun avoidance.
* Fixes for possible buffer overflows in sprintf() usages.Marc-André Lemburg2001-11-281-1/+1
|
* Referencable is not a word, so don't use it in an error message <wink>.Jeremy Hylton2001-10-221-2/+2
|
* Remove an unnecessary check for NULL.Fred Drake2001-10-181-4/+3
|
* When weakref proxies are involved in binary & ternary slot operations,Fred Drake2001-10-181-15/+28
| | | | | | | | | | | 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.
* The weak reference implementation, separated from the weakref module.Fred Drake2001-10-051-0/+715