This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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

Created on 2018-05-17 15:38 by jwilk, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test-tabcheck.py jwilk, 2018-05-17 15:38
Messages (2)
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.
msg379639 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-10-26 04:52
Python 2.7 became EOL.
History
Date User Action Args
2022-04-11 14:59:00adminsetgithub: 77738
2020-10-26 04:52:42methanesetstatus: open -> closed

nosy: + methane
messages: + msg379639

resolution: out of date
stage: resolved
2018-05-17 15:38:07jwilkcreate