[C++-SIG] help with CXX-4.2 and add_keyword_method

Barry Scott barry at scottb.demon.co.uk
Fri Apr 28 21:43:48 CEST 2000


There is a bug in the keyword template. I got the types of the call back handlers wrong
and the C++ compiler is rightly very upset.

I have fixed the problem and added a test to the demo software. This works well under
Windows with Visual C++ 6.0.

I have seen this compile clean under G++ 2.95.2 on FreeBSD. But it does not run because
of undefined symbol "cout" (which should not be used as we use std::cout everywhere).

Attached are two files:

Demo\example.cxx adds a test function "kw" to the Demo.
Include\CXX_Extensions.h contains the fix to correctly support keyword functions.

Example output:

Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import example
>>> example.kw
<built-in method kw of tuple object at 8285d8>
>>> example.kw.__doc__
'kw()'
>>> example.kw('fred',12,name='barry',size='big',test=1)
Called with 2 normal arguments.
and with 3 keyword arguments:
    size
    name
    test
0
>>>

		BArry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.cxx
Type: application/octet-stream
Size: 8935 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20000428/977ee7db/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CXX_Extensions.h
Type: application/octet-stream
Size: 19216 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20000428/977ee7db/attachment-0001.obj>


More information about the Cplusplus-sig mailing list