Skip to content

Commit

Permalink
Merge pull request #1961 from hroncok/py3.13
Browse files Browse the repository at this point in the history
Don't fail when logging.Logger.warn is not available
  • Loading branch information
minrk authored Mar 11, 2024
2 parents 208184d + 8283156 commit 0cd27dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion zmq/log/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ def log(self, level, topic, msg, *args, **kwargs):
# Generate the methods of TopicLogger, since they are just adding a
# topic prefix to a message.
for name in "debug warn warning error critical fatal".split():
meth = getattr(logging.Logger, name)
try:
meth = getattr(logging.Logger, name)
except AttributeError:
# some methods are missing, e.g. Logger.warn was removed from Python 3.13
continue
setattr(
TopicLogger,
name,
Expand Down

0 comments on commit 0cd27dc

Please sign in to comment.