[pypy-commit] pypy int_w-refactor: don't allow unwanted conversions between cdatas

antocuni noreply at buildbot.pypy.org
Wed Feb 26 19:15:13 CET 2014


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: int_w-refactor
Changeset: r69469:20289253d2ac
Date: 2014-02-26 19:14 +0100
http://bitbucket.org/pypy/pypy/changeset/20289253d2ac/

Log:	don't allow unwanted conversions between cdatas

diff --git a/pypy/module/_cffi_backend/misc.py b/pypy/module/_cffi_backend/misc.py
--- a/pypy/module/_cffi_backend/misc.py
+++ b/pypy/module/_cffi_backend/misc.py
@@ -131,13 +131,13 @@
     if space.is_w(space.type(w_ob), space.w_int):   # shortcut
         return space.int_w(w_ob)
     try:
-        bigint = space.bigint_w(w_ob)
+        bigint = space.bigint_w(w_ob, allow_conversion=False)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
         if _is_a_float(space, w_ob):
             raise
-        bigint = space.bigint_w(space.int(w_ob))
+        bigint = space.bigint_w(space.int(w_ob), allow_conversion=False)
     try:
         return bigint.tolonglong()
     except OverflowError:
@@ -148,13 +148,13 @@
     if space.is_w(space.type(w_ob), space.w_int):   # shortcut
         return space.int_w(w_ob)
     try:
-        bigint = space.bigint_w(w_ob)
+        bigint = space.bigint_w(w_ob, allow_conversion=False)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
         if _is_a_float(space, w_ob):
             raise
-        bigint = space.bigint_w(space.int(w_ob))
+        bigint = space.bigint_w(space.int(w_ob), allow_conversion=False)
     try:
         return bigint.toint()
     except OverflowError:
@@ -171,13 +171,13 @@
             raise OperationError(space.w_OverflowError, space.wrap(neg_msg))
         return r_ulonglong(value)
     try:
-        bigint = space.bigint_w(w_ob)
+        bigint = space.bigint_w(w_ob, allow_conversion=False)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
         if strict and _is_a_float(space, w_ob):
             raise
-        bigint = space.bigint_w(space.int(w_ob))
+        bigint = space.bigint_w(space.int(w_ob), allow_conversion=False)
     if strict:
         try:
             return bigint.toulonglong()
@@ -196,13 +196,13 @@
             raise OperationError(space.w_OverflowError, space.wrap(neg_msg))
         return r_uint(value)
     try:
-        bigint = space.bigint_w(w_ob)
+        bigint = space.bigint_w(w_ob, allow_conversion=False)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
         if strict and _is_a_float(space, w_ob):
             raise
-        bigint = space.bigint_w(space.int(w_ob))
+        bigint = space.bigint_w(space.int(w_ob), allow_conversion=False)
     if strict:
         try:
             return bigint.touint()


More information about the pypy-commit mailing list