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

Empty __module__ attribute for built-in static methods #115231

Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement
@skirpichev

Description

@skirpichev

Bug report

Bug description:

An example:

>>>bytes.maketrans.__module__isNoneTrue

c.f. pure-python staticmethod:

>>>classSpam:...@staticmethod...deffoo():...pass... >>> Spam.foo.__module__'__main__'

I'm not sure, maybe this should be treated rather as a feature request. Docssays about the attribute value: "The name of the module the function was defined in, or None if unavailable." But clearly, this valueis available: thetype_add_method() hastype argument and we could query value of its__module__ attribute.

Edit: BTW, same happens for class methods, e.g.:

>>>int.from_bytes.__module__isNoneTrue

Probably this should be fixed as well.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp