[pypy-svn] pypy psycopg2compatibility: Recovered intobject.py from my crappy merge...

ademan commits-noreply at bitbucket.org
Thu Dec 23 09:18:05 CET 2010


Author: Daniel Roberts <Ademan555 at gmail.com>
Branch: psycopg2compatibility
Changeset: r40190:e4293a5fe3b1
Date: 2010-12-23 00:10 -0800
http://bitbucket.org/pypy/pypy/changeset/e4293a5fe3b1/

Log:	Recovered intobject.py from my crappy merge...

diff --git a/pypy/module/cpyext/intobject.py b/pypy/module/cpyext/intobject.py
--- a/pypy/module/cpyext/intobject.py
+++ b/pypy/module/cpyext/intobject.py
@@ -1,7 +1,9 @@
 
 from pypy.rpython.lltypesystem import rffi, lltype
 from pypy.interpreter.error import OperationError
-from pypy.module.cpyext.api import (cpython_api, build_type_checkers, PyObject, CONST_STRING, CANNOT_FAIL, Py_ssize_t)
+from pypy.module.cpyext.api import (
+    cpython_api, build_type_checkers, PyObject,
+    CONST_STRING, CANNOT_FAIL, Py_ssize_t)
 from pypy.rlib.rarithmetic import r_uint
 
 PyInt_Check, PyInt_CheckExact = build_type_checkers("Int")
@@ -86,3 +88,10 @@
     a number too large to be contained within the machine's long int type
     and overflow warnings are being suppressed, a PyLongObject will be
     returned.  If overflow warnings are not being suppressed, NULL will be
+    returned in this case."""
+    s = rffi.charp2str(str)
+    w_str = space.wrap(s)
+    w_base = space.wrap(rffi.cast(lltype.Signed, base))
+    if pend:
+        pend[0] = rffi.ptradd(str, len(s))
+    return space.call_function(space.w_int, w_str, w_base)


More information about the Pypy-commit mailing list