New submission from Jakub Wilk <jw...@jwilk.net>:

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.

----------
components: Library (Lib), Windows
files: test-tabcheck.py
messages: 316949
nosy: jwilk, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Windows multiprocessing doesn't propagate tabcheck to children
versions: Python 2.7
Added file: https://bugs.python.org/file47598/test-tabcheck.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33557>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to