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

Use existing fields and methods before calling custom __getattr__ #505

Merged
merged 2 commits into from
Jul 13, 2019

Conversation

konstin
Copy link
Member

@konstin konstin commented Jun 5, 2019

Previously, defining __getattr__ would override all existing fields and methods. This changes it to behave like a __getattr__ method defined in python, i.e. the custom method is only called if there isn't a field or method of that name.

Copy link
Member

@kngwyu kngwyu left a comment

Choose a reason for hiding this comment

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

LGTM, though it's desirable if we have a test

konstin and others added 2 commits July 13, 2019 22:54
Previously, defining `__getattr__` would override all existing fields and methods. This changes it to behave like a `__getattr__` method defined in python, i.e. the custom method is only called if there isn't a field or method of that name
@codecov
Copy link

codecov bot commented Jul 13, 2019

Codecov Report

Merging #505 into master will increase coverage by 0.28%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #505      +/-   ##
=========================================
+ Coverage   87.52%   87.8%   +0.28%     
=========================================
  Files          65      65              
  Lines        3422    3435      +13     
=========================================
+ Hits         2995    3016      +21     
+ Misses        427     419       -8
Impacted Files Coverage Δ
src/class/basic.rs 91.07% <ø> (ø) ⬆️
src/type_object.rs 89.09% <0%> (-0.12%) ⬇️
src/gil.rs 93.93% <0%> (ø) ⬆️
src/class/sequence.rs 80.8% <0%> (+0.19%) ⬆️
src/freelist.rs 82.6% <0%> (+0.38%) ⬆️
src/buffer.rs 70.38% <0%> (+0.82%) ⬆️
src/err.rs 62.42% <0%> (+1.31%) ⬆️
src/class/macros.rs 88.35% <0%> (+1.55%) ⬆️
src/types/string.rs 89.83% <0%> (+1.69%) ⬆️
src/conversion.rs 97.34% <0%> (+1.76%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d85ea7...60cbe2f. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Jul 13, 2019

Codecov Report

Merging #505 into master will increase coverage by 0.28%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #505      +/-   ##
=========================================
+ Coverage   87.52%   87.8%   +0.28%     
=========================================
  Files          65      65              
  Lines        3422    3435      +13     
=========================================
+ Hits         2995    3016      +21     
+ Misses        427     419       -8
Impacted Files Coverage Δ
src/class/basic.rs 91.07% <ø> (ø) ⬆️
src/type_object.rs 89.09% <0%> (-0.12%) ⬇️
src/gil.rs 93.93% <0%> (ø) ⬆️
src/class/sequence.rs 80.8% <0%> (+0.19%) ⬆️
src/freelist.rs 82.6% <0%> (+0.38%) ⬆️
src/buffer.rs 70.38% <0%> (+0.82%) ⬆️
src/err.rs 62.42% <0%> (+1.31%) ⬆️
src/class/macros.rs 88.35% <0%> (+1.55%) ⬆️
src/types/string.rs 89.83% <0%> (+1.69%) ⬆️
src/conversion.rs 97.34% <0%> (+1.76%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d85ea7...60cbe2f. Read the comment docs.

@kngwyu
Copy link
Member

kngwyu commented Jul 13, 2019

Rebased and added a test.

@konstin
Copy link
Member Author

konstin commented Jul 13, 2019

Thank for adding the test!

@konstin konstin merged commit 96a56fa into master Jul 13, 2019
@konstin konstin deleted the fix_getattr branch July 13, 2019 18:39
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.

2 participants