[pypy-commit] cffi default: Disable encode('utf-8') on Python 2, where it makes no sense and
arigo
noreply at buildbot.pypy.org
Mon Sep 3 22:15:50 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r911:311388c97d50
Date: 2012-09-03 22:15 +0200
http://bitbucket.org/cffi/cffi/changeset/311388c97d50/
Log: Disable encode('utf-8') on Python 2, where it makes no sense and
just adds to the confusion
diff --git a/cffi/verifier.py b/cffi/verifier.py
--- a/cffi/verifier.py
+++ b/cffi/verifier.py
@@ -14,7 +14,9 @@
self.kwds = kwds
#
key = '\x00'.join(['1', sys.version[:3], __version__, preamble] +
- ffi._cdefsources).encode('utf-8')
+ ffi._cdefsources)
+ if sys.version_info >= (3,):
+ key = key.encode('utf-8')
k1 = hex(binascii.crc32(key[0::2]) & 0xffffffff)
k1 = k1.lstrip('0x').rstrip('L')
k2 = hex(binascii.crc32(key[1::2]) & 0xffffffff)
More information about the pypy-commit
mailing list