3.0.8 bump
This commit is contained in:
parent
1e0fea7d84
commit
1c6f4b8217
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,3 +17,4 @@ swig-2.0.0.tar.gz
|
|||||||
/swig-3.0.5.tar.gz
|
/swig-3.0.5.tar.gz
|
||||||
/swig-3.0.6.tar.gz
|
/swig-3.0.6.tar.gz
|
||||||
/swig-3.0.7.tar.gz
|
/swig-3.0.7.tar.gz
|
||||||
|
/swig-3.0.8.tar.gz
|
||||||
|
2
sources
2
sources
@ -1 +1 @@
|
|||||||
7fff46c84b8c630ede5b0f0827e3d90a swig-3.0.7.tar.gz
|
c96a1d5ecb13d38604d7e92148c73c97 swig-3.0.8.tar.gz
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
diff --git a/CCache/test.sh b/CCache/test.sh
|
|
||||||
index 6e5d267..a0e888d 100755
|
|
||||||
--- a/CCache/test.sh
|
|
||||||
+++ b/CCache/test.sh
|
|
||||||
@@ -15,6 +15,10 @@ else
|
|
||||||
SWIG=swig
|
|
||||||
fi
|
|
||||||
|
|
||||||
+# RH fix: Remove ccache from $PATH if it exists
|
|
||||||
+# as it will influence the unit tests
|
|
||||||
+PATH="`echo $PATH |awk -v RS=: -v ORS=: '/\/usr\/lib(64|)\/ccache(:|)/ {next} {print}' | sed 's/:*$//'`"
|
|
||||||
+
|
|
||||||
CCACHE=../ccache-swig
|
|
||||||
TESTDIR=test.$$
|
|
||||||
|
|
47
swig.spec
47
swig.spec
@ -32,36 +32,18 @@
|
|||||||
|
|
||||||
Summary: Connects C/C++/Objective C to some high-level programming languages
|
Summary: Connects C/C++/Objective C to some high-level programming languages
|
||||||
Name: swig
|
Name: swig
|
||||||
Version: 3.0.7
|
Version: 3.0.8
|
||||||
Release: 10%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv3+ and BSD
|
License: GPLv3+ and BSD
|
||||||
URL: http://swig.sourceforge.net/
|
URL: http://swig.sourceforge.net/
|
||||||
Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz
|
Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz
|
||||||
# Define the part of man page sections
|
# Define the part of man page sections
|
||||||
Source1: description.h2m
|
Source1: description.h2m
|
||||||
|
|
||||||
# Ruby patches will be part of SWIG 3.0.8
|
# Fixed python test li_boost_array on arm, ppc, s390
|
||||||
Patch1: swig307-Fix-Ruby-trackings-code-to-use-C-hash.patch
|
# The failure was caused because "char" is not equivalent to "signed char"
|
||||||
Patch2: swig307-Ruby-trackings-patch-tidy-up.patch
|
# on these arches
|
||||||
Patch3: swig307-Ruby-trackings-support-for-1.8.patch
|
Patch0: swig308-Fix-li_boost_array-test.patch
|
||||||
Patch4: swig-ccache-conflict-fix.patch
|
|
||||||
|
|
||||||
### Python 3.5 patches, will be part of SWIG 3.0.8
|
|
||||||
### https://github.com/swig/swig/issues/539 and more.
|
|
||||||
#
|
|
||||||
# https://github.com/swig/swig/commit/ef001de5240c1e05494e23b933b687f3f266045c
|
|
||||||
Patch10: swig307-Python35-fix-builtin.patch
|
|
||||||
# https://github.com/swig/swig/commit/3e9854d308b56488e3bcae69acb4618253b49a94
|
|
||||||
Patch11: swig307-Fix-incorrect-director_classic_runme-py-test.patch
|
|
||||||
# https://github.com/swig/swig/commit/4e8ea4e853efeca6782e905a75f83a5e704a5fb0
|
|
||||||
Patch12: swig307-Python-SystemError-fix-with-builtin.patch
|
|
||||||
# https://github.com/swig/swig/commit/327b59a574c81437f79b168655feff04b12ce56d
|
|
||||||
Patch13: swig307-size_type-correction-for-SwigPySequence_Cont.patch
|
|
||||||
# https://github.com/swig/swig/commit/c5322a9ecb2b9b13ad6300cf1675192a54f952c1
|
|
||||||
Patch14: swig307-Python-use-Py_ssize_t-instead-of-int-for-better-portability.patch
|
|
||||||
# https://github.com/swig/swig/commit/625a405b8e42f944fdc1a87e36725f03b8817a85
|
|
||||||
Patch15: swig307-Add-python-inplace-operator-caveats-to-pyopers-swg.patch
|
|
||||||
|
|
||||||
|
|
||||||
BuildRequires: perl, python2-devel, pcre-devel
|
BuildRequires: perl, python2-devel, pcre-devel
|
||||||
BuildRequires: autoconf, automake, gawk, dos2unix
|
BuildRequires: autoconf, automake, gawk, dos2unix
|
||||||
@ -125,16 +107,7 @@ This package contains documentation for SWIG and useful examples
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n swig-%{version}
|
%setup -q -n swig-%{version}
|
||||||
|
|
||||||
%patch1 -p1 -b .rubyhash
|
%patch0 -p1 -b .signed
|
||||||
%patch2 -p1 -b .rubytidyup
|
|
||||||
%patch3 -p1 -b .ruby18
|
|
||||||
%patch4 -p1 -b .ccache-conflict
|
|
||||||
%patch10 -p1 -b .python35-builtin
|
|
||||||
%patch11 -p1 -b .python35-incorrect-director
|
|
||||||
%patch12 -p1 -b .python35-systemerror-with-builtin
|
|
||||||
%patch13 -p1 -b .python35-size_type-correction
|
|
||||||
%patch14 -p1 -b .python35-use-Py_ssize_t
|
|
||||||
%patch15 -p1 -b .python35-inplace-operator-caveats
|
|
||||||
|
|
||||||
for all in CHANGES README; do
|
for all in CHANGES README; do
|
||||||
iconv -f ISO88591 -t UTF8 < $all > $all.new
|
iconv -f ISO88591 -t UTF8 < $all > $all.new
|
||||||
@ -223,7 +196,8 @@ ln -fs ../../bin/ccache-swig %{buildroot}%{_libdir}/ccache/swig
|
|||||||
%{_bindir}/*
|
%{_bindir}/*
|
||||||
%{_datadir}/swig
|
%{_datadir}/swig
|
||||||
%{_libdir}/ccache
|
%{_libdir}/ccache
|
||||||
%{_mandir}/man1/ccache-swig.1*
|
# The man page was replaced by HTML page
|
||||||
|
#%%{_mandir}/man1/ccache-swig.1*
|
||||||
%{_mandir}/man1/swig.1*
|
%{_mandir}/man1/swig.1*
|
||||||
%license LICENSE LICENSE-GPL LICENSE-UNIVERSITIES
|
%license LICENSE LICENSE-GPL LICENSE-UNIVERSITIES
|
||||||
%doc ANNOUNCE CHANGES CHANGES.current
|
%doc ANNOUNCE CHANGES CHANGES.current
|
||||||
@ -234,6 +208,9 @@ ln -fs ../../bin/ccache-swig %{buildroot}%{_libdir}/ccache/swig
|
|||||||
%doc Doc Examples COPYRIGHT
|
%doc Doc Examples COPYRIGHT
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jan 04 2016 Jitka Plesnikova <jplesnik@redhat.com> - 3.0.8-1
|
||||||
|
- Update to 3.0.8
|
||||||
|
|
||||||
* Sun Dec 06 2015 Björn Esser <fedora@besser82.io> - 3.0.7-10
|
* Sun Dec 06 2015 Björn Esser <fedora@besser82.io> - 3.0.7-10
|
||||||
- fix hunk-offsets in patches
|
- fix hunk-offsets in patches
|
||||||
|
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
From 625a405b8e42f944fdc1a87e36725f03b8817a85 Mon Sep 17 00:00:00 2001
|
|
||||||
From: William S Fulton <wsf@fultondesigns.co.uk>
|
|
||||||
Date: Sat, 5 Dec 2015 19:23:14 +0000
|
|
||||||
Subject: [PATCH] Add python inplace operator caveats to pyopers.swg
|
|
||||||
|
|
||||||
Observations reported in issue #562
|
|
||||||
---
|
|
||||||
Lib/python/pyopers.swg | 16 +++++++++++-----
|
|
||||||
1 file changed, 11 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Lib/python/pyopers.swg b/Lib/python/pyopers.swg
|
|
||||||
index ecbe783..80a0d68 100644
|
|
||||||
--- a/Lib/python/pyopers.swg
|
|
||||||
+++ b/Lib/python/pyopers.swg
|
|
||||||
@@ -151,11 +151,11 @@ __bool__ = __nonzero__
|
|
||||||
|
|
||||||
They translate the inplace C++ operators (+=, -=, ...) into the
|
|
||||||
corresponding python equivalents(__iadd__,__isub__), etc,
|
|
||||||
- disabling the ownership of the input 'self' pointer, and assigning
|
|
||||||
+ disabling the ownership of the input 'this' pointer, and assigning
|
|
||||||
it to the returning object:
|
|
||||||
|
|
||||||
- %feature("del") *::Operator;
|
|
||||||
- %feature("new") *::Operator;
|
|
||||||
+ %feature("del") *::Operator; // disables ownership by generating SWIG_POINTER_DISOWN
|
|
||||||
+ %feature("new") *::Operator; // claims ownership by generating SWIG_POINTER_OWN
|
|
||||||
|
|
||||||
This makes the most common case safe, ie:
|
|
||||||
|
|
||||||
@@ -174,8 +174,8 @@ __bool__ = __nonzero__
|
|
||||||
that never get deleted (maybe, not sure, it depends). But if that is
|
|
||||||
the case, you could recover the old behaviour using
|
|
||||||
|
|
||||||
- %feature("del","") A::operator+=;
|
|
||||||
- %feature("new","") A::operator+=;
|
|
||||||
+ %feature("del","0") A::operator+=;
|
|
||||||
+ %feature("new","0") A::operator+=;
|
|
||||||
|
|
||||||
which recovers the old behaviour for the class 'A', or if you are
|
|
||||||
100% sure your entire system works fine in the old way, use:
|
|
||||||
@@ -183,6 +183,12 @@ __bool__ = __nonzero__
|
|
||||||
%feature("del","") *::operator+=;
|
|
||||||
%feature("new","") *::operator+=;
|
|
||||||
|
|
||||||
+ The default behaviour assumes that the 'this' pointer's memory is
|
|
||||||
+ already owned by the SWIG object; it relinquishes ownership then
|
|
||||||
+ takes it back. This may not be the case though as the SWIG object
|
|
||||||
+ might be owned by memory managed elsewhere, eg after calling a
|
|
||||||
+ function that returns a C++ reference. In such case you will need
|
|
||||||
+ to use the features above to recover the old behaviour too.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(SWIGPYTHON_BUILTIN)
|
|
@ -1,202 +0,0 @@
|
|||||||
From 0e725b5d9bd534964ae606852453df46d04037ee Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
|
|
||||||
Date: Thu, 3 Jan 2013 11:56:25 +0100
|
|
||||||
Subject: [PATCH] Fix Ruby tracking code to use C hash
|
|
||||||
|
|
||||||
This is a patch to resolve SF bug 2034216 (Github issue #225)
|
|
||||||
The bug is that the tracking code uses a ruby hash and thus may
|
|
||||||
allocate objects (Bignum) while running the GC. This was tolerated in
|
|
||||||
1.8 but is invalid (raises an exception) in 1.9.
|
|
||||||
The patch uses a C hash (also used by ruby) instead.
|
|
||||||
---
|
|
||||||
Lib/ruby/rubytracking.swg | 127 ++++++++++++++++++----------------------------
|
|
||||||
1 file changed, 49 insertions(+), 78 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Lib/ruby/rubytracking.swg b/Lib/ruby/rubytracking.swg
|
|
||||||
index 0a36f4a..d974228 100644
|
|
||||||
--- a/Lib/ruby/rubytracking.swg
|
|
||||||
+++ b/Lib/ruby/rubytracking.swg
|
|
||||||
@@ -22,19 +22,19 @@ extern "C" {
|
|
||||||
# error sizeof(void*) is not the same as long or long long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-
|
|
||||||
-/* Global Ruby hash table to store Trackings from C/C++
|
|
||||||
+/* Global hash table to store Trackings from C/C++
|
|
||||||
structs to Ruby Objects.
|
|
||||||
*/
|
|
||||||
-static VALUE swig_ruby_trackings = Qnil;
|
|
||||||
+static st_table* swig_ruby_trackings = NULL;
|
|
||||||
+
|
|
||||||
+VALUE get_swig_trackings_count(ANYARGS) {
|
|
||||||
+ return SWIG2NUM(swig_ruby_trackings->num_entries);
|
|
||||||
+}
|
|
||||||
|
|
||||||
-/* Global variable that stores a reference to the ruby
|
|
||||||
- hash table delete function. */
|
|
||||||
-static ID swig_ruby_hash_delete;
|
|
||||||
|
|
||||||
-/* Setup a Ruby hash table to store Trackings */
|
|
||||||
+/* Setup a hash table to store Trackings */
|
|
||||||
SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
|
|
||||||
- /* Create a ruby hash table to store Trackings from C++
|
|
||||||
+ /* Create a hash table to store Trackings from C++
|
|
||||||
objects to Ruby objects. */
|
|
||||||
|
|
||||||
/* Try to see if some other .so has already created a
|
|
||||||
@@ -43,87 +43,47 @@ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
|
|
||||||
This is done to allow multiple DSOs to share the same
|
|
||||||
tracking table.
|
|
||||||
*/
|
|
||||||
- ID trackings_id = rb_intern( "@__trackings__" );
|
|
||||||
+ VALUE trackings_value = Qnil;
|
|
||||||
+ /* change the variable name so that we can mix modules
|
|
||||||
+ compiled with older SWIG's */
|
|
||||||
+ ID trackings_id = rb_intern( "@__safetrackings__" );
|
|
||||||
VALUE verbose = rb_gv_get("VERBOSE");
|
|
||||||
rb_gv_set("VERBOSE", Qfalse);
|
|
||||||
- swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
|
|
||||||
+ trackings_value = rb_ivar_get( _mSWIG, trackings_id );
|
|
||||||
rb_gv_set("VERBOSE", verbose);
|
|
||||||
|
|
||||||
- /* No, it hasn't. Create one ourselves */
|
|
||||||
- if ( swig_ruby_trackings == Qnil )
|
|
||||||
- {
|
|
||||||
- swig_ruby_trackings = rb_hash_new();
|
|
||||||
- rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- /* Now store a reference to the hash table delete function
|
|
||||||
- so that we only have to look it up once.*/
|
|
||||||
- swig_ruby_hash_delete = rb_intern("delete");
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* Get a Ruby number to reference a pointer */
|
|
||||||
-SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
|
|
||||||
- /* We cast the pointer to an unsigned long
|
|
||||||
- and then store a reference to it using
|
|
||||||
- a Ruby number object. */
|
|
||||||
-
|
|
||||||
- /* Convert the pointer to a Ruby number */
|
|
||||||
- return SWIG2NUM(ptr);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* Get a Ruby number to reference an object */
|
|
||||||
-SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
|
|
||||||
- /* We cast the object to an unsigned long
|
|
||||||
- and then store a reference to it using
|
|
||||||
- a Ruby number object. */
|
|
||||||
-
|
|
||||||
- /* Convert the Object to a Ruby number */
|
|
||||||
- return SWIG2NUM(object);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* Get a Ruby object from a previously stored reference */
|
|
||||||
-SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
|
|
||||||
- /* The provided Ruby number object is a reference
|
|
||||||
- to the Ruby object we want.*/
|
|
||||||
+ /* The trick here is that we have to store the hash table
|
|
||||||
+ pointer in a Ruby variable. We do not want Ruby's GC to
|
|
||||||
+ treat this pointer as a Ruby object, so we convert it to
|
|
||||||
+ a Ruby numeric value. */
|
|
||||||
+ if (trackings_value == Qnil) {
|
|
||||||
+ /* No, it hasn't. Create one ourselves */
|
|
||||||
+ swig_ruby_trackings = st_init_numtable();
|
|
||||||
+ rb_ivar_set( _mSWIG, trackings_id, SWIG2NUM(swig_ruby_trackings) );
|
|
||||||
+ }
|
|
||||||
+ else {
|
|
||||||
+ swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- /* Convert the Ruby number to a Ruby object */
|
|
||||||
- return NUM2SWIG(reference);
|
|
||||||
+ rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", get_swig_trackings_count, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add a Tracking from a C/C++ struct to a Ruby object */
|
|
||||||
SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
|
|
||||||
- /* In a Ruby hash table we store the pointer and
|
|
||||||
- the associated Ruby object. The trick here is
|
|
||||||
- that we cannot store the Ruby object directly - if
|
|
||||||
- we do then it cannot be garbage collected. So
|
|
||||||
- instead we typecast it as a unsigned long and
|
|
||||||
- convert it to a Ruby number object.*/
|
|
||||||
-
|
|
||||||
- /* Get a reference to the pointer as a Ruby number */
|
|
||||||
- VALUE key = SWIG_RubyPtrToReference(ptr);
|
|
||||||
-
|
|
||||||
- /* Get a reference to the Ruby object as a Ruby number */
|
|
||||||
- VALUE value = SWIG_RubyObjectToReference(object);
|
|
||||||
-
|
|
||||||
/* Store the mapping to the global hash table. */
|
|
||||||
- rb_hash_aset(swig_ruby_trackings, key, value);
|
|
||||||
+ st_insert(swig_ruby_trackings, (st_data_t)ptr, object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the Ruby object that owns the specified C/C++ struct */
|
|
||||||
SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
|
|
||||||
- /* Get a reference to the pointer as a Ruby number */
|
|
||||||
- VALUE key = SWIG_RubyPtrToReference(ptr);
|
|
||||||
-
|
|
||||||
/* Now lookup the value stored in the global hash table */
|
|
||||||
- VALUE value = rb_hash_aref(swig_ruby_trackings, key);
|
|
||||||
-
|
|
||||||
- if (value == Qnil) {
|
|
||||||
- /* No object exists - return nil. */
|
|
||||||
- return Qnil;
|
|
||||||
+ VALUE value;
|
|
||||||
+
|
|
||||||
+ if (st_lookup(swig_ruby_trackings, (st_data_t)ptr, &value)) {
|
|
||||||
+ return value;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
- /* Convert this value to Ruby object */
|
|
||||||
- return SWIG_RubyReferenceToObject(value);
|
|
||||||
+ return Qnil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -132,12 +92,8 @@ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
|
|
||||||
since the same memory address may be reused later to create
|
|
||||||
a new object. */
|
|
||||||
SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
|
|
||||||
- /* Get a reference to the pointer as a Ruby number */
|
|
||||||
- VALUE key = SWIG_RubyPtrToReference(ptr);
|
|
||||||
-
|
|
||||||
- /* Delete the object from the hash table by calling Ruby's
|
|
||||||
- do this we need to call the Hash.delete method.*/
|
|
||||||
- rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
|
|
||||||
+ /* Delete the object from the hash table */
|
|
||||||
+ st_delete(swig_ruby_trackings, (st_data_t *)&ptr, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is a helper method that unlinks a Ruby object from its
|
|
||||||
@@ -147,10 +103,25 @@ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
|
|
||||||
VALUE object = SWIG_RubyInstanceFor(ptr);
|
|
||||||
|
|
||||||
if (object != Qnil) {
|
|
||||||
+ if (TYPE(object) != T_DATA)
|
|
||||||
+ abort();
|
|
||||||
DATA_PTR(object) = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* This is a helper method that iterates over all the trackings
|
|
||||||
+ passing the C++ object pointer and its related Ruby object
|
|
||||||
+ to the passed callback function. */
|
|
||||||
+
|
|
||||||
+/* Proxy method to abstract the internal trackings datatype */
|
|
||||||
+static int _ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) {
|
|
||||||
+ (*meth)(ptr, obj);
|
|
||||||
+ return ST_CONTINUE;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) {
|
|
||||||
+ st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&_ruby_internal_iterate_callback, (st_data_t)meth);
|
|
||||||
+}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
From 3e9854d308b56488e3bcae69acb4618253b49a94 Mon Sep 17 00:00:00 2001
|
|
||||||
From: William S Fulton <wsf@fultondesigns.co.uk>
|
|
||||||
Date: Sat, 10 Oct 2015 01:17:32 +0100
|
|
||||||
Subject: [PATCH] Fix incorrect director_classic_runme.py test
|
|
||||||
|
|
||||||
Python 3.5 and -builtin threw an error as the incorrect base was being
|
|
||||||
initialized.
|
|
||||||
---
|
|
||||||
Examples/test-suite/python/director_classic_runme.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/Examples/test-suite/python/director_classic_runme.py b/Examples/test-suite/python/director_classic_runme.py
|
|
||||||
index 9dd5f59..a4d78f1 100644
|
|
||||||
--- a/Examples/test-suite/python/director_classic_runme.py
|
|
||||||
+++ b/Examples/test-suite/python/director_classic_runme.py
|
|
||||||
@@ -69,7 +69,7 @@ def id(self):
|
|
||||||
class TargetLangOrphanChild(OrphanChild):
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
- Child.__init__(self)
|
|
||||||
+ OrphanChild.__init__(self)
|
|
||||||
|
|
||||||
def id(self):
|
|
||||||
identifier = "TargetLangOrphanChild"
|
|
@ -1,28 +0,0 @@
|
|||||||
From 4e8ea4e853efeca6782e905a75f83a5e704a5fb0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: William S Fulton <wsf@fultondesigns.co.uk>
|
|
||||||
Date: Sat, 14 Nov 2015 22:14:32 +0000
|
|
||||||
Subject: [PATCH] Python SystemError fix with -builtin
|
|
||||||
|
|
||||||
Fix error when append on a SWIG Object with -builtin:
|
|
||||||
|
|
||||||
x.append(10)
|
|
||||||
SystemError: error return without exception set
|
|
||||||
|
|
||||||
Having append and next methods on a SWIG object by default doesn't seem
|
|
||||||
right to me though.
|
|
||||||
---
|
|
||||||
Lib/python/pyrun.swg | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg
|
|
||||||
index 5eedca4..d43b752 100644
|
|
||||||
--- a/Lib/python/pyrun.swg
|
|
||||||
+++ b/Lib/python/pyrun.swg
|
|
||||||
@@ -569,6 +569,7 @@ SwigPyObject_append(PyObject* v, PyObject* next)
|
|
||||||
next = tmp;
|
|
||||||
#endif
|
|
||||||
if (!SwigPyObject_Check(next)) {
|
|
||||||
+ PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
sobj->next = next;
|
|
@ -1,404 +0,0 @@
|
|||||||
From c5322a9ecb2b9b13ad6300cf1675192a54f952c1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: William S Fulton <wsf@fultondesigns.co.uk>
|
|
||||||
Date: Fri, 4 Dec 2015 23:32:46 +0000
|
|
||||||
Subject: [PATCH] Python use Py_ssize_t instead of int for better portability
|
|
||||||
|
|
||||||
---
|
|
||||||
Lib/python/pycontainer.swg | 25 ++++++++++++-------------
|
|
||||||
Lib/python/pyrun.swg | 12 +++++-------
|
|
||||||
Lib/python/pystrings.swg | 6 +++---
|
|
||||||
Lib/python/pywstrings.swg | 2 +-
|
|
||||||
Lib/python/std_map.i | 26 +++++++++++---------------
|
|
||||||
Lib/python/std_multimap.i | 5 ++---
|
|
||||||
Lib/python/std_unordered_map.i | 26 +++++++++++---------------
|
|
||||||
Lib/python/std_unordered_multimap.i | 5 ++---
|
|
||||||
Source/Modules/python.cxx | 6 +++---
|
|
||||||
9 files changed, 50 insertions(+), 63 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg
|
|
||||||
index ceb3b66..46d0438 100644
|
|
||||||
--- a/Lib/python/pycontainer.swg
|
|
||||||
+++ b/Lib/python/pycontainer.swg
|
|
||||||
@@ -415,7 +415,7 @@ namespace swig
|
|
||||||
template <class T>
|
|
||||||
struct SwigPySequence_Ref
|
|
||||||
{
|
|
||||||
- SwigPySequence_Ref(PyObject* seq, int index)
|
|
||||||
+ SwigPySequence_Ref(PyObject* seq, Py_ssize_t index)
|
|
||||||
: _seq(seq), _index(index)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -427,7 +427,7 @@ namespace swig
|
|
||||||
return swig::as<T>(item, true);
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
char msg[1024];
|
|
||||||
- sprintf(msg, "in sequence element %d ", _index);
|
|
||||||
+ sprintf(msg, "in sequence element %d ", (int)_index);
|
|
||||||
if (!PyErr_Occurred()) {
|
|
||||||
::%type_error(swig::type_name<T>());
|
|
||||||
}
|
|
||||||
@@ -445,7 +445,7 @@ namespace swig
|
|
||||||
|
|
||||||
private:
|
|
||||||
PyObject* _seq;
|
|
||||||
- int _index;
|
|
||||||
+ Py_ssize_t _index;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
@@ -466,13 +466,13 @@ namespace swig
|
|
||||||
typedef Reference reference;
|
|
||||||
typedef T value_type;
|
|
||||||
typedef T* pointer;
|
|
||||||
- typedef int difference_type;
|
|
||||||
+ typedef Py_ssize_t difference_type;
|
|
||||||
|
|
||||||
SwigPySequence_InputIterator()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- SwigPySequence_InputIterator(PyObject* seq, int index)
|
|
||||||
+ SwigPySequence_InputIterator(PyObject* seq, Py_ssize_t index)
|
|
||||||
: _seq(seq), _index(index)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -559,7 +559,7 @@ namespace swig
|
|
||||||
typedef const SwigPySequence_Ref<T> const_reference;
|
|
||||||
typedef T value_type;
|
|
||||||
typedef T* pointer;
|
|
||||||
- typedef int difference_type;
|
|
||||||
+ typedef Py_ssize_t difference_type;
|
|
||||||
typedef size_t size_type;
|
|
||||||
typedef const pointer const_pointer;
|
|
||||||
typedef SwigPySequence_InputIterator<T, reference> iterator;
|
|
||||||
@@ -621,13 +621,13 @@ namespace swig
|
|
||||||
|
|
||||||
bool check(bool set_err = true) const
|
|
||||||
{
|
|
||||||
- int s = size();
|
|
||||||
- for (int i = 0; i < s; ++i) {
|
|
||||||
+ Py_ssize_t s = size();
|
|
||||||
+ for (Py_ssize_t i = 0; i < s; ++i) {
|
|
||||||
swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i);
|
|
||||||
if (!swig::check<value_type>(item)) {
|
|
||||||
if (set_err) {
|
|
||||||
char msg[1024];
|
|
||||||
- sprintf(msg, "in sequence element %d", i);
|
|
||||||
+ sprintf(msg, "in sequence element %d", (int)i);
|
|
||||||
SWIG_Error(SWIG_RuntimeError, msg);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
@@ -988,10 +988,9 @@ namespace swig {
|
|
||||||
%#endif
|
|
||||||
size_type size = seq.size();
|
|
||||||
if (size <= (size_type)INT_MAX) {
|
|
||||||
- PyObject *obj = PyTuple_New((int)size);
|
|
||||||
- int i = 0;
|
|
||||||
- for (const_iterator it = seq.begin();
|
|
||||||
- it != seq.end(); ++it, ++i) {
|
|
||||||
+ PyObject *obj = PyTuple_New((Py_ssize_t)size);
|
|
||||||
+ Py_ssize_t i = 0;
|
|
||||||
+ for (const_iterator it = seq.begin(); it != seq.end(); ++it, ++i) {
|
|
||||||
PyTuple_SetItem(obj,i,swig::from<value_type>(*it));
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg
|
|
||||||
index d43b752..85ff276 100644
|
|
||||||
--- a/Lib/python/pyrun.swg
|
|
||||||
+++ b/Lib/python/pyrun.swg
|
|
||||||
@@ -161,7 +161,7 @@ SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
|
|
||||||
|
|
||||||
/* Unpack the argument tuple */
|
|
||||||
|
|
||||||
-SWIGINTERN int
|
|
||||||
+SWIGINTERN Py_ssize_t
|
|
||||||
SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
|
|
||||||
{
|
|
||||||
if (!args) {
|
|
||||||
@@ -175,7 +175,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
|
|
||||||
}
|
|
||||||
if (!PyTuple_Check(args)) {
|
|
||||||
if (min <= 1 && max >= 1) {
|
|
||||||
- int i;
|
|
||||||
+ Py_ssize_t i;
|
|
||||||
objs[0] = args;
|
|
||||||
for (i = 1; i < max; ++i) {
|
|
||||||
objs[i] = 0;
|
|
||||||
@@ -195,7 +195,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
|
|
||||||
name, (min == max ? "" : "at most "), (int)max, (int)l);
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
- int i;
|
|
||||||
+ Py_ssize_t i;
|
|
||||||
for (i = 0; i < l; ++i) {
|
|
||||||
objs[i] = PyTuple_GET_ITEM(args, i);
|
|
||||||
}
|
|
||||||
@@ -1515,13 +1515,11 @@ PyModule_AddObject(PyObject *m, char *name, PyObject *o)
|
|
||||||
{
|
|
||||||
PyObject *dict;
|
|
||||||
if (!PyModule_Check(m)) {
|
|
||||||
- PyErr_SetString(PyExc_TypeError,
|
|
||||||
- "PyModule_AddObject() needs module as first arg");
|
|
||||||
+ PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg");
|
|
||||||
return SWIG_ERROR;
|
|
||||||
}
|
|
||||||
if (!o) {
|
|
||||||
- PyErr_SetString(PyExc_TypeError,
|
|
||||||
- "PyModule_AddObject() needs non-NULL value");
|
|
||||||
+ PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value");
|
|
||||||
return SWIG_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/Lib/python/pystrings.swg b/Lib/python/pystrings.swg
|
|
||||||
index 2b14547..2eefaef 100644
|
|
||||||
--- a/Lib/python/pystrings.swg
|
|
||||||
+++ b/Lib/python/pystrings.swg
|
|
||||||
@@ -90,12 +90,12 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
|
|
||||||
} else {
|
|
||||||
%#if PY_VERSION_HEX >= 0x03000000
|
|
||||||
%#if PY_VERSION_HEX >= 0x03010000
|
|
||||||
- return PyUnicode_DecodeUTF8(carray, %numeric_cast(size,int), "surrogateescape");
|
|
||||||
+ return PyUnicode_DecodeUTF8(carray, %numeric_cast(size, Py_ssize_t), "surrogateescape");
|
|
||||||
%#else
|
|
||||||
- return PyUnicode_FromStringAndSize(carray, %numeric_cast(size,int));
|
|
||||||
+ return PyUnicode_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t));
|
|
||||||
%#endif
|
|
||||||
%#else
|
|
||||||
- return PyString_FromStringAndSize(carray, %numeric_cast(size,int));
|
|
||||||
+ return PyString_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t));
|
|
||||||
%#endif
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
diff --git a/Lib/python/pywstrings.swg b/Lib/python/pywstrings.swg
|
|
||||||
index 864376b..79f193b 100644
|
|
||||||
--- a/Lib/python/pywstrings.swg
|
|
||||||
+++ b/Lib/python/pywstrings.swg
|
|
||||||
@@ -58,7 +58,7 @@ SWIG_FromWCharPtrAndSize(const wchar_t * carray, size_t size)
|
|
||||||
return pwchar_descriptor ?
|
|
||||||
SWIG_InternalNewPointerObj(%const_cast(carray,wchar_t *), pwchar_descriptor, 0) : SWIG_Py_Void();
|
|
||||||
} else {
|
|
||||||
- return PyUnicode_FromWideChar(carray, %numeric_cast(size,int));
|
|
||||||
+ return PyUnicode_FromWideChar(carray, %numeric_cast(size, Py_ssize_t));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return SWIG_Py_Void();
|
|
||||||
diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i
|
|
||||||
index 454e821..65dd91d 100644
|
|
||||||
--- a/Lib/python/std_map.i
|
|
||||||
+++ b/Lib/python/std_map.i
|
|
||||||
@@ -119,10 +119,9 @@
|
|
||||||
static PyObject *asdict(const map_type& map) {
|
|
||||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
|
||||||
size_type size = map.size();
|
|
||||||
- int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
|
|
||||||
+ Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
|
||||||
if (pysize < 0) {
|
|
||||||
- PyErr_SetString(PyExc_OverflowError,
|
|
||||||
- "map size not valid in python");
|
|
||||||
+ PyErr_SetString(PyExc_OverflowError, "map size not valid in python");
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
@@ -211,17 +210,16 @@
|
|
||||||
|
|
||||||
PyObject* keys() {
|
|
||||||
Map::size_type size = self->size();
|
|
||||||
- int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
|
|
||||||
+ Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
|
||||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
|
||||||
if (pysize < 0) {
|
|
||||||
- PyErr_SetString(PyExc_OverflowError,
|
|
||||||
- "map size not valid in python");
|
|
||||||
+ PyErr_SetString(PyExc_OverflowError, "map size not valid in python");
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
PyObject* keyList = PyList_New(pysize);
|
|
||||||
Map::const_iterator i = self->begin();
|
|
||||||
- for (int j = 0; j < pysize; ++i, ++j) {
|
|
||||||
+ for (Py_ssize_t j = 0; j < pysize; ++i, ++j) {
|
|
||||||
PyList_SET_ITEM(keyList, j, swig::from(i->first));
|
|
||||||
}
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
@@ -230,17 +228,16 @@
|
|
||||||
|
|
||||||
PyObject* values() {
|
|
||||||
Map::size_type size = self->size();
|
|
||||||
- int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
|
|
||||||
+ Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
|
||||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
|
||||||
if (pysize < 0) {
|
|
||||||
- PyErr_SetString(PyExc_OverflowError,
|
|
||||||
- "map size not valid in python");
|
|
||||||
+ PyErr_SetString(PyExc_OverflowError, "map size not valid in python");
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
PyObject* valList = PyList_New(pysize);
|
|
||||||
Map::const_iterator i = self->begin();
|
|
||||||
- for (int j = 0; j < pysize; ++i, ++j) {
|
|
||||||
+ for (Py_ssize_t j = 0; j < pysize; ++i, ++j) {
|
|
||||||
PyList_SET_ITEM(valList, j, swig::from(i->second));
|
|
||||||
}
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
@@ -249,17 +246,16 @@
|
|
||||||
|
|
||||||
PyObject* items() {
|
|
||||||
Map::size_type size = self->size();
|
|
||||||
- int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
|
|
||||||
+ Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
|
||||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
|
||||||
if (pysize < 0) {
|
|
||||||
- PyErr_SetString(PyExc_OverflowError,
|
|
||||||
- "map size not valid in python");
|
|
||||||
+ PyErr_SetString(PyExc_OverflowError, "map size not valid in python");
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
PyObject* itemList = PyList_New(pysize);
|
|
||||||
Map::const_iterator i = self->begin();
|
|
||||||
- for (int j = 0; j < pysize; ++i, ++j) {
|
|
||||||
+ for (Py_ssize_t j = 0; j < pysize; ++i, ++j) {
|
|
||||||
PyList_SET_ITEM(itemList, j, swig::from(*i));
|
|
||||||
}
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
diff --git a/Lib/python/std_multimap.i b/Lib/python/std_multimap.i
|
|
||||||
index c81e2ac..2c539cf 100644
|
|
||||||
--- a/Lib/python/std_multimap.i
|
|
||||||
+++ b/Lib/python/std_multimap.i
|
|
||||||
@@ -45,11 +45,10 @@
|
|
||||||
return SWIG_InternalNewPointerObj(new multimap_type(multimap), desc, SWIG_POINTER_OWN);
|
|
||||||
} else {
|
|
||||||
size_type size = multimap.size();
|
|
||||||
- int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
|
|
||||||
+ Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
|
||||||
if (pysize < 0) {
|
|
||||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
|
||||||
- PyErr_SetString(PyExc_OverflowError,
|
|
||||||
- "multimap size not valid in python");
|
|
||||||
+ PyErr_SetString(PyExc_OverflowError, "multimap size not valid in python");
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
diff --git a/Lib/python/std_unordered_map.i b/Lib/python/std_unordered_map.i
|
|
||||||
index e58a4e9..f956f4f 100644
|
|
||||||
--- a/Lib/python/std_unordered_map.i
|
|
||||||
+++ b/Lib/python/std_unordered_map.i
|
|
||||||
@@ -48,11 +48,10 @@
|
|
||||||
return SWIG_NewPointerObj(new unordered_map_type(unordered_map), desc, SWIG_POINTER_OWN);
|
|
||||||
} else {
|
|
||||||
size_type size = unordered_map.size();
|
|
||||||
- int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
|
|
||||||
+ Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
|
||||||
if (pysize < 0) {
|
|
||||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
|
||||||
- PyErr_SetString(PyExc_OverflowError,
|
|
||||||
- "unordered_map size not valid in python");
|
|
||||||
+ PyErr_SetString(PyExc_OverflowError, "unordered_map size not valid in python");
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
@@ -164,17 +163,16 @@
|
|
||||||
|
|
||||||
PyObject* keys() {
|
|
||||||
Map::size_type size = self->size();
|
|
||||||
- int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
|
|
||||||
+ Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
|
||||||
if (pysize < 0) {
|
|
||||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
|
||||||
- PyErr_SetString(PyExc_OverflowError,
|
|
||||||
- "unordered_map size not valid in python");
|
|
||||||
+ PyErr_SetString(PyExc_OverflowError, "unordered_map size not valid in python");
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
PyObject* keyList = PyList_New(pysize);
|
|
||||||
Map::const_iterator i = self->begin();
|
|
||||||
- for (int j = 0; j < pysize; ++i, ++j) {
|
|
||||||
+ for (Py_ssize_t j = 0; j < pysize; ++i, ++j) {
|
|
||||||
PyList_SET_ITEM(keyList, j, swig::from(i->first));
|
|
||||||
}
|
|
||||||
return keyList;
|
|
||||||
@@ -182,17 +180,16 @@
|
|
||||||
|
|
||||||
PyObject* values() {
|
|
||||||
Map::size_type size = self->size();
|
|
||||||
- int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
|
|
||||||
+ Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
|
||||||
if (pysize < 0) {
|
|
||||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
|
||||||
- PyErr_SetString(PyExc_OverflowError,
|
|
||||||
- "unordered_map size not valid in python");
|
|
||||||
+ PyErr_SetString(PyExc_OverflowError, "unordered_map size not valid in python");
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
PyObject* valList = PyList_New(pysize);
|
|
||||||
Map::const_iterator i = self->begin();
|
|
||||||
- for (int j = 0; j < pysize; ++i, ++j) {
|
|
||||||
+ for (Py_ssize_t j = 0; j < pysize; ++i, ++j) {
|
|
||||||
PyList_SET_ITEM(valList, j, swig::from(i->second));
|
|
||||||
}
|
|
||||||
return valList;
|
|
||||||
@@ -200,17 +197,16 @@
|
|
||||||
|
|
||||||
PyObject* items() {
|
|
||||||
Map::size_type size = self->size();
|
|
||||||
- int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
|
|
||||||
+ Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
|
||||||
if (pysize < 0) {
|
|
||||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
|
||||||
- PyErr_SetString(PyExc_OverflowError,
|
|
||||||
- "unordered_map size not valid in python");
|
|
||||||
+ PyErr_SetString(PyExc_OverflowError, "unordered_map size not valid in python");
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
PyObject* itemList = PyList_New(pysize);
|
|
||||||
Map::const_iterator i = self->begin();
|
|
||||||
- for (int j = 0; j < pysize; ++i, ++j) {
|
|
||||||
+ for (Py_ssize_t j = 0; j < pysize; ++i, ++j) {
|
|
||||||
PyList_SET_ITEM(itemList, j, swig::from(*i));
|
|
||||||
}
|
|
||||||
return itemList;
|
|
||||||
diff --git a/Lib/python/std_unordered_multimap.i b/Lib/python/std_unordered_multimap.i
|
|
||||||
index adf86f2..b3b7236 100644
|
|
||||||
--- a/Lib/python/std_unordered_multimap.i
|
|
||||||
+++ b/Lib/python/std_unordered_multimap.i
|
|
||||||
@@ -45,11 +45,10 @@
|
|
||||||
return SWIG_NewPointerObj(new unordered_multimap_type(unordered_multimap), desc, SWIG_POINTER_OWN);
|
|
||||||
} else {
|
|
||||||
size_type size = unordered_multimap.size();
|
|
||||||
- int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
|
|
||||||
+ Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
|
||||||
if (pysize < 0) {
|
|
||||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
|
||||||
- PyErr_SetString(PyExc_OverflowError,
|
|
||||||
- "unordered_multimap size not valid in python");
|
|
||||||
+ PyErr_SetString(PyExc_OverflowError, "unordered_multimap size not valid in python");
|
|
||||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
|
|
||||||
index 570f8fa..e91047a 100644
|
|
||||||
--- a/Source/Modules/python.cxx
|
|
||||||
+++ b/Source/Modules/python.cxx
|
|
||||||
@@ -2474,15 +2474,15 @@ class PYTHON:public Language {
|
|
||||||
|
|
||||||
Printv(f->def, linkage, builtin_ctor ? "int " : "PyObject *", wname, "(PyObject *self, PyObject *args) {", NIL);
|
|
||||||
|
|
||||||
- Wrapper_add_local(f, "argc", "int argc");
|
|
||||||
+ Wrapper_add_local(f, "argc", "Py_ssize_t argc");
|
|
||||||
Printf(tmp, "PyObject *argv[%d] = {0}", maxargs + 1);
|
|
||||||
Wrapper_add_local(f, "argv", tmp);
|
|
||||||
|
|
||||||
if (!fastunpack) {
|
|
||||||
- Wrapper_add_local(f, "ii", "int ii");
|
|
||||||
+ Wrapper_add_local(f, "ii", "Py_ssize_t ii");
|
|
||||||
if (maxargs - (add_self ? 1 : 0) > 0)
|
|
||||||
Append(f->code, "if (!PyTuple_Check(args)) SWIG_fail;\n");
|
|
||||||
- Append(f->code, "argc = args ? (int)PyObject_Length(args) : 0;\n");
|
|
||||||
+ Append(f->code, "argc = args ? PyObject_Length(args) : 0;\n");
|
|
||||||
if (add_self)
|
|
||||||
Append(f->code, "argv[0] = self;\n");
|
|
||||||
Printf(f->code, "for (ii = 0; (ii < %d) && (ii < argc); ii++) {\n", add_self ? maxargs - 1 : maxargs);
|
|
@ -1,28 +0,0 @@
|
|||||||
From ef001de5240c1e05494e23b933b687f3f266045c Mon Sep 17 00:00:00 2001
|
|
||||||
From: William S Fulton <wsf@fultondesigns.co.uk>
|
|
||||||
Date: Sat, 10 Oct 2015 00:38:52 +0100
|
|
||||||
Subject: [PATCH] Support Python 3.5 and -builtin.
|
|
||||||
|
|
||||||
PyAsyncMethods is a new member in PyHeapTypeObject.
|
|
||||||
Closes#539
|
|
||||||
|
|
||||||
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
|
|
||||||
index 7bc5658..3395ebe 100644
|
|
||||||
--- a/Source/Modules/python.cxx
|
|
||||||
+++ b/Source/Modules/python.cxx
|
|
||||||
@@ -4053,6 +4053,15 @@ class PYTHON:public Language {
|
|
||||||
Printv(f, "#endif\n", NIL);
|
|
||||||
Printf(f, " },\n");
|
|
||||||
|
|
||||||
+ // PyAsyncMethods as_async
|
|
||||||
+ Printv(f, "#if PY_VERSION_HEX >= 0x03050000\n", NIL);
|
|
||||||
+ Printf(f, " {\n");
|
|
||||||
+ printSlot(f, getSlot(n, "feature:python:am_await"), "am_await", "unaryfunc");
|
|
||||||
+ printSlot(f, getSlot(n, "feature:python:am_aiter"), "am_aiter", "unaryfunc");
|
|
||||||
+ printSlot(f, getSlot(n, "feature:python:am_anext"), "am_anext", "unaryfunc");
|
|
||||||
+ Printf(f, " },\n");
|
|
||||||
+ Printv(f, "#endif\n", NIL);
|
|
||||||
+
|
|
||||||
// PyNumberMethods as_number
|
|
||||||
Printf(f, " {\n");
|
|
||||||
printSlot(f, getSlot(n, "feature:python:nb_add"), "nb_add", "binaryfunc");
|
|
@ -1,76 +0,0 @@
|
|||||||
From e14b392596f453dc8f437de90e8d405a04d5df62 Mon Sep 17 00:00:00 2001
|
|
||||||
From: William S Fulton <wsf@fultondesigns.co.uk>
|
|
||||||
Date: Sun, 13 Sep 2015 13:25:29 +0100
|
|
||||||
Subject: [PATCH] Ruby trackings patch tidy up and add changes entry
|
|
||||||
|
|
||||||
Closes #225
|
|
||||||
---
|
|
||||||
Lib/ruby/rubytracking.swg | 16 +++++++---------
|
|
||||||
1 file changed, 7 insertions(+), 9 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Lib/ruby/rubytracking.swg b/Lib/ruby/rubytracking.swg
|
|
||||||
index d974228..37789c1 100644
|
|
||||||
--- a/Lib/ruby/rubytracking.swg
|
|
||||||
+++ b/Lib/ruby/rubytracking.swg
|
|
||||||
@@ -27,7 +27,7 @@ extern "C" {
|
|
||||||
*/
|
|
||||||
static st_table* swig_ruby_trackings = NULL;
|
|
||||||
|
|
||||||
-VALUE get_swig_trackings_count(ANYARGS) {
|
|
||||||
+static VALUE swig_ruby_trackings_count(ANYARGS) {
|
|
||||||
return SWIG2NUM(swig_ruby_trackings->num_entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
|
|
||||||
*/
|
|
||||||
VALUE trackings_value = Qnil;
|
|
||||||
/* change the variable name so that we can mix modules
|
|
||||||
- compiled with older SWIG's */
|
|
||||||
+ compiled with older SWIG's - this used to be called "@__trackings__" */
|
|
||||||
ID trackings_id = rb_intern( "@__safetrackings__" );
|
|
||||||
VALUE verbose = rb_gv_get("VERBOSE");
|
|
||||||
rb_gv_set("VERBOSE", Qfalse);
|
|
||||||
@@ -60,12 +60,11 @@ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
|
|
||||||
/* No, it hasn't. Create one ourselves */
|
|
||||||
swig_ruby_trackings = st_init_numtable();
|
|
||||||
rb_ivar_set( _mSWIG, trackings_id, SWIG2NUM(swig_ruby_trackings) );
|
|
||||||
- }
|
|
||||||
- else {
|
|
||||||
+ } else {
|
|
||||||
swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
- rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", get_swig_trackings_count, NULL);
|
|
||||||
+ rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add a Tracking from a C/C++ struct to a Ruby object */
|
|
||||||
@@ -81,8 +80,7 @@ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
|
|
||||||
|
|
||||||
if (st_lookup(swig_ruby_trackings, (st_data_t)ptr, &value)) {
|
|
||||||
return value;
|
|
||||||
- }
|
|
||||||
- else {
|
|
||||||
+ } else {
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -114,13 +112,13 @@ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
|
|
||||||
to the passed callback function. */
|
|
||||||
|
|
||||||
/* Proxy method to abstract the internal trackings datatype */
|
|
||||||
-static int _ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) {
|
|
||||||
+static int swig_ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) {
|
|
||||||
(*meth)(ptr, obj);
|
|
||||||
return ST_CONTINUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) {
|
|
||||||
- st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&_ruby_internal_iterate_callback, (st_data_t)meth);
|
|
||||||
+ st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&swig_ruby_internal_iterate_callback, (st_data_t)meth);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
From 604b3d009ce4ed170ebfcfb256fc5c91c08b1d0e Mon Sep 17 00:00:00 2001
|
|
||||||
From: William S Fulton <wsf@fultondesigns.co.uk>
|
|
||||||
Date: Sun, 13 Sep 2015 20:09:50 +0100
|
|
||||||
Subject: [PATCH] Ruby trackings bug fix support for 1.8
|
|
||||||
|
|
||||||
Issue #225
|
|
||||||
---
|
|
||||||
Lib/ruby/rubytracking.swg | 5 +++++
|
|
||||||
1 file changed, 5 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/Lib/ruby/rubytracking.swg b/Lib/ruby/rubytracking.swg
|
|
||||||
index 37789c1..8f9f01b 100644
|
|
||||||
--- a/Lib/ruby/rubytracking.swg
|
|
||||||
+++ b/Lib/ruby/rubytracking.swg
|
|
||||||
@@ -11,6 +11,11 @@
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#if !defined(ST_DATA_T_DEFINED)
|
|
||||||
+/* Needs to be explicitly included for Ruby 1.8 and earlier */
|
|
||||||
+#include <st.h>
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
/* Ruby 1.8 actually assumes the first case. */
|
|
||||||
#if SIZEOF_VOIDP == SIZEOF_LONG
|
|
||||||
# define SWIG2NUM(v) LONG2NUM((unsigned long)v)
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
From 327b59a574c81437f79b168655feff04b12ce56d Mon Sep 17 00:00:00 2001
|
|
||||||
From: William S Fulton <wsf@fultondesigns.co.uk>
|
|
||||||
Date: Sat, 28 Nov 2015 23:52:32 +0000
|
|
||||||
Subject: [PATCH] size_type correction for SwigPySequence_Cont
|
|
||||||
|
|
||||||
---
|
|
||||||
Lib/python/pycontainer.swg | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg
|
|
||||||
index 7c5cc37..ceb3b66 100644
|
|
||||||
--- a/Lib/python/pycontainer.swg
|
|
||||||
+++ b/Lib/python/pycontainer.swg
|
|
||||||
@@ -560,7 +560,7 @@ namespace swig
|
|
||||||
typedef T value_type;
|
|
||||||
typedef T* pointer;
|
|
||||||
typedef int difference_type;
|
|
||||||
- typedef int size_type;
|
|
||||||
+ typedef size_t size_type;
|
|
||||||
typedef const pointer const_pointer;
|
|
||||||
typedef SwigPySequence_InputIterator<T, reference> iterator;
|
|
||||||
typedef SwigPySequence_InputIterator<T, const_reference> const_iterator;
|
|
12
swig308-Fix-li_boost_array-test.patch
Normal file
12
swig308-Fix-li_boost_array-test.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -up swig-3.0.8/Examples/test-suite/li_boost_array.i.orig swig-3.0.8/Examples/test-suite/li_boost_array.i
|
||||||
|
--- swig-3.0.8/Examples/test-suite/li_boost_array.i.orig 2016-01-06 08:09:48.851786620 +0100
|
||||||
|
+++ swig-3.0.8/Examples/test-suite/li_boost_array.i 2016-01-06 08:10:54.028471052 +0100
|
||||||
|
@@ -31,7 +31,7 @@ namespace boost {
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
boost::array<int, 6> arrayOutVal() {
|
||||||
|
- const char carray[] = { -2, -1, 0, 0, 1, 2 };
|
||||||
|
+ const signed char carray[] = { -2, -1, 0, 0, 1, 2 };
|
||||||
|
boost::array<int, 6> myarray;
|
||||||
|
for (size_t i=0; i<6; ++i) {
|
||||||
|
myarray[i] = carray[i];
|
Loading…
Reference in New Issue
Block a user