summaryrefslogtreecommitdiff
path: root/numpy/core/defchararray.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2020-02-13 16:17:15 -0800
committerGitHub <noreply@github.com>2020-02-13 16:17:15 -0800
commit1f9ab28a9ee5a0cda956da35d0c77a3a4c4bcd55 (patch)
tree24e7752be50437d9dcedafcecbebdefb01e53a9f /numpy/core/defchararray.py
parent491f41acd2c6a0e7886662a2448b3d245ae432a9 (diff)
parentd0b7b6638fe7496d25a488a179d79879748075fa (diff)
downloadnumpy-1f9ab28a9ee5a0cda956da35d0c77a3a4c4bcd55.tar.gz
Merge pull request #15385 from eric-wieser/fix-unicode-ucs2
BUG, MAINT: Stop using the error-prone deprecated Py_UNICODE apis
Diffstat (limited to 'numpy/core/defchararray.py')
-rw-r--r--numpy/core/defchararray.py19
1 files changed, 0 insertions, 19 deletions
diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py
index 942a698a9..b22d6b85e 100644
--- a/numpy/core/defchararray.py
+++ b/numpy/core/defchararray.py
@@ -2679,25 +2679,6 @@ def array(obj, itemsize=None, copy=True, unicode=None, order=None):
itemsize = len(obj)
shape = len(obj) // itemsize
- if unicode:
- if sys.maxunicode == 0xffff:
- # On a narrow Python build, the buffer for Unicode
- # strings is UCS2, which doesn't match the buffer for
- # NumPy Unicode types, which is ALWAYS UCS4.
- # Therefore, we need to convert the buffer. On Python
- # 2.6 and later, we can use the utf_32 codec. Earlier
- # versions don't have that codec, so we convert to a
- # numerical array that matches the input buffer, and
- # then use NumPy to convert it to UCS4. All of this
- # should happen in native endianness.
- obj = obj.encode('utf_32')
- else:
- obj = str(obj)
- else:
- # Let the default Unicode -> string encoding (if any) take
- # precedence.
- obj = bytes(obj)
-
return chararray(shape, itemsize=itemsize, unicode=unicode,
buffer=obj, order=order)