From 08aee96cbd1de0c842b29776be8c24e9f742ef2d Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 6 Apr 2023 13:08:47 +0100 Subject: Remove assign method uses by the removed Python Sequence Protocol --- Lib/python/pycontainer.swg | 11 ----------- Lib/python/pyname_compat.i | 2 -- Lib/python/std_array.i | 10 ---------- Lib/python/std_map.i | 10 ---------- Lib/python/std_multimap.i | 10 ---------- Lib/python/std_multiset.i | 11 ----------- Lib/python/std_set.i | 11 ----------- Lib/python/std_unordered_map.i | 10 ---------- Lib/python/std_unordered_multimap.i | 10 ---------- Lib/python/std_unordered_multiset.i | 11 ----------- Lib/python/std_unordered_set.i | 11 ----------- 11 files changed, 107 deletions(-) (limited to 'Lib') diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg index b77a37876..2c0466c21 100644 --- a/Lib/python/pycontainer.swg +++ b/Lib/python/pycontainer.swg @@ -775,17 +775,6 @@ namespace swig { fragment="SwigPySequence_Cont") { namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, Seq* seq) { - // seq->assign(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented - typedef typename SwigPySeq::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - seq->insert(seq->end(),(value_type)(*it)); - } - } - template struct IteratorProtocol { static void assign(PyObject *obj, Seq *seq) { diff --git a/Lib/python/pyname_compat.i b/Lib/python/pyname_compat.i index ca063153b..789b28443 100644 --- a/Lib/python/pyname_compat.i +++ b/Lib/python/pyname_compat.i @@ -37,7 +37,6 @@ #define PyObject_ptr SwigPtr_PyObject #define PyObject_var SwigVar_PyObject #define PyOper SwigPyOper -#define PySeq SwigPySeq #define PySwigClientData SwigPyClientData #define PySwigClientData_Del SwigPyClientData_Del #define PySwigClientData_New SwigPyClientData_New @@ -74,7 +73,6 @@ #define PySwigPacked_repr SwigPyPacked_repr #define PySwigPacked_str SwigPyPacked_str #define PySwigPacked_type SwigPyPacked_type -#define pyseq swigpyseq #define pyswigobject_type swigpyobject_type #define pyswigpacked_type swigpypacked_type %} diff --git a/Lib/python/std_array.i b/Lib/python/std_array.i index d41d1f15e..561f00fc7 100644 --- a/Lib/python/std_array.i +++ b/Lib/python/std_array.i @@ -19,16 +19,6 @@ } }; - template - inline void - assign(const SwigPySeq& swigpyseq, std::array* seq) { - if (swigpyseq.size() < seq->size()) - throw std::invalid_argument("std::array cannot be expanded in size"); - else if (swigpyseq.size() > seq->size()) - throw std::invalid_argument("std::array cannot be reduced in size"); - std::copy(swigpyseq.begin(), swigpyseq.end(), seq->begin()); - } - template struct IteratorProtocol, T> { diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i index e0b7d69dc..ef6eb7f20 100644 --- a/Lib/python/std_map.i +++ b/Lib/python/std_map.i @@ -77,16 +77,6 @@ %fragment("StdMapTraits","header",fragment="StdMapCommonTraits") { namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::map *map) { - typedef typename std::map::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - map->insert(value_type(it->first, it->second)); - } - } - template struct traits_asptr > { typedef std::map map_type; diff --git a/Lib/python/std_multimap.i b/Lib/python/std_multimap.i index bbffb6bcd..75b4d7fcf 100644 --- a/Lib/python/std_multimap.i +++ b/Lib/python/std_multimap.i @@ -6,16 +6,6 @@ %fragment("StdMultimapTraits","header",fragment="StdMapCommonTraits") { namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::multimap *multimap) { - typedef typename std::multimap::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - multimap->insert(value_type(it->first, it->second)); - } - } - template struct traits_asptr > { typedef std::multimap multimap_type; diff --git a/Lib/python/std_multiset.i b/Lib/python/std_multiset.i index ac430334c..b79f64e5a 100644 --- a/Lib/python/std_multiset.i +++ b/Lib/python/std_multiset.i @@ -7,17 +7,6 @@ %fragment("StdMultisetTraits","header",fragment="StdSequenceTraits") %{ namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::multiset* seq) { - // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented - typedef typename SwigPySeq::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - seq->insert(seq->end(),(value_type)(*it)); - } - } - template struct traits_asptr > { static int asptr(PyObject *obj, std::multiset **m) { diff --git a/Lib/python/std_set.i b/Lib/python/std_set.i index 0ef011998..3f80daff6 100644 --- a/Lib/python/std_set.i +++ b/Lib/python/std_set.i @@ -5,17 +5,6 @@ %fragment("StdSetTraits","header",fragment="StdSequenceTraits") %{ namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::set* seq) { - // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented - typedef typename SwigPySeq::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - seq->insert(seq->end(),(value_type)(*it)); - } - } - template struct traits_asptr > { static int asptr(PyObject *obj, std::set **s) { diff --git a/Lib/python/std_unordered_map.i b/Lib/python/std_unordered_map.i index 784be4c8f..200ec2c5d 100644 --- a/Lib/python/std_unordered_map.i +++ b/Lib/python/std_unordered_map.i @@ -56,16 +56,6 @@ %fragment("StdUnorderedMapTraits","header",fragment="StdMapCommonTraits",fragment="StdUnorderedMapForwardIteratorTraits") { namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::unordered_map *unordered_map) { - typedef typename std::unordered_map::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - unordered_map->insert(value_type(it->first, it->second)); - } - } - template struct traits_reserve > { static void reserve(std::unordered_map &seq, typename std::unordered_map::size_type n) { diff --git a/Lib/python/std_unordered_multimap.i b/Lib/python/std_unordered_multimap.i index bc095ea48..816ec0933 100644 --- a/Lib/python/std_unordered_multimap.i +++ b/Lib/python/std_unordered_multimap.i @@ -6,16 +6,6 @@ %fragment("StdUnorderedMultimapTraits","header",fragment="StdMapCommonTraits",fragment="StdUnorderedMapForwardIteratorTraits") { namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::unordered_multimap *unordered_multimap) { - typedef typename std::unordered_multimap::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - unordered_multimap->insert(value_type(it->first, it->second)); - } - } - template struct traits_reserve > { static void reserve(std::unordered_multimap &seq, typename std::unordered_multimap::size_type n) { diff --git a/Lib/python/std_unordered_multiset.i b/Lib/python/std_unordered_multiset.i index b0f3f096b..0542247b2 100644 --- a/Lib/python/std_unordered_multiset.i +++ b/Lib/python/std_unordered_multiset.i @@ -7,17 +7,6 @@ %fragment("StdUnorderedMultisetTraits","header",fragment="StdSequenceTraits") %{ namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::unordered_multiset* seq) { - // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented - typedef typename SwigPySeq::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - seq->insert(seq->end(),(value_type)(*it)); - } - } - template struct traits_reserve > { static void reserve(std::unordered_multiset &seq, typename std::unordered_multiset::size_type n) { diff --git a/Lib/python/std_unordered_set.i b/Lib/python/std_unordered_set.i index 79fca6c2f..fd866b14a 100644 --- a/Lib/python/std_unordered_set.i +++ b/Lib/python/std_unordered_set.i @@ -5,17 +5,6 @@ %fragment("StdUnorderedSetTraits","header",fragment="StdSequenceTraits") %{ namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::unordered_set* seq) { - // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented - typedef typename SwigPySeq::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - seq->insert(seq->end(),(value_type)(*it)); - } - } - template struct traits_reserve > { static void reserve(std::unordered_set &seq, typename std::unordered_set::size_type n) { -- cgit v1.2.1