thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

array() with subok=True broken with subclass in nested sequence (Trac #2130) #5926

Open numpy-gitbot opened 12 years ago

numpy-gitbot commented 12 years ago

Original ticket http://projects.scipy.org/numpy/ticket/2130 on 2012-05-11 by atmention:dopplershift, assigned to unknown.

The following works fine:

import numpy as np a = np.ma.array([1,2,3]) print a

masked_array(data = [1 2 3],

mask = False,

fill_value = 999999)

print np.array(a, subok=True)

masked_array(data = [1 2 3],

mask = False,

fill_value = 999999)

This is broken

print np.array([a], subok=True)

array([[1, 2, 3]])

numpy-gitbot commented 12 years ago

atmention:dopplershift wrote on 2012-05-11

(Adding example with sane formatting.)

# The following works fine:
import numpy as np
a = np.ma.array([1,2,3])
print a
# masked_array(data = [1 2 3], 
# mask = False, 
# fill_value = 999999)

print np.array(a, subok=True) #Works
# masked_array(data = [1 2 3],
# mask = False, # fill_value = 999999)

print np.array([a], subok=True) # Broken
#array([[1, 2, 3]])