From cc30570330499fb55aae271bab3df9394e830dd8 Mon Sep 17 00:00:00 2001 From: Jarl Haggerty Date: Sat, 27 Sep 2014 13:41:51 -0400 Subject: [PATCH 1/2] changed asscalar to pass through scalars --- numpy/lib/type_check.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py index a45d0bd865c3..9355a74ea98f 100644 --- a/numpy/lib/type_check.py +++ b/numpy/lib/type_check.py @@ -460,7 +460,10 @@ def asscalar(a): 24 """ - return a.item() + try: + return a.item() + except AttributeError, e: + return asarray(a).item() #----------------------------------------------------------------------------- From 525574d8da7133d3a4385dc30ada86b9cd1dd360 Mon Sep 17 00:00:00 2001 From: Jarl Haggerty Date: Sat, 27 Sep 2014 14:34:52 -0400 Subject: [PATCH 2/2] removed old syntax in except clause of asscalar --- numpy/lib/type_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py index 9355a74ea98f..2cd15941d7b0 100644 --- a/numpy/lib/type_check.py +++ b/numpy/lib/type_check.py @@ -462,7 +462,7 @@ def asscalar(a): """ try: return a.item() - except AttributeError, e: + except AttributeError as e: return asarray(a).item() #-----------------------------------------------------------------------------