Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
3d0e8c36
Commit
3d0e8c36
authored
Oct 16, 2017
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue #49: 2.x/3.x compatible decode.
Much uglier command line, but it works across major Python releases.
parent
038ab049
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
mitogen/master.py
mitogen/master.py
+10
-2
No files found.
mitogen/master.py
View file @
3d0e8c36
...
...
@@ -728,8 +728,16 @@ class Stream(mitogen.core.Stream):
source
=
source
.
replace
(
' '
,
'
\
t
'
)
source
=
source
.
replace
(
'CONTEXT_NAME'
,
self
.
remote_name
)
encoded
=
source
.
encode
(
'zlib'
).
encode
(
'base64'
).
replace
(
'
\
n
'
,
''
)
return
[
self
.
python_path
,
'-c'
,
'exec("%s".decode("base64").decode("zlib"))'
%
(
encoded
,)]
# We can't use bytes.decode() in 3.x since it was restricted to always
# return unicode, so codecs.decode() is used instead. In 3.x
# codecs.decode() requires a bytes object. Since we must be compatible
# with 2.4 (no bytes literal), an extra .encode() either returns the
# same str (2.x) or an equivalent bytes (3.x).
return
[
self
.
python_path
,
'-c'
,
'from codecs import decode as _;'
'exec(_(_("%s".encode(),"base64"),"zlib"))'
%
(
encoded
,)
]
def
get_preamble
(
self
):
parent_ids
=
mitogen
.
parent_ids
[:]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment