From a9e1e6398aa71042635d56f32db4a22a48a6c2e6 Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Wed, 27 Dec 2017 09:16:45 -0800 Subject: [PATCH] Create separate instances for IPv4 and IPv6 Chains --- iptc/ip4tc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iptc/ip4tc.py b/iptc/ip4tc.py index 8afdbb9..29d77ea 100644 --- a/iptc/ip4tc.py +++ b/iptc/ip4tc.py @@ -1400,10 +1400,11 @@ class Chain(object): _cache = weakref.WeakValueDictionary() def __new__(cls, table, name): - obj = Chain._cache.get(table.name + "." + name, None) + table_name = type(table).__name__ + "." + table.name + obj = Chain._cache.get(table_name + "." + name, None) if not obj: obj = object.__new__(cls) - Chain._cache[table.name + "." + name] = obj + Chain._cache[table_name + "." + name] = obj return obj def __init__(self, table, name):