[pypy-commit] cffi default: Some more module-like behavior hacks

arigo pypy.commits at gmail.com
Thu Sep 21 11:29:58 EDT 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r3023:19ab3ca30f71
Date: 2017-09-21 17:29 +0200
http://bitbucket.org/cffi/cffi/changeset/19ab3ca30f71/

Log:	Some more module-like behavior hacks

diff --git a/c/lib_obj.c b/c/lib_obj.c
--- a/c/lib_obj.c
+++ b/c/lib_obj.c
@@ -530,6 +530,13 @@
         PyErr_Clear();
         return PyText_FromFormat("%s.lib", PyText_AS_UTF8(lib->l_libname));
     }
+#if PY_MAJOR_VERSION >= 3
+    if (strcmp(p, "__loader__") == 0 || strcmp(p, "__spec__") == 0) {
+        /* some more module-like behavior hacks */
+        Py_INCREF(Py_None);
+        return Py_None;
+    }
+#endif
     return NULL;
 }
 


More information about the pypy-commit mailing list