@@ -5,6 +5,7 @@ from libc.stdint cimport (intptr_t, int8_t, int16_t, int32_t, int64_t,
55 uint8_t, uint16_t, uint32_t, uint64_t)
66from libcpp.map cimport map
77from libcpp.string cimport string
8+ from libcpp.vector cimport vector
89from libcpp cimport bool as cpp_bool
910
1011import datetime
@@ -692,6 +693,7 @@ complex_float64 = type(complex_float64_id)
692693void = type (void_id)
693694
694695def tuple (*args ):
696+ cdef vector[_type] _args
695697
696698 if args:
697699 # TODO: Use a different interface that doesn't involve nd.array.
@@ -700,17 +702,25 @@ def tuple(*args):
700702 # that can then be used to create a tuple type.
701703 # Constructing an array from the list is really
702704 # only partially correct.
703- return dynd_ndt_type_from_cpp(_make_tuple(as_cpp_array(args)))
705+ for arg in args:
706+ _args.push_back(as_cpp_type(arg))
707+
708+ return dynd_ndt_type_from_cpp(_make_tuple(_args))
704709
705710 return dynd_ndt_type_from_cpp(_make_tuple())
706711
707712def struct (**kwds ):
708713 # TODO: require an ordered dict here since struct types are ordered.
709714 # TODO: Use something other than dynd arrays to pass these arguments.
710715 # See the comment in the tuple function for details.
716+ cdef vector[_type] _kwds
717+
711718 if kwds:
719+ for kwd in kwds.values():
720+ _kwds.push_back(as_cpp_type(kwd))
721+
712722 return dynd_ndt_type_from_cpp(_make_struct(
713- as_cpp_array(list (kwds.keys())), as_cpp_array( list (kwds.values())) ))
723+ as_cpp_array(list (kwds.keys())), _kwds ))
714724
715725 return dynd_ndt_type_from_cpp(_make_struct())
716726
0 commit comments