[pypy-commit] pypy cpyext-gc-support-2: Kill PyPy_Borrow()

arigo pypy.commits at gmail.com
Sun Feb 14 06:43:33 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: cpyext-gc-support-2
Changeset: r82240:9c732bb2412b
Date: 2016-02-14 12:42 +0100
http://bitbucket.org/pypy/pypy/changeset/9c732bb2412b/

Log:	Kill PyPy_Borrow()

diff --git a/pypy/module/cpyext/__init__.py b/pypy/module/cpyext/__init__.py
--- a/pypy/module/cpyext/__init__.py
+++ b/pypy/module/cpyext/__init__.py
@@ -61,7 +61,6 @@
 import pypy.module.cpyext.funcobject
 import pypy.module.cpyext.frameobject
 import pypy.module.cpyext.classobject
-import pypy.module.cpyext.pypyintf
 import pypy.module.cpyext.memoryobject
 import pypy.module.cpyext.codecs
 import pypy.module.cpyext.pyfile
diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h
--- a/pypy/module/cpyext/include/patchlevel.h
+++ b/pypy/module/cpyext/include/patchlevel.h
@@ -31,6 +31,12 @@
 /* PyPy version as a string */
 #define PYPY_VERSION "4.1.0-alpha0"
 
+/* Defined to mean a PyPy where cpyext holds more regular references
+   to PyObjects, e.g. staying alive as long as the internal PyPy object
+   stays alive. */
+#define PYPY_CPYEXT_GC      1
+#define PyPy_Borrow(a, b)   ((void) 0)
+
 /* Subversion Revision number of this file (not of the repository).
  * Empty since Mercurial migration. */
 #define PY_PATCHLEVEL_REVISION  ""
diff --git a/pypy/module/cpyext/pypyintf.py b/pypy/module/cpyext/pypyintf.py
deleted file mode 100644
--- a/pypy/module/cpyext/pypyintf.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from pypy.module.cpyext.api import cpython_api
-from pypy.module.cpyext.pyobject import PyObject, borrow_from
-
-
- at cpython_api([PyObject, PyObject], PyObject)
-def PyPy_Borrow(space, w_parentobj, w_obj):
-    """Returns a borrowed reference to 'obj', borrowing from the 'parentobj'.
-    """
-    return borrow_from(w_parentobj, w_obj)
diff --git a/pypy/module/cpyext/src/getargs.c b/pypy/module/cpyext/src/getargs.c
--- a/pypy/module/cpyext/src/getargs.c
+++ b/pypy/module/cpyext/src/getargs.c
@@ -442,7 +442,7 @@
             strncpy(msgbuf, "is not retrievable", bufsize);
             return msgbuf;
         }
-	PyPy_Borrow(arg, item);
+	//PyPy_Borrow(arg, item);
         msg = convertitem(item, &format, p_va, flags, levels+1,
                           msgbuf, bufsize, freelist);
         /* PySequence_GetItem calls tp->sq_item, which INCREFs */


More information about the pypy-commit mailing list