Skip to content

Commit 2a825de

Browse files
committed
fix deserialization error
1 parent 8d5ae3e commit 2a825de

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

Pyro5/serializers.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,10 @@ def dict_to_class(cls, data):
190190
if "__" in classname:
191191
raise errors.SecurityError("refused to deserialize types with double underscores in their name: " + classname)
192192
# for performance, the constructors below are hardcoded here instead of added on a per-class basis to the dict-to-class registry
193-
if classname.startswith("Pyro5.core."):
194-
if classname == "Pyro5.core.URI":
195-
uri = core.URI.__new__(core.URI)
196-
uri.__setstate_from_dict__(data["state"])
197-
return uri
193+
if classname == "Pyro5.core.URI":
194+
uri = core.URI.__new__(core.URI)
195+
uri.__setstate_from_dict__(data["state"])
196+
return uri
198197
elif classname == "Pyro5.client.Proxy":
199198
proxy = client.Proxy.__new__(client.Proxy)
200199
proxy.__setstate_from_dict__(data["state"])

examples/autoproxy/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
print(repr(thing1))
1414

1515
# interact with them on the server.
16-
print("Speaking stuff.")
16+
print("Speaking stuff (see output on server).")
1717
thing1.speak("I am the first")
1818
thing2.speak("I am second")
1919
thing3.speak("I am last then...")

examples/batchedcalls/client.py

-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,5 @@
8080
# this will raise the proper zerodivision exception once we're about
8181
# to process the batch result from the divide by 0 call.
8282
except ZeroDivisionError:
83-
# @todo FIX THIS a serialization error is thrown rather than the divide by zero error we expect... unsupported serialized class: Pyro5.core._ExceptionWrapper
8483
print("A divide by zero error occurred during the batch! (expected)")
8584
print("".join(get_pyro_traceback()))

performance4.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import timeit
2-
import uuid
3-
import Pyro4
4-
import Pyro4.core
2+
import Pyro4.naming
53

64

7-
# Pyro4.core.current_context.correlation_id = uuid.uuid1()
5+
Pyro4.config.SERIALIZER = 'marshal'
6+
87

98
num_iterations = 3000
109
num_tries = 10
1110

12-
ns = Pyro4.locateNS()
11+
ns = Pyro4.naming.locateNS()
1312
ns._pyroBind()
1413

1514

1615
def test():
17-
ns.list("Pyro.NameServer", return_metadata=True)
16+
ns.list("Pyro.NameServer", return_metadata=False)
1817

1918

2019
print("running %d tries..." % num_tries)

performance5.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import timeit
2-
import uuid
32
import Pyro5.api
4-
import Pyro5.core
3+
import Pyro5.config
54

65

7-
# Pyro5.core.current_context.correlation_id = uuid.uuid1()
6+
Pyro5.config.SERIALIZER = 'marshal'
7+
88

99
num_iterations = 3000
1010
num_tries = 10
@@ -14,7 +14,7 @@
1414

1515

1616
def test():
17-
ns.list("Pyro.NameServer", return_metadata=True)
17+
ns.list("Pyro.NameServer", return_metadata=False)
1818

1919

2020
print("running %d tries..." % num_tries)

0 commit comments

Comments
 (0)