[prev in list] [next in list] [prev in thread] [next in thread]
List: python-bugs-list
Subject: [issue6409] 2to3 generates malformed diffs
From: STINNER Victor <report () bugs ! python ! org>
Date: 2010-01-31 2:05:45
Message-ID: 1264903545.71.0.716613179618.issue6409 () psf ! upfronthosting ! co ! za
[Download RAW message or body]
STINNER Victor <victor.stinner@haypocalc.com> added the comment:
I'm able to reproduce the bug. The problem is that "-j 4" option creates 4 working \
processes, and they are all writing to stdout at the same time.
Main process: main() => refactor() => refactor_file() sends tasks to child processes
Children: _child() => queue.get ~> refactor_file() => processed_file() => \
print_output() writes the diff to stdout using print()
A solution would be to use a lock to ensure that only one process is writing to \
stdout at the same time... But we may loose all advantages of using different Python \
processes, it's a new kind of GIL :)
A better solution would be to send output (the whole diff for one file) to the main \
process which will be the only process writing the stdout. I don't know \
multiprocessing enough to propose a patch.
Note: flush() in each child process doesn't ensure that no process is writing to \
stdout at the same time.
----------
nosy: +haypo
_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue6409>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/python-bugs-list%40marc.info
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic