We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
getattr
release
1 parent 278e2cb commit 4862d24Copy full SHA for 4862d24
spannerlib/wrappers/spannerlib-python/spannerlib-python/google/cloud/spannerlib/internal/message.py
@@ -125,7 +125,7 @@ def raise_if_error(self) -> None:
125
126
def release(self) -> None:
127
"""Releases memory using the injected library instance."""
128
- if self._is_released:
+ if getattr(self, "_is_released", False):
129
return
130
131
self._is_released = True
@@ -135,7 +135,8 @@ def release(self) -> None:
135
136
137
# 2. Check if we have the tool to free it
138
- if self._lib is None:
+ lib = getattr(self, "_lib", None)
139
+ if lib is None:
140
logger.critical(
141
"Message (pinner=%d) cannot be released! "
142
"Library dependency was not injected via bind_library().",
0 commit comments