summaryrefslogtreecommitdiff
path: root/numpy/core/defchararray.py
diff options
context:
space:
mode:
authorAlexandr Shadchin <alexandr.shadchin@gmail.com>2016-12-08 17:15:52 +0500
committerAlexandr Shadchin <alexandr.shadchin@gmail.com>2016-12-09 16:22:24 +0500
commit15f52f530c4dc1af69e93aae60d81c2008101639 (patch)
tree6d445533dc4477f9cd5f27469addf9f9edef74ed /numpy/core/defchararray.py
parent58394d6c27b3ff03f70b07580036a1b96c7a4608 (diff)
downloadnumpy-15f52f530c4dc1af69e93aae60d81c2008101639.tar.gz
MAINT: Other cleanup Python < 2.7 and Python3 < 3.4
Diffstat (limited to 'numpy/core/defchararray.py')
-rw-r--r--numpy/core/defchararray.py12
1 files changed, 1 insertions, 11 deletions
diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py
index 3e01aaa8e..a11b343cb 100644
--- a/numpy/core/defchararray.py
+++ b/numpy/core/defchararray.py
@@ -2559,17 +2559,7 @@ def array(obj, itemsize=None, copy=True, unicode=None, order=None):
# numerical array that matches the input buffer, and
# then use NumPy to convert it to UCS4. All of this
# should happen in native endianness.
- if sys.hexversion >= 0x2060000:
- obj = obj.encode('utf_32')
- else:
- if isinstance(obj, str):
- ascii = numpy.frombuffer(obj, 'u1')
- ucs4 = numpy.array(ascii, 'u4')
- obj = ucs4.data
- else:
- ucs2 = numpy.frombuffer(obj, 'u2')
- ucs4 = numpy.array(ucs2, 'u4')
- obj = ucs4.data
+ obj = obj.encode('utf_32')
else:
obj = _unicode(obj)
else: