Skip to content

Commit

Permalink
feat: small speed up to _unpack_variants (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Nov 4, 2022
1 parent f7b3a2e commit ef7acdc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/dbus_fast/unpack.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

import cython

from .signature cimport Variant

cdef object Variant

cpdef unpack_variants(object data)

@cython.locals(
var=Variant
)
cdef _unpack_variants(object data)
3 changes: 2 additions & 1 deletion src/dbus_fast/unpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ def _unpack_variants(data: Any) -> Any:
if type(data) is list:
return [_unpack_variants(item) for item in data]
if type(data) is Variant:
return _unpack_variants(data.value)
var = data
return _unpack_variants(var.value)
return data

0 comments on commit ef7acdc

Please sign in to comment.