Package: xapers
Version: 0.8.2-1
Severity: normal
Tags: patch

Dear Maintainer,

The attached fairly simple patch fixes tests when Python 3.7 is the
default, which is the case currently in Ubuntu and I believe will be
fairly soon in Debian too.

Cheers,
mwh
-- System Information:
Debian Release: buster/sid
  APT prefers bionic-updates
  APT policy: (500, 'bionic-updates'), (500, 'bionic-security'), (500, 
'bionic'), (400, 'bionic-proposed'), (100, 'bionic-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.15.0-38-generic (SMP w/4 CPU cores)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_NZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages xapers depends on:
ii  poppler-utils          0.62.0-2ubuntu2.2
ii  python3                3.6.5-3ubuntu1
ii  python3-pkg-resources  39.0.1-2
pn  python3-pybtex         <none>
pn  python3-xapian         <none>

Versions of packages xapers recommends:
ii  python3-pycurl  7.43.0.1-0.2
ii  python3-urwid   2.0.1-2
pn  xclip           <none>
ii  xdg-utils       1.1.2-1ubuntu2.2

xapers suggests no packages.
>From e1265a5ea54f62c7a0e250473dcb90daf8a79724 Mon Sep 17 00:00:00 2001
From: Michael Hudson-Doyle <Michael Hudson-Doyle mwhud...@debian.org>
Date: Mon, 5 Nov 2018 14:46:27 +1300
Subject: [PATCH] Fixes for Python 3.7

PEP 472 changes how StopIteration is handled inside generators -- it no
longer bubbles out but instead causes an error.
---
 lib/xapers/util.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/xapers/util.py b/lib/xapers/util.py
index 6805c5a..6fc0254 100644
--- a/lib/xapers/util.py
+++ b/lib/xapers/util.py
@@ -9,12 +9,18 @@ def xapian_term_iter(xapian_object, prefix=None):
     term_iter = iter(xapian_object)
     if prefix:
         plen = len(prefix)
-        term = term_iter.skip_to(prefix).term.decode()
+        try:
+            term = term_iter.skip_to(prefix).term.decode()
+        except StopIteration:
+            return
         if not term.startswith(prefix):
             return
         yield term[plen:]
     for tli in term_iter:
-        term = tli.term.decode()
+        try:
+           term = tli.term.decode()
+        except StopIteration:
+            return
         if prefix:
             if not term.startswith(prefix):
                 break
-- 
2.17.1

Reply via email to