Thread: [Pyobjc-dev] New test in Foundation
Brought to you by:
ronaldoussoren
From: Bill B. <bb...@co...> - 2002-10-23 14:58:00
|
I added a test_paths.py suite to Foundation to test the NSPathUtilities APIs. The NSSearchPathForDirectoriesInDomains() function is causing a bus error, at the moment: class TestSearchPaths( unittest.TestCase ): def testSearchPaths( self ): self.assert_( NSSearchPathForDirectoriesInDomains( NSAllLibrariesDirectory, NSAllDomainsMask, NO ), "NSSearchPathForDirectoriesInDomains() failed to return anything." ) It appears that the auto-generated wrappers are not invoking PyArg_ParseTupleAndKeywords() correctly in that the list of variables to parse the args into are passed by value, not by reference. For example... if (PyArg_ParseTupleAndKeywords(args, kwds, "iii:NSSearchPathForDirectoriesInDomains", keywords, objc_directory, objc_domainMask, objc_expandTilde) < 0) return NULL; ... the three objc_* should all be prefixed by an &, correct? I had a look at scripts/func_* and wasn't entirely certain how to re-run the scripts once modified. Gdb session follows.... b.bum --- [bumbox:~/bbum-developer/sourceforge/pyobjc] bbum% gdb python GNU gdb 5.1-20020408 (Apple version gdb-231) (Tue Aug 13 21:37:39 GMT 2002) .... Reading symbols for shared libraries .... done (gdb) r Lib/Foundation/test/test_paths.py Starting program: /usr/bin/python Lib/Foundation/test/test_paths.py [Switching to process 17312 thread 0xb03] ... Program received signal EXC_BAD_ACCESS, Could not access memory. 0x0000796c in PyArg_VaParse () (gdb) bt #0 0x0000796c in PyArg_VaParse () #1 0x00007470 in PyArg_VaParse () #2 0x00008b60 in PyArg_ParseTupleAndKeywords () #3 0x0000872c in PyArg_ParseTupleAndKeywords () #4 0x0080f340 in objc_NSSearchPathForDirectoriesInDomains (self=0x0, args=0x9d840, kwds=0xbfffde20) at Modules/Cocoa/_Fnd_Functions.inc:980 #5 0x00045930 in PyObject_Call () #6 0x0005df64 in PyEval_GetFuncDesc () #7 0x0005b1f8 in PyEval_EvalCode () #8 0x0005c634 in PyEval_EvalCodeEx () #9 0x0005db9c in PyEval_GetFuncDesc () #10 0x0005b314 in PyEval_EvalCode () #11 0x0005c634 in PyEval_EvalCodeEx () #12 0x0006d870 in PyFunction_SetClosure () #13 0x00045930 in PyObject_Call () #14 0x00056d74 in PyMethod_New () #15 0x00045930 in PyObject_Call () #16 0x000562cc in PyInstance_New () #17 0x00045930 in PyObject_Call () #18 0x0005df64 in PyEval_GetFuncDesc () #19 0x0005b32c in PyEval_EvalCode () #20 0x0005c634 in PyEval_EvalCodeEx () #21 0x0006d870 in PyFunction_SetClosure () #22 0x00045930 in PyObject_Call () #23 0x00056d74 in PyMethod_New () #24 0x00045930 in PyObject_Call () #25 0x000562cc in PyInstance_New () #26 0x00045930 in PyObject_Call () #27 0x0005df64 in PyEval_GetFuncDesc () #28 0x0005b32c in PyEval_EvalCode () #29 0x0005c634 in PyEval_EvalCodeEx () #30 0x0006d870 in PyFunction_SetClosure () #31 0x00045930 in PyObject_Call () #32 0x00056d74 in PyMethod_New () #33 0x00045930 in PyObject_Call () #34 0x000562cc in PyInstance_New () #35 0x00045930 in PyObject_Call () #36 0x0005df64 in PyEval_GetFuncDesc () #37 0x0005b32c in PyEval_EvalCode () #38 0x0005c634 in PyEval_EvalCodeEx () #39 0x0005db9c in PyEval_GetFuncDesc () #40 0x0005b314 in PyEval_EvalCode () #41 0x0005c634 in PyEval_EvalCodeEx () #42 0x0005db9c in PyEval_GetFuncDesc () #43 0x0005b314 in PyEval_EvalCode () #44 0x0005c634 in PyEval_EvalCodeEx () #45 0x0006d870 in PyFunction_SetClosure () #46 0x00045930 in PyObject_Call () #47 0x00056d74 in PyMethod_New () #48 0x00045930 in PyObject_Call () #49 0x0005d838 in PyEval_CallObjectWithKeywords () #50 0x000527c0 in PyInstance_New () #51 0x00045930 in PyObject_Call () #52 0x0005df64 in PyEval_GetFuncDesc () #53 0x0005b32c in PyEval_EvalCode () #54 0x0005c634 in PyEval_EvalCodeEx () #55 0x00058a80 in PyEval_EvalCode () #56 0x00027e90 in PyRun_FileExFlags () #57 0x00026ef4 in PyRun_SimpleFileExFlags () #58 0x000069f0 in Py_Main () #59 0x00002970 in start () #60 0x000027f0 in start () |
From: Ronald O. <ous...@ci...> - 2002-10-23 20:50:07
|
On Wednesday, Oct 23, 2002, at 16:57 Europe/Amsterdam, Bill Bumgarner wrote: > I added a test_paths.py suite to Foundation to test the > NSPathUtilities APIs. > > The NSSearchPathForDirectoriesInDomains() function is causing a bus > error, at the moment: [...] > hat the auto-generated wrappers are not invoking > PyArg_ParseTupleAndKeywords() correctly in that the list of variables > to parse the args into are passed by value, not by reference. For > example... > > if (PyArg_ParseTupleAndKeywords(args, kwds, > "iii:NSSearchPathForDirectoriesInDomains", keywords, objc_directory, > objc_domainMask, objc_expandTilde) < 0) return NULL; > > ... the three objc_* should all be prefixed by an &, correct? Corrrect. If fixed that script and reran 'scripts/cocoa_generator.py'. Afterwards I fixed a second problem: The functions were not marked as functions that accept keyword arguments, causing yet another bus error. Ronald |
From: Bill B. <bb...@co...> - 2002-10-23 21:13:43
|
BTW: Is there a way to express a dependency between the *.inc files and their respective .m file? I ask because I have often updated the .inc, forgotten to touch the .m, done a build and scratched my head for a sec until I realize that the .m didn't recompile... Excellent! Of the unit tests we have so far, only one is failing now (nothing new): ......E. ====================================================================== ERROR: testClassInvocation (__main__.TestMethodInvocation) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/objc/test/test_objc.py", line 44, in testClassInvocation self.assert_( objc.runtime.NSObject.description(), "Failed to invoke the +description method." ) TypeError: Missing self argument Very cool. Ahh.... cocoa_generator.py -- not func_builder.py. That was why my .inc files were tiny in comparison to the version in the repository. I'm going to try to work through testing of the collection bridging as that is a fairly major feature that could be the source of problems. b.bum On Wednesday, October 23, 2002, at 04:50 PM, Ronald Oussoren wrote: > Corrrect. If fixed that script and reran 'scripts/cocoa_generator.py'. > Afterwards I fixed a second problem: The functions were not marked as > functions that accept keyword arguments, causing yet another bus > error. |