Commit 36f79d47 authored by Armin Rigo's avatar Armin Rigo
Browse files

Test and fix: Python 3.5 (at least the current beta) is unhappy

with module-like objects without a '__name__'
parent 41f9e10dfdee
......@@ -451,6 +451,11 @@ static PyObject *lib_getattr(LibObject *lib, PyObject *name)
PyErr_Clear();
return _lib_dict(lib);
}
/* this hack is for Python 3.5 */
if (strcmp(PyText_AsUTF8(name), "__name__") == 0) {
PyErr_Clear();
return lib_repr(lib);
}
return NULL;
}
......
import sys, os, py
from cffi import FFI, VerificationError
from cffi import recompiler
......@@ -1079,3 +1080,4 @@ def test_import_from_lib():
assert MYFOO == 42
assert hasattr(lib, '__dict__')
assert lib.__all__ == ['MYFOO', 'mybar'] # but not 'myvar'
assert lib.__name__ == repr(lib)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment