mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
[3.13] gh-65454: avoid triggering call to a PropertyMock in NonCallableMock.__setattr__ (GH-120019) (#120336)
gh-65454: avoid triggering call to a PropertyMock in NonCallableMock.__setattr__ (GH-120019)
(cherry picked from commit 9e9ee50421
)
Co-authored-by: blhsing <blhsing@gmail.com>
This commit is contained in:
parent
aba5f2a4d1
commit
81eae21733
3 changed files with 12 additions and 0 deletions
|
@ -830,6 +830,9 @@ class NonCallableMock(Base):
|
|||
mock_name = f'{self._extract_mock_name()}.{name}'
|
||||
raise AttributeError(f'Cannot set {mock_name}')
|
||||
|
||||
if isinstance(value, PropertyMock):
|
||||
self.__dict__[name] = value
|
||||
return
|
||||
return object.__setattr__(self, name, value)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue