fix: move module docstring to top of `handoff_filters.py` so it is assigned to `__doc__` by kuishou68 · Pull Request #2950 · openai/openai-agents-python · GitHub
Skip to content

fix: move module docstring to top of handoff_filters.py so it is assigned to __doc__#2950

Merged
seratch merged 1 commit intoopenai:mainfrom
kuishou68:fix/handoff-filters-docstring
Apr 19, 2026
Merged

fix: move module docstring to top of handoff_filters.py so it is assigned to __doc__#2950
seratch merged 1 commit intoopenai:mainfrom
kuishou68:fix/handoff-filters-docstring

Conversation

@kuishou68
Copy link
Copy Markdown
Contributor

Fixes #2949

Problem

The module-level docstring in src/agents/extensions/handoff_filters.py:

"""Contains common handoff input filters, for convenience. """

was placed after all the import statements. In Python, only a string literal that is the very first statement of a module is treated as the module docstring and assigned to __doc__. Any string literal appearing after other statements is discarded as an expression and never bound to __doc__.

# Before fix
import agents.extensions.handoff_filters as m
print(m.__doc__)  # None

This causes confusion for IDEs, help(), and documentation generators.

Fix

Move the docstring to the very top of the file (before all imports), where Python expects it.

# After fix
import agents.extensions.handoff_filters as m
print(m.__doc__)  # "Contains common handoff input filters, for convenience."

Changes

  • src/agents/extensions/handoff_filters.py: Move module docstring to before imports; remove trailing space from docstring.

@seratch seratch enabled auto-merge (squash) April 19, 2026 01:22
@seratch seratch added documentation Improvements or additions to documentation and removed bug Something isn't working labels Apr 19, 2026
@seratch seratch merged commit cebc763 into openai:main Apr 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature:extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: module docstring in handoff_filters.py is misplaced — appears after imports so it is not the module __doc__

2 participants