Implement Alex's awesome idea of zlibbing the first stage too! Closes #49

This commit is contained in:
David Wilson 2017-10-16 17:34:47 +05:30
parent 8dcfb1b7f7
commit db9bec8720
1 changed files with 2 additions and 2 deletions

View File

@ -727,9 +727,9 @@ class Stream(mitogen.core.Stream):
source = textwrap.dedent('\n'.join(source.strip().split('\n')[2:]))
source = source.replace(' ', '\t')
source = source.replace('CONTEXT_NAME', self.remote_name)
encoded = source.encode('base64').replace('\n', '')
encoded = source.encode('zlib').encode('base64').replace('\n', '')
return [self.python_path, '-c',
'exec("%s".decode("base64"))' % (encoded,)]
'exec("%s".decode("base64").decode("zlib"))' % (encoded,)]
def get_preamble(self):
parent_ids = mitogen.parent_ids[:]