[Zope3-checkins] CVS: Zope3/src/zope - __init__.py:1.3
Fred L. Drake, Jr.
fred at zope.com
Fri Feb 20 11:56:46 EST 2004
Update of /cvs-repository/Zope3/src/zope
In directory cvs.zope.org:/tmp/cvs-serv22389/src/zope
Modified Files:
__init__.py
Log Message:
add monkey-patch to work around a weakref bug in Python 2.3.3 (fixed
in 2.3.4)
=== Zope3/src/zope/__init__.py 1.2 => 1.3 ===
--- Zope3/src/zope/__init__.py:1.2 Wed Dec 25 09:12:24 2002
+++ Zope3/src/zope/__init__.py Fri Feb 20 11:56:45 2004
@@ -1,2 +1,22 @@
#
# This file is necessary to make this directory a package.
+
+# XXX Evil monkey patch of weakref to avoid a Python 2.3.3 weakref bug that
+# causes sporadic segfaults
+
+def monkey_patch():
+ import weakref
+ import gc
+ ref = weakref.ref
+ disable = gc.disable
+ enable = gc.enable
+ def monkey_ref(*args, **kw):
+ disable()
+ r = ref(*args, **kw)
+ enable()
+ return r
+
+ weakref.ref = monkey_ref
+
+monkey_patch()
+del monkey_patch
More information about the Zope3-Checkins
mailing list