Skip to content

Add bool methods - #909

Merged
windelbouwman merged 4 commits into
RustPython:masterfrom
sapir:add-bool-methods
May 4, 2019
Merged

Add bool methods#909
windelbouwman merged 4 commits into
RustPython:masterfrom
sapir:add-bool-methods

Conversation

@sapir

@sapir sapir commented May 2, 2019

Copy link
Copy Markdown
Contributor

For #358

@sapir
sapir force-pushed the add-bool-methods branch from e7fdbe5 to 2f514da Compare May 2, 2019 23:37
@codecov-io

codecov-io commented May 3, 2019

Copy link
Copy Markdown

Codecov Report

Merging #909 into master will increase coverage by 0.08%.
The diff coverage is 84.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #909      +/-   ##
==========================================
+ Coverage   64.11%   64.19%   +0.08%     
==========================================
  Files          89       89              
  Lines       15342    15394      +52     
  Branches     3436     3446      +10     
==========================================
+ Hits         9836     9882      +46     
+ Misses       3224     3223       -1     
- Partials     2282     2289       +7
Impacted Files Coverage Δ
vm/src/obj/objint.rs 86.66% <66.66%> (+0.54%) ⬆️
vm/src/obj/objbool.rs 77.88% <85.18%> (+7.88%) ⬆️

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 c217685...45d7c38. Read the comment docs.

Comment thread vm/src/obj/objbool.rs Outdated
let rhs = get_value(rhs);
(lhs ^ rhs).into_pyobject(vm)
} else {
Ok(lhs.payload::<PyInt>().unwrap().and(rhs.clone(), vm))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should probably use .xor instead of .and?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oops

Comment thread vm/src/obj/objbool.rs
}
}

fn bool_xor(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This method seems duplicate with the one marked by pymethod in the class. There are at this point several styles to define object methods. The latest and the way to go is to use the pymethod markers on the class. If you mark a method as such, it will be available on the object if you use PyBool::extend_class. objint.rs is a good example file where this is used.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, ignore my comment :). I was not aware that also objint.rs was modified.

@windelbouwman

Copy link
Copy Markdown
Contributor

@sapir thank you for contributing to this project. This is appreciated! I left one remark in your change.

@sapir
sapir force-pushed the add-bool-methods branch from 2f514da to 45d7c38 Compare May 4, 2019 19:28
@windelbouwman
windelbouwman merged commit ee2b2a8 into RustPython:master May 4, 2019
@aldanor aldanor mentioned this pull request Jul 16, 2019
33 tasks
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.

3 participants