Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cfef05e

Browse files
committed
Merge pull request numpy#6263 from pv/comment-clarify
MAINT: clarify unclear comment in NumPyOS_ascii_strtod
2 parents 5d6a9f0 + f3fe31f commit cfef05e

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

numpy/core/src/multiarray/numpyos.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -458,17 +458,6 @@ NumPyOS_ascii_strtod(const char *s, char** endptr)
458458
struct lconv *locale_data = localeconv();
459459
const char *decimal_point = locale_data->decimal_point;
460460
size_t decimal_point_len = strlen(decimal_point);
461-
/*
462-
* It is unclear why this function needs locale information.
463-
* The goal is to do locale-independent parsing. This function
464-
* contains code to stop the parsing early if an unusual decimal
465-
* point is encountered and then pass the string so far to
466-
* NumPyOS_ascii_strtod_plain, which will also stop if an unusual
467-
* decimal point is encountered. The only case I can think of
468-
* where this would matter is if the decimal separator were
469-
* something that could occur in the middle of a valid number,
470-
* in which case this function does the wrong thing.
471-
*/
472461

473462
char buffer[FLOAT_FORMATBUFLEN+1];
474463
const char *p;
@@ -525,10 +514,12 @@ NumPyOS_ascii_strtod(const char *s, char** endptr)
525514
/*
526515
* ## 2
527516
*
528-
* At least Python versions <= 2.6.1
517+
* At least Python versions <= 2.6.8
529518
*
530519
* Fails to do best-efforts parsing of strings of the form "1<DP>234"
531520
* where <DP> is the decimal point under the foreign locale.
521+
* This is because PyOS_ascii_strtod is buggy, and will completely
522+
* refuse to parse the string, rather than parsing the first part "1".
532523
*/
533524
if (decimal_point[0] != '.' || decimal_point[1] != 0) {
534525
p = s;

0 commit comments

Comments
 (0)