Skip to content

Commit

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


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

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 c08d080

Please sign in to comment.