structmember.h inclusion moved for external runtime to work without
requiring users to include structmember.h and the Py_READONLY and
Py_ST_PYSSIZE_T definitions. Including Python.h remains the requirement
for using the external runtime (Examples/python/external_runtime).
Note that stddef.h is not always included by structmember.h
Rename dict to swigdict in PySwigObject for easier identification.
SWIG_HEAPTYPES definition is moved to support both external runtime
and Python Stable ABI.
DeprecationWarning fixes when using 'python -Walways' or if using one of the types being warned about:
DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute
DeprecationWarning: builtin type SwigPyObject has no __module__ attribute
DeprecationWarning: builtin type swigvarlink has no __module__ attribute
The warning was present if code was generated without using -builtin in 4.3.x.
The warning was only present if using the Python limited API in 4.2.1 and earlier.
These 3 types were not in any module at all. Now they are in the swig runtime module.
Docs to follow.
Issue #2881
Issue #3061
Issue #3160
SWIG_Python_str_AsChar has undefined behaviour when Py_LIMITED_API is defined
as it returns a pointer to a string in a PyBytes object that no longer exists.
SWIG_PyUnicode_AsUTF8AndSize is an efficient replacement, but requires a
different API and the caller to decrement the refcount on the intermediate
PyObject in the Py_LIMITED_API < 0x030A0000 implementation. The alternative
would have required copying the returned char * string as was done in a
previous implementation requiring a call to the defunct SWIG_Python_str_DelForPy3
function.
Any users calling the removed API will have to make changes.
* py3-stable-abi:
Add CI build using -py3-stable-abi option
Make Python buffer typemaps compatible with limited API
Don't use PyUnicode_AsUTF8() when python limited API is used
Make directors implementation for Python work with limited API
Support using stable Python ABI
Conflicts:
.github/workflows/ci.yml
Lib/python/pyhead.swg
Lib/python/pyrun.swg
Source/Modules/python.cxx
Types generated with and without -builtin are not compatible. Mixing
them in a common type list leads to crashes. Avoid this by using
different capsule names: "type_pointer_capsule" without -builtin and
"type_pointer_capsule_builtin" with.
See #1684
The new -py3-stable-abi option allows to generate code using only stable
Python ABI, which means that the module can be used with any Python 3.4+
version instead of having to be built with the Python headers exactly
corresponding to the version of Python used at run time.
Co-Authored-By: Vadim Zeitlin <vz-swig@zeitlins.org>
This fallback version of PyString_AS_STRING() for Python 3 makes use of
PyUnicode_AS_STRING, but I can find no evidence that ever existed in
Python - all references I've found are to SWIG or SWIG-generated code.
The only uses of PyString_AS_STRING() in SWIG generated code are for
Python 2 #if-branches, so this fallback is never used by SWIG.
Because it doesn't work it can't be usefully used in user interface
files either, so let's remove it to avoid potential user confusion
(such as #987).
Default hash is the underlying C/C++ pointer.
This matches up with testing for equivalence (Py_EQ in SwigPyObject_richcompare)
which compares the pointers.
- 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
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