Skip to content

Commit

Permalink
Fix some ctypes argtypes declarations
Browse files Browse the repository at this point in the history
The ESMC_MeshCreateFromFile change was needed to fix
#326 (comment) with python
3.12 on my Mac.

The ESMC_RouteHandleCreateFromFile change was needed to fix
#326 (comment) with
python 3.12 on my Mac.

The two other changes weren't causing any visible problems, but were
things I noticed that should be fixed.

Resolves #326
  • Loading branch information
billsacks committed Dec 9, 2024
1 parent b39311b commit 6d5fdfe
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/addon/esmpy/src/esmpy/interface/cbindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ def ESMP_Initialize(logkind = constants.LogKind.MULTI):
raise ValueError('ESMC_Initialize() failed with rc = '+str(rc)+'. '+
constants._errmsg)

_ESMF.ESMC_Finalize.restype = ct.c_int
_ESMF.ESMC_Finalize.argtypes = []
_ESMF.ESMC_FinalizeWithFlag.restype = ct.c_int
_ESMF.ESMC_FinalizeWithFlag.argtypes = [ct.c_uint]

def ESMP_Finalize(endFlag = constants.EndAction.NORMAL):
"""
Expand Down Expand Up @@ -389,7 +389,7 @@ def ESMP_VMGetGlobal():
constants._errmsg)
return vm.ptr

_ESMF.ESMC_VMLogMemInfo.argtypes = [ct.c_int]
_ESMF.ESMC_VMLogMemInfo.restype = ct.c_int
_ESMF.ESMC_VMLogMemInfo.argtypes = [ct.c_char_p]

def ESMP_VMLogMemInfo(str):
Expand Down Expand Up @@ -1216,7 +1216,8 @@ def ESMP_MeshCreate(parametricDim, spatialDim, coordSys=None):
OptionalNamedConstant,
Py3Char,
OptionalNamedConstant,
Py3Char]
Py3Char,
ct.POINTER(ct.c_int)]

@pio
@netcdf
Expand Down Expand Up @@ -2425,7 +2426,7 @@ def ESMP_GridspecInq(filename):
#### RouteHandle #####################################################

_ESMF.ESMC_RouteHandleCreateFromFile.restype = ESMP_RouteHandle
_ESMF.ESMC_RouteHandleCreateFromFile.argtypes = [Py3Char]
_ESMF.ESMC_RouteHandleCreateFromFile.argtypes = [Py3Char, ct.POINTER(ct.c_int)]
def ESMP_RouteHandleCreateFromFile(filename):
"""
Preconditions: ESMP has been initialized.\n
Expand Down

0 comments on commit 6d5fdfe

Please sign in to comment.