File tree Expand file tree Collapse file tree 2 files changed +28
-13
lines changed Expand file tree Collapse file tree 2 files changed +28
-13
lines changed Original file line number Diff line number Diff line change @@ -130,17 +130,18 @@ def prepare_int32_array(self, value):
130130 return value , ptr , cnt
131131
132132 def prepare_string_array (self , value ):
133- raise NotImplementedError
134-
135-
136- # This might be useful for methods like Get_Channel that are exposed as Channel[] and Channel()
137- # def arrayfunc(func):
138- # class ArrayFuncWrapper:
139- # def __call__(self, v):
140- # return func(self, v)
141-
142- # def __getitem__(self, v):
143- # return func(self, v)
133+ if value is None :
134+ raise ValueError ("Value cannot be None!" )
144135
145- # return ArrayFuncWrapper()
136+ ptrs = []
137+ for v in value :
138+ if type (v ) is not bytes :
139+ v = v .encode (codec )
140+
141+ ptrs .append (self .ffi .new ("char[]" , v ))
142+
143+ # Need to keep reference to every pointer to they don't get
144+ # garbage collected too early
145+ return value , ptrs , len (ptrs )
146+
146147
Original file line number Diff line number Diff line change @@ -131,7 +131,21 @@ def validate_CktElement(self):
131131 fB = getattr (B , field )
132132 if fA == ('' ,) and fB == [None ]: continue # comtypes and win32com results are a bit different here
133133 assert all (x [0 ] == x [1 ] for x in zip (fA , fB )), field
134-
134+
135+
136+ # Check if setting bus names works
137+ BusNames = list (A .BusNames )
138+ A .BusNames = BusNames
139+ B .BusNames = BusNames
140+
141+ # Check if they match again
142+ field = 'BusNames'
143+ fA = getattr (A , field )
144+ fB = getattr (B , field )
145+ if not (fA == ('' ,) and fB == [None ]): # comtypes and win32com results are a bit different here
146+ assert all (x [0 ] == x [1 ] for x in zip (fA , fB )), field
147+
148+
135149 if no_properties : return
136150
137151 all_props = list (A .AllPropertyNames )
You can’t perform that action at this time.
0 commit comments