-
Notifications
You must be signed in to change notification settings - Fork 309
Initialize Python Imath values #1956
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
base: main
Are you sure you want to change the base?
Initialize Python Imath values #1956
Conversation
Signed-off-by: Darby Johnston <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your changes status has failed because you have indirect coverage changes. Learn more about Unexpected Coverage Changes and reasons for indirect coverage changes. Additional details and impacted files@@ Coverage Diff @@
## main #1956 +/- ##
==========================================
+ Coverage 84.11% 85.00% +0.88%
==========================================
Files 198 181 -17
Lines 22241 13080 -9161
Branches 4687 1206 -3481
==========================================
- Hits 18709 11119 -7590
+ Misses 2610 1778 -832
+ Partials 922 183 -739
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 138 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
| .def(py::init<IMATH_NAMESPACE::V2d>()) | ||
| .def(py::init<IMATH_NAMESPACE::V2d, IMATH_NAMESPACE::V2d>()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there may be a couple sneaky ones!
| py::class_<IMATH_NAMESPACE::Box2d>(m, "Box2d", py::module_local()) | ||
| .def(py::init<>()) | ||
| .def(py::init<>([]() { return IMATH_NAMESPACE::Box2d(IMATH_NAMESPACE::V2d(0.0, 0.0)); })) | ||
| .def(py::init<IMATH_NAMESPACE::V2d>()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reinecke In the meeting today we were wondering if this also needs to be initialized:
.def(py::init<IMATH_NAMESPACE::V2d>())
I believe this is OK as is, since this constructs a Box2d from a V2d. Since the V2d is now initialized to zero with this change, the Box2d will also be initialized to zero:
v = otio.schema.V2d() # initialized to zero
box = otio.schema.Box2d(v) # also initialized to zero
This PR initializes Imath values created in Python to 0.0. In C++ the default constructor does not initialize the values which means they could be anything. This is done as an optimization for C++ but is probably not necessary and also unexpected in Python.
For example this was recently causing CI failures: #1955