issue #426: tighten up PushFileService types.

Bytes/Unicode mixing caused a hang, so prevent bytes entirely.
issue510
David Wilson 6 years ago
parent 8fa3c74de4
commit 04755c3321

@ -172,7 +172,7 @@ class BinaryPlanner(Planner):
return module_common._is_binary(self._inv.module_source)
def get_push_files(self):
return [self._inv.module_path]
return [mitogen.core.to_text(self._inv.module_path)]
def get_kwargs(self, **kwargs):
return super(BinaryPlanner, self).get_kwargs(
@ -285,7 +285,7 @@ class NewStylePlanner(ScriptPlanner):
def get_push_files(self):
return super(NewStylePlanner, self).get_push_files() + [
path
mitogen.core.to_text(path)
for fullname, path, is_pkg in self.get_module_map()['custom']
]

@ -492,14 +492,16 @@ class ModuleDepService(mitogen.service.Service):
def _get_builtin_names(self, builtin_path, resolved):
return [
fullname
mitogen.core.to_text(fullname)
for fullname, path, is_pkg in resolved
if os.path.abspath(path).startswith(builtin_path)
]
def _get_custom_tups(self, builtin_path, resolved):
return [
(fullname, path, is_pkg)
(mitogen.core.to_text(fullname),
mitogen.core.to_text(path),
is_pkg)
for fullname, path, is_pkg in resolved
if not os.path.abspath(path).startswith(builtin_path)
]

@ -594,6 +594,7 @@ class PushFileService(Service):
self._sent_by_stream = {}
def get(self, path):
assert isinstance(path, mitogen.core.UnicodeType)
self._lock.acquire()
try:
if path in self._cache:
@ -670,7 +671,7 @@ class PushFileService(Service):
@expose(policy=AllowParents())
@no_reply()
@arg_spec({
'path': mitogen.core.FsPathTypes,
'path': mitogen.core.UnicodeType,
'data': mitogen.core.Blob,
'context': mitogen.core.Context,
})

Loading…
Cancel
Save