Commit graph

174 commits

Author SHA1 Message Date
William S Fulton
c7dca4e49f Merge branch 'sethtroisi-master'
* sethtroisi-master:
  [Minor Doc Fix] Fix Python struct example
2018-08-11 15:44:03 +01:00
William S Fulton
fd651ff4e2 Overloaded C++ function Python wrappers now raise a TypeError instead of NotImplementedError
Occurs when the types passed are incorrect. This change means
there is now consistency with non-overloaded function wrappers which have always
raised TypeError when the incorrect types are passed.

See issue #1293
2018-08-10 08:14:12 +01:00
Seth Troisi
3738dcc747
[Minor Doc Fix] Fix Python struct example 2018-08-09 12:54:15 -07:00
William S Fulton
e96316bf31 Fix seg fault using Python 2 invalid utf-8 strings and wstring
Fixes seg fault when passing a Python string, containing invalid utf-8 content,
to a wstring or wchar * parameter.  A TypeError is thrown instead, eg:

  %include <std_wstring.i>
  void instring(const std::wstring& s);

  instring(b"h\xe9llooo") # Python
2018-06-15 19:39:12 +01:00
William S Fulton
4079fb927b Python 3.7 support - deprecation of classes in the collections module
Change the base classes in the pyabc.i file to use the
collections.abc module instead of collections due to the deprecation
of the classes in the collections module in Python 3.7.
2018-06-12 21:05:07 +01:00
William S Fulton
ecf61f8e39 Restore Python 3.2/3.3 support 2018-06-12 08:02:23 +01:00
Olly Betts
a82c1b943b Drop support for Python 3.0 to 3.3
See #701.
2018-06-08 11:08:31 +12:00
Olly Betts
1198155083 Drop Python 2.6 support too
See #701.
2018-06-08 11:08:31 +12:00
Olly Betts
78c56168ab Update manual contents for removed Python section
I removed the section on classic classes in the previous commit,
but failed to update the contents list.
2018-06-08 11:08:31 +12:00
Olly Betts
7c034ead32 Remove special handling for Python < 2.6
See #701.
2018-06-08 09:34:48 +12:00
William S Fulton
33921666a1 Merge branch 'vadz-doxygen'
This is the Doxygen work begun in Google Summer of Code projects 2008
and 2012 and subsequently improved by numerous contributors.

* vadz-doxygen: (314 commits)
  Add changes entry for Doxygen support
  Add some missing doctype tyemaps
  Doxygen warnings cleanup
  Move doxygen warning numbers
  Add Python doxygen example
  Doxygen example
  Add Doxygen to include paths
  Doxygen source rename
  More merge fixes from doxygen branches
  Correct python example headers
  Correct source code headers
  Another merge fix from doxygen branches
  Java enums output format fixes
  Add omitted doxygen_parsing_enums testcase
  PEP8 conformance for comment verifier module
  Clean up merge problem
  Doxygen html tweaks
  Update html chapter numbering for added Doxygen chapter
  Fixes to makechap.py to detect ill-formed headers
  html fixes for Doxygen
  Add missing CPlusPlus17.html file
  Format files to unix format
  Doxygen testcase tweak to match that in the html docs
  Doxygen html documentation updates and corrections
  Remove doxygen Examples subdirectory
  Beautify doxygen source code
  Code formatting fixes in doxygen code
  Remove unused doxygen code
  new_node refactor
  Various merge fixes in doxygen branches
  Unused variable warning fix
  Fix wrongly resetting indent after formulae in Doxygen comments
  Add support for doxygen:alias feature
  Get rid of meaningless return type of DoxygenParser methods
  Return enum, not untyped int, when classifying Doxygen commands
  Get rid of unnecessary "typedef enum" in C++ code
  Use slash, not backslash, in "C/C++" in the documentation
  Replace literal "<" with "&lt;" in HTML documentation
  Fix broken link to java.sun.com in Doxygen documentation
  Fix using com.sun.tools.javadoc package under macOS
  Fix error reporting for special characters in Doxygen parsing code
  Switch Python Doxygen unit tests to use inspect.getdoc()
  Use correct separator in Java class path under Windows.
  Remove executable permission from appveyor.yml.
  Use JAVA_HOME value in configure to detect Java.
  Display JAVA_HOME value in "make java_version".
  Fix harmless MSVC warning in DoxygenTranslator code.
  Reset "_last" for all but first enum elements.
  Don't duplicate Javadoc from global enum Doxygen comments twice.
  Move Doxygen comments concatenation from the parser to the lexer.
  Fix shift/reduce conflicts in Doxygen pre/post comment parsing.
  Rewrote part of the grammar dealing with Doxygen comments for enums.
  No changes, just remove spurious white space only differences.
  Move Doxygen comment mangling from the parser to the lexer.
  Merge "-builtin" autodoc bugs workarounds from master into test.
  Quote JAVA_HOME variable value in Java test suite makefile.
  Remove unused C_COMMENT_STRING terminal from the grammar.
  Fix missing returns in the Doxygen test suite code.
  Fix trimming whitespace from Doxygen comments.
  Remove code not doing anything from PyDocConverter.
  Remove unused <sstream> header.
  Remove unreferenced struct declaration.
  Remove unused Swig_warn() function.
  Remove any whitespace before ignored Doxygen commands.
  Remove trailing space from one of Doxygen tests.
  Fix autodoc strings generated in Python builtin case and the test.
  Fix Doxygen unit test in Python "-builtin" case.
  Use class docstrings in "-builtin" Python case.
  Don't indent Doxygen doc strings in generated Python code.
  Add a possibility to flexibly ignore custom Doxygen tags.
  Stop completely ignoring many Doxygen comments.
  Fix structural Doxygen comment recognition in the parser.
  No changes, just make checking for Doxygen structural tags more sane.
  Use "//", not "#", for comments in SWIG input.
  Allow upper case letters and digits in Doxygen words.
  Pass the node the Doxygen comment is attached to to DoxygenParser.
  Get rid of findCommand() which duplicaed commandBelongs().
  Recognize unknown Doxygen tags correctly.
  No real changes, just pass original command to commandBelongs().
  Describe Doxygen-specific %features in a single place.
  Give warnings for unknown Doxygen commands in Doxygen parser.
  Document the return type when translating Doxygen @return to Python.
  Fix translated Doxygen comments for overloaded functions in Python.
  Also merge Doxygen comments for overloaded constructors in Python.
  Allow using enum elements as default values for Python functions.
  Don't always use "*args" for all Python wrapper functions.
  No real changes, just make PYTHON::check_kwargs() const.
  Refactor: move makeParameterName() to common Language base class.
  Remove long line wrapping from Python parameter list generation code.
  Simplify and make more efficient building Python docstrings.
  Translate Doxygen code blocks to Sphinx code blocks.
  Add a simple test of multiple parameters to Doxygen test suite.
  Make Python parameters types hyperlinks in the doc strings.
  Make Language::classLookup() and enumLookup() static.
  Fix arguments of @param, @return etc translations to Python.
  Remove unused method from PyDocConverter.
  No real changes, just remove an unnecessary variable.
  Preserve relative indentation when parsing Doxygen comments.
  Use Sphinx-friendly formatting for overloaded functions documentation.
  Add poor man trailing white space detection to Doxygen Python tests.
  ...
2018-06-07 08:13:10 +01:00
William S Fulton
4cdca98709 Update html chapter numbering for added Doxygen chapter 2018-05-25 07:56:44 +01:00
luz.paz
60dfa31a67 Misc. typos
found via `codespell` and `grep`
2018-05-17 10:04:23 -04:00
William S Fulton
066c396ad6 Add C++17 documentation chapter 2018-05-14 21:29:46 +01:00
William S Fulton
b0e29fbdf3 Add missing checks for failures in calls to PyUnicode_AsUTF8String.
Previously a seg fault could occur when passing invalid UTF8 strings (low
surrogates), eg passing u"\udcff" to the C layer (Python 3).
2017-12-04 20:14:04 +00:00
William S Fulton
32a454cfef Merge branch 'templates-scope-enforcement'
* templates-scope-enforcement:
  Test a few %template errors
  Add using declarations to templates into typedef table.
  Fix type lookup in the presence of using directives and using declarations
  More docs on %template
  Testcase fix for nameclash in php
  %template scope enforcement and class definition fixes
  Template documentation tweaks
  More consistent formatting of examples in documentation
  More consistent formatting of examples in documentation
  Documentation corrections to use targetlang formatting
  More consistent formatting of examples in documentation
  More consistent formatting of examples in documentation
  More consistent formatting of examples in documentation
  Namespace documentation minor corrections
  Improve description of template_parameters_resolve
  Minor code optimisation in template_parameters_resolve
  Fix scope lookup for template parameters containing unary scope operators
  Typemap change for templates
2017-08-16 21:44:51 +01:00
William S Fulton
5779aa8d79 More consistent formatting of examples in documentation 2017-08-16 00:24:25 +01:00
William S Fulton
04131a988f More consistent formatting of examples in documentation 2017-08-16 00:24:25 +01:00
William S Fulton
7ee76f93f9 More consistent formatting of examples in documentation 2017-08-16 00:24:25 +01:00
Olly Betts
90f9117e10 Fix various comment and documentation typos 2017-08-13 18:04:33 +12:00
William S Fulton
687cf9c9c1 Add missing %python:maybecall to operator overloads.
This ensures NotImplemented is returned on error so that the Python
interpreter will handle the operators correctly instead of throwing an
exception. NotImplemented was not being returned for non-builtin wrappers
when the operator overload did not have a function overload.

See PEP 207 and https://docs.python.org/3/library/constants.html#NotImplemented

Mentioned in SF patch #303 and SF bug #1208.
2017-06-19 19:25:27 +01:00
Julien Schueller
7350e9fffa Typo in Python.html 2017-03-24 14:22:53 +01:00
William S Fulton
f0f2fd2dae Merge branch 'tleonhardt-python_threads'
* tleonhardt-python_threads:
  Style fixes for Python threads documentation changes
  Finished updating Python docs for -threads option
  Started making changes to Python.html to document support for multithreaded Python SWIG applications.
2017-03-24 08:22:51 +00:00
William S Fulton
d888fabc0c Style fixes for Python threads documentation changes 2017-03-24 08:22:16 +00:00
William S Fulton
da381668a2 Python doc correction for %pybuffer_mutable_string usage
[skip ci]
2017-03-17 19:02:38 +00:00
Todd Leonhardt
bcf8d927f0 Finished updating Python docs for -threads option 2017-03-01 17:51:47 -05:00
Todd Leonhardt
52d12bc415 Started making changes to Python.html to document support for multithreaded Python SWIG applications. 2017-02-28 20:53:30 -05:00
William S Fulton
92d694225a Update wiki links to new Github wiki site
[skip ci]
2017-01-05 18:39:57 +00:00
sunoru
8985c34809 Fix some typos in docs and examples and make the code look nicer. 2016-12-31 23:06:56 +08:00
William S Fulton
2a42031b08 Custom Python module importing code
Add optional moduleimport attribute to %module so that the
default module import code can be overridden. See the
"Searching for the wrapper module" documentation in Python.html.
Example:

  %module(moduleimport="import _foo") foo

$module also expands to the low-level C/C++ module name, so
the following is the same as above

  %module(moduleimport="import $module") foo

Issue https://github.com/swig/swig/issues/769
2016-12-01 18:59:33 +00:00
William S Fulton
96015de0dd Update documentation for using SWIG_ConvertPtr example usage
Add a test case to test the example documentation typemaps
2016-10-23 20:16:35 +01:00
William S Fulton
268b942865 Consistent formatting of example code in the docs 2016-10-23 20:16:35 +01:00
William S Fulton
129ef8ea8f Correct docs and examples to call SWIG_fail after setting a Python error
Although 'return NULL' works, it may miss out on some cleanup and NULL
is the wrong value to return in generated code for overloaded functions.
2016-10-23 20:16:35 +01:00
William S Fulton
4f681f751d Update Python docs on builtin slots 2016-08-18 07:11:00 +01:00
William S Fulton
64f5d23b13 Python docs on static linking section edits 2016-06-12 00:13:07 +01:00
Mike Romberg
2bb732008a Add more documentation about statically linked python modules. 2016-06-11 16:08:24 -06:00
William S Fulton
d18b6e2c8d Python module loading documentation tweaks 2016-06-11 00:59:00 +01:00
Mike Romberg
7b1b2e177f Add documentation about how foo.py finds/loads _foo for python. 2016-06-07 15:28:40 -06:00
William S Fulton
81adedd7dd Python: Do not import all of sys when using -relativeimport 2016-06-06 22:20:07 +01:00
Mike Romberg
ac7157dfc6 Update -relative import documentation to reflect runtime check. 2016-06-06 13:43:58 -06:00
William S Fulton
d01efd82e1 Merge branch 'mromberg-implpkg'
* mromberg-implpkg:
  Minor edits to Python implicit namespace package docs
  use %inline for test
  use relative import for -builtin and python2
  Python3 removes support for relative imports
  Document implicit namespace packages for python
  disable namespace package build
  Attempt to calm the testing gods...
  use whatever name winders uses for .so files.
  Examples (and tests) for python namespace packages
  disable namespace package build
  spelling
  Attempt to calm the testing gods...
  use whatever name winders uses for .so files.
  Don't run example for old pythons
  Examples (and tests) for python namespace packages
  use importlib to load C extension modules for python 2.7 and newer
2016-05-24 22:48:37 +01:00
William S Fulton
4253740d40 Minor edits to Python implicit namespace package docs 2016-05-24 22:46:46 +01:00
William S Fulton
bf24c11645 Correct default arg link in Python docs
[skip ci]
2016-05-06 07:36:53 +01:00
William S Fulton
a8110e3761 Correct Python docs example
Fix PyTuple_SetItem in argout typemap
Fix from Bob Hood on swig-user mailing list
[skip ci]
2016-04-30 12:58:22 +01:00
Mike Romberg
cd2c7b9245 Document implicit namespace packages for python 2016-04-05 11:10:04 -06:00
William S Fulton
80e3ebf0d1 html doc fixes 2016-04-02 13:47:23 +01:00
William S Fulton
355f2623c7 Improve documentation for multi-argument typemaps and overloading 2016-04-02 13:44:44 +01:00
Olly Betts
4e9203acc3 Eliminate doc reference to Python 1.4 2016-02-17 14:18:21 +13:00
Alec Cooper
ba40c4a256 Documentation on Python Bytes/Unicode distinction 2016-02-04 21:07:40 -05:00
Olly Betts
72691e5a49 Clean up Python embed.i
Remove duplicate (aside from comment formatting) embed15.i.

Remove references to Python 1.5.

Tested and remarkably still works with Python 2.7, so update
documentation and comments to reflect that.
2016-01-27 19:01:49 +13:00