-
Notifications
You must be signed in to change notification settings - Fork 272
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
Improve types of childen, tracks, effects and markers parameters in function signatures #1448
Improve types of childen, tracks, effects and markers parameters in function signatures #1448
Conversation
765a7a7
to
4ab9670
Compare
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
4ab9670
to
877de06
Compare
Rebased to fix conflicts. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1448 +/- ##
==========================================
+ Coverage 78.85% 78.90% +0.05%
==========================================
Files 203 202 -1
Lines 22246 22214 -32
Branches 4517 4502 -15
==========================================
- Hits 17541 17529 -12
+ Misses 2437 2430 -7
+ Partials 2268 2255 -13
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp
Show resolved
Hide resolved
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
…unction signatures (AcademySoftwareFoundation#1448) * remove py_to_vector Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com> Signed-off-by: Michele Spina <michelespina96@gmail.com>
Summarize your change.
Continuation of the work I've been doing to improve the parameter types in our bindings.
In this PR, I'm changing the types of the
children
,tracks
,effects
andmarkers
parameters. A nice side effect is that we no more need the Python > C++ > Python > C++ > Python dance to convert the inputs from apy::object
andAnyVector
s.Previously, there was an hand-coded bridging to
AnyVector
while now it's using facilities in pybind11 to accomplish the same thing. Part of the reason that's possible, is thatpy::object
has been replaced in the interfaces with explicit types that pybind11 knows how to deal with.Here is an example of why it's important to expose the correct types in constructors (and functions/methods):
The previous behavior was something like this:
In this example there is two things to note. First, the error doesn't tell us which argument is of wrong type. Second, it doesn't tell us which specific types should be in the list/sequence. From the code, the list/sequence passed to the children parameter is not all subclasses of
SerializableObject
. It only accepts a list/sequence of typeComposable
and its sublcasses.Compare this to the new behavior:
Now we can at least see all the arguments and the list of all accepted signatures. The signature is clear about that fact that it accepts a list of
Composable
and its subclasses. Pybind11 doesn't tell us which argument is wrong, but that could be contributed to Pybind11 if we feel like it would improve the experience.There is one unanswered question though, at least for me, and it's what about the crashes mentioned in
otio_utils.cpp
? Andl also, what aboutEvery element has to be a SerializableObject::Retainer<>
? Was all this needed/casued by the fact that we were round tripping to Python?