diff options
author | Hye-Shik Chang <perky@FreeBSD.org> | 2004-02-09 09:54:07 +0000 |
---|---|---|
committer | Hye-Shik Chang <perky@FreeBSD.org> | 2004-02-09 09:54:07 +0000 |
commit | d3a457db41524eef0d8bc9b8d54445b7b1163433 (patch) | |
tree | 11b78305919b6a74f7e60603763cf8515c613c01 /lang/python/files/patch-Objects::weakrefobject.c | |
parent | Update to 0.83.2 release. (diff) |
- Use process scope threads instead of system scope to enable large
amount of threads on -CURRENT libpthread by default. [1]
- Merge bugfixes from python 2.3 maintenance branch: [2]
o weakref object's garbage collection problem.
o save unnecessary startup-time memory allocation of 100KB+ from
intobject.
- SIZEify.
- Bump PORTREVISION subsequently.
Advised by: eischen, julian [1]
Obtained from: Python CVS [2]
Notes
Notes:
svn path=/head/; revision=100480
Diffstat (limited to 'lang/python/files/patch-Objects::weakrefobject.c')
-rw-r--r-- | lang/python/files/patch-Objects::weakrefobject.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/lang/python/files/patch-Objects::weakrefobject.c b/lang/python/files/patch-Objects::weakrefobject.c new file mode 100644 index 000000000000..13789fbde97f --- /dev/null +++ b/lang/python/files/patch-Objects::weakrefobject.c @@ -0,0 +1,65 @@ +diff -u python/dist/src/Objects/weakrefobject.c:1.13.6.1 python/dist/src/Objects/weakrefobject.c:1.13.6.3 +--- Objects/weakrefobject.c:1.13.6.1 Thu Nov 20 14:13:51 2003 ++++ Objects/weakrefobject.c Wed Feb 4 15:13:43 2004 +@@ -624,20 +624,29 @@ + } + list = GET_WEAKREFS_LISTPTR(ob); + get_basic_refs(*list, &ref, &proxy); +- if (callback == NULL || callback == Py_None) ++ if (callback == Py_None) ++ callback = NULL; ++ if (callback == NULL) + /* return existing weak reference if it exists */ + result = ref; + if (result != NULL) +- Py_XINCREF(result); ++ Py_INCREF(result); + else { ++ /* Note: new_weakref() can trigger cyclic GC, so the weakref ++ list on ob can be mutated. This means that the ref and ++ proxy pointers we got back earlier may have been collected, ++ so we need to compute these values again before we use ++ them. */ + result = new_weakref(ob, callback); + if (result != NULL) { + if (callback == NULL) { + insert_head(result, list); + } + else { +- PyWeakReference *prev = (proxy == NULL) ? ref : proxy; ++ PyWeakReference *prev; + ++ get_basic_refs(*list, &ref, &proxy); ++ prev = (proxy == NULL) ? ref : proxy; + if (prev == NULL) + insert_head(result, list); + else +@@ -664,12 +673,19 @@ + } + list = GET_WEAKREFS_LISTPTR(ob); + get_basic_refs(*list, &ref, &proxy); ++ if (callback == Py_None) ++ callback = NULL; + if (callback == NULL) + /* attempt to return an existing weak reference if it exists */ + result = proxy; + if (result != NULL) +- Py_XINCREF(result); ++ Py_INCREF(result); + else { ++ /* Note: new_weakref() can trigger cyclic GC, so the weakref ++ list on ob can be mutated. This means that the ref and ++ proxy pointers we got back earlier may have been collected, ++ so we need to compute these values again before we use ++ them. */ + result = new_weakref(ob, callback); + if (result != NULL) { + PyWeakReference *prev; +@@ -678,6 +694,7 @@ + result->ob_type = &_PyWeakref_CallableProxyType; + else + result->ob_type = &_PyWeakref_ProxyType; ++ get_basic_refs(*list, &ref, &proxy); + if (callback == NULL) + prev = ref; + else |