[pypy-commit] cffi default: Issue #352
arigo
pypy.commits at gmail.com
Wed Jan 10 16:18:21 EST 2018
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r3060:d16706e3c2da
Date: 2018-01-10 22:18 +0100
http://bitbucket.org/cffi/cffi/changeset/d16706e3c2da/
Log: Issue #352
Oops.
diff --git a/c/lib_obj.c b/c/lib_obj.c
--- a/c/lib_obj.c
+++ b/c/lib_obj.c
@@ -505,6 +505,7 @@
return x;
missing:
+ /*** ATTRIBUTEERROR IS SET HERE ***/
p = PyText_AsUTF8(name);
if (p == NULL)
return NULL;
@@ -534,6 +535,7 @@
#if PY_MAJOR_VERSION >= 3
if (strcmp(p, "__loader__") == 0 || strcmp(p, "__spec__") == 0) {
/* some more module-like behavior hacks */
+ PyErr_Clear();
Py_INCREF(Py_None);
return Py_None;
}
diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py
--- a/testing/cffi1/test_recompiler.py
+++ b/testing/cffi1/test_recompiler.py
@@ -2287,3 +2287,13 @@
def test_char16_char32_plain_c():
test_char16_char32_type(no_cpp=True)
+
+def test_loader_spec():
+ ffi = FFI()
+ lib = verify(ffi, "test_loader_spec", "")
+ if sys.version_info < (3,):
+ assert not hasattr(lib, '__loader__')
+ assert not hasattr(lib, '__spec__')
+ else:
+ assert lib.__loader__ is None
+ assert lib.__spec__ is None
More information about the pypy-commit
mailing list