This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Created on 2018-11-30 07:55 by cjw296, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10873 merged and3rson, 2018-12-03 19:17
PR 10887 merged miss-islington, 2018-12-04 09:09
PR 10888 merged miss-islington, 2018-12-04 09:09
Messages (9)
msg330757 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2018-11-30 07:55
While working on https://bugs.python.org/issue35226, I stumbled upon this: >>> from unittest.mock import call >>> call.parent() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'NoneType' object is not callable Guess we need to make .parent and friends more uniquely named ;-)
msg330964 - (view) Author: Andrew Dunai (and3rson) * Date: 2018-12-03 17:57
I've just stumbled upon this issue while looking for a good first issue to contribute on. If the community agrees this is something that needs to be done, I'll gladly work on this.
msg330965 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2018-12-03 18:29
Go for it! :-)
msg330966 - (view) Author: Andrew Dunai (and3rson) * Date: 2018-12-03 18:38
I see 2 most applicable ways to do it: - Hide .parent and .name by mangling - Define them within the mock class definition scope, but not within the class itself. As long as those are accessed only from within the mock class, I think second method would be better as it would completely remove them from mock's attributes.
msg330967 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2018-12-03 18:40
Not sure I follow the second option, I was thinking of just _mock_parent and _mock_name when I logged this. Happy to see a PR for either though!
msg330971 - (view) Author: Andrew Dunai (and3rson) * Date: 2018-12-03 19:00
I was considering wrapping a `unittest.mock._Call` class definition within a function that would contain name & parent as local variables (arguments). Thus they would be accessible within the `_Call` class, but wouldn't be accessible from the outside. However this would make them inaccessible from other instances of `_Call`. So I think I'll stick to the more trivial solution of renaming them to `_mock_name` and `_mock_parent` to conform to the rest of the module :)
msg331019 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2018-12-04 09:08
 New changeset e63e617ebbe481c498bdf037a62e09f4f9f3963f by Chris Withers (Andrew Dunai) in branch 'master': bpo-35357: Add _mock_ prefix to name/parent/from_kall attributes of _Call/_MagicProxy. (#10873) https://github.com/python/cpython/commit/e63e617ebbe481c498bdf037a62e09f4f9f3963f 
msg331021 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2018-12-04 09:34
 New changeset 12735c14134082584b899308af8dd8fcc9f15696 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-35357: Add _mock_ prefix to name/parent/from_kall attributes of _Call/_MagicProxy. (GH-10873) (#10887) https://github.com/python/cpython/commit/12735c14134082584b899308af8dd8fcc9f15696 
msg331022 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2018-12-04 09:34
 New changeset 70ca3fce9fe2bdd7bf97d5fe1299cfa5e32b3ad4 by Chris Withers (Miss Islington (bot)) in branch '3.6': bpo-35357: Add _mock_ prefix to name/parent/from_kall attributes of _Call/_MagicProxy. (GH-10873) https://github.com/python/cpython/commit/70ca3fce9fe2bdd7bf97d5fe1299cfa5e32b3ad4 
History
Date User Action Args
2022-04-11 14:59:08adminsetgithub: 79538
2018-12-04 09:35:25cjw296setstatus: open -> closed
stage: patch review -> resolved
2018-12-04 09:34:51cjw296setmessages: + msg331022
2018-12-04 09:34:38cjw296setmessages: + msg331021
2018-12-04 09:09:20miss-islingtonsetpull_requests: + pull_request10126
2018-12-04 09:09:10miss-islingtonsetpull_requests: + pull_request10125
2018-12-04 09:08:51cjw296setmessages: + msg331019
2018-12-03 19:17:22and3rsonsetkeywords: + patch
stage: patch review
pull_requests: + pull_request10110
2018-12-03 19:00:29and3rsonsetmessages: + msg330971
2018-12-03 18:40:10cjw296setmessages: + msg330967
2018-12-03 18:38:20and3rsonsetmessages: + msg330966
2018-12-03 18:29:54cjw296setmessages: + msg330965
2018-12-03 17:57:37and3rsonsetnosy: + and3rson
messages: + msg330964
2018-11-30 07:55:37cjw296create