Skip to content

Commit

Permalink
Fix: infinite recursion on LoggerWrapper (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau authored Sep 19, 2024
1 parent df1e657 commit 7ac31c4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions micropip/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ def _set_formatter_once() -> None:


class LoggerWrapper:
__slots__ = ("logger", "_orig_level")

logger: logging.Logger
# need a default value because of __getattr__/__setattr__
logger: logging.Logger = None # type: ignore[assignment]

def __init__(self, logger: logging.Logger):
self.logger = logger
# Bypassing __setattr__ by setting attributes directly in __dict__
self.__dict__["logger"] = logger

def __getattr__(self, attr):
return getattr(self.logger, attr)
Expand Down

0 comments on commit 7ac31c4

Please sign in to comment.