Skip to content

Commit 5c5c5cb

Browse files
committed
Fox for #48
1 parent 76a73cd commit 5c5c5cb

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [2.0.1] - 2025-05-05
8+
9+
### Fixed
10+
11+
- #48: AttributeError object has no attribute 'logging_id' in "__del__" methods
12+
713
## [2.0.0] - 2025-04-30
814

915
### Fixed

docs/changelog.txt

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog
33
#########
44

5+
Version 2.0.1
6+
=============
7+
8+
- #48: AttributeError object has no attribute 'logging_id' in "__del__" methods
9+
510
Version 2.0.0
611
=============
712

src/firebird/driver/core.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -1795,7 +1795,7 @@ def __init__(self, att: iAttachment, dsn: str, dpb: bytes | None=None, sql_diale
17951795
self.__FIREBIRD_LIB__ = None
17961796
def __del__(self):
17971797
if not self.is_closed():
1798-
warn(f"Connection '{self.logging_id}' disposed without prior close()", ResourceWarning)
1798+
warn(f"Connection disposed without prior close()", ResourceWarning)
17991799
self._close()
18001800
self._close_internals()
18011801
self._att.detach()
@@ -2537,7 +2537,7 @@ def __exit__(self, exc_type, exc_value, traceback) -> None:
25372537
self.close()
25382538
def __del__(self):
25392539
if self._tra is not None:
2540-
warn(f"Transaction '{self.logging_id}' disposed while active", ResourceWarning)
2540+
warn(f"Transaction disposed while active", ResourceWarning)
25412541
self._finish()
25422542
def __dead_con(self, obj: Connection) -> None: # noqa: ARG002
25432543
self._connection = None
@@ -2947,12 +2947,8 @@ def __exit__(self, exc_type, exc_value, traceback) -> None:
29472947
self.free()
29482948
def __del__(self):
29492949
if self._in_meta or self._out_meta or self._istmt:
2950-
warn(f"Statement '{self.logging_id}' disposed without prior free()", ResourceWarning)
2950+
warn(f"Statement disposed without prior free()", ResourceWarning)
29512951
self.free()
2952-
def __str__(self):
2953-
return f'{self.logging_id}[{self.sql}]'
2954-
def __repr__(self):
2955-
return str(self)
29562952
def __dead_con(self, obj: Connection) -> None: # noqa: ARG002
29572953
self._connection = None
29582954
def __get_plan(self, *, detailed: bool) -> str:
@@ -3085,10 +3081,8 @@ def __exit__(self, exc_type, exc_value, traceback) -> None:
30853081
self.close()
30863082
def __del__(self):
30873083
if self._blob is not None:
3088-
warn(f"BlobReader '{self.logging_id}' disposed without prior close()", ResourceWarning)
3084+
warn(f"BlobReader disposed without prior close()", ResourceWarning)
30893085
self.close()
3090-
def __repr__(self):
3091-
return f'{self.logging_id}[size={self.length}]'
30923086
def flush(self) -> None:
30933087
"""Does nothing.
30943088
"""
@@ -3292,7 +3286,7 @@ def __exit__(self, exc_type, exc_value, traceback) -> None:
32923286
self.close()
32933287
def __del__(self):
32943288
if self._result is not None or self._stmt is not None or self.__blob_readers:
3295-
warn(f"Cursor '{self.logging_id}' disposed without prior close()", ResourceWarning)
3289+
warn(f"Cursor disposed without prior close()", ResourceWarning)
32963290
self.close()
32973291
def __next__(self):
32983292
if (row := self.fetchone()) is not None:
@@ -5547,7 +5541,7 @@ def __exit__(self, exc_type, exc_value, traceback) -> None:
55475541
self.close()
55485542
def __del__(self):
55495543
if self._svc is not None:
5550-
warn(f"Server '{self.logging_id}' disposed without prior close()", ResourceWarning)
5544+
warn(f"Server disposed without prior close()", ResourceWarning)
55515545
self.close()
55525546
def __next__(self):
55535547
if (line := self.readline()) is not None:

0 commit comments

Comments
 (0)