Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspect.isabstract to return boolean values only #51318

Closed
ggenellina mannequin opened this issue Oct 6, 2009 · 7 comments
Closed

inspect.isabstract to return boolean values only #51318

ggenellina mannequin opened this issue Oct 6, 2009 · 7 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@ggenellina
Copy link
Mannequin

ggenellina mannequin commented Oct 6, 2009

BPO 7069
Nosy @benjaminp
Files
  • inspect.diff: patch + unit tests
  • inspect.diff: patch + unit tests
  • 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 = 'https://github.com/benjaminp'
    closed_at = <Date 2009-10-15.03:07:35.669>
    created_at = <Date 2009-10-06.04:32:39.690>
    labels = ['type-bug', 'library']
    title = 'inspect.isabstract to return boolean values only'
    updated_at = <Date 2009-10-15.03:07:35.667>
    user = 'https://bugs.python.org/ggenellina'

    bugs.python.org fields:

    activity = <Date 2009-10-15.03:07:35.667>
    actor = 'benjamin.peterson'
    assignee = 'benjamin.peterson'
    closed = True
    closed_date = <Date 2009-10-15.03:07:35.669>
    closer = 'benjamin.peterson'
    components = ['Library (Lib)']
    creation = <Date 2009-10-06.04:32:39.690>
    creator = 'ggenellina'
    dependencies = []
    files = ['15057', '15064']
    hgrepos = []
    issue_num = 7069
    keywords = ['patch']
    message_count = 7.0
    messages = ['93631', '93633', '93660', '93677', '93769', '93974', '94069']
    nosy_count = 3.0
    nosy_names = ['ggenellina', 'benjamin.peterson', 'chuck']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue7069'
    versions = ['Python 2.7', 'Python 3.2']

    @ggenellina
    Copy link
    Mannequin Author

    ggenellina mannequin commented Oct 6, 2009

    Currently, inspect.isabstract() may return an integer like 1048576
    instead of True, or 0 instead of False.

    Although technically correct, no other isXXX function behaves that way;
    also, isgeneratorfunction() uses a similar code construct but casts the
    result into a boolean.

    The attached patch makes inspect.isabstract() return a boolean value
    always.

    @ggenellina ggenellina mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Oct 6, 2009
    @chuck
    Copy link
    Mannequin

    chuck mannequin commented Oct 6, 2009

    The patch works, as this is what is implicitly happening anyway if you use
    the function. There seem to be no tests for this function, so there is
    nothing to break. I guess this is the right time to get some tests.

    Gabriel, would you like to write tests for this function?

    @ggenellina
    Copy link
    Mannequin Author

    ggenellina mannequin commented Oct 6, 2009

    Tests added.

    @chuck
    Copy link
    Mannequin

    chuck mannequin commented Oct 7, 2009

    I changed the patch so it does not introduce new dependencies and fails
    before the patch of isabstract().

    @ggenellina
    Copy link
    Mannequin Author

    ggenellina mannequin commented Oct 9, 2009

    I don't think we should test the actual type returned (bool); that
    would be overspecifying. The documentation doesn't promise it IS a
    boolean, and no other test for any isXXX() function checks the type
    either.
    I'd remove the last five assertions.

    @chuck
    Copy link
    Mannequin

    chuck mannequin commented Oct 14, 2009

    That's fine with me. Looks like nobody wants to check it in anyways.

    @benjaminp benjaminp self-assigned this Oct 14, 2009
    @benjaminp
    Copy link
    Contributor

    Applied in r75433.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant