Skip to content

Commit b799d5c

Browse files
committed
Use the new strings_to_ctypes_array function
1 parent fe41846 commit b799d5c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pygmt/clib/session.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -641,11 +641,8 @@ def call_module(self, module: str, args: list[str]):
641641
# This is the preferred way to pass arguments to GMT API, because we don't
642642
# have to deal with whitespaces or quotation marks on the PyGMT side.
643643
mode = len(args) # Now mode is the number of arguments.
644-
if mode == 0: # No arguments, passing a null pointer
645-
argv = None
646-
else:
647-
argv = (ctp.c_char_p * len(args))()
648-
argv[:] = np.char.encode(args)
644+
# Pass a null pointer if no arguments are specified.
645+
argv = strings_to_ctypes_array(args) if mode != 0 else None
649646
else:
650647
raise GMTInvalidInput(
651648
"'args' must be either a string or a list of strings."

0 commit comments

Comments
 (0)