File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1681,15 +1681,24 @@ def get_file_results(self):
16811681 'row' : self .line_offset + line_number , 'col' : offset + 1 ,
16821682 'code' : code , 'text' : text ,
16831683 })
1684+ # stdout is block buffered when not stdout.isatty().
1685+ # When using pep8 in multiprocess, line can be broken where
1686+ # buffer boundary since other processes write to same file.
1687+ # So flush() after print() to avoid buffer boundary.
1688+ # Typical buffer size is 8192. line written safely when
1689+ # len(line) < 8192.
1690+ sys .stdout .flush ()
16841691 if self ._show_source :
16851692 if line_number > len (self .lines ):
16861693 line = ''
16871694 else :
16881695 line = self .lines [line_number - 1 ]
16891696 print (line .rstrip ())
16901697 print (re .sub (r'\S' , ' ' , line [:offset ]) + '^' )
1698+ sys .stdout .flush ()
16911699 if self ._show_pep8 and doc :
16921700 print (' ' + doc .strip ())
1701+ sys .stdout .flush ()
16931702 return self .file_errors
16941703
16951704
You can’t perform that action at this time.
0 commit comments