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 — Wrong sign placement in PyUnicode_FromFormat · Issue #95504 · python/cpython

Wrong sign placement in PyUnicode_FromFormat #95504

New issue
Copy link
New issue
Copy link
Closed
Closed
Wrong sign placement in PyUnicode_FromFormat#95504
Copy link
Assignees
methane
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@philg314
philg314
opened on Jul 31, 2022
Issue body actions

Bug report

When specifying width or precision with a negative number the sign ignores that and sticks to the number.
Width specifies the minimum output width, so if the zero flag is set the sign should be the first character of the width padding, if the zero flag is not set the last character of the padding.
Precision specifies the number of digits, so the sign should be placed before precision count digits.

PyUnicode_FromFormat(  "%05d", -123); //   "0-123" should be   "-0123"
PyUnicode_FromFormat(  "%.5d", -123); //   "0-123" should be  "-00123"
PyUnicode_FromFormat( "%7.5d", -123); // "  0-123" should be " -00123"
PyUnicode_FromFormat("%07.5d", -123); // "000-123" should be "-000123"

Your environment

  • CPython versions tested on: main branch

Activity

  1. philg314
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jul 31, 2022
  2. corona10
    assigned
    methane
    on Aug 1, 2022
  3. encukou
    added a commit that references this issue on Aug 10, 2022

    gh-95504: Fix negative numbers in PyUnicode_FromFormat (GH-95848)

    71c3d64
  4. kumaraditya303 commented on Sep 4, 2022

    @kumaraditya303
    kumaraditya303
    on Sep 4, 2022
    Contributor
    More actions

    Fixed by #95848

  5. kumaraditya303
    closed this as completedon Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @methane
    methane

Labels

type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

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.