From 202ce0f641d16825f23e86b7cd931e6049cc9f26 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 17 Apr 2018 13:38:30 +0100 Subject: [PATCH] Prevent construction of unicode Message.data And fix one case of it in parent.py. --- mitogen/core.py | 1 + mitogen/parent.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mitogen/core.py b/mitogen/core.py index e369a48a..6bda7f84 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -314,6 +314,7 @@ class Message(object): self.src_id = mitogen.context_id self.auth_id = mitogen.context_id vars(self).update(kwargs) + assert isinstance(self.data, str) def _unpickle_context(self, context_id, name): return _unpickle_context(self.router, context_id, name) diff --git a/mitogen/parent.py b/mitogen/parent.py index 1b54cccc..03373bbc 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -675,7 +675,7 @@ class RouteMonitor(object): data = str(target_id) if name: - data = '%s:%s' % (target_id, name) + data = '%s:%s' % (target_id, mitogen.core.b(name)) self.parent.send( mitogen.core.Message( handle=handle,