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 — Support functools.partial in inspect.is*function() checks · Issue #79071 · python/cpython

Support functools.partial in inspect.is*function() checks #79071

New issue
Copy link
New issue
Copy link
Closed
Closed
Support functools.partial in inspect.is*function() checks#79071
Copy link
Labels
3.8 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory

Description

@asvetlov
asvetlov
opened on Oct 4, 2018
Issue body actions
BPO 34890
Nosy @asvetlov, @1st1, @pablogsal, @sweeneyde
PRs
  • bpo-34890: Make iscoroutinefunction, isgeneratorfunction and isasyncgenfunction work with functools.partial #9903
  • 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 = <Date 2018-10-26.11:23:04.921>
    created_at = <Date 2018-10-04.07:29:56.296>
    labels = ['3.8', 'library']
    title = 'Support functools.partial in inspect.is*function() checks'
    updated_at = <Date 2022-02-13.06:36:40.836>
    user = 'https://github.com/asvetlov'

    bugs.python.org fields:

    activity = <Date 2022-02-13.06:36:40.836>
    actor = 'Dennis Sweeney'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-10-26.11:23:04.921>
    closer = 'pablogsal'
    components = ['Library (Lib)']
    creation = <Date 2018-10-04.07:29:56.296>
    creator = 'asvetlov'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34890
    keywords = ['patch']
    message_count = 5.0
    messages = ['327039', '327056', '327057', '328538', '413171']
    nosy_count = 4.0
    nosy_names = ['asvetlov', 'yselivanov', 'pablogsal', 'Dennis Sweeney']
    pr_nums = ['9903']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue34890'
    versions = ['Python 3.8']

    Activity

    1. asvetlov commented on Oct 4, 2018

      @asvetlov
      asvetlov
      on Oct 4, 2018
      ContributorAuthor
      More actions

      isfunction() processes both isfunction(func) and isfunction(partial(func, arg)) correctly.

      But iscoroutinefunction() misses this functionality.

      We can implement it easy by adding a check for isinstance(func, partial) and applying a coroutine check for func.func.

      Also, we can do the same for isgeneratorfunction() and isasyncgenfunction().

      The patch looks easy and straightforward.

      Yuri, what do you think about?

    2. asvetlov
      added
      3.8 (EOL)end of lifeend of life
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      on Oct 4, 2018
    3. 1st1 commented on Oct 4, 2018

      @1st1
      1st1
      on Oct 4, 2018
      Member
      More actions

      I think the fact that inspect.isfunction recognizes partials is a very strong argument to enable inspect.iscoroutinefunction to do so as well.

      This is a backwards incompatible change though, strictly speaking.

    4. 1st1 commented on Oct 4, 2018

      @1st1
      1st1
      on Oct 4, 2018
      Member
      More actions

      Feel free to work on the PR. If we want to push this to 3.8 we should do that now and have enough time for it to be tested.

    5. pablogsal commented on Oct 26, 2018

      @pablogsal
      pablogsal
      on Oct 26, 2018
      Member
      More actions

      New changeset 7cd2543 by Pablo Galindo in branch 'master':
      bpo-34890: Make iscoroutinefunction, isgeneratorfunction and isasyncgenfunction work with functools.partial (GH-9903)
      7cd2543

    6. pablogsal
      closed this as completedon Oct 26, 2018
    7. sweeneyde commented on Feb 13, 2022

      @sweeneyde
      sweeneyde
      on Feb 13, 2022
      Member
      More actions

      See https://bugs.python.org/issue46722 for a concern about this change.

    8. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    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.8 (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 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.