From 8f175bf7a8b078fb55163d5f35773ae3f94931bc Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 1 Apr 2018 11:27:51 +0100 Subject: [PATCH] issue #106: _unpickle_context() did not allow nameless contexts. These are generated by any child calling .context_by_id() without previously knowing the context's name, such as Contexts set in ExternalContext.master and ExternalContext.parent. --- mitogen/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index 60971c61..d60fbafc 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -957,8 +957,10 @@ class Context(object): def _unpickle_context(router, context_id, name): if not (isinstance(router, Router) and - isinstance(context_id, (int, long)) and context_id >= 0 and - isinstance(name, basestring) and len(name) < 100): + isinstance(context_id, (int, long)) and context_id >= 0 and ( + (name is None) or + (isinstance(name, basestring) and len(name) < 100)) + ): raise TypeError('cannot unpickle Context: bad input') return router.context_class(router, context_id, name)