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

cmath.polar() can raise due to pre-existing errno #68677

Closed
pitrou opened this issue Jun 23, 2015 · 7 comments
Closed

cmath.polar() can raise due to pre-existing errno #68677

pitrou opened this issue Jun 23, 2015 · 7 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Jun 23, 2015

BPO 24489
Nosy @mdickinson, @pitrou, @vstinner
Files
  • polar_errno.patch
  • 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 2015-06-23.12:44:49.318>
    created_at = <Date 2015-06-23.12:15:08.734>
    labels = ['type-bug', 'library']
    title = 'cmath.polar() can raise due to pre-existing errno'
    updated_at = <Date 2015-06-23.12:44:49.316>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2015-06-23.12:44:49.316>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-06-23.12:44:49.318>
    closer = 'pitrou'
    components = ['Library (Lib)']
    creation = <Date 2015-06-23.12:15:08.734>
    creator = 'pitrou'
    dependencies = []
    files = ['39787']
    hgrepos = []
    issue_num = 24489
    keywords = ['patch']
    message_count = 7.0
    messages = ['245678', '245679', '245681', '245682', '245683', '245684', '245685']
    nosy_count = 4.0
    nosy_names = ['mark.dickinson', 'pitrou', 'vstinner', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue24489'
    versions = ['Python 3.4', 'Python 3.5', 'Python 3.6']

    @pitrou
    Copy link
    Member Author

    pitrou commented Jun 23, 2015

    Here is a patch, with additional tests.

    @pitrou pitrou added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jun 23, 2015
    @vstinner
    Copy link
    Member

    polar_errno.patch doesn't apply cleanly on the default branch, I get that you wrote your patch for Python 3.4.

    + @cpython_only
    + def test_polar_errno(self):
    + # Check a previously set C errno doesn't disturb polar()

    Please add the number of this issue in the comment.

    + inf = float('inf')
    + ...
    + nan = float('nan')

    On Python 3.5 and 3.6, You can use math.inf and math.nan.

    Except of that, the patch looks good to me.

    @pitrou
    Copy link
    Member Author

    pitrou commented Jun 23, 2015

    On Python 3.5 and 3.6, You can use math.inf and math.nan.

    The patch is for 3.4.

    @vstinner
    Copy link
    Member

    > On Python 3.5 and 3.6, You can use math.inf and math.nan.

    The patch is for 3.4.

    Ok, it confirms my guess. But when you merge your change into 3.5, you may replace nan and inf with math.nan and math.inf. As you want.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 23, 2015

    New changeset 70e3230c2872 by Antoine Pitrou in branch '3.4':
    Issue bpo-24489: ensure a previously set C errno doesn't disturb cmath.polar().
    https://hg.python.org/cpython/rev/70e3230c2872

    New changeset d165712b2dee by Antoine Pitrou in branch '3.5':
    Issue bpo-24489: ensure a previously set C errno doesn't disturb cmath.polar().
    https://hg.python.org/cpython/rev/d165712b2dee

    New changeset b1fac7685947 by Antoine Pitrou in branch 'default':
    Issue bpo-24489: ensure a previously set C errno doesn't disturb cmath.polar().
    https://hg.python.org/cpython/rev/b1fac7685947

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 23, 2015

    New changeset 9f4b066754c3 by Antoine Pitrou in branch '2.7':
    Issue bpo-24489: ensure a previously set C errno doesn't disturb cmath.polar().
    https://hg.python.org/cpython/rev/9f4b066754c3

    @pitrou
    Copy link
    Member Author

    pitrou commented Jun 23, 2015

    Ok, pushed it!

    @pitrou pitrou closed this as completed Jun 23, 2015
    @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

    2 participants