GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — __signature__ in the inspect module · Issue #106310 · python/cpython

__signature__ in the inspect module #106310

New issue
Copy link
New issue
Copy link
Closed
Closed
__signature__ in the inspect module#106310
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@Gouvernathor
Gouvernathor
opened on Jul 1, 2023
Issue body actions

Documentation

The __signature__ attribute is treated by inspect.signature (and inspect.Signature.from_callable) as an override which is returned instead of computing the signature through the ordinary process. __text_signature__ serves a similar purpose but containing a string version of the signature.
That's for the implementation.

None of the two are mentioned in the signature or Signature sections of the inspect module's doc page. However, the inspect.unwrap function's doc entry mentions, in an example, that inspect.signature does recognize the __signature__ attribute, without saying what it does with it.
This is the only mention of __signature__ or __text_signature__ in the doc, excluding changelogs, whatsnew, and the Argument clinic section which is overtly implementation-dependent.
However, it is also mentioned in the PEP 362 which introduced Signature, albeit in the Implementation section.

It should be clarified whether what __signature__ does is documented or not. It's a very useful feature to be able to cache or lie about a function's signature, and I think it should be supported.
If not, then inspect.unwrap should stop mentioning it and use another example.

Linked PRs

  • gh-106310 - document the __signature__ attribute #106311
  • [3.12] gh-106310 - document the __signature__ attribute (GH-106311) #111145
  • [3.11] gh-106310 - document the __signature__ attribute (GH-106311) #111146

Activity

  1. Gouvernathor
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Jul 1, 2023
  2. terryjreedy
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Oct 11, 2023
  3. ncoghlan
    added a commit that references this issue on Oct 20, 2023

    gh-106310 - document the __signature__ attribute (#106311)

    b07f232
  4. miss-islington
    added 2 commits that reference this issue on Oct 20, 2023

    pythongh-106310 - document the __signature__ attribute (pythonGH-106311)

    5048628

    pythongh-106310 - document the __signature__ attribute (pythonGH-106311)

    cd678d6
  5. hugovk
    added 2 commits that reference this issue on Oct 23, 2023

    [3.12] gh-106310 - document the __signature__ attribute (GH-106311) (#…

    6a5aab0

    [3.11] gh-106310 - document the __signature__ attribute (GH-106311) (#…

    135d5c5
  6. hugovk
    closed this as completedon Oct 23, 2023
  7. aisk
    added a commit that references this issue on Feb 11, 2024

    pythongh-106310 - document the __signature__ attribute (python#106311)

    509e24d
  8. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythongh-106310 - document the __signature__ attribute (python#106311)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.