Skip to content

Commit d0547c6

Browse files
committed
Log record values and were not assigned properly under Python 3.11
1 parent fdd94a1 commit d0547c6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/firebird/base/logging.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
from collections.abc import Mapping
4444
from dataclasses import dataclass
4545
from logging import Logger, LoggerAdapter, getLogger, lastResort, Formatter
46+
from platform import python_version_tuple
4647
from .types import UNDEFINED, DEFAULT, ANY, ALL, Distinct, CachedDistinct, Sentinel
4748
from .collections import Registry
4849

@@ -124,7 +125,7 @@ def log(self, level, msg, *args, **kwargs):
124125
msg = eval(f'f"""{msg}"""', globals(), ns)
125126
args = ()
126127
if 'stacklevel' not in kwargs:
127-
kwargs['stacklevel'] = 3
128+
kwargs['stacklevel'] = 3 if int(python_version_tuple()[1]) < 11 else 2
128129
kwargs.setdefault('extra', {}).update(topic=self.topic, agent=self.agent,
129130
context=self.context)
130131
self.logger.log(level, msg, *args, **{k: v for k, v in kwargs.items()

0 commit comments

Comments
 (0)