Skip to content

Commit

Permalink
fix: AttributeError on macOS creating a Python 2.x virtualenv
Browse files Browse the repository at this point in the history
Fixes pypa#2269

> AttributeError: 'bool' object has no attribute 'error'

when creating a Python 2.x environment on macOS with virtualenv 20.12.0.

Refs pypa#2233
  • Loading branch information
moreati committed Jan 1, 2022
1 parent 51408e6 commit c3c8e80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/changelog/bugfix.2269.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix ``AttributeError: 'bool' object has no attribute 'error'`` when creating a
Python 2.x virtualenv on macOS - by ``moreati``
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit c3c8e80

Please sign in to comment.