Skip to content

Commit ccf04ed

Browse files
committed
Use declare to hide internal vars
1 parent 6b68c8c commit ccf04ed

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

av/error.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from cython.cimports.libc.stdio import fprintf, stderr
1111
from cython.cimports.libc.stdlib import free, malloc
1212

13-
# Will get extended with all of the exceptions.
13+
# Will get extended with all the exceptions.
1414
__all__ = [
1515
"ErrorType",
1616
"FFmpegError",
@@ -117,8 +117,8 @@ def __str__(self):
117117

118118

119119
# Our custom error, used in callbacks.
120-
c_PYAV_STASHED_ERROR: cython.int = tag_to_code(b"PyAV")
121-
PYAV_STASHED_ERROR_message: str = "Error in PyAV callback"
120+
c_PYAV_STASHED_ERROR = cython.declare(cython.int, tag_to_code(b"PyAV"))
121+
PYAV_STASHED_ERROR_message = cython.declare(str, "Error in PyAV callback")
122122

123123

124124
# Bases for the FFmpeg-based exceptions.
@@ -342,8 +342,9 @@ class UndefinedError(FFmpegError):
342342

343343

344344
# Storage for stashing.
345-
_local: object = local()
346-
_err_count: cython.int = 0
345+
_local = cython.declare(object, local())
346+
_err_count = cython.declare(cython.int, 0)
347+
_last_log_count = cython.declare(cython.int, 0)
347348

348349

349350
@cython.cfunc
@@ -364,9 +365,6 @@ def stash_exception(exc_info=None) -> cython.int:
364365
return -c_PYAV_STASHED_ERROR
365366

366367

367-
_last_log_count: cython.int = 0
368-
369-
370368
@cython.ccall
371369
@cython.exceptval(-1, check=False)
372370
def err_check(res: cython.int, filename=None) -> cython.int:

0 commit comments

Comments
 (0)