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 — inspect.signature() doesn't parse __text_signature__ containing a newline character · Issue #85267 · python/cpython

inspect.signature() doesn't parse __text_signature__ containing a newline character #85267

New issue
Copy link
New issue
Copy link
Closed
Closed
inspect.signature() doesn't parse __text_signature__ containing a newline character#85267
Copy link
Labels
3.10 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory

Description

@vstinner
vstinner
opened on Jun 23, 2020
Issue body actions
BPO 41095
Nosy @vstinner, @serhiy-storchaka, @1st1, @asottile
PRs
  • bpo-31938: Fix default-value signatures of several functions in the select module #21066
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2020-06-23.22:26:29.252>
    labels = ['library', '3.10']
    title = "inspect.signature() doesn't parse __text_signature__ containing a newline character"
    updated_at = <Date 2020-06-24.01:12:14.804>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-06-24.01:12:14.804>
    actor = 'Anthony Sottile'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2020-06-23.22:26:29.252>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41095
    keywords = ['patch']
    message_count = 2.0
    messages = ['372213', '372222']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'serhiy.storchaka', 'yselivanov', 'Anthony Sottile']
    pr_nums = ['21066']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue41095'
    versions = ['Python 3.10']

    • PR: gh-85267: Improvements to inspect.signature __text_signature__ handling #98796
    • PR: [3.11] gh-85267: Improvements to inspect.signature __text_signature__ handling (GH-98796) #100392
    • PR: [3.10] gh-85267: Improvements to inspect.signature __text_signature__ handling (GH-98796) #100393

    Activity

    1. vstinner commented on Jun 23, 2020

      @vstinner
      vstinner
      on Jun 23, 2020
      MemberAuthor
      More actions
      $ ./python
      Python 3.10.0a0 (heads/unicode_latin1:40855c7064, Jun 24 2020, 00:20:07) 
      >>> import select
      >>> select.epoll.register.__text_signature__
      '($self, /, fd,\n         eventmask=select.EPOLLIN | select.EPOLLPRI | select.EPOLLOUT)'
      
      >>> import inspect
      >>> inspect.signature(select.epoll.register)
      <Signature (self, /, fd)>

      => eventmask parameter is gone!

      Either signature() must raise an exception, or it must handle a __text_signature__ containing a newline character.

      Issue spotted on bpo-31938 when fixing "./python -m pydoc select".

      By the way, as expected, pydoc shows:

      Help on method_descriptor in select.epoll:
      ---

      $ ./python -m pydoc select.epoll.register
      select.epoll.register = register(self, /, fd)
          Registers a new fd or raises an OSError if the fd is already registered.
      (...)

    2. vstinner
      added
      3.10 (EOL)end of lifeend of life
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      on Jun 23, 2020
    3. asottile commented on Jun 24, 2020

      @asottile
      asottilemannequin
      on Jun 24, 2020
      Mannequin
      More actions

      Looking into this, it appears to be due to the default value and not due to the newline

      I've stumbled upon two simplifications to the routines in inspect but not a fix for this

      1. bpo-20684: Remove unused inspect._signature_get_bound_param #21100
      2. gh-99815: remove unused 'invalid' sentinel value and code that checks for it in inspect.signature parsing #21104

      the following code is hit because ast.literal_eval(...) fails for the |d expression:

      cpython/Lib/inspect.py

      Lines 2069 to 2070 in 2f9ada9

      if o is invalid:
      return None

      this causes the parameter to be skipped entirely

    4. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    5. hauntsaninja
      added a commit that references this issue on Oct 28, 2022

      pythongh-85267: Improvements to inspect.signature __text_signature__ …

      16ae02e
    6. vstinner commented on Nov 3, 2022

      @vstinner
      vstinner
      on Nov 3, 2022
      MemberAuthor
      More actions

      Sadly, I don't have the bandwidth to work on this issue, so I just close it.

    7. vstinner
      closed this as completedon Nov 3, 2022
    8. JelleZijlstra commented on Nov 8, 2022

      @JelleZijlstra
      JelleZijlstra
      on Nov 8, 2022
      Member
      More actions

      Reopening as there's an active PR fixing this.

    9. JelleZijlstra
      reopened this on Nov 8, 2022
    10. vstinner commented on Nov 8, 2022

      @vstinner
      vstinner
      on Nov 8, 2022
      MemberAuthor
      More actions

      What is the active PR?

    11. JelleZijlstra commented on Nov 8, 2022

      @JelleZijlstra
      JelleZijlstra
      on Nov 8, 2022
      Member
      More actions

      #98796

    12. JelleZijlstra
      added a commit that references this issue on Dec 21, 2022

      gh-85267: Improvements to inspect.signature __text_signature__ handli…

      79311cb
    13. hauntsaninja
      added 2 commits that reference this issue on Dec 21, 2022

      [3.11] pythongh-85267: Improvements to inspect.signature __text_signa…

      14a483c

      [3.10] pythongh-85267: Improvements to inspect.signature __text_signa…

      e34fbcc
    14. JelleZijlstra
      added 2 commits that reference this issue on Dec 21, 2022

      [3.11] gh-85267: Improvements to inspect.signature __text_signature__…

      bee9051

      [3.10] gh-85267: Improvements to inspect.signature __text_signature__…

      919045c
    15. hauntsaninja
      closed this as completedon Dec 21, 2022
    16. hauntsaninja
      reopened this on Dec 21, 2022
    17. hauntsaninja
      closed this as completedon Dec 21, 2022
    18. iritkatriel
      added a commit that references this issue on Dec 28, 2022

      Merged main into regmachine branch (#50)

      fdc73cb
    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

      3.10 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — 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.