Bug#1088764: pocketsphinx-python: autopkgtest failure with Python 3.13

Samuel Thibault sthibault at debian.org
Mon Dec 2 02:01:33 GMT 2024


Just FTR, the patch I had tried to add to the sphinxbase package to try
to get pocketsphinx-python expose a proper __iter__ method. It does
return a new object, but doesn't duplicate ptr, thus deemed to get
duplicate frees and whatnot.

Samuel

Samuel Thibault, le lun. 02 déc. 2024 02:58:51 +0100, a ecrit:
> Hello,
> 
> Graham Inggs, le sam. 30 nov. 2024 17:41:54 +0000, a ecrit:
> > The autopkgtests of this package fail with Python 3.13 [1].
> 
> It looks like python 3.13 now requires the iterator (not just the
> interable) to provide an __iter__ method. I don't see how to do that
> with the pocketsphinx interface: there is ps_seg_next method to get the
> next one, but no method that would allow to duplicate a ps_seg_t.
> 
> I guess we'll just have to bite the bullet and upload pocketsphinx 5
> without waiting for parlatype, subtitlecomposer and ffmpeg to catch up,
> unless somebody knows how to fix this.
> 
> Samuel
> 
> > [1] https://ci.debian.net/packages/p/pocketsphinx-python/testing/amd64/
> > 
> > 
> > 67s =================================== FAILURES
> > ===================================
> > 67s ___________________ TestRawDecoder.test_raw_decoder_segments
> > ___________________
> > 67s
> > 67s self = <tests.test_decoder.TestRawDecoder
> > testMethod=test_raw_decoder_segments>
> > 67s
> > 67s def test_raw_decoder_segments(self):
> > 67s > self.assertEqual(self.ps.segments(), [
> > 67s '<s>', '<sil>', 'go', 'forward', 'ten', 'meters', '</s>'
> > 67s ])
> > 67s
> > 67s tests/test_decoder.py:52:
> > 67s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> > _ _ _ _ _ _ _
> > 67s
> > 67s self = <pocketsphinx.Pocketsphinx; proxy of <Swig Object of type
> > 'Decoder *' at 0x7f4c03ee2d60> >
> > 67s detailed = False
> > 67s
> > 67s def segments(self, detailed=False):
> > 67s if detailed:
> > 67s return [
> > 67s (s.word, s.prob, s.start_frame, s.end_frame)
> > 67s for s in self.seg()
> > 67s ]
> > 67s else:
> > 67s > return [s.word for s in self.seg()]
> > 67s E TypeError: 'SegmentIterator' object is not iterable
> > 67s
> > 67s /usr/lib/python3/dist-packages/pocketsphinx/__init__.py:123: TypeError
> > 67s _______________________________ TestKws.test_kws
> > _______________________________
> > 67s
> > 67s self = <tests.test_kws.TestKws testMethod=test_kws>
> > 67s
> > 67s def test_kws(self):
> > 67s segments = []
> > 67s for phrase in AudioFile(lm=False, keyphrase='forward',
> > 67s kws_threshold=1e+20):
> > 67s > segments = phrase.segments(detailed=True)
> > 67s
> > 67s tests/test_kws.py:41:
> > 67s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> > _ _ _ _ _ _ _
> > 67s
> > 67s self = <pocketsphinx.AudioFile; proxy of <Swig Object of type
> > 'Decoder *' at 0x7f4c03136490> >
> > 67s detailed = True
> > 67s
> > 67s def segments(self, detailed=False):
> > 67s if detailed:
> > 67s return [
> > 67s (s.word, s.prob, s.start_frame, s.end_frame)
> > 67s > for s in self.seg()
> > 67s ]
> > 67s E TypeError: 'SegmentIterator' object is not iterable
> > 67s
> > 67s /usr/lib/python3/dist-packages/pocketsphinx/__init__.py:120: TypeError
> > 67s ____________________ TestPhoneme.test_phoneme_best_phonemes
> > ____________________
> > 67s
> > 67s self = <tests.test_phoneme.TestPhoneme
> > testMethod=test_phoneme_best_phonemes>
> > 67s
> > 67s def test_phoneme_best_phonemes(self):
> > 67s > self.assertEqual(self.ps.segments(), [
> > 67s 'SIL',
> > 67s 'G',
> > 67s 'OW',
> > 67s 'F',
> > 67s 'AO',
> > 67s 'R',
> > 67s 'W',
> > 67s 'ER',
> > 67s 'D',
> > 67s 'T',
> > 67s 'AE',
> > 67s 'N',
> > 67s 'M',
> > 67s 'IY',
> > 67s 'IH',
> > 67s 'ZH',
> > 67s 'ER',
> > 67s 'Z',
> > 67s 'S',
> > 67s 'V',
> > 67s 'SIL'
> > 67s ])
> > 67s
> > 67s tests/test_phoneme.py:58:
> > 67s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> > _ _ _ _ _ _ _
> > 67s
> > 67s self = <pocketsphinx.Pocketsphinx; proxy of <Swig Object of type
> > 'Decoder *' at 0x7f4c03e388a0> >
> > 67s detailed = False
> > 67s
> > 67s def segments(self, detailed=False):
> > 67s if detailed:
> > 67s return [
> > 67s (s.word, s.prob, s.start_frame, s.end_frame)
> > 67s for s in self.seg()
> > 67s ]
> > 67s else:
> > 67s > return [s.word for s in self.seg()]
> > 67s E TypeError: 'SegmentIterator' object is not iterable
> > 67s
> > 67s /usr/lib/python3/dist-packages/pocketsphinx/__init__.py:123: TypeError
> > 
> > _______________________________________________
> > Pkg-a11y-devel mailing list
> > Pkg-a11y-devel at alioth-lists.debian.net
> > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-a11y-devel
-------------- next part --------------
--- a/swig/iterators.i
+++ b/swig/iterators.i
@@ -110,6 +110,14 @@ typedef struct {
     }
     return NULL;
   }
+
+  // Python3.13
+  %newobject __iter__;
+  TYPE##Iterator * __iter__() {
+    TYPE##Iterator *iter = (TYPE##Iterator *)ckd_malloc(sizeof *iter);
+    iter->ptr = $self->ptr;
+    return iter;
+  }
 #endif
 }
 


More information about the Pkg-a11y-devel mailing list