Commit graph

38 commits

Author SHA1 Message Date
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
Alec Cooper
33edfa4a62 Add support for Python Bytes/Unicode distinction 2016-02-04 20:16:41 -05:00
William S Fulton
e07938ae8e pystrings.swg cosmetic formatting 2015-12-19 04:11:48 +00:00
William S Fulton
291186cfaf Refine Python 2 unicode strings patch 2015-12-19 03:46:44 +00:00
Brian Cole
edd36b28d2 Automatically coerce python 2.x unicode objects into UTF8 when passing to underlying code. 2015-12-19 03:44:27 +00:00
William S Fulton
c5322a9ecb Python use Py_ssize_t instead of int for better portability 2015-12-05 09:00:04 +00:00
Harvey Falcic
9846f3f1ea Python 3 byte string output: use errors="surrogateescape"
... if available on the version of Python that's in use. This allows
obtaining the original byte string (and potentially trying a fallback
encoding) if the bytes can't be decoded as UTF-8.

Previously, a UnicodeDecodeError would be raised with no way to treat
the data as bytes or try another codec.
2014-05-23 15:40:01 -04: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
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
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
William S Fulton
d6d23465e0 Patch from Michal Marek for Python 2.5 to fix 64 bit array indexes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9289 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-09-16 09:57:26 +00:00
Marcelo Matus
a2c99f619d reduce the aliasing warnings (when compiling with CFLAGS='-O2 -Wstrict-aliasing=2') to the minimum, ie, enums and pointer to functions
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8883 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-02-23 21:43:33 +00:00
Marcelo Matus
268cc4fb97 add -proxydel/-noproxydel plus minor improvements
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7972 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-11 10:44:57 +00:00
Marcelo Matus
abbf8b406a more on the TypeQuery fix
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7971 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-10 23:53:53 +00:00
Marcelo Matus
ae761ca3ba fix extra calls to TypeQuery for 'char *' and 'wchar_t *'
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7968 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-10 20:20:19 +00:00
Marcelo Matus
3b3d3118f1 add missing %s
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7964 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-10 00:40:42 +00:00
Marcelo Matus
e0eea5f625 add safecstrings option and leave the default of string conversions as in older version, ie, return the pointer not a copy
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7963 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-10 00:36:12 +00:00
Marcelo Matus
922d58ac19 don't use Py_None directly nor &PyType_Type
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7925 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-04 08:50:00 +00:00
Marcelo Matus
f3c24eff33 fixes for directors + pointers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7860 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-11-21 21:01:35 +00:00
Marcelo Matus
3c65cea431 Perl added to the Unified typemap library, cleaner way to use the library, and 'normalized' macro names
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7707 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-10-24 14:59:05 +00:00
Marcelo Matus
aadff06f45 more typemaps unification and fixes for valgrind
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7684 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-10-19 10:52:50 +00:00
Marcelo Matus
7e5e4fd1f9 massive typemap unification
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7676 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-10-18 13:24:15 +00:00
Marcelo Matus
a2f5af9ddd fix #1188207 and uniform the error/null/none handling
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7225 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-05-26 20:43:33 +00:00
Marcelo Matus
192e00615d More fix for warnings, and add some of the ideas of the Bill's 'labels' patch
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6998 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-02-24 23:48:20 +00:00
Marcelo Matus
988db075cb fix char* typemap in bug #1080514
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6856 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-12-11 08:30:40 +00:00
Marcelo Matus
d809efcb2f delete unused line
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6494 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-24 06:30:40 +00:00
Marcelo Matus
dc4409a1f1 isolate language independent STD/STL/C++ code + more documentation + cleaning
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6382 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-10 06:42:15 +00:00
Marcelo Matus
e46c80edf8 replacing SWIGSTATIC(a) by SWIGINTERN a
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6290 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-02 20:15:46 +00:00
Marcelo Matus
a4a7a2ff1f better error messages, more comments, clean up for the next major modifications
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6284 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-02 01:43:17 +00:00
Marcelo Matus
349e6bc6ee using <> when including lib files, fix char{ANY], add char FIXSIZE[ANY], fix pyfragments.swg, fixing *.swg and *.i names
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6250 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-09-17 06:17:35 +00:00
Marcelo Matus
bc715fc9a0 fix warnings for intel compiler
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6194 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-09-01 08:07:45 +00:00
Marcelo Matus
12af360d6f fixes for char[], const char[], and cleaning wchar_t
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5930 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-05-27 11:25:31 +00:00
Marcelo Matus
459e527647 add wstring/wchar_t support
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5829 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-04-05 20:12:02 +00:00
Marcelo Matus
f896efa6dd fixes for strings and cosmetics
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5792 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-28 13:34:16 +00:00
Marcelo Matus
7afe6bc139 normalizing the inout typemaps and other cosmetic fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5782 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-21 23:26:18 +00:00
Marcelo Matus
2568b57d46 extending std_string and more fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5771 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-18 21:20:55 +00:00
Marcelo Matus
1d5529bcfc better STL support, see CHANGES.current
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5755 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-17 09:41:19 +00:00
Marcelo Matus
68024b15ce Reducing pyrun.swg and splitting python.swg into different files
for clarity and for easier maintainance.

pyrun.swg almost the same than 1.3.20, therefore there will be
compatible again.

code generated is reduced by the use and reuse of %fragments.

as usual, all the test-suite is compiling and a much bigger
"test project" too.

with the new typemaps definition should be much eaiser and
uniform add stl/std and user types.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5706 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-10 09:50:24 +00:00