Skip to content

Fix Logger.__getattr__ infinite recursion#683

Draft
kmontemayor2-sc wants to merge 1 commit into
mainfrom
kmonte/fix-logger-getattr-recursion
Draft

Fix Logger.__getattr__ infinite recursion#683
kmontemayor2-sc wants to merge 1 commit into
mainfrom
kmonte/fix-logger-getattr-recursion

Conversation

@kmontemayor2-sc

Copy link
Copy Markdown
Collaborator

Logger(logging.LoggerAdapter) stores the wrapped logger as self.logger, but getattr delegated to self._logger (nonexistent). Since getattr only fires on failed lookups, resolving self._logger re-entered getattr("_logger") and recursed forever -> RecursionError.

This was dormant for the info/debug/... methods (defined directly on LoggerAdapter) but fired on any other attribute access, making Logger impossible to copy/deepcopy/pickle and turning undefined-attribute access into a crash instead of a clean AttributeError.

Read logger straight from dict (cannot re-enter getattr) and raise AttributeError when it is not yet set. Add a regression test covering undefined-attr, delegation, deepcopy, and pickle.

Scope of work done

Where is the documentation for this feature?: N/A

Did you add automated tests or write a test plan?

Updated Changelog.md? NO

Ready for code review?: NO

Logger(logging.LoggerAdapter) stores the wrapped logger as self.logger,
but __getattr__ delegated to self._logger (nonexistent). Since
__getattr__ only fires on failed lookups, resolving self._logger
re-entered __getattr__("_logger") and recursed forever -> RecursionError.

This was dormant for the info/debug/... methods (defined directly on
LoggerAdapter) but fired on any other attribute access, making Logger
impossible to copy/deepcopy/pickle and turning undefined-attribute
access into a crash instead of a clean AttributeError.

Read logger straight from __dict__ (cannot re-enter __getattr__) and
raise AttributeError when it is not yet set. Add a regression test
covering undefined-attr, delegation, deepcopy, and pickle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kmontemayor2-sc

Copy link
Copy Markdown
Collaborator Author

/all_test

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 16:09:26UTC : 🔄 Integration Test started.

@ 17:39:08UTC : ✅ Workflow completed successfully.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 16:09:26UTC : 🔄 Python Unit Test started.

@ 17:18:11UTC : ✅ Workflow completed successfully.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 16:09:26UTC : 🔄 C++ Unit Test started.

@ 16:11:27UTC : ✅ Workflow completed successfully.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 16:09:28UTC : 🔄 Scala Unit Test started.

@ 16:20:04UTC : ✅ Workflow completed successfully.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 16:09:29UTC : 🔄 E2E Test started.

@ 17:45:29UTC : ✅ Workflow completed successfully.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 16:09:31UTC : 🔄 Lint Test started.

@ 16:17:14UTC : ✅ Workflow completed successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants