[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#792606: python-apt: Python 3.5 and PEP 479 support



Package: python-apt
Version: 1.0.0~beta3
Severity: normal

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dear Maintainer,

PEP 479 in Python 3.5 clarifies the protocol for iterators when they
are exhausted, such that they should just 'return' rather than raise a
StopIteration.  In fact, raising a StopIteration causes a silent
deprecation warning to be issued in Python 3.5.  This results in
output to stderr, causing the DEP-8 tests of the package to fail.

Attached is a patch which just eliminates the explicit raising of
StopIteration and lets the iterators return by falling off the end of
the function.  I've confirmed that the package builds, tests pass, and
DEP-8 tests pass with this patch. 

- -- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.0.0-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages python-apt depends on:
ii  libapt-inst1.5     1.0.9.10
ii  libapt-pkg4.12     1.0.9.10
ii  libc6              2.19-19
ii  libgcc1            1:5.1.1-14
ii  libstdc++6         5.1.1-14
ii  python             2.7.9-1
ii  python-apt-common  1.0.0~beta3
pn  python:any         <none>

Versions of packages python-apt recommends:
ii  iso-codes    3.59-1
ii  lsb-release  4.1+Debian13+nmu1
ii  xz-utils     5.1.1alpha+20120614-2.1

Versions of packages python-apt suggests:
ii  python-apt-dbg  1.0.0~beta3
pn  python-apt-doc  <none>

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJVp9l1AAoJEBJutWOnSwa/zfoP/RNtYjQgY0G6RFcaEqpVZqPc
K/E5o9wEcPqj32/g0DCQZyXmzxhY7UWEu8cj2Woog9es6M3H+/5quBmBa4Rr/rk/
aWlUkv3CLkgEnfN71UX2MdRc34+Yg5Vx96+c1gDnC1bgQnHJ1YEIqElJr73aypf7
n1GgLp4IpXiFVLN5A9vKNEwfK6rBtXGwpX7WtcRd6R121YJfufTrBjdiNFVaUn77
utDOhygsG/kgr3BVfokrvd1ZX3BJwCBsDMNt1FrAer/y4qZq+CJeSTLmaFqG7rDr
G9Qo5Oj0mzekFvUmuA9kHWAELplfo4OkkOFmVHOolIfqfi5rdc+/8JcJtBOe1+QU
A9kqNjzZNaqFc+/T2RZJAsYpmhzoQlTLgAth94k4CcxdqKQxF9zgsu5iLuaRI03F
OxM3rL/reNVBAB47mu5UrEPadVsO+UvQxym+AuOz5hsAgKFaAX7ueTc4OwBUXqU/
hoQL1oL+1UW2hpfPIcjYWfGZod2rRLEO13EpigYiEDCd2Ptcs14gQ6MKoDwgAJBr
L+SkJwXdwAejGcgESSmZlvnQDyXSbx9n5buy9wqxY0cEMr2ixHJbR9Z244MRo+HP
Yyhb6VKPFf82u2bqoN7UAMIO1PWiKsXzmidySuwd8gBQPmcAAYemu+gXLMvIH7Vm
YxlKFob2spq0/rfbxuL2
=ASlQ
-----END PGP SIGNATURE-----
diff --git a/apt/cache.py b/apt/cache.py
index 74bbe71..7849806 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -221,7 +221,6 @@ class Cache(object):
         # necessary for uncompressed indexes.
         for pkgname in self.keys():
             yield self[pkgname]
-        raise StopIteration
 
     def __is_real_pkg(self, rawpkg):
         """Check if the apt_pkg.Package provided is a real package."""
diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py
index f490352..6be7e5e 100644
--- a/aptsources/sourceslist.py
+++ b/aptsources/sourceslist.py
@@ -295,7 +295,6 @@ class SourcesList(object):
             types """
         for entry in self.list:
             yield entry
-        raise StopIteration
 
     def __find(self, *predicates, **attrs):
         for source in self.list:
diff --git a/debian/changelog b/debian/changelog
index 2dc57e6..cbb3501 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+python-apt (1.0.0~beta4) UNRELEASED; urgency=medium
+
+  * To properly conform to PEP 479 and Python 3.5, __iter__() methods
+    should return when exhausted instead of raising StopIterator.
+
+ -- Barry Warsaw <barry@debian.org>  Thu, 16 Jul 2015 11:37:43 -0400
+
 python-apt (1.0.0~beta3) unstable; urgency=medium
 
   * tests/test_paths.py: Catch and assert the DeprecationWarning

Reply to: