Improve handling of whitespace in %pythoncode
Previously SWIG looked at the indentation of the first line and removed that many characters from each subsequent line, regardless of what those characters were. This was made worse because SWIG's preprocessor removes any whitespace before a '#'. Fixes github issue #379, reported by Joe Orton.
This commit is contained in:
parent
a8c6f9c9e2
commit
822b2355c0
10 changed files with 173 additions and 48 deletions
29
Examples/test-suite/python_pythoncode.i
Normal file
29
Examples/test-suite/python_pythoncode.i
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
%module python_pythoncode
|
||||
|
||||
// github issue#379 - these examples failed with 3.0.5 and earlier (at least as
|
||||
// far back as 1.3.37):
|
||||
|
||||
struct TYPE {
|
||||
%pythoncode %{
|
||||
def one():
|
||||
# Comment XXXX
|
||||
return 1
|
||||
%}
|
||||
};
|
||||
|
||||
%define %bar
|
||||
%pythoncode %{
|
||||
def one():
|
||||
# Comment XXXX
|
||||
return 1
|
||||
%}
|
||||
%enddef
|
||||
|
||||
struct TYPE2 {
|
||||
%bar
|
||||
};
|
||||
|
||||
%{
|
||||
struct TYPE { };
|
||||
struct TYPE2 { };
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue