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

f-string error description seems wrong #85847

Closed
millefalcon mannequin opened this issue Aug 31, 2020 · 6 comments
Closed

f-string error description seems wrong #85847

millefalcon mannequin opened this issue Aug 31, 2020 · 6 comments
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@millefalcon
Copy link
Mannequin

millefalcon mannequin commented Aug 31, 2020

BPO 41681
Nosy @ericvsmith, @miss-islington, @millefalcon
PRs
  • bpo-41681: Fix for f-string/str.format error description when using 2 , in format specifier #22036
  • [3.9] bpo-41681: Fix for f-string/str.format error description when using 2 , in format specifier (GH-22036) #22041
  • bpo-41681 Fixed mistake in test for f-string/str.format error description (GH-22036) #22059
  • 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 2020-09-01.15:56:39.262>
    created_at = <Date 2020-08-31.18:40:25.789>
    labels = ['interpreter-core', 'type-feature', '3.8', '3.9', '3.10']
    title = 'f-string error description seems wrong'
    updated_at = <Date 2020-09-02.06:09:55.352>
    user = 'https://github.com/millefalcon'

    bugs.python.org fields:

    activity = <Date 2020-09-02.06:09:55.352>
    actor = 'han-solo'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-09-01.15:56:39.262>
    closer = 'eric.smith'
    components = ['Interpreter Core']
    creation = <Date 2020-08-31.18:40:25.789>
    creator = 'han-solo'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41681
    keywords = ['patch']
    message_count = 6.0
    messages = ['376160', '376161', '376162', '376170', '376192', '376195']
    nosy_count = 3.0
    nosy_names = ['eric.smith', 'miss-islington', 'han-solo']
    pr_nums = ['22036', '22041', '22059']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue41681'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @millefalcon
    Copy link
    Mannequin Author

    millefalcon mannequin commented Aug 31, 2020

    There seems to an error in the f-string error description when one do:

    >>> f'{1:,,}'
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: Cannot specify both ',' and '_'.
    >>> 

    The error seems to be that, i am not specifying both ',' and '_', but it does seem to think so.

    This also seems to be happening for str.format:

    >>> '{:,,}'.format(1)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: Cannot specify both ',' and '_'.

    So i was just wondering if this is an issue worth raising :)

    Thank you

    @millefalcon millefalcon mannequin added 3.7 (EOL) end of life 3.10 only security fixes 3.8 only security fixes 3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels Aug 31, 2020
    @ericvsmith
    Copy link
    Member

    It has to do with how the specification for the mini-language is parsed and how the defaults work. It could probably be fixed, but I'm personally not super motivated to track it down. But I'd look at a patch!

    I'm going to remove versions that we wouldn't backport this to.

    @ericvsmith ericvsmith removed 3.7 (EOL) end of life labels Aug 31, 2020
    @millefalcon
    Copy link
    Mannequin Author

    millefalcon mannequin commented Aug 31, 2020

    Sure. Thanks for the quick response :)

    Let me see if i can try to come up with something :)

    @millefalcon millefalcon mannequin added 3.7 (EOL) end of life labels Aug 31, 2020
    @ericvsmith ericvsmith removed 3.7 (EOL) end of life labels Aug 31, 2020
    @millefalcon
    Copy link
    Mannequin Author

    millefalcon mannequin commented Aug 31, 2020

    I have raised a pull request for the fix #22036. Your review is appreciated :)

    @ericvsmith
    Copy link
    Member

    New changeset 0d6aa7f by han-solo in branch 'master':
    bpo-41681: Fix for f-string/str.format error description when using 2 , in format specifier (GH-22036)
    0d6aa7f

    @ericvsmith
    Copy link
    Member

    New changeset c16a2a1 by Miss Islington (bot) in branch '3.9':
    bpo-41681: Fix for f-string/str.format error description when using 2 , in format specifier (GH-22036) (GH-22041)
    c16a2a1

    @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
    3.8 only security fixes 3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant