| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 32480b0 commit 2ad79e8
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -497,6 +497,12 @@ def test(f, format_spec, result): | |||
| 497 | 497 | test(0.01, '', '0.01') | |
| 498 | 498 | test(0.01, 'g', '0.01') | |
| 499 | 499 | ||
| 500 | + # test for issue 3411 | ||
| 501 | + test(1.23, '1', '1.23') | ||
| 502 | + test(-1.23, '1', '-1.23') | ||
| 503 | + test(1.23, '1g', '1.23') | ||
| 504 | + test(-1.23, '1g', '-1.23') | ||
| 505 | + | ||
| 500 | 506 | test( 1.0, ' g', ' 1') | |
| 501 | 507 | test(-1.0, ' g', '-1') | |
| 502 | 508 | test( 1.0, '+g', '+1') | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -302,6 +302,10 @@ ensure_decimal_point(char* buffer, size_t buf_size) | |||
| 302 | 302 | ||
| 303 | 303 | /* search for the first non-digit character */ | |
| 304 | 304 | char *p = buffer; | |
| 305 | + if (*p == '-' || *p == '+') | ||
| 306 | + /* Skip leading sign, if present. I think this could only | ||
| 307 | + ever be '-', but it can't hurt to check for both. */ | ||
| 308 | + ++p; | ||
| 305 | 309 | while (*p && isdigit(Py_CHARMASK(*p))) | |
| 306 | 310 | ++p; | |
| 307 | 311 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments