Skip to content

Commit b424fa3

Browse files
committed
Remove redundant/unused lines
1 parent a146710 commit b424fa3

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

av/video/frame.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
PyCapsule_IsValid,
1616
PyCapsule_SetName,
1717
)
18-
from cython.cimports.cpython.ref import Py_DECREF, Py_INCREF, PyObject
18+
from cython.cimports.cpython.ref import Py_DECREF, Py_INCREF
1919
from cython.cimports.dlpack import DLManagedTensor, kDLCPU, kDLCUDA, kDLUInt
2020
from cython.cimports.libc.stdint import int64_t, uint8_t
2121

@@ -1412,8 +1412,6 @@ def from_dlpack(
14121412
if dev0 != dev1:
14131413
raise ValueError("plane tensors must be on the same CUDA device")
14141414
if dev_type0 == kDLCUDA:
1415-
if dev0 != dev1:
1416-
raise ValueError("plane tensors must be on the same CUDA device")
14171415
if device_id is None:
14181416
device_id = dev0
14191417
elif device_id != dev0:
@@ -1509,8 +1507,6 @@ def from_dlpack(
15091507
frame.ptr.width = width
15101508
frame.ptr.height = height
15111509
if dev_type0 == kDLCUDA:
1512-
if primary_ctx is None:
1513-
primary_ctx = True
15141510
if not isinstance(primary_ctx, (bool, int)):
15151511
raise TypeError("primary_ctx must be a bool")
15161512
primary_ctx = bool(primary_ctx)

av/video/plane.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import cython
44
import cython.cimports.libav as lib
5-
from cython.cimports.av.buffer import Buffer
65
from cython.cimports.av.error import err_check
76
from cython.cimports.av.video.format import get_pix_fmt, get_video_format
87
from cython.cimports.av.video.frame import VideoFrame
@@ -13,7 +12,6 @@
1312
PyCapsule_IsValid,
1413
PyCapsule_New,
1514
)
16-
from cython.cimports.cpython.ref import PyObject
1715
from cython.cimports.dlpack import DLManagedTensor, kDLCPU, kDLCUDA, kDLUInt
1816
from cython.cimports.libc.stdint import int64_t
1917
from cython.cimports.libc.stdlib import free, malloc
@@ -120,6 +118,11 @@ def __dlpack__(self, stream: int | Any | None = None):
120118
"DLPack export is only implemented for CUDA hw frames"
121119
)
122120

121+
if stream is not None:
122+
raise NotImplementedError(
123+
"DLPack export with stream is not implemented for CUDA hw frames"
124+
)
125+
123126
frames_ctx: cython.pointer[lib.AVHWFramesContext] = cython.cast(
124127
cython.pointer[lib.AVHWFramesContext], self.frame.ptr.hw_frames_ctx.data
125128
)

0 commit comments

Comments
 (0)