nac3artiq/demo/embedding_map: avoid key 0
Object key 0 is reserved for builtin exceptions.
This commit is contained in:
parent
294943e303
commit
a5e1da0b92
@ -33,7 +33,7 @@ class EmbeddingMap:
|
|||||||
obj_id = id(obj)
|
obj_id = id(obj)
|
||||||
if obj_id in self.object_inverse_map:
|
if obj_id in self.object_inverse_map:
|
||||||
return self.object_inverse_map[obj_id]
|
return self.object_inverse_map[obj_id]
|
||||||
key = len(self.object_map)
|
key = len(self.object_map) + 1
|
||||||
self.object_map[key] = obj
|
self.object_map[key] = obj
|
||||||
self.object_inverse_map[obj_id] = key
|
self.object_inverse_map[obj_id] = key
|
||||||
return key
|
return key
|
||||||
|
Loading…
Reference in New Issue
Block a user