Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in module deprecator #3937

Merged
merged 3 commits into from
Mar 19, 2021

Conversation

balopat
Copy link
Contributor

@balopat balopat commented Mar 19, 2021

Adds __dict__ to the wrapped module to ensure its member attributes stay on it.

@balopat balopat requested review from cduck, vtomole and a team as code owners March 19, 2021 14:27
@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Mar 19, 2021
@balopat
Copy link
Contributor Author

balopat commented Mar 19, 2021

ping @cduck this was a bug that causes issues when create_attribute = True.

Copy link
Collaborator

@cduck cduck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Did this only affect dir?

@balopat
Copy link
Contributor Author

balopat commented Mar 19, 2021

LGTM. Did this only affect dir?

Yes, well, also things that were using it, e.g. inspect.getmembers - which is in turn used in the json serialization tests - which were failing after extracting cirq.google, that's how I spotted it.

Another thing to note that this was my mistake - the deprecated_attributes utility already does this __dict__ redefinition, I just didn't understand where this was important, so I decided to remove it yesterday. Now I understand it better and added the test to protect it.

@balopat balopat added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Mar 19, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Mar 19, 2021
@CirqBot CirqBot merged commit 0d37128 into quantumlib:master Mar 19, 2021
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants