[pypy-svn] r25665 - pypy/dist/pypy/objspace/std
arigo at codespeak.net
arigo at codespeak.net
Mon Apr 10 16:50:31 CEST 2006
Author: arigo
Date: Mon Apr 10 16:50:30 2006
New Revision: 25665
Modified:
pypy/dist/pypy/objspace/std/stdtypedef.py
Log:
Safety-check: registering several multimethods of the same name on
the same type is not a good idea.
Modified: pypy/dist/pypy/objspace/std/stdtypedef.py
==============================================================================
--- pypy/dist/pypy/objspace/std/stdtypedef.py (original)
+++ pypy/dist/pypy/objspace/std/stdtypedef.py Mon Apr 10 16:50:30 2006
@@ -93,8 +93,13 @@
def hack_out_multimethods(ns):
"NOT_RPYTHON: initialization-time only."
result = []
+ seen = {}
for value in ns.itervalues():
if isinstance(value, StdObjSpaceMultiMethod):
+ if value.name in seen:
+ raise Exception("duplicate multimethod name %r" %
+ (value.name,))
+ seen[value.name] = True
result.append(value)
return result
More information about the Pypy-commit
mailing list