rca / PySPICE

Python wrapper around the NAIF CSPICE library
http://naif.jpl.nasa.gov/naif/
BSD 3-Clause "New" or "Revised" License
38 stars 15 forks source link

Bad wrapping of gfoclt_c #4

Open paulray opened 12 years ago

paulray commented 12 years ago

The wrapper code for gfoclt_c is broken. The argument cnfine is actually supposed to be BOTH an input and an output. The wrapper considers it only an input and thus when the routine is called it tries to read a null pointer and segfaults.

I don't know if PySPICE has a preferred method for handling arguments that are both Input and Output.

The help text correctly lists it as I-O:

In [106]: spice.gfoclt?

Type:             builtin_function_or_method
Base Class:       <type 'builtin_function_or_method'>
String Form:   <built-in function gfoclt>
Namespace:        Interactive
Docstring:
    -Abstract

       Determine time intervals when an observer sees one target
       occulted by, or in transit across, another.

    -Brief_I/O

       VARIABLE        I/O  DESCRIPTION
       --------------- ---  -------------------------------------------------
       SPICE_GF_CNVTOL  P   Convergence tolerance.
       occtyp           I   Type of occultation.
       front            I   Name of body occulting the other.
       fshape           I   Type of shape model used for front body.
       fframe           I   Body-fixed, body-centered frame for front body.
       back             I   Name of body occulted by the other.
       bshape           I   Type of shape model used for back body.
       bframe           I   Body-fixed, body-centered frame for back body.
       abcorr           I   Aberration correction flag.
       obsrvr           I   Name of the observing body.
       step             I   Step size in seconds for finding occultation
                            events.
       cnfine          I-O  SPICE window to which the search is restricted.
       result           O   SPICE window containing results.
michaelaye commented 12 years ago

no, indeed it hasn't, the original design had a strict separation between in and output, because Roberto wanted Python-style return values, so to decide want to have as function parameter and what to return he had to separate. thanks for the bug report. Will need to think a bit about how to solve this. It might be cleaned up together for the functions that have unallocated array sizes as output. Those as well are not implemented as of yet (apart from my hardcoding hack for getfov).