[Biopython-dev] C code review - Bio.trie fix for Python 3.4

Manlio Calvi manlio.calvi at gmail.com
Mon Apr 21 14:41:39 UTC 2014


I don't know if it is related (but probably is) but I understood why I
don't get a trie error in my Test config... simply the module don't compile
itself!
Looking at the build dump seems to be compiled (with a lot of warning and
deprecations)

My test machine is Win7 x64, Python 3.4 x64 binary from Python.org

That's is the command I enter and the copy of the test dump I obtained

##############################################################
C:\Users\Public\BioPython3\biopython>python Tests/run_tests.py test_trie.py
> TestTrie.log 2>&1

test_trie ... skipping. Could not import Bio.trie, check C code was
compiled.
----------------------------------------------------------------------
Ran 1 test in 0.006 seconds

Python version: 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC
v.1600 64 bit (AMD64)]
Operating system: nt win32


##################################

What follows is part of the build dump related to the trie c module,instead
################################################

building 'Bio.trie' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c
/nologo /Ox /MD /W3 /GS- /DNDEBUG -IBio -IC:\Python34\include
-IC:\Python34\include /TcBio/triemodule.c
/Fobuild\temp.win-amd64-3.4\Release\Bio/triemodule.obj
triemodule.c
Bio/triemodule.c(578) : warning C4133: 'initializing' : incompatible types
- from 'long (__cdecl *)(PyObject *)' to 'hashfunc'
Bio/triemodule.c(750) : warning C4244: 'function' : conversion from
'Py_ssize_t' to 'const int', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c
/nologo /Ox /MD /W3 /GS- /DNDEBUG -IBio -IC:\Python34\include
-IC:\Python34\include /TcBio/trie.c
/Fobuild\temp.win-amd64-3.4\Release\Bio/trie.obj
trie.c
Bio/trie.c(11) : warning C4996: 'strcpy': This function or variable may be
unsafe. Consider using strcpy_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
Bio/trie.c(161) : warning C4996: 'strncpy': This function or variable may
be unsafe. Consider using strncpy_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
        C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\INCLUDE\string.h(157) : see declaration of 'strncpy'
Bio/trie.c(294) : warning C4267: 'initializing' : conversion from 'size_t'
to 'int', possible loss of data
Bio/trie.c(310) : warning C4996: 'strncat': This function or variable may
be unsafe. Consider using strncat_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
        C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\INCLUDE\string.h(144) : see declaration of 'strncat'
Bio/trie.c(379) : warning C4267: 'initializing' : conversion from 'size_t'
to 'int', possible loss of data
Bio/trie.c(382) : warning C4996: 'strcat': This function or variable may be
unsafe. Consider using strcat_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
Bio/trie.c(395) : warning C4267: 'function' : conversion from 'size_t' to
'const int', possible loss of data
Bio/trie.c(466) : warning C4267: '=' : conversion from 'size_t' to 'int',
possible loss of data
Bio/trie.c(467) : warning C4267: '=' : conversion from 'size_t' to 'int',
possible loss of data
Bio/trie.c(494) : warning C4267: 'initializing' : conversion from 'size_t'
to 'int', possible loss of data
Bio/trie.c(501) : warning C4996: 'strcat': This function or variable may be
unsafe. Consider using strcat_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
Bio/trie.c(547) : warning C4267: '=' : conversion from 'size_t' to 'int',
possible loss of data
Bio/trie.c(548) : warning C4267: '=' : conversion from 'size_t' to 'int',
possible loss of data
Bio/trie.c(575) : warning C4267: 'initializing' : conversion from 'size_t'
to 'int', possible loss of data
Bio/trie.c(581) : warning C4996: 'strncat': This function or variable may
be unsafe. Consider using strncat_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
        C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\INCLUDE\string.h(144) : see declaration of 'strncat'
Bio/trie.c(669) : warning C4267: '=' : conversion from 'size_t' to 'int',
possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe
/DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python34\libs
/LIBPATH:C:\Python34\PCbuild\amd64 /EXPORT:PyInit_trie
build\temp.win-amd64-3.4\Release\Bio/triemodule.obj
build\temp.win-amd64-3.4\Release\Bio/trie.obj
/OUT:build\lib.win-amd64-3.4\Bio\trie.pyd
/IMPLIB:build\temp.win-amd64-3.4\Release\Bio\trie.lib
/MANIFESTFILE:build\temp.win-amd64-3.4\Release\Bio\trie.pyd.manifest
   Creating library build\temp.win-amd64-3.4\Release\Bio\trie.lib and
object build\temp.win-amd64-3.4\Release\Bio\trie.exp


On Mon, Apr 21, 2014 at 3:37 PM, Peter Cock <p.j.a.cock at googlemail.com>wrote:

> Hi all,
>
> Do we have any Python 3 bytes/unicode C API experts
> lurking on the list who could review my patch here please?
>
> https://github.com/biopython/biopython/issues/305
>
> Thanks,
>
> Peter
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython-dev
>



More information about the Biopython-dev mailing list