DEF silently converts byte strings to Unicode strings: $ cat testcase.pyx DEF ABYTE = b'a' print type(ABYTE) $ python --version Python 2.7.10 $ python -c 'import pyximport as p; p.install(); import testcase' <type 'unicode'> Tested with Cython 0.23.1. -- Jakub Wilk