Skip to content

Commit 452238e

Browse files
MehulBatraFokko
andauthored
Bug fix falsy value of zero (#249)
* certain values are considered False in a boolean context. These include None,0, empty sequences/collections, we are explicity handling that as in our case 0 stands for true * Update pyiceberg/table/__init__.py Co-authored-by: Fokko Driesprong <[email protected]> --------- Co-authored-by: Fokko Driesprong <[email protected]>
1 parent b004e35 commit 452238e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pyiceberg/table/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,8 +809,8 @@ def new_snapshot_id(self) -> int:
809809

810810
def current_snapshot(self) -> Optional[Snapshot]:
811811
"""Get the current snapshot for this table, or None if there is no current snapshot."""
812-
if snapshot_id := self.metadata.current_snapshot_id:
813-
return self.snapshot_by_id(snapshot_id)
812+
if self.metadata.current_snapshot_id is not None:
813+
return self.snapshot_by_id(self.metadata.current_snapshot_id)
814814
return None
815815

816816
def snapshot_by_id(self, snapshot_id: int) -> Optional[Snapshot]:

0 commit comments

Comments
 (0)