Skip to content

Commit 64f7f54

Browse files
committed
Fix for pypy
1 parent 628786e commit 64f7f54

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

av/container/output.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23

34
import cython
45
from cython.cimports import libav as lib
@@ -36,12 +37,15 @@ def __cinit__(self, *args, **kwargs):
3637
self.packet_ptr = lib.av_packet_alloc()
3738

3839
def __del__(self):
39-
try:
40-
close_output(self)
41-
except Exception:
42-
pass
40+
if "__pypy__" not in sys.builtin_module_names:
41+
try:
42+
close_output(self)
43+
except Exception:
44+
pass
4345

4446
def __dealloc__(self):
47+
if "__pypy__" in sys.builtin_module_names:
48+
close_output(self)
4549
with cython.nogil:
4650
lib.av_packet_free(cython.address(self.packet_ptr))
4751

0 commit comments

Comments
 (0)