[Debian-med-packaging] Bug#747494: python3-biopython: Does not use C implementations of cpairwise2 functions

Jakub Wilk jwilk at debian.org
Fri May 9 11:32:37 UTC 2014


* Andreas Tille <andreas at an3as.eu>, 2014-05-09, 13:15:
>thanks for your bug report.  I think this should work out of the box 
>but I personally not comfortable with cpython to know how this could be 
>fixed.  I keep the Debian Python list in CC - perhaps they might have 
>some helpful advise.

The relvant code in Bio/pairwaise2.py is:

# Try and load C implementations of functions.  If I can't,
# then just ignore and use the pure python implementations.
try:
    from cpairwise2 import rint, _make_score_matrix_fast
except ImportError:
    pass

But in Python 3 imports as always absolute, unless explicitly 
requested, so the import fails, and this code snippet is no-op.
Changing the import line to:

    from .cpairwise2 import rint, _make_score_matrix_fast

should do the trick.

Before:
$ python3 -c 'from Bio.pairwise2 import rint; print(rint.__module__)'
Bio.pairwise2

After:
$ python3 -c 'from Bio.pairwise2 import rint; print(rint.__module__)'
Bio.cpairwise2

>It seems this module is not affected by the test suite since this runs 
>fine.

Yeah, as the code comment says, if the import fails, everything(?) still 
works, just slower.

-- 
Jakub Wilk



More information about the Debian-med-packaging mailing list