[Zodb-checkins] CVS: ZODB3/ZEO/zrpc - marshal.py:1.8

Guido van Rossum guido@python.org
Sat, 28 Sep 2002 21:25:53 -0400


Update of /cvs-repository/ZODB3/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv15564

Modified Files:
	marshal.py 
Log Message:
I ran a test, and sharing a pickler, even a fast one, between threads,
is *not* thread-safe.  So don't share the Pickler.


=== ZODB3/ZEO/zrpc/marshal.py 1.7 => 1.8 ===
--- ZODB3/ZEO/zrpc/marshal.py:1.7	Wed Sep 25 18:30:23 2002
+++ ZODB3/ZEO/zrpc/marshal.py	Sat Sep 28 21:25:53 2002
@@ -23,16 +23,11 @@
 class Marshaller:
     """Marshal requests and replies to second across network"""
 
-    # It's okay to share a single Pickler as long as it's in fast
-    # mode, which means that it doesn't have a memo.
-
-    pickler = cPickle.Pickler()
-    pickler.fast = 1
-    pickle = pickler.dump
-
     def encode(self, msgid, flags, name, args):
         """Returns an encoded message"""
-        return self.pickle((msgid, flags, name, args), 1)
+        pickler = cPickle.Pickler()
+        pickler.fast = 1
+        return pickler.dump((msgid, flags, name, args), 1)
 
     def decode(self, msg):
         """Decodes msg and returns its parts"""