Skip to content

Commit

Permalink
Don't fail when logging.Logger.warn is not available
Browse files Browse the repository at this point in the history
Python 3.13 removed it.

See python/cpython#105376
  • Loading branch information
hroncok committed Mar 11, 2024
1 parent 208184d commit 8283156
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 8283156

Please sign in to comment.