diff options
| author | Scott <[email protected]> | 2022-02-02 13:47:36 -0800 |
|---|---|---|
| committer | Scott <[email protected]> | 2022-02-02 13:47:36 -0800 |
| commit | 7ff2af6fe7bffea90dc4a31c93140c189917c659 (patch) | |
| tree | 34cb138c3a572037b5bc1d1b52ad9d25a2604ccb /collect/shared_dict.py | |
| parent | 6ba90a1f30f1c0cf4df12fcd0c62181f29bc3668 (diff) | |
Let's be explicit with asserts; there was a bug in histogram
caused by assert foo when foo was an int with valid valid 0.
Diffstat (limited to 'collect/shared_dict.py')
| -rw-r--r-- | collect/shared_dict.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/collect/shared_dict.py b/collect/shared_dict.py index 7c84c14..ac390bc 100644 --- a/collect/shared_dict.py +++ b/collect/shared_dict.py @@ -74,6 +74,7 @@ class SharedDict(object): super().__init__() self.name = name self._serializer = PickleSerializer() + assert size_bytes is None or size_bytes > 0 self.shared_memory = self._get_or_create_memory_block(name, size_bytes) self._ensure_memory_initialization() self.lock = RLock() @@ -89,7 +90,7 @@ class SharedDict(object): try: return shared_memory.SharedMemory(name=name) except FileNotFoundError: - assert size_bytes + assert size_bytes is not None return shared_memory.SharedMemory(name=name, create=True, size=size_bytes) def _ensure_memory_initialization(self): |
