Hi,
I compiled and ran the demo. The test seems to work okay, but fails for example.kw. Any thoughts?
Thanks much in adv,
Hoon,
---
C:\Python20\CXX>python
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import example as E
>>> dir(E)
['__doc__', '__file__', '__name__', 'a_constant', 'kw', 'r', 'sum', 'test']
>>> E.test()
Correctly caught CXX: type error.
Exception value: CXX: type error.
Exception traceback: None
Numbers: ok
String: ok
List: ok
Dict: ok
Tuple: ok
STL test: ok
Extension object test: ok.
Module test ok.
>>> dict = {'a':1, 'b':2}
>>> dict
{'b': 2, 'a': 1}
>>> E.kw(dict)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: CXX: type error.
>>> E.a_constant
3
P.S: The old example init does not work anymore?
void initexample()
{
// experimental initialization stuff
init_rtype();
example = new ExtensionModule("example");
example->add("sum", ex_sum, "sum(arglist) = sum of arguments");
example->add("test", ex_test, "test(arglist) runs a test suite");
example->add("r", r_new, "r(start,stop,stride)");
Dict d = example->initialize();
Object b(FromAPI(new r(1,10,2)));
d["a_constant"] = b.getAttr("c");
}
Logged In: YES
user_id=171902
The kw() example function fails unless you pass at least
one keyword argument:
E.kw(1, two=2)
works. But the source code for ex_keyword looks like it
should work even without keword args.
Logged In: YES
user_id=28665
Fixed in the current code. THe code needed to take account of
the keywords dict being a NULL poiinter.
NOte that E.kw( dict ) passes one param, a dict.
Maybe you wanted E.kw( a=1, b=2 ) ?