[pypy-commit] cffi cffi-1.0: simplify

arigo noreply at buildbot.pypy.org
Fri May 8 10:24:38 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1924:13879916deb2
Date: 2015-05-07 23:48 +0200
http://bitbucket.org/cffi/cffi/changeset/13879916deb2/

Log:	simplify

diff --git a/_cffi1/lib_obj.c b/_cffi1/lib_obj.c
--- a/_cffi1/lib_obj.c
+++ b/_cffi1/lib_obj.c
@@ -113,24 +113,18 @@
        CPython never unloads its C extension modules anyway.
     */
     xfunc = PyMem_Malloc(sizeof(struct CPyExtFunc_s));
-    if (xfunc == NULL)
-        goto no_memory;
-
+    if (xfunc == NULL) {
+        PyErr_NoMemory();
+        return NULL;
+    }
     memset((char *)xfunc, 0, sizeof(struct CPyExtFunc_s));
     xfunc->md.ml_meth = (PyCFunction)g->address;
     xfunc->md.ml_flags = flags;
     xfunc->md.ml_name = g->name;
     xfunc->md.ml_doc = cpyextfunc_doc;
-    if (xfunc->md.ml_name == NULL)
-        goto no_memory;
-
     xfunc->type_index = type_index;
 
     return PyCFunction_NewEx(&xfunc->md, (PyObject *)lib, lib->l_libname);
-
- no_memory:
-    PyErr_NoMemory();
-    return NULL;
 }
 
 static PyObject *lib_build_and_cache_attr(LibObject *lib, PyObject *name,


More information about the pypy-commit mailing list