diff options
| author | Armin Rigo <arigo@tunes.org> | 2015-06-26 23:47:36 +0200 |
|---|---|---|
| committer | Armin Rigo <arigo@tunes.org> | 2015-06-26 23:47:36 +0200 |
| commit | b1b44ce4bfb7b6fe3d8411845b487d9ed825227b (patch) | |
| tree | 6166496b4a6139e81331c6eb745f61811c10b7d6 /c/lib_obj.c | |
| parent | 582d1ffda41a7b1519ac3bb3d2a9b5cff83100f1 (diff) | |
| download | cffi-b1b44ce4bfb7b6fe3d8411845b487d9ed825227b.tar.gz | |
Test and fix: Python 3.5 (at least the current beta) is unhappy
with module-like objects without a '__name__'
Diffstat (limited to 'c/lib_obj.c')
| -rw-r--r-- | c/lib_obj.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/c/lib_obj.c b/c/lib_obj.c index c8b2318..4d2bf3c 100644 --- a/c/lib_obj.c +++ b/c/lib_obj.c @@ -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; } |
