Skip to content

Commit

Permalink
Use the new strings_to_ctypes_array function
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Mar 26, 2024
1 parent fe41846 commit b799d5c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,11 +641,8 @@ def call_module(self, module: str, args: list[str]):
# This is the preferred way to pass arguments to GMT API, because we don't
# have to deal with whitespaces or quotation marks on the PyGMT side.
mode = len(args) # Now mode is the number of arguments.
if mode == 0: # No arguments, passing a null pointer
argv = None
else:
argv = (ctp.c_char_p * len(args))()
argv[:] = np.char.encode(args)
# Pass a null pointer if no arguments are specified.
argv = strings_to_ctypes_array(args) if mode != 0 else None
else:
raise GMTInvalidInput(

Check warning on line 647 in pygmt/clib/session.py

View check run for this annotation

Codecov / codecov/patch

pygmt/clib/session.py#L647

Added line #L647 was not covered by tests
"'args' must be either a string or a list of strings."
Expand Down

0 comments on commit b799d5c

Please sign in to comment.