classification
Title: Windows multiprocessing doesn't propagate tabcheck to children
Type: Stage:
Components: Library (Lib), Windows Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: jwilk, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2018-05-17 15:38 by jwilk, last changed 2018-05-17 15:38 by jwilk.

Files
File name Uploaded Description Edit
test-tabcheck.py jwilk, 2018-05-17 15:38
Messages (1)
msg316949 - (view) Author: Jakub Wilk (jwilk) Date: 2018-05-17 15:38
Multiprocessing on Windows is supposed to start child processes using
the same sys.flags as the current process (see issue 12098).
However, at least sys.flags.tabcheck is not propagated.

I've attached small test program that reproduces this bug.
On Linux, as expected, it fails with TabError if you use -tt:

  $ python -tt test-tabcheck.py 
  Process Process-1:
  Traceback (most recent call last):
    File "/usr/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
      self.run()
    File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
      self._target(*self._args, **self._kwargs)
    File "test-tabcheck.py", line 6, in test_ast_parse
      ast.parse('if 1:\n\t1\n' + '\x20' * 8 +'1')
    File "/usr/lib/python2.7/ast.py", line 37, in parse
      return compile(source, filename, mode, PyCF_ONLY_AST)
    File "<unknown>", line 3
      1
      ^
  TabError: inconsistent use of tabs and spaces in indentation

But it doesn't on Windows:

  >python -tt test-tabcheck.py
  Process Process-1:
  Traceback (most recent call last):
    File "C:\Python27\lib\multiprocessing\process.py", line 267, in _bootstrap
      self.run()
    File "C:\Python27\lib\multiprocessing\process.py", line 114, in run
      self._target(*self._args, **self._kwargs)
    File "...\test-tabcheck.py", line 7, in test_ast_parse
      assert sys.flags.tabcheck == expected_tabcheck, 'sys.flags.tabcheck == {0} != {1}'.format(sys.flags.tabcheck, expected_tabcheck)
  AssertionError: sys.flags.tabcheck == 0 != 2

This was tested with Python 2.7.15.
History
Date User Action Args
2018-05-17 15:38:07jwilkcreate