Skip to content

Commit 696fb23

Browse files
committed
Backwards compatibility fix for 3.7 and earlier.
1 parent 296d856 commit 696fb23

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mock/mock.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2265,7 +2265,11 @@ def __init__(self, *args, **kwargs):
22652265
)
22662266
code_mock.co_argcount = 0
22672267
code_mock.co_varnames = ('args', 'kwargs')
2268-
code_mock.co_posonlyargcount = 0
2268+
try:
2269+
code_mock.co_posonlyargcount = 0
2270+
except AttributeError:
2271+
# Python 3.7 and earlier.
2272+
pass
22692273
code_mock.co_kwonlyargcount = 0
22702274
self.__dict__['__code__'] = code_mock
22712275
self.__dict__['__name__'] = 'AsyncMock'

0 commit comments

Comments
 (0)