[pypy-commit] pypy default: Simplify.

arigo noreply at buildbot.pypy.org
Wed Sep 19 12:04:17 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r57380:6c9dd55c6b2e
Date: 2012-09-19 10:16 +0200
http://bitbucket.org/pypy/pypy/changeset/6c9dd55c6b2e/

Log:	Simplify.

diff --git a/pypy/module/_cffi_backend/ctypeprim.py b/pypy/module/_cffi_backend/ctypeprim.py
--- a/pypy/module/_cffi_backend/ctypeprim.py
+++ b/pypy/module/_cffi_backend/ctypeprim.py
@@ -169,13 +169,9 @@
             self.vrangemax = (r_ulonglong(1) << sh) - 1
 
     def int(self, cdata):
-        if self.value_fits_long:
-            # this case is to handle enums, but also serves as a slight
-            # performance improvement for some other primitive types
-            value = misc.read_raw_long_data(cdata, self.size)
-            return self.space.wrap(value)
-        else:
-            return self.convert_to_object(cdata)
+        # enums: really call convert_to_object() just below,
+        # and not the one overridden in W_CTypeEnum.
+        return W_CTypePrimitiveSigned.convert_to_object(self, cdata)
 
     def convert_to_object(self, cdata):
         if self.value_fits_long:


More information about the pypy-commit mailing list