File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,10 @@ def dtype(self):
196196 elif k == 8 :
197197 return np .cdouble
198198 elif t == "CHARACTER" :
199- return f"S{ self .strlen .value } "
199+ try :
200+ return f"S{ self .strlen .value } "
201+ except AttributeError :
202+ return "S"
200203
201204 raise NotImplementedError (f"Object of type { t } and kind { k } not supported yet" )
202205
Original file line number Diff line number Diff line change @@ -357,4 +357,16 @@ subroutine set_chr_star_star(x)
357357 end subroutine set_chr_star_star
358358
359359
360+ subroutine check_assumed_shape_str (x )
361+ character (len=* ), dimension (:), intent (in ) :: x
362+ integer :: i
363+
364+
365+ do i= 1 ,ubound (x,dim= 1 )
366+ write (* ,* ) trim (x(i))
367+ end do
368+
369+
370+ end subroutine check_assumed_shape_str
371+
360372end module strings
Original file line number Diff line number Diff line change @@ -289,3 +289,10 @@ def test_set_str_array_dt_out(self):
289289 def test_set_chr_star_star (self ):
290290 res = x .set_chr_star_star (" " )
291291 assert res .args ["x" ] == "abcdefghijkl"
292+
293+ def test_check_assumed_shape_str (self , capfd ):
294+ y = np .array (["a/b/c/d/e/f/g" ], dtype = "S" )
295+
296+ res = x .check_assumed_shape_str (y )
297+ out , err = capfd .readouterr ()
298+ assert out .strip () == "a/b/c/d/e/f/g"
You can’t perform that action at this time.
0 commit comments