Skip to content

Conversation

@reinecke
Copy link
Collaborator

@reinecke reinecke commented May 6, 2020

The bindings for __deepcopy__ on TimeRange previously didn't accept the memo arg. This was causing the following error:

>>> copy.deepcopy(otio.opentime.TimeRange())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ereinecke/.newt-cache/pyenv/versions/3.8.2/lib/python3.8/copy.py", line 153, in deepcopy
    y = copier(memo)
TypeError: __deepcopy__(): incompatible function arguments. The following argument types are supported:
    1. (self: opentimelineio._opentime.TimeRange) -> opentimelineio._opentime.TimeRange

Invoked with: otio.opentime.TimeRange(start_time=otio.opentime.RationalTime(value=0, rate=1), duration=otio.opentime.RationalTime(value=0, rate=1)), {}

I've also added unitests for copy and deepcopy on RationalTime and TimeRange to protect against regression.

…TimeRange. Added unittests for copy on RationalTime and TimeRange
@reinecke reinecke requested review from meshula and ssteinbach May 6, 2020 22:55
@codecov-io
Copy link

codecov-io commented May 6, 2020

Codecov Report

Merging #692 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #692   +/-   ##
=======================================
  Coverage   81.72%   81.72%           
=======================================
  Files          72       72           
  Lines        2731     2731           
=======================================
  Hits         2232     2232           
  Misses        499      499           
Flag Coverage Δ
#py27 81.70% <ø> (ø)
#py36 81.70% <ø> (ø)
#py37 81.70% <ø> (ø)
Impacted Files Coverage Δ
...imelineio/opentime-bindings/opentime_timeRange.cpp 100.00% <ø> (ø)

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 234b3f3...e5253d5. Read the comment docs.

Copy link
Collaborator

@meshula meshula left a comment

Choose a reason for hiding this comment

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

I'm surprised this slipped through the cracks; of course it's not an obvious implementation detail. Did you scan for other deepcopy usages for the same problem?

@reinecke
Copy link
Collaborator Author

reinecke commented May 7, 2020

I did a quick grep and the others seemed to be alright. I only ran into this because I was using a TimeRange in a dataclass and certain actions in that context trigger a deepcopy. Since RationalTime and TimeRange are effectively immutable there's no real reason for people to be doing this directly.

@reinecke reinecke merged commit 673ece9 into AcademySoftwareFoundation:master May 7, 2020
@reinecke reinecke deleted the fix/timerange_deepcopy branch May 7, 2020 17:22
@ssteinbach ssteinbach added this to the Public Beta 13 milestone Aug 19, 2020
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.

4 participants