44 lines
1.9 KiB
Plaintext
44 lines
1.9 KiB
Plaintext
|
This patch makes a number of changes to the SWIG python module.
|
||
|
|
||
|
1. Add -apply option, and change the default code output to use the
|
||
|
foo(*args, **kw) calling syntax instead of using apply(). If the
|
||
|
-apply option is given then code is generated as before. This is
|
||
|
very similar to Patch #737281 but the new -modern option makes the
|
||
|
second half of that patch unnecessary so it is not included here.
|
||
|
|
||
|
2. Add -new_repr option. This is the same as my Patch #797002 which I
|
||
|
will mark as closed since it is no longer needed. When this new
|
||
|
option is used then the __repr__ methods that are generated for
|
||
|
proxy classes will be more informative and give details about the
|
||
|
python class and the C++ class.
|
||
|
|
||
|
3. Add %feature("addtofunc"). It allows you to insert one or more
|
||
|
lines of code inside the shadow method or function that is already
|
||
|
generated, instead of replacing the whole thing like
|
||
|
%feature("shadow") does. For __init__ it goes at the end, for
|
||
|
__del__ it goes at the begining and for all others the code
|
||
|
generated is expanded out to be like
|
||
|
|
||
|
def Bar(*args, **kwargs):
|
||
|
val = _module.Foo_Bar(*args, **kwargs)
|
||
|
return val
|
||
|
|
||
|
and the "addtofunc" code is inserted just before the return
|
||
|
statement. If the feature is not used for a particular method or
|
||
|
function then the shorter code is generated just like before.
|
||
|
|
||
|
4. A little bit of refactoring to make implementing addtofunc a little
|
||
|
easier.
|
||
|
|
||
|
5. Added a -modern command-line flag that will cause SWIG to omit the
|
||
|
cruft in the proxy modules that allows it to work with versions of
|
||
|
Python prior to 2.2. The result is a simpler, cleaner and faster
|
||
|
python proxy module, but one that requires Python 2.2 or greater.
|
||
|
For most of us this requirement is easy to live with!
|
||
|
|
||
|
|
||
|
I've been using and greatly benefiting from all these features with
|
||
|
wxPython for the last few weeks and have had no problems.
|
||
|
|
||
|
This patch depends upon Patch #829317.
|