From 6922f58ed3f13796414cde81fdaa46266b113cf7 Mon Sep 17 00:00:00 2001 From: schlamar Date: Wed, 1 Jun 2016 07:40:02 +0200 Subject: [PATCH] Enable multiprocessing on Windows on unaffected Python versions The upstream bug in Python is fixed in Python 2.7.11+ and Python 3.2+ --- flake8/reporter.py | 4 ++-- flake8/util.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/flake8/reporter.py b/flake8/reporter.py index 1df3d9e..95d4eb7 100644 --- a/flake8/reporter.py +++ b/flake8/reporter.py @@ -59,8 +59,8 @@ class BaseQReport(pep8.BaseReport): def _process_main(self): if not self._loaded: # Windows needs to parse again the configuration - from flake8.main import get_style_guide, DEFAULT_CONFIG - get_style_guide(parse_argv=True, config_file=DEFAULT_CONFIG) + from flake8.main import get_style_guide + get_style_guide(parse_argv=True) for filename in iter(self.task_queue.get, 'DONE'): self.input_file(filename) diff --git a/flake8/util.py b/flake8/util.py index 4e2c0d3..2751f6b 100644 --- a/flake8/util.py +++ b/flake8/util.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import os +import sys try: import ast @@ -54,7 +55,10 @@ def warn_when_using_jobs(options): def force_disable_jobs(styleguide): - return is_windows() or is_using_stdin(styleguide.paths) + affected_mp_version = (sys.version_info <= (2, 7, 11) or + (3, 0) <= sys.version_info < (3, 2)) + return (is_windows() and affected_mp_version or + is_using_stdin(styleguide.paths)) INT_TYPES = ('int', 'count')