Commit graph

106 commits

Author SHA1 Message Date
William S Fulton
bdda0a0829 Python - fix compilation error when using -extranative and -builtin.
Closes #816
2016-11-02 22:00:54 +00:00
William S Fulton
96fae38be2 Fix Python pickling and metaclass for builtin wrappers
The metaclass (SwigPyObjectType) for SWIG objects was not defined in
a way that let importlib successfully import the Python wrappers.
The pickle module failed because it couldn't determine what module the
SWIG wrapped objects are in.

I've changed the definition of SwigPyObjectType using more normal
builtin type definitions. There are still some open questions:
- None of the builtin types, like swig_static_var_getset_descriptor and
  SwigPyObject are added into any module. No call to PyModule_AddObject
  is made, so isinstance cannot be used for any wrapped type, all of
  which are derived from SwigPyObject.

Closes #808
2016-10-14 07:30:44 +01:00
William S Fulton
f778ee19df Python builtin hashfunc closure fix
If the wrong return type in the hash function was used, an error:
  SystemError: error return without exception set
was raised

Add some tests for testing builtin slots
2016-08-18 07:10:54 +01:00
William S Fulton
7aa5f07dfd Fix 'make partialcheck-test-suite'
Python pep8 should not be run as part of partialcheck
Javascript should also only invoke SWIG during partialcheck
2016-03-18 18:56:55 +00:00
Alec Cooper
17a4143dd0 Tests for Python Bytes/Unicode distinction 2016-02-04 21:07:40 -05:00
Brian Cole
a863e98874 Extended zjturner's changes to encompass all function dispatch and use PyErr_WriteUnraisable to handle exceptions during __del__.
Also added test cases for the unnamed temporary destruction that is throwing assertions in Python 3.5.
2015-12-15 08:39:55 -07:00
Olly Betts
aa0e781034 Suppress pep8 E731 (lambda assignment)
This is a new warning in pep8 1.6.0 which breaks our testsuite.
2015-09-04 12:50:52 +12:00
William S Fulton
ca64b06229 Consistent quoting in Makefile 2015-08-21 22:48:34 +01:00
William S Fulton
fa282b3540 Improve Python docstring indentation handling
SWIG-3.0.5 and earlier sometimes truncated text provided in the docstring
feature.
SWIG-3.0.6 gave a 'Line indented less than expected' error instead of
truncating the docstring text.
Now the indentation for the 'docstring' feature is smarter and is
adjusted so that no truncation occurs.

Closes #475
2015-07-30 08:26:08 +01:00
Olly Betts
822b2355c0 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.
2015-06-29 22:12:38 +12:00
William S Fulton
0f94ea9208 Example and test-suite makefile tidy up
Python output is less verbose if pep8 is not available (tweaks for patch #416)
2015-05-11 00:09:40 +01:00
William S Fulton
9d87b9f099 Revert introduction of python:defaultargs feature
See issue #294
2015-01-12 21:35:47 +00:00
William S Fulton
38ba81811e Fix Python default argument handing broken since swig-3.0.3
Default values are no longer generated as Python code by default.
They must be explicitly turned on using the "python:defaultargs" feature.

Closes #294
Closes #296

The problems in these two issues when "python:defaultargs" is turned
on still need to be fixed and should be addressed in separate patches.
The important thing is the default code generation is now fixed.
2015-01-09 00:34:17 +00:00
Vadim Zeitlin
e12a1d7671 Ignore E402 (import not on top of file) PEP8 error.
Travis uses the latest pep8 sources from Git and since

f3a12babd4

this error is given for all Python files generated by SWIG with -builtin
option.
2014-12-16 17:28:27 +01:00
Vadim Zeitlin
cb53e3063b Add PEP8_FLAGS variable to the test suite Python makefile.
Put pep8 options into this variable to avoid repeating them twice.

No real changes.
2014-12-16 17:28:25 +01:00
William S Fulton
bfde148887 The kwargs feature no longer turns on compactdefaultargs for languages that don't support kwargs.
Affects all languages except Python and Ruby.

Closes #242
2014-10-21 07:34:51 +01:00
William S Fulton
49038b30b7 Bypass Python tests not supported by -builtin
Builtin types can't inherit from pure-python abstract bases
2014-10-07 20:58:40 +01:00
William S Fulton
ab79441151 Bypass Python tests not supported by -builtin
The base class is needed for the builtin class hierarchy, like many
other languages
2014-10-07 20:58:40 +01:00
William S Fulton
185d65895f Bypass Python tests not supported by -builtin
There are a number of autodoc comment differences when using -builtin.
Some of which might need fixing, but for now we'll accept them as they
are.
2014-10-07 20:58:39 +01:00
William S Fulton
afcd61388a Bypass Python tests not supported by -builtin
The old static syntax (e.g., dc.new_A() rather than dc.A()) is not
supported with -builtin
2014-10-07 20:58:39 +01:00
William S Fulton
9f1b051c16 Bypass Python tests failing with -builtin
Reverse operators not supported in builtin types
2014-10-07 20:58:39 +01:00
William S Fulton
bbad7f96ab Bypass Python tests throwing base classes as exceptions for -builtin
Throwing builtin classes as exceptions is not supported
2014-10-07 20:58:30 +01:00
William S Fulton
34eb4b15d3 Add some more Python -builtin tests that don't work 2014-10-02 19:08:58 +01:00
Julien Schueller
11b5a61879 Check multi-module examples. Dont use sed. 2014-06-10 08:59:55 +02:00
Julien Schueller
7a4cef998c Enable pep8 check 2014-06-07 13:10:27 +02:00
Karl Wette
b8026cc02f Fix cleaning of Python runme.py scripts for in-source-tree builds 2014-05-29 14:40:50 +02:00
Karl Wette
cc0738bbda Fully clean Python examples and test-suite 2014-05-29 02:29:27 +02:00
William S Fulton
2b5499a262 Slight simplification of test-suite build for new out-of-source changes
Provide default SRCDIR and SCRIPTDIR variables in common.mk and override
only where needed.
2014-05-15 23:11:07 +01:00
Karl Wette
f574a34155 Allow examples and test-suite to be built out of source tree
- Examples/Makefile.in rules use SRCDIR as the relative source directory

- ./config.status replicates Examples/ source directory tree in build
  directory, and copies each Makefile to build directory, prefixed with
  a header which sets SRCDIR to source directory

- Examples/test-suite/.../Makefile.in set SRCDIR from Autoconf-set srcdir

- Examples/test-suite/errors/Makefile.in needs to filter out source
  directory from SWIG error messages

- Lua: embedded interpreters are passed location of run-time test

- Python: copy run-time scripts to build directory because of 2to3
  conversion; import_packages example copies __init__.py from source
  directory; test-suite sets SCRIPTDIR to location of run-time tests

- Javascript: binding.gyp renamed to binding.gyp.in so that $srcdir
  can be substituted with SRCDIR; removed './' from require() statements
  so that NODE_PATH can be used to point Node.js to build directory
2014-05-11 23:21:10 +02:00
Karl Wette
d5b765d388 Whitespace cleanup of all Makefiles*
- some of the %.clean rules in the test-suite Makefiles were using a single tab
  as an empty rule, dangerous! I've replaced these with the safer '@exit 0'.
2014-05-02 20:06:11 +02:00
Paweł Tomulik
c9295401da clean all .py files generated by python-test-suite
Closes #49
2013-06-04 22:23:53 +01:00
William S Fulton
72f2d8ac8f Fix Python test-suite makefile to show which tests have runtime tests (for Python 3). 2013-05-27 10:24:02 +01:00
William S Fulton
fd93beadf4 Fix 'make check-python-test-suite PY3=1' and -j (make jobs) 2013-05-25 22:29:18 +01:00
William S Fulton
f00a41093c As std_list.i is not available in many language, put this python specific test just in Python makefile
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12986 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-14 21:11:19 +00:00
William S Fulton
ff6b144f30 Fix Python directorin typemap for PyObject *
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12760 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-07-16 14:43:04 +00:00
William S Fulton
58e74e8675 Rename python_kwargs testcase to kwargs_feature. Add kwargs_feature to Ruby and fix Ruby warnings when using kwargs feature. Add %kwargs macro for Ruby
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12739 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-06-13 17:38:08 +00:00
William S Fulton
a47da97ffe rename python_autodoc testcase to autodoc for use with all languages (note it was once called autodoc.i in the python subdirectory)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12728 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-06-03 06:07:46 +00:00
William S Fulton
6e87b73c40 reorder tests alphabetically
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12665 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-14 00:11:40 +00:00
Stefan Zager
a52612f845 Fixed PyGetSetDescr for python3.2.
Fixed memory management in special_variable_macros test.

Don't define asdict() for multimap.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12659 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-08 06:54:21 +00:00
Ian Lance Taylor
045861e9c5 Rename varargs_typemap test case to python_varargs_typemap, and move
to Python Makefile.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12650 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-02 21:11:15 +00:00
Stefan Zager
e629b192e2 Fixed the argument counts passed to SWIG_Python_UnpackTuple for varargs.
Removed obsolete methods from std_map.i and pyiterators.swg.

Added builtin-check target to python test suite Makefile.

Fixed using_namespace_loop.i so that the generated wrappers will compile.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12644 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-04-29 18:25:16 +00:00
Stefan Zager
4b9ef9bc99 Bug 1498929: Access to member fields of map elements.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12643 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-04-25 21:12:33 +00:00
Stefan Zager
769f6648c8 Added test case for python richcompare operators.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12577 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-31 03:55:42 +00:00
Vadim Zeitlin
1f939323a4 Fix PYTHONPATH value when running Python tests outside source directory.
PYTHONPATH needs to include the current directory and not (just) the source
directory as the SWIG-generated files are produced here and not under the
source directory when the top build directory is different from it.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12166 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-07-22 16:59:08 +00:00
William S Fulton
9d6e826bd8 Test std::map in all languages
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11658 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-20 23:21:07 +00:00
William S Fulton
b5de6aabe5 more efficient python test-suite clean
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11591 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-16 20:02:22 +00:00
Miklos Vajna
451f71d7b1 remove unnecessary extra semicolons in the tesuite
Basically just style cleanup, "fi;" or "fi; \" -> "fi".

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11523 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-09 22:52:08 +00:00
William S Fulton
56c5b52c1d remove unnecessary extra shells being spawned in the test-suite
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11522 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-09 22:39:51 +00:00
William S Fulton
9064b08651 better way to provide custom commandline options for individual tests
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11356 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-03 22:23:43 +00:00
William S Fulton
267ffd6ce6 move std::multimap tests from li_std_map.i into new li_std_multimap.i
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11210 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-05-12 17:24:01 +00:00