Skip to content

Commit 00306d8

Browse files
committed
Set _xtables._xtables_pending_matches and ._xtables_pending_targets
to None if they are not found in libxtables.
1 parent 61040db commit 00306d8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

iptc/xtables.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,17 @@ class xtables(object):
762762

763763
_xtables_xt_params = ct.c_void_p.in_dll(_lib_xtables, "xt_params")
764764
_xtables_matches = (ct.c_void_p.in_dll(_lib_xtables, "xtables_matches"))
765-
_xtables_pending_matches = (ct.c_void_p.in_dll(_lib_xtables,
766-
"xtables_pending_matches"))
765+
try:
766+
_xtables_pending_matches = (ct.c_void_p.in_dll(_lib_xtables,
767+
"xtables_pending_matches"))
768+
except ValueError:
769+
_xtables_pending_matches = ct.POINTER(None)
767770
_xtables_targets = (ct.c_void_p.in_dll(_lib_xtables, "xtables_targets"))
768-
_xtables_pending_targets = (ct.c_void_p.in_dll(_lib_xtables,
769-
"xtables_pending_targets"))
771+
try:
772+
_xtables_pending_targets = (ct.c_void_p.in_dll(_lib_xtables,
773+
"xtables_pending_targets"))
774+
except ValueError:
775+
_xtables_pending_targets = ct.POINTER(None)
770776

771777
_cache = weakref.WeakValueDictionary()
772778

0 commit comments

Comments
 (0)