Skip to content

Commit

Permalink
argvC: fix off-by-one error.
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Jan 8, 2022
1 parent ce851bb commit c410d75
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Python/pywarpx/_libwarpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,15 @@ def get_nattr_species(self, species_name):
def amrex_init(self, argv, mpi_comm=None):
# --- Construct the ctype list of strings to pass in
argc = len(argv)
argvC = (_LP_c_char * (argc+1))()
argvC = (_LP_c_char * argc)()
print("amrex_init argv=", argv)
print("amrex_init len(argv)=", len(argv))
for i, arg in enumerate(argv):
enc_arg = arg.encode('utf-8')
argvC[i] = ctypes.create_string_buffer(enc_arg)
print("len(argvC)=", len(argvC))
print("argc=", argc)
print("argvC=", argvC)

if mpi_comm is None or MPI is None:
self.libwarpx_so.amrex_init(argc, argvC)
Expand Down

0 comments on commit c410d75

Please sign in to comment.