From bce3bab3e866229778e975ba0539111a9f2362af Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Sat, 16 Jan 2021 13:24:37 +0000 Subject: [PATCH] Add the msvcrt moduleto the default module deny list Commit https://github.com/python/cpython/commit/880d42a3b247 (first released in Python 3.8a0) moved an import of msvcrt from an if block, into a try/except block. So now the import is tried even on Linux or MacOS. https://docs.python.org/3/library/msvcrt.html is a Windows specific builtin. --- docs/changelog.rst | 1 + mitogen/core.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 48fbb083..99c30798 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -41,6 +41,7 @@ v0.2.10 (unreleased) * :gh:issue:`758` fix initilialisation of callback plugins in test suite, to address a `KeyError` in :method:`ansible.plugins.callback.CallbackBase.v2_runner_on_start` * :gh:issue:`775` Test with Python 3.9 +* :gh:issue:`775` Add msvcrt to the default module deny list v0.2.9 (2019-11-02) diff --git a/mitogen/core.py b/mitogen/core.py index 4dcc3d77..9a00ce65 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -1270,6 +1270,10 @@ class Importer(object): 'builtins', '__builtin__', + # On some Python releases (e.g. 3.8, 3.9) the subprocess module tries + # to import of this Windows-only builtin module. + 'msvcrt', + # Python 2.x module that was renamed to _thread in 3.x. # This entry avoids a roundtrip on 2.x -> 3.x. 'thread',