Skip to content

Commit 82a0efc

Browse files
committed
mitogen: Allow line comments in first stage, strip them.
1 parent abb77e7 commit 82a0efc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mitogen/parent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,8 +1463,9 @@ def get_python_argv(self):
14631463
return [self.options.python_path]
14641464

14651465
def get_boot_command(self):
1466-
source = inspect.getsource(self._first_stage)
1467-
source = textwrap.dedent('\n'.join(source.strip().split('\n')[2:]))
1466+
lines = inspect.getsourcelines(self._first_stage)[0][2:]
1467+
# Remove line comments, leading indentation, trailing newline
1468+
source = textwrap.dedent(''.join(s for s in lines if '#' not in s))[:-1]
14681469
source = source.replace(' ', ' ')
14691470
compressor = zlib.compressobj(
14701471
zlib.Z_BEST_COMPRESSION, zlib.DEFLATED, -zlib.MAX_WBITS,

0 commit comments

Comments
 (0)