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.
This commit is contained in:
parent
47297f3453
commit
4079fb927b
4 changed files with 53 additions and 18 deletions
|
|
@ -6426,7 +6426,8 @@ modify the buffer.
|
|||
<p>
|
||||
By including <tt>pyabc.i</tt> and using the <tt>-py3</tt> command
|
||||
line option when calling SWIG, the proxy classes of the STL containers
|
||||
will automatically gain an appropriate abstract base class. For
|
||||
will automatically gain an appropriate abstract base class from the
|
||||
<tt>collections.abc</tt> module. For
|
||||
example, the following SWIG interface:
|
||||
</p>
|
||||
|
||||
|
|
@ -6443,8 +6444,8 @@ namespace std {
|
|||
|
||||
<p>
|
||||
will generate a Python proxy class <tt>Mapii</tt> inheriting from
|
||||
<tt>collections.MutableMap</tt> and a proxy class <tt>IntList</tt>
|
||||
inheriting from <tt>collections.MutableSequence</tt>.
|
||||
<tt>collections.abc.MutableMap</tt> and a proxy class <tt>IntList</tt>
|
||||
inheriting from <tt>collections.abc.MutableSequence</tt>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
@ -6453,7 +6454,7 @@ used to define an abstract base class for your own C++ class:
|
|||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
%pythonabc(MySet, collections.MutableSet);
|
||||
%pythonabc(MySet, collections.abc.MutableSet);
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
|
|
@ -6461,6 +6462,14 @@ For details of abstract base class, please see
|
|||
<a href="https://www.python.org/dev/peps/pep-3119/">PEP 3119</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Compatibility Note:</b> SWIG-4.0.0 changed the base classes to use the
|
||||
<tt>collections.abc</tt> module instead of <tt>collections</tt> due to the deprecation
|
||||
of the classes in the <tt>collections</tt> module in Python 3.7.
|
||||
The <tt>collections.abc</tt> module was introduced in Python 3.3 and hence this feature
|
||||
requires Python 3.3 or later.
|
||||
</p>
|
||||
|
||||
<H3><a name="Python_nn77">38.12.4 Byte string output conversion</a></H3>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue