diff options
author | Timothy Crosley <timothy.crosley@gmail.com> | 2013-11-24 21:14:49 -0500 |
---|---|---|
committer | Timothy Crosley <timothy.crosley@gmail.com> | 2013-11-24 21:14:49 -0500 |
commit | d5fa0f541148a579854702688a4dd3073c9c15c3 (patch) | |
tree | 13c81ee5520792125e7153a92d8d6efab2346e69 /pies | |
parent | b3c15412a3ace052e38dc9b47d845b934211bc2c (diff) | |
download | pies-d5fa0f541148a579854702688a4dd3073c9c15c3.tar.gz |
Fix not allow to return correct name, instead of always referencing last name in loop
Diffstat (limited to 'pies')
-rw-r--r-- | pies/overrides.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pies/overrides.py b/pies/overrides.py index 6c6157c..6c92b7a 100644 --- a/pies/overrides.py +++ b/pies/overrides.py @@ -95,12 +95,14 @@ else: range = xrange integer_types = (int, long) - for removed in ('apply', 'cmp', 'coerce', 'execfile', 'raw_input', 'unpacks'): + def _create_not_allowed(name): def _not_allow(*args, **kwargs): - raise NameError("name '{0}' is not defined".format(removed)) + raise NameError("name '{0}' is not defined".format(name)) + _not_allow.__name__ = name + return _not_allow - _not_allow.__name__ = removed - globals()[removed] = _not_allow + for removed in ('apply', 'cmp', 'coerce', 'execfile', 'raw_input', 'unpacks'): + globals()[removed] = _create_not_allowed(removed) def u(string): return codecs.unicode_escape_decode(string[0]) |