Issue 1:
numpy.unique returns erroneous results when the number 63 is encountered in masked uint8 array with return_index=True:

>>> src_ds = '/Users/histo/S2_10_T_DN_2016_7_27_0_4328_repro.tif'
>>> src_ds = gdal.Open(src_ds)
>>> src = src_ds.GetRasterBand(1).ReadAsArray()
>>> src = np.ma.masked_equal(src, 0)
>>> src = src.ravel()
>>> s_values, s_idx, s_counts = np.unique(src, return_index=True, return_inverse=True)
>>> s_values
masked_array(data = [3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
55 56 57 58 59 60 61 62 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63
-- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 --
63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63
-- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 --
63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63 -- 63
-- 63 -- 63 -- 63 -- 63 -- `

This is reproducible:

import numpy as np

x = np.array([64, 0, 1, 2, 3, 62, 62, 0, 0, 0, 1, 2, 0, 62, 0], dtype='uint8')
y = np.ma.masked_equal(x, 0)
v, i, c = np.unique(y, return_index=True, return_counts=True)
print(v)
# [1 2 3 62 -- 64]

x = np.array([64, 0, 1, 2, 3, 63, 63, 0, 0, 0, 1, 2, 0, 63, 0], dtype='uint8')
y = np.ma.masked_equal(x, 0)
v, i, c = np.unique(y, return_index=True, return_counts=True)
print(v)
# [1 2 3 -- 63 -- 63 -- 64]

x = np.array([64, 0, 1, 2, 3, 63, 63, 0, 0, 0, 1, 2, 0, 63, 0], dtype='uint8')
y = np.ma.masked_equal(x, 0)
v = np.unique(y)
print(v)
# [1 2 3 63 64 --]

A workaround has been suggested on stackoverflow by changing the dtype to int16:

x = np.array([64, 0, 1, 2, 3, 63, 63, 0, 0, 0, 1, 2, 0, 63, 0], dtype='uint8')
y = np.ma.masked_equal(x.astype('int16'), 0)
v, i, c = np.unique(y, return_index=True, return_counts=True)
print(v)
# [1 2 3 63 64 --]

This works but greatly increases the memory footprint which is undesirable.

Issue 2:
Original ticket http://projects.scipy.org/numpy/ticket/1254 on 2009-10-07 by @mdboom, assigned to @teoliphant.

Creating a newbyteorder of a dtype which contains both a name and title returns the "" dtype. Using this dtype to create a new array segfaults.

>>> import numpy as np
>>> x = np.array([(1, 1)], dtype=[(('a', 'a'), 'i'), ('b', 'i')])
>>> x.dtype.newbyteorder('>')
dtype(<err>)
>>> y = np.array(x, dtype=x.dtype.newbyteorder('>'))
Segmentation fault

And here's the backtrace from the segfault

[Switching to Thread -1208456544 (LWP 6456)]
0x080d5957 in vgetargs1 (args=0x0, format=0xb7db54 "", p_va=0xbfe05bd4, flags=Variable "flags" is not available.
)
at Python/getargs.c:286
286 if (!PyTuple_Check(args)) {
(gdb) bt
#0 0x080d5957 in vgetargs1 (args=0x0, format=0xb7db54 "", p_va=0xbfe05bd4,
flags=Variable "flags" is not available.
) at Python/getargs.c:286
#1 0x080d5ec5 in _PyArg_ParseTuple_SizeT (args=0xb7db55, format=0xb7db54 "")
at Python/getargs.c:96
#2 0x00b73092 in VOID_setitem (op=0xb7a9090c, ip=0x8fc8980 "", ap=0x8fa80e8)
at numpy/core/src/multiarray/arraytypes.c.src:620
#3 0x00b748ce in VOID_to_VOID (ip=0x8fd4838 "\001", op=0x8fc8980 "", n=1,
aip=0x8ebacd8, aop=0x8fa80e8)
at numpy/core/src/multiarray/arraytypes.c.src:1392
#4 0x00b53958 in PyArray_CastTo (out=0x8fa80e8, mp=0x8ebacd8)
at numpy/core/src/multiarray/convert_datatype.c:316
#5 0x00b4ae74 in _array_copy_into (dest=0x8fa80e8, src=0x8ebacd8, usecopy=1)
at numpy/core/src/multiarray/ctors.c:855
#6 0x00b4be98 in PyArray_FromArray (arr=0x8ebacd8, newtype=0xb7a982f0,
flags=112) at numpy/core/src/multiarray/ctors.c:2421
#7 0x00b4c3ef in PyArray_FromAny (op=0x8ebacd8, newtype=0xb7a982f0,
min_depth=0, max_depth=0, flags=112, context=0x0)
at numpy/core/src/multiarray/ctors.c:1598
#8 0x00b6a60a in PyArray_CheckFromAny (op=0x8ebacd8, descr=0xb7a982f0,
min_depth=0, max_depth=0, requires=112, context=0x0)
at numpy/core/src/multiarray/ctors.c:1769
#9 0x00b75fde in _array_fromobject (__NPY_UNUSED_TAGGEDignored=0x0,
args=0xb7f0a2cc, kws=0xb7a91dfc)
at numpy/core/src/multiarray/multiarraymodule.c:1478
#10 0x0805d984 in PyObject_Call (func=0xb7db50, arg=0xb7f0a2cc, kw=0xb7a91dfc)
at Objects/abstract.c:1861
#11 0x080bf804 in PyEval_EvalFrameEx (f=0x8e85dc4, throwflag=0)
at Python/ceval.c:3784
#12 0x080c43bb in PyEval_EvalCodeEx (co=0xb7eabec0, globals=0xb7f5eacc,
locals=0xb7f5eacc, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0,
defcount=0, closure=0x0) at Python/ceval.c:2836
#13 0x080c450a in PyEval_EvalCode (co=0xb7eabec0, globals=0xb7f5eacc,
locals=0xb7f5eacc) at Python/ceval.c:494
#14 0x080e3e52 in PyRun_InteractiveOneFlags (fp=0xd16720,
filename=0x811a058 "<stdin>", flags=0xbfe065dc) at Python/pythonrun.c:1273
#15 0x080e4005 in PyRun_InteractiveLoopFlags (fp=0xd16720,
filename=0x811a058 "<stdin>", flags=0xbfe065dc) at Python/pythonrun.c:723
#16 0x080e4525 in PyRun_AnyFileExFlags (fp=0xd16720,
filename=0x811a058 "<stdin>", closeit=0, flags=0xbfe065dc)
at Python/pythonrun.c:692
#17 0x08056d85 in Py_Main (argc=0, argv=0xbfe06714) at Modules/main.c:523
#18 0x08056323 in main (argc=1, argv=0xbfe06714) at ./Modules/python.c:23