Skip to content

Commit

Permalink
Fix #6803: Disable parallel build on macOS and py38+
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Dec 1, 2019
1 parent 9d3f537 commit 6f529f0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Dependencies
Incompatible changes
--------------------

* #6803: For security reason of python, parallel mode is disabled on macOS and
Python3.8+

Deprecated
----------

Expand All @@ -19,6 +22,7 @@ Bugs fixed
* #6776: LaTeX: 2019-10-01 LaTeX release breaks :file:`sphinxcyrillic.sty`
* #6815: i18n: French, Hindi, Japanese and Korean translation messages has been
broken
* #6803: parallel build causes AttributeError on macOS and Python3.8

Testing
--------
Expand Down
7 changes: 7 additions & 0 deletions sphinx/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import os
import pickle
import platform
import sys
import warnings
from collections import deque
Expand Down Expand Up @@ -199,6 +200,12 @@ def __init__(self, srcdir, confdir, outdir, doctreedir, buildername,
# say hello to the world
logger.info(bold(__('Running Sphinx v%s') % sphinx.__display_version__))

# notice for parallel build on macOS and py38+
if sys.version_info > (3, 8) and platform.system() == 'Darwin' and parallel > 1:
logger.info(bold(__("For security reason, parallel mode is disabled on macOS and "
"python3.8 and above. For more details, please read "
"https://github.com/sphinx-doc/sphinx/issues/6803")))

# status code for command-line application
self.statuscode = 0

Expand Down
9 changes: 8 additions & 1 deletion sphinx/util/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"""

import os
import platform
import sys
import time
import traceback
from math import sqrt
Expand All @@ -26,7 +28,12 @@


# our parallel functionality only works for the forking Process
parallel_available = multiprocessing and (os.name == 'posix')
#
# Note: "fork" is not recommended on macOS and py38+.
# see https://bugs.python.org/issue33725
parallel_available = (multiprocessing and
(os.name == 'posix') and
not (sys.version_info > (3, 8) and platform.system() == 'Darwin'))


class SerialTasks:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_util_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import codecs
import os
import platform
import sys

import pytest
from docutils import nodes
Expand Down Expand Up @@ -276,6 +278,8 @@ def test_colored_logs(app, status, warning):


@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
@pytest.mark.xfail(platform.system() == 'Darwin' and sys.version_info > (3, 8),
reason="Not working on macOS and py38")
def test_logging_in_ParallelTasks(app, status, warning):
logging.setup(app, status, warning)
logger = logging.getLogger(__name__)
Expand Down

0 comments on commit 6f529f0

Please sign in to comment.