Commit graph

575 commits

Author SHA1 Message Date
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
Olly Betts
28e277f8c5 Fix typo "the the" -> "the"
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12285 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-10-19 06:31:31 +00:00
Olly Betts
c636855bcc [Python] Allow reinitialisation to work with an embedded Python
interpreter (patch from Jim Carroll in SF#3075178).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12235 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-10-01 04:01:08 +00:00
William S Fulton
36c2e97a1c Add std_shared_ptr.i and document shared_ptr library
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12077 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-01 19:03:55 +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
William S Fulton
3dfac02269 shared_ptr improvements so the proxy class does not need to be specified - SWIG_SHARED_PTR macro deprecated and replaced by %shared_ptr
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12037 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-22 23:57:19 +00:00
William S Fulton
12cfc251e4 Fix #2408232. Improve shared_ptr and intrusive_ptr wrappers for classes in an inheritance hierarchy. No special treatment is needed for derived classes, the SWIG_SHARED_PTR_DERIVED macro is deprecated.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12036 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-22 22:49:47 +00:00
William S Fulton
2535297efb minor formatting change
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11995 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-04-23 06:44:47 +00:00
William S Fulton
f9caea4b29 Add SWIG_DIRECTOR_CAST recently added to languages needing it
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11989 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-04-10 00:04:28 +00:00
William S Fulton
bdb136d611 Change typemap matching rules for the default type (SWIGTYPE) to follow template partial specialization type deduction. Fixes some containers of const pointers. SWIGTYPE*& typemps removed and replaced with SWIGTYPE *const&.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11958 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-04-01 18:26:37 +00:00
William S Fulton
15dfd9f0e7 minor formatting change
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11956 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-03-31 19:14:34 +00:00
William S Fulton
4308dd03cf SWIG license change - The Examples and Lib move to a very permissive license in the LICENSE file, removing the BSD license restrictions as agreed by committers since it was inadvertently introduced. Remove some examples where the impact of the license change is not clear.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11874 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-27 23:26:02 +00:00
William S Fulton
1de9c8b27f Add a few comments about the smart pointer implementation
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11828 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-01-23 15:30:42 +00:00
Olly Betts
70e8072612 [Python] Fix potential memory leak in initialisation code for the generated
module.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11717 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-11-02 06:31:45 +00:00
William S Fulton
719cfe68bf add some useful info for assert around SWIG_CAST_NEW_MEMORY
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11686 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-09-07 06:17:40 +00:00
William S Fulton
3932d02a2a fix SWIG naming convention
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11663 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-21 00:25:11 +00:00
William S Fulton
3076cbcdc0 Fix seg fault in SWIG_Python_ConvertFunctionPtr() for invalid values
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11537 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-12 00:22:47 +00:00
Olly Betts
0d539c8048 [Python] Add missing locks to std::map wrappers. Patch from
Paul Hampson in SF#2813836.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11465 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-29 03:34:22 +00:00
Olly Betts
734dafd405 Fix grammar in comment and error message.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11352 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-03 11:58:37 +00:00
Haoyu Bai
6c96148de5 fixed the wrong pointer value returned by SwigPyObject_repr()
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11213 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-05-14 15:58:09 +00:00
Olly Betts
feb1e6de94 Remove two accidentally committed debug fprintf() calls.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11197 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-04-29 23:59:06 +00:00
Olly Betts
1c91a4a9b9 int -> Py_ssize_t to fix 64 bit Python 3 failure to compile generated code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11195 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-04-29 13:43:23 +00:00
Haoyu Bai
e8aa9d8703 fix of unclear comment regarding Python 3 tp_compare removal
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11194 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-04-29 12:05:33 +00:00
Olly Betts
6d8ea4f7fa Fix comment typos
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11193 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-04-29 12:00:38 +00:00
Haoyu Bai
a863d31e81 Fix the memory leak related to Python 3 unicode and char * conversion.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11160 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-19 15:26:57 +00:00
William S Fulton
f630911352 remove debug comment
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11158 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-19 00:04:28 +00:00
William S Fulton
51a723aa85 Add possibility of using when using shared_ptr and wrapping pointers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11157 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-18 23:54:09 +00:00
William S Fulton
e8e8527642 vc++ warning fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11152 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-16 17:42:30 +00:00
Haoyu Bai
94a788c30f Remove an nonsense Py_INCREF.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11151 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-16 11:10:29 +00:00
Haoyu Bai
caa6f2b9fa Fixes to support Python 3.0.1 and higher.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11143 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-02 17:56:29 +00:00
Haoyu Bai
c74c467a09 Fix SF#2637352, move declaration of SWIG_module before the call of SWIG_Python_FixMethods, since some C compiler don't allow declaration in middle of function body.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11140 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-02-28 14:02:02 +00:00
Haoyu Bai
03e840f3ec changed the mapped 'SIZE' of buffer interface from the length of raw buffer to number of items in the buffer. So it would be easier to use with type other than 'char'
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11125 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-02-10 14:21:43 +00:00
William S Fulton
a4906b8182 remove gcc warning when using -Wunreachable-code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11117 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-02-07 23:44:12 +00:00
William S Fulton
3f03858862 minor formatting
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11044 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-08 23:29:33 +00:00
William S Fulton
e2679a6fd3 correct return type for PyUnicode_GetSize
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11041 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-08 19:20:51 +00:00
Haoyu Bai
8f84447860 Commited SF#2158938: change all SWIG symbols start with Py to a new name.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10961 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-12-03 18:43:44 +00:00
William S Fulton
93f0390322 UTL - Fix some incorrect acceptance of types in the STL, eg a double * element passed into a vector<int *> constructor would be accepted, but the ensuing behaviour was undefined. Now the type conversion correctly raises an exception
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10958 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-11-28 23:35:46 +00:00
William S Fulton
7ec3c4ae81 minor typo and formatting improvements
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10868 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-09-18 20:16:50 +00:00
William S Fulton
6588eb61f4 pointer display correction
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10867 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-09-18 20:16:03 +00:00
Haoyu Bai
3d8ddfc442 Merged the Python 3.0 support branch. The merging progress is not so smooth, so hope this commit won't make anything broken.
This is the (incomplemete) log produced by svnmerge.py:

Merged revisions 10405-10409,10420-10422,10426,10438,10445,10451,10454-10465,10467,10473-10475,10485,10488-10489,10493-10495,10497,10509-10510,10513-10514,10517,10520,10525,10528-10529,10533-10535,10554-10557,10570,10573,10593,10614,10666-10669,10673,10678,10687,10690,10704-10706,10731,10744,10750-10752,10755,10759,10770,10775-10776,10813,10819 via svnmerge from 
https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10834 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-09-11 17:18:07 +00:00
Richard Boulton
761ef2b98f [Python] Commit patch #2089149: Director exception handling mangles
returned exception.  Exceptions raised by Python code in directors
are now passed through to the caller without change.  Also, remove
the ": " prefix which used to be added to other director exceptions
(eg, those due to incorrect return types).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10827 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-09-10 10:08:21 +00:00