Commit graph

311 commits

Author SHA1 Message Date
William S Fulton
5f6389ab31 Cosmetic Python changes and replace DOH types
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12608 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-04-04 20:13:14 +00:00
Stefan Zager
20cda0168e Eliminate warnings about empty case statements.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12604 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-04-03 19:44:46 +00:00
Stefan Zager
c95cc72454 Merged %pythonnondynamic fix
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12594 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-04-03 05:15:48 +00:00
Stefan Zager
90fe22acf7 Fix for METH_O and -compactdefaultargs, in two parts:
- Don't mark a method as METH_O if it has compactdefaultargs
  - In SWIG_Python_UnpackTuple, allow for a non-tuple 'args'.

Added compatibility for python versions 2.3 and 2.4.  These are only
partially supported; inheriting from wrapped types looks problematic.
Versions older that 2.3 are unlikely ever to work.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12590 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-04-02 21:40:00 +00:00
Stefan Zager
cd7fc2047b Factored some #ifdef noise out of the initialization function by adding
SwigPyBuiltin_SetMetaType.

For %import statements, move the runtime import out of SWIG_init and into the
.py file.  The reason for this is that the import must be executed within the
python execution frame of the module, which is true in the .py file, but *not*
true in the initialization function.  Had to re-order the .py file slightly
to put the 'import' statements at the top; that's necessary to make sure base
types from an imported module are initialized first.  If -builtin isn't used,
then the .py code is not re-ordered.

Added an explanation and workaround for the limitation that wrapped types are
not raise-able.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12585 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-04-01 19:35:30 +00:00
Stefan Zager
51ef340eed Converted rest of slot outputting to use printSlot.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12583 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-31 21:26:12 +00:00
Stefan Zager
f1cb5b7ca6 Bug fix: missing quotation mark on autodoc string
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12582 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-31 20:37:23 +00:00
Stefan Zager
bc200998b1 Added usage message for -builtin, and tweaked -builtin docs.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12574 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-30 19:51:22 +00:00
Stefan Zager
3d444101d1 A slew of changes based on William Fulton's code review.
- Fixed naming conventions; SwigPyBuiltin is used a lot
- Removed use of std::vector
- builtin.swg isn't included if -builtin isn't specified
- Changed many feature names to use a "python:" prefix
- Eliminated static vars in std_pair.i
- Eliminated C++-style comments (//)
- Enabled autodoc and docstring with -builtin
- Fixed non-ansi generated C code
- Detect and complain if two incompatible swig modules are loaded
- Removed argcargvtest_runme3.py, and fixed argcargvtest_runme.py
  so that 2to3 handles it better
- Removed anonymous namespaces
- Eliminated builtin_init typemaps; consolidated functionality into
  SWIG_Python_NewPointerObj
- Eliminate printf warnings from %U conversion character by switching
  to %S, which works just as well
- Fixed li_std_set_runme.py for python3, which returns set members in
  a different order from python2





git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12562 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-29 06:57:02 +00:00
Stefan Zager
93499e12af Merged trunk up to revision 12551
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12552 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-24 05:46:05 +00:00
William S Fulton
a63d456f8a Remove redundant code highlighted by warnings in gcc-4.6
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12536 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-14 07:22:08 +00:00
William S Fulton
5f4d8c6112 Fix SF #3194294 - corner case bug when 'NULL' is used as the default value for a primitive type parameter in a method declaration.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12525 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-09 22:31:08 +00:00
William S Fulton
d008ab2bc6 Remove local mode editor setting - editors should be set up correctly for the whole of SWIG
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12517 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-03 19:42:43 +00:00
William S Fulton
cca5a76d91 Minor rewrites of some recent builtin changes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12516 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-03 19:39:48 +00:00
William S Fulton
908c37cef8 Coding style fixes for Python builtin changes added on the szager-builtin branch
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12515 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-03 19:34:18 +00:00
William S Fulton
084a3c7205 Run make beautify on python.cxx to fix code style to match style on szager-builtin branch
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12514 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-03 19:33:25 +00:00
William S Fulton
0a5ca9ccd6 Fix potential name clash in director class
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12501 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-20 13:47:14 +00:00
Stefan Zager
ea4cab8e4c A small unicode fix.
A partial fix for the problem with overloading, varargs,
and fastunpack: with this fix, the wrappers will compile.
However, they still contain faulty logic and unreachable
code in the dispatch function.

The comprehensive fix would have to be in overload.cxx.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12465 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-17 05:52:18 +00:00
Stefan Zager
b5889b8b0f Unicode fixes for python3.
Added a few more closure types.

Guard against operator overloads outside of a class declaration.

Incorporate fix for patch #3171793.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12446 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-09 08:59:09 +00:00
Stefan Zager
62fef1bf99 python3 support; passes all regressions.
Adding argcargvtest_runme3.py, because 2to3 can't handle it.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12425 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-03 07:21:37 +00:00
Stefan Zager
00b5fa9c47 Now passes regressions with '-O -builtin'. Almost all changes
are to accomodate -fastunpack.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12423 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-02 10:28:46 +00:00
Stefan Zager
288c37f5bf Regressions pass! With a few tweaks for unsupported features, primarily:
- Throwing wrapped types as exceptions is unsupported.
- Reverse comparison operators (e.g., __radd__) aren't supported.

Rationalized destructors.

Finished std::map implementation.  Required fixes to typecheck for
SWIGTYPE* const&.

Need a little special handling of the swig_type_info for SwigPyObject
when multiple modules are loaded.

Fall back to SwigPyObject_richcompare if there's no operator overload.

"memberget" and "memberset" attrs are applied strangely; work around
them.

Added 'this' attribute.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12415 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-30 03:17:28 +00:00
Stefan Zager
d4b8048e9a Stopped using template class SwigPyBuiltin, because it caused problems
when two typedef-equivalent types are wrapped as separate classes.

Now failing on refcount.cpptest.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12392 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-12 00:43:01 +00:00
Stefan Zager
8ac54d1d5e Director issues should be mostly clean now.
Refactored some type initialization out of SWIG_init.

Use __all__ attribute of module to define public interface.
This is necessary to make available symbols starting with '_'.

Now dying on li_boost_shared_ptr.  Looks like it's gonna be ugly.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12373 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-06 00:09:25 +00:00
Stefan Zager
b77b64944b Static member variables are working.
Fixed some corner cases with protected members of director classes.

Now dying in director_finalizer.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12371 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-05 08:35:28 +00:00
Stefan Zager
3a86f2068f Added support for multiple inheritance. Not as hard as I feared.
Apply operator features to both the operator name, and the renamed
"__*__" method.  That's the only way to hit all corners.

Added support for %pythonnondynamic.  I believe this implementation
is more correct than the existing implementation, but I'm still
waiting for an adjudication on the behavior of the python_nondynamic
test.

Current list of unsupported features that require minor tweaks
to the test suite:

- 'this' member variable is obsolete.

- No support for reversible operator overloads (e.g., __radd__).  You
can still support this:

a = MyString("foo")
b = "bar"
c = a + b

... but you can't do this:

a = "foo"
b = MyString("bar")
c = a + b

With the tweaks, the test suite now fails on python_nondynamic.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12353 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-12-20 23:35:18 +00:00
Stefan Zager
dd465f9588 Finished std::pair and std::map support.
li_std_pair_extra test fails, because the _runme.py uses the
secret 'this' member variable, which doesn't exist when the
-builtin option is used.  Seems like a flaw in the test.

Test suite now fails on li_std_string_extra, because static
member variables are not fully implemented.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12351 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-12-15 23:04:20 +00:00
Stefan Zager
8a7ad756d0 Added sequence and mapping support for builtin types.
Fixed object ownership in %pyswigbinoperator.

Test suite now fails on li_std_vector_extra.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12346 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-12-14 21:11:02 +00:00
Stefan Zager
b1682d4d80 Added support for operator overrides (PyNumberMethods) and
member variable access.

test suite now croaks on inplaceadd.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12345 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-12-14 00:08:45 +00:00
Stefan Zager
399ae62561 Basic director support (passes first few director tests). Now fails on iadd_runme, because member variable support is missing.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12340 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-12-08 21:57:27 +00:00
Stefan Zager
ee3a6623da First cut. Works for wrapping OpenAccess, but there's plenty
left to do.

Currently, the test suite hurls at director_stl.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12332 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-12-07 21:50:00 +00:00
William S Fulton
77b87aa919 typo fix in help message
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12288 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-11-11 19:30:44 +00:00
Olly Betts
5437d71d73 [Python] Improve error message given when a parameter of the wrong
type is passed to an overloaded method (SF#3027355).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12229 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-09-27 01:16:29 +00:00
William S Fulton
1e051820ec Line/file reporting corrections for warnings: WARN_RUBY_MULTIPLE_INHERITANCE, WARN_TYPE_UNDEFINED_CLASS, WARN_MODULA3_MULTIPLE_INHERITANCE
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12225 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-09-21 06:07:06 +00:00
William S Fulton
95a3eb5a7d code style: fix inconsistent NULL pointer comparisons
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12137 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-17 23:49:12 +00:00
William S Fulton
bb41eeb343 Fix potential name clashes with symbols in the Director class
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12062 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-27 20:55:24 +00:00
Haoyu Bai
2450c4b108 fix regression of Python constructor renaming introduced by py3k work
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11997 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-04-25 14:07:14 +00:00
William S Fulton
a743d54665 Fix segfault when using Python's -threads options and exceptions are thrown
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11980 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-04-08 06:46:18 +00:00
William S Fulton
1253657bb4 Add improved namespace support - the nspace feature, working for Java only at the moment.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11896 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-03-04 21:27:23 +00:00
William S Fulton
cb64f65bae SWIG license change - Source moves to GPLv3
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11876 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-27 23:53:33 +00:00
William S Fulton
f6ce153f8f Remove -dirvtable from the optimizations included by -O as it this option currently leads to memory leaks
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11872 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-27 15:53:21 +00:00
William S Fulton
83bd820285 Add typemaps used debugging option (-debug-tmused). Fix missing file/line numbers for typemap warnings and in the output from the -debug-tmsearch/-debug-tmused options
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11802 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-01-04 19:33:52 +00:00
William S Fulton
136bd5175a Python and Tcl - improve error message for missing constructor when the reason is because the class is abstract.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11518 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-08 22:56:10 +00:00
Olly Betts
5215d9227a [Python] Fix indentation so that we give a useful error if the
module can't be loaded.  Patch from Gaetan Lehmann in SF#2829853.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11485 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-31 12:09:25 +00:00
William S Fulton
8ec7035eee improve WARN_LANG_OVERLOAD_KEYWORD warning by giving the name of the overloaded function
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11421 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-18 22:34:33 +00:00
William S Fulton
54b87bdd7d remove extra lookup of directorout typemap
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11246 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-06-05 17:19:29 +00:00
Olly Betts
38f00d3544 [Python] Don't attempt to acquire the GIL in situations where we
know that it will already be locked.  This avoids some dead-locks
with mod_python (due to mod_python bugs which are apparently
unlikely to ever be fixed), and results in smaller wrappers which
run a little faster (in tests with Xapian on x86-64 Ubuntu 9.04,
the stripped wrapper library was 11% smaller and ran 2.7% faster).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11192 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-04-29 09:35:58 +00:00
Haoyu Bai
5d64541c44 Fix SF#2583160. Make swig_import_helper() in shadow wrapper able to deal with the case that module already imported at other place.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-01 09:37:21 +00:00
William S Fulton
efa11dee52 add new %begin directive for inserting code at top of wrapper file
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11133 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-02-20 07:52:24 +00:00
Haoyu Bai
afd67f8c67 Fix SF#2552488: indentation adjust of %pythonappend and %pythonprepend
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11100 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-31 14:37:54 +00:00