Skip to content

bpo-35082: Don't report deleted attributes in __dir__#10148

Merged
cjw296 merged 1 commit into
python:masterfrom
mariocj89:pu/dir-delete-sentinel
Apr 30, 2019
Merged

bpo-35082: Don't report deleted attributes in __dir__#10148
cjw296 merged 1 commit into
python:masterfrom
mariocj89:pu/dir-delete-sentinel

Conversation

@mariocj89
Copy link
Copy Markdown
Contributor

@mariocj89 mariocj89 commented Oct 27, 2018

When an attribute is deleted from a Mock, a sentinel is added rather than just deleting the attribute. This commit checks for such sentinels when returning the child mocks in the dir method as users won't
expect deleted attributes to appear when performing dir(mock).

https://bugs.python.org/issue35082

Comment thread Misc/NEWS.d/next/Library/2018-10-27-11-54-12.bpo-35082.HDj1nr.rst Outdated
When an attribute is deleted from a Mock, a sentinel is added rather
than just deleting the attribute. This commit checks for such sentinels
when returning the child mocks in the __dir__ method as users won't
expect deleted attributes to appear when performing dir(mock).
@mariocj89 mariocj89 force-pushed the pu/dir-delete-sentinel branch from 89f5183 to e2c8f05 Compare October 27, 2018 14:01
@tirkarthi
Copy link
Copy Markdown
Member

@cjw296 ping for review.

@cjw296 cjw296 merged commit 0df635c into python:master Apr 30, 2019
@miss-islington
Copy link
Copy Markdown
Contributor

Thanks @mariocj89 for the PR, and @cjw296 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@tirkarthi
Copy link
Copy Markdown
Member

It seems the backport was never created by the bot to 3.7. @cjw296 would you be able to trigger it again?

@miss-islington
Copy link
Copy Markdown
Contributor

Thanks @mariocj89 for the PR, and @cjw296 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@asvetlov
Copy link
Copy Markdown
Contributor

asvetlov commented Jun 6, 2019

@Mariatta can you take a look, please.
Seems like @miss-islington has problems with backporting thing PR :(

@tirkarthi
Copy link
Copy Markdown
Member

tirkarthi commented Jun 6, 2019

Backport #13859 is created but it's not linked here. Issue number is missing in the backport title which could be a cause.

@bedevere-bot
Copy link
Copy Markdown

GH-13859 is a backport of this pull request to the 3.7 branch.

@asvetlov
Copy link
Copy Markdown
Contributor

asvetlov commented Jun 6, 2019

Ok, fixed

@tirkarthi
Copy link
Copy Markdown
Member

Thanks @asvetlov

@mariocj89 mariocj89 deleted the pu/dir-delete-sentinel branch September 14, 2019 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants