Skip to content

Commit 50c5591

Browse files
authored
fix: AttributeError on macOS creating a Python 2.x virtualenv (#2270)
1 parent 319a540 commit 50c5591

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

docs/changelog/bugfix.2269.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix ``AttributeError: 'bool' object has no attribute 'error'`` when creating a
2+
Python 2.x virtualenv on macOS - by ``moreati``

src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ def image_ref(cls, interpreter):
7070
class CPython2macOsFramework(CPythonmacOsFramework, CPython2PosixBase):
7171
@classmethod
7272
def can_create(cls, interpreter):
73-
return not IS_MAC_ARM64 and super(CPython2macOsFramework, cls).can_describe(interpreter)
73+
if not IS_MAC_ARM64 and super(CPython2macOsFramework, cls).can_describe(interpreter):
74+
return super(CPython2macOsFramework, cls).can_create(interpreter)
75+
return False
7476

7577
@classmethod
7678
def image_ref(cls, interpreter):
@@ -111,7 +113,9 @@ def reload_code(self):
111113
class CPython2macOsArmFramework(CPython2macOsFramework, CPythonmacOsFramework, CPython2PosixBase):
112114
@classmethod
113115
def can_create(cls, interpreter):
114-
return IS_MAC_ARM64 and super(CPythonmacOsFramework, cls).can_describe(interpreter)
116+
if IS_MAC_ARM64 and super(CPythonmacOsFramework, cls).can_describe(interpreter):
117+
return super(CPythonmacOsFramework, cls).can_create(interpreter)
118+
return False
115119

116120
def create(self):
117121
super(CPython2macOsFramework, self).create()

0 commit comments

Comments
 (0)