Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

reprlib.recursive_repr does not copy__type_params__ #109818

Closed
Assignees
sobolevn
Labels
3.12only security fixes3.13bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@sobolevn

Description

@sobolevn

Bug report

Repro:

>>>fromreprlibimportrecursive_repr>>>>>>classMy:...    @recursive_repr()...def__repr__[T](self,converter:T|None=None): ......>>>My().__repr__.__type_params__()

This happens becauserecursive_repr does not use@wraps, but reinvents it:

# Can't use functools.wraps() here because of bootstrap issues
wrapper.__module__=getattr(user_function,'__module__')
wrapper.__doc__=getattr(user_function,'__doc__')
wrapper.__name__=getattr(user_function,'__name__')
wrapper.__qualname__=getattr(user_function,'__qualname__')
wrapper.__annotations__=getattr(user_function,'__annotations__', {})
wrapper.__wrapped__=user_function
returnwrapper

And__type_params__ was added in#104600

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp