Skip to content

Commit

Permalink
sage.doctest: multiprocessing import fixes for pyodide (fixup)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Nov 5, 2024
1 parent e6de27e commit ec91df5
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/sage/doctest/forker.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,12 @@
import multiprocessing
multiprocessing.set_start_method('fork', force=True)

from multiprocessing import Process

try:
import multiprocessing
from multiprocessing import Process
import _multiprocessing
except ImportError:
multiprocessing = None
class Process:
pass
_multiprocessing = None


def _sorted_dict_pprinter_factory(start, end):
Expand Down Expand Up @@ -1490,7 +1489,7 @@ def report_failure(self, out, test, example, got, globs):
except KeyboardInterrupt:
# Assume this is a *real* interrupt. We need to
# escalate this to the master doctesting process.
if not self.options.serial and multiprocessing:
if not self.options.serial and _multiprocessing:
os.kill(os.getppid(), signal.SIGINT)
raise
finally:
Expand Down Expand Up @@ -1634,7 +1633,7 @@ def report_unexpected_exception(self, out, test, example, exc_info):
except KeyboardInterrupt:
# Assume this is a *real* interrupt. We need to
# escalate this to the master doctesting process.
if not self.options.serial and multiprocessing:
if not self.options.serial and _multiprocessing:
os.kill(os.getppid(), signal.SIGINT)
raise
finally:
Expand Down Expand Up @@ -2139,7 +2138,7 @@ def dispatch(self):
sage -t .../sage/rings/big_oh.py
[... tests, ...s wall]
"""
if self.controller.options.serial or not multiprocessing:
if self.controller.options.serial or not _multiprocessing:
self.serial_dispatch()
else:
self.parallel_dispatch()
Expand Down

0 comments on commit ec91df5

Please sign in to comment.