diff options
author | Taku Kudo <taku@google.com> | 2020-05-18 08:29:36 +0300 |
---|---|---|
committer | Taku Kudo <taku@google.com> | 2020-05-18 08:29:36 +0300 |
commit | 8970682ca6828f168909be7bbe701f6905ad123e (patch) | |
tree | 590f06a25681fedffa685b3e45c77ee25e04783e | |
parent | 680c8c6a2af92282fed0f71f422aa4a3a7c7cd2a (diff) |
fixed test failure.
-rw-r--r-- | python/sentencepiece.i | 4 | ||||
-rw-r--r-- | python/sentencepiece_wrap.cxx | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/python/sentencepiece.i b/python/sentencepiece.i index e909506..784411b 100644 --- a/python/sentencepiece.i +++ b/python/sentencepiece.i @@ -105,7 +105,9 @@ class PySentenceIterator : public sentencepiece::SentenceIterator { CopyValue(); } - ~PySentenceIterator() {} + ~PySentenceIterator() { + if (iter_) Py_DECREF(iter_); + } bool done() const override { return item_ == nullptr; diff --git a/python/sentencepiece_wrap.cxx b/python/sentencepiece_wrap.cxx index e47b780..3bced05 100644 --- a/python/sentencepiece_wrap.cxx +++ b/python/sentencepiece_wrap.cxx @@ -2876,7 +2876,9 @@ class PySentenceIterator : public sentencepiece::SentenceIterator { CopyValue(); } - ~PySentenceIterator() {} + ~PySentenceIterator() { + if (iter_) Py_DECREF(iter_); + } bool done() const override { return item_ == nullptr; |