Title: Wrong sign placement in PyUnicode_FromFormat · Issue #95504 · python/cpython · GitHub
Open Graph Title: Wrong sign placement in PyUnicode_FromFormat · Issue #95504 · python/cpython
X Title: Wrong sign placement in PyUnicode_FromFormat · Issue #95504 · python/cpython
Description: 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...
Open Graph Description: 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 sh...
X Description: 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 sh...
Opengraph URL: https://github.com/python/cpython/issues/95504
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Wrong sign placement in PyUnicode_FromFormat","articleBody":"# Bug report\r\n\r\nWhen specifying width or precision with a negative number the sign ignores that and sticks to the number.\r\nWidth 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.\r\nPrecision specifies the number of digits, so the sign should be placed before precision count digits.\r\n\r\n```c\r\nPyUnicode_FromFormat( \"%05d\", -123); // \"0-123\" should be \"-0123\"\r\nPyUnicode_FromFormat( \"%.5d\", -123); // \"0-123\" should be \"-00123\"\r\nPyUnicode_FromFormat( \"%7.5d\", -123); // \" 0-123\" should be \" -00123\"\r\nPyUnicode_FromFormat(\"%07.5d\", -123); // \"000-123\" should be \"-000123\"\r\n```\r\n\r\n# Your environment\r\n\r\n- CPython versions tested on: main branch","author":{"url":"https://github.com/philg314","@type":"Person","name":"philg314"},"datePublished":"2022-07-31T19:56:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/95504/cpython/issues/95504"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c7a4420e-c480-583c-5f60-fc3f81958758 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B2E8:21FAD6:1473F3B:1BE0BEE:69694CAA |
| html-safe-nonce | 73b3680b57aa1b25b3aa90ef7b91eaf7a164d672b6f9f9eabf46a878ae9ad4e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkU4OjIxRkFENjoxNDczRjNCOjFCRTBCRUU6Njk2OTRDQUEiLCJ2aXNpdG9yX2lkIjoiNjU1NjU5ODM4MTc4ODYxMzgwMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0063bc59ef709e7b4ac3f8476ac679873b58b6ebcb8972edfc80720d00437559 |
| hovercard-subject-tag | issue:1323560587 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/95504/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7576cdd693d9b16b5702e0b83b883b6189ddc6203772b784a3ddca4aa8792dad/python/cpython/issues/95504 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7576cdd693d9b16b5702e0b83b883b6189ddc6203772b784a3ddca4aa8792dad/python/cpython/issues/95504 |
| og:image:alt | 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 sh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | philg314 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d69ac0477df0f87da03b8b06cebd187012d7a930 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width