From 74eec4e13435688e72ef6a50f3263ab6edf83d55 Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Tue, 29 Jan 2008 03:14:01 +0000 Subject: [PATCH] Fix fromstring to match fromfile behavior when parsing integers (base-10 only). Ticket #650 --- numpy/add_newdocs.py | 1 + numpy/core/src/arraytypes.inc.src | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index 91c6a6e80e5e..d727df2347bc 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -216,6 +216,7 @@ size is determined by the size of string. If sep is not empty then the string is interpreted in ASCII mode and converted to the desired number type using sep as the separator between elements (extra whitespace is ignored). + ASCII integer conversions are base-10; octal and hex are not supported. """) diff --git a/numpy/core/src/arraytypes.inc.src b/numpy/core/src/arraytypes.inc.src index 2499fc0590d6..25a149d04696 100644 --- a/numpy/core/src/arraytypes.inc.src +++ b/numpy/core/src/arraytypes.inc.src @@ -934,7 +934,7 @@ static int { @btype@ result; - result = PyOS_strto@func@(str, endptr, 0); + result = PyOS_strto@func@(str, endptr, 10); *ip = (@type@) result; return 0; }