Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r78327:c636e65f2d90 Date: 2015-06-26 23:51 +0200 http://bitbucket.org/pypy/pypy/changeset/c636e65f2d90/
Log: cffi/9d86b893ad22: add 'lib.__name__' diff --git a/pypy/module/_cffi_backend/lib_obj.py b/pypy/module/_cffi_backend/lib_obj.py --- a/pypy/module/_cffi_backend/lib_obj.py +++ b/pypy/module/_cffi_backend/lib_obj.py @@ -175,6 +175,8 @@ return self.dir1(ignore_type=cffi_opcode.OP_GLOBAL_VAR) if is_getattr and attr == '__dict__': return self.full_dict_copy() + if is_getattr and attr == '__name__': + return self.descr_repr() raise oefmt(self.space.w_AttributeError, "cffi library '%s' has no function, constant " "or global variable named '%s'", diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -1011,3 +1011,4 @@ assert MYFOO == 42 assert hasattr(lib, '__dict__') assert lib.__all__ == ['MYFOO', 'mybar'] # but not 'myvar' + assert lib.__name__ == repr(lib) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit