GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-45756: do not execute `@property` descrs while creating mock autospecs by sobolevn · Pull Request #29901 · python/cpython Conversation
| |||||||||||||||||||||||||||||
|
I am going to friendly ping @serhiy-storchaka to review this 🙂 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CC @corona10 Maybe you will be interested to review this? 🙂 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -0,0 +1,2 @@ | |||
| We no longer execute ``@property`` descriptors while creating autospecs in | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| We no longer execute ``@property`` descriptors while creating autospecs in | |
| Fixed :class:`property` decorators executing descriptors while creating autospecs in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -0,0 +1,2 @@ | |||
| We no longer execute ``@property`` descriptors while creating autospecs in | |||
| ``mock.py``. This was not safe and could affect user's code in unknown way. | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| ``mock.py``. This was not safe and could affect user's code in unknown way. | |
| :mod:`unittest.mock`. This was not safe and could affect user's code in unknown ways. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Is this potentially a breaking change (can some mocks be relying on running a property)? In general, it is a good idea to avoid accidentally running code; however, mocks are advanced case where users are already doing something invasive, and properties are also a special case where programmers are intentionally running behavior upon access. Long ago, In a slightly related issue, it was decided that hasattr() would be left as-is rather than making perhap futile efforts to avoid running a descriptor. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
It is possible. However, the execution of properties by specced mocks was introduced relatively recently (3.8) along with The current PR to fix it is #22209. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.