Commit 249d4cc3 authored by Jim Fulton's avatar Jim Fulton

Added optional special handling of the case when the first positional

argument is "self" to prevent things like hijacking external methods.
parent 013b6715
......@@ -105,7 +105,7 @@ def mapply(object, positional=(), keyword={},
debug=None, maybe=None,
missing_name=default_missing_name,
handle_class=default_handle_class,
context=None
context=None, bind=0,
):
if hasattr(object,'__bases__'):
......@@ -135,8 +135,14 @@ def mapply(object, positional=(), keyword={},
nargs=len(names)
if positional:
positional=list(positional)
if bind and nargs and names[0]=='self':
positional.insert(0, missing_name('self', context))
if len(positional) > nargs: raise TypeError, 'too many arguments'
args=list(positional)
args=positional
else:
if bind and nargs and names[0]=='self':
args=[missing_name('self', context)]
else:
args=[]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment