diff --git a/docs/changelog/bugfix.2269.rst b/docs/changelog/bugfix.2269.rst new file mode 100644 index 000000000..fdedc778a --- /dev/null +++ b/docs/changelog/bugfix.2269.rst @@ -0,0 +1,2 @@ +Fix ``AttributeError: 'bool' object has no attribute 'error'`` when creating a +Python 2.x virtualenv on macOS - by ``moreati`` diff --git a/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py b/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py index 4f7f646c5..812ec589c 100644 --- a/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py +++ b/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py @@ -70,7 +70,9 @@ def image_ref(cls, interpreter): class CPython2macOsFramework(CPythonmacOsFramework, CPython2PosixBase): @classmethod def can_create(cls, interpreter): - return not IS_MAC_ARM64 and super(CPython2macOsFramework, cls).can_describe(interpreter) + if not IS_MAC_ARM64 and super(CPython2macOsFramework, cls).can_describe(interpreter): + return super(CPython2macOsFramework, cls).can_create(interpreter) + return False @classmethod def image_ref(cls, interpreter): @@ -111,7 +113,9 @@ def reload_code(self): class CPython2macOsArmFramework(CPython2macOsFramework, CPythonmacOsFramework, CPython2PosixBase): @classmethod def can_create(cls, interpreter): - return IS_MAC_ARM64 and super(CPythonmacOsFramework, cls).can_describe(interpreter) + if IS_MAC_ARM64 and super(CPythonmacOsFramework, cls).can_describe(interpreter): + return super(CPythonmacOsFramework, cls).can_create(interpreter) + return False def create(self): super(CPython2macOsFramework, self).create()