-
Notifications
You must be signed in to change notification settings - Fork 15
Fix fatal error from deallocating Py_None #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Import traceback for debugging - Get base type of SpiceInt from typedef of gcc -E cspice/include/SpiceUsr.h - module globals spiceintType and spiceintType1 - Use envvar DEBUG_MKWRAPPER to set DEBUG - Added INOUTPUT_TYPE for variables that are both inputs and outputs - Parse IN/OUT/INOUT-PUT_TYPE from I, O, I/O, I-O, I,O in Brief_I/O section in document string of cspice/src/*_c.c - Added get_py_boolean for Py_True/_False input arguments - Added int for input argument (sigcode), with warning - Skip functions named *_ declared in gcc -E .../SpiceUsr.h - Skip functions names zz* declared in gcc -E .../SpiceUsr.h - Use local var funcnm for prototype_arg.function_name - Indent 2nd and laster lines comments with function definition - Put ioDict which contains IN/OUT/INOUT-PUT_TYPE info - Issue warning for void argument list in non-void argument list - Issue warning if input parameter cannot be parsed - Use I|O|I/O|I-O|I,O for setting IN/OUT/INOUT-PUT_TYPE - disable old code - disable old code about last_item - Add INOUTPUT_TYPE arguments to both input_list and output_list - Handle SpiceCell as pointer - Do not declare I/O argments - Move returnVal declaration to begining of routine - Make returnVal declaration for single return values other than found - Change indenting of output for py_to_c_conversions - Add .make_pointer to reasons for appending ouput name to t_list - Special handling as pointers for SpiceCell output arguments - Put {}s around PyObject* returnVal creation pyspice.c pyspice.h - Include malloc.h - Added get_py_boolean - Added gat/i/d/b to get time, int, double, bool from class instance attribute, specifically for spice.objects.Cell class instance - Parse spice.objects.Cell PyObject* to struct SpiceCell* - Added static data types to spice.objects.DataType class - Added type, size and length arguments to spice.objects.Cell.__init__ - Create spice.objects.Cell instance using these
pyspice.h - Include malloc.h - Added get_py_boolean - Added gat/i/d/b to get time, int, double, bool from class instance attribute, specifically for spice.objects.Cell class instance - Parse spice.objects.Cell PyObject* to struct SpiceCell* - Added static data types to spice.objects.DataType class - Added type, size and length arguments to spice.objects.Cell.__init__ - Create spice.objects.Cell instance using these
- added some comments - replaced malloc and free with PyMem_Malloc/_Free - return True from gen_wrapper instead of buffer.getvalue() - added count adjustment of prototypes for one-line prototypes pyspice.c pyspice.h - replaced malloc and free with PyMem_Malloc/_Free spice/objects.py - workable DataType and Cell classes
- changed logic of parsing prototypes, did not change result - change now includes one-line prototype in prototype counters - added some comments
mkwrapper.py - allow appnd_c calls (they work now!) - removed zz* calls - handle SpiceCell pointer outputs by making them required inputs also - added extra_inoutput_name_list - added extra_parse_tuple_string - moved py_to_c_conversions list before output handler loop - gen_wrapper returns True instead of full string pyspice.c - completed get_py_cell and get_spice_cell - N.B. get_spice_cell use PyMem_Malloc to create structure, - disabled SPICE_TIME and SPICE_BOOL cells spice/objects.py - bumped minimum character length to six because toolkit uses last char as terminator
- Key is variable name (e.g. 'c') - Value is tuple of toolkit routine names (e.g. 'whtevr_c') where that variable name should be an output but is labeled as an input in the -Brief_I/O sections of the source file
errdev_c call in initialization mkwrapper.py - use Py_BuildValue format of "s#" with output arg declaration "SpiceChar type [1]"
errdev_c call in initialization mkwrapper.py - use Py_BuildValue format of "s#" with output arg declaration "SpiceChar type [1]"
…tor frame angle; added comments; removed MYEARTH frame
…alculations; other mods.
Awesome! Michael Sent from my iPad
|
for kernel in self.kernels: spice.unload( kernel ) | ||
|
||
def test_horizons(self): | ||
import horizons |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The horizons module depends on connectivity to a JPL server. Can this test be updated so the connection is not necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more of an example application, it also used matplotlib.
maybe it does not belong in the tests directory.
On Fri, Sep 27, 2013 at 5:17 PM, Roberto Aguilar
notifications@github.comwrote:
In tests/test_horizons2plot.py:
- def setUp(self):
Load default kernels
- mydir = os.path.dirname(file)
- self.kernels = [ os.path.join( mydir,i.strip()) for i in
+kernels/naif0010.tls"""
+kernels/spk_drm239_WithBurn-full.bsp""".strip().split('\n') ]
- for kernel in self.kernels: spice.furnsh( kernel )
- def tearDown(self):
Unload any kernels
- for kernel in self.kernels: spice.unload( kernel )
- def test_horizons(self):
- import horizons
The horizons module depends on connectivity to a JPL server. Can this test
be updated so the connection is not necessary?—
Reply to this email directly or view it on GitHubhttps://github.com//pull/12/files#r6639839
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it doesn't have the connection to JPL then we will need another SPK; it
could be small.
On Fri, Sep 27, 2013 at 8:18 PM, Brian Carcich drbitboy@gmail.com wrote:
It's more of an example application, it also used matplotlib.
maybe it does not belong in the tests directory.
On Fri, Sep 27, 2013 at 5:17 PM, Roberto Aguilar <notifications@github.com
wrote:
...
The horizons module depends on connectivity to a JPL server. Can this
test be updated so the connection is not necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay. I think samples are great actually. Maybe make a samples
directory at the project root. Unless the SPK is massive I think having some data files in the repo makes sense to provide sample usage.
@drbitboy thanks for the patch; especially adding tests, they are much needed! I'll leave it to @michaelaye to verify the change when he is well. |
Is there a way to have getfov_c included now? I hacked it in my fork with some hardcoded cheating (see my fork), but do we now have a clean way to add it? |
Without looking, i assume the issue is the length input arguments of output That way it is data-driven, stored in one place, and easily fixed if the On Tue, Oct 15, 2013 at 12:42 AM, K.-Michael Aye
|
yeah, I looked at getfov_c; it's a real gem but a perfect example. So a global dict something like this: lengthDict = dict( getfov=[ ["shapelen", "shape"], "framelen (ignore my ["...","..."] vs. "... ...".split() nonsense - I find the or even lengthDict = dict( getfov=dict( shape=True, frame=True, bounds=["room",3] where var=True is shorthand for var="varlen" Also, bounds=["room",3] could be "room*3" (for eval()), or even just that plus some more code to check and process that dict should do it: On Tue, Oct 15, 2013 at 2:40 PM, Brian Carcich drbitboy@gmail.com wrote:
|
Only 56 likely SpiceChar outputs: % grep 'SpiceChar [] [a-zA-Z0-9]_ _[,)]' ~/cspice/src/cspice/__c.c| so may 100 or so total. -b On Tue, Oct 15, 2013 at 2:59 PM, Brian Carcich drbitboy@gmail.com wrote:
|
Ok, we need to decide how to proceed with the tests, guys. @drbitboy Brian obviously did a hell of a job to improve a lot of things, but
Can we either have a list of the kernels that need to be there or to change the tests in a way that they can run off-line? Another question, to Brian, should we do these changes before merging this pull request, or would you prefer not to spend so much time on it, merge it to an extra branch, improve things there and then merge it to master later? Let me know what you guys think. |
With regards to tests, anybody with access to the repository (the world) should be able to run tests. The test suite should be self-contained such that everything needed to run the tests is in the repository. Of course, with the exception of any third party libraries necessary, for example, Python's mock library, which instead should be listed in the project's As in one of my previous comments, one of the tests connected directly to a JPL server. That test should be refactored to eliminate this requirement so that folks outside the lab can run the tests too. Test data files should also be included, but everyone should be mindful not to bloat the repository with massive data files just to run simple tests. i.e. kernels needed to run the tests should be in the repository. Hope this helps. |
how about auto-download of required files? |
The question then becomes from where? On Wednesday, October 16, 2013, K.-Michael Aye wrote:
|
Isn't the SPICE NAIF server world-wide reachable? |
yes, and so is horizons, which is where the other test data come from On Wed, Oct 16, 2013 at 7:10 PM, K.-Michael Aye notifications@github.comwrote:
|
What's the retention policy on kernel files on those systems? If the files ever go away the tests will break. This is a healthy discussion and I'm glad we're having it. Can you explain the reluctance towards keeping test files in the repo? |
reluctance on size. i've rarely seen a file disappear, although daily CKs and SPKs will be but as long as we choose carefully (e.g. -b On Thu, Oct 17, 2013 at 12:46 AM, Roberto Aguilar
|
Actually I totally love your hackorz trick of doing |
mkwrapper.py Special code to get gcpool working; should work for others setup.py My build stopped working (why?), this fixed it
Solves a KeyError in recent versions of Mac OSX
Update getnaifspicetoolkit.py
include and library files are handled in module1 below
PyObject*
} |
this library is not being maintained anymore, you should use SpiceyPy instead: https://github.com/AndrewAnnex/SpiceyPy |
added Py_INCREF(Py_None) that was missing when returning Py_None