[pypy-commit] pypy default: make it a clear error

fijal noreply at buildbot.pypy.org
Tue May 13 11:24:01 CEST 2014


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r71484:769e23925b13
Date: 2014-05-13 11:23 +0200
http://bitbucket.org/pypy/pypy/changeset/769e23925b13/

Log:	make it a clear error

diff --git a/lib_pypy/gdbm.py b/lib_pypy/gdbm.py
--- a/lib_pypy/gdbm.py
+++ b/lib_pypy/gdbm.py
@@ -44,6 +44,8 @@
     pass
 
 def _fromstr(key):
+    if not isinstance(key, str):
+        raise TypeError("gdbm mappings have string indices only")
     return {'dptr': ffi.new("char[]", key), 'dsize': len(key)}
 
 class gdbm(object):


More information about the pypy-commit mailing list