.Click handler incorrectly errors on a callable

I’m using the std lib function functools.partial to call a function on a Click event. It doesn’t work, although the partial object returned is callable. I’m not sure if this is a bug related to IronPython not being able to recognize actual callables or just a simple check gone wrong. I’ve modified the https://github.com/mcneel/rhino-developer-samples/blob/6/rhinopython/SampleEtoDialog.py example below to illustrate the bug:

from functools import partial

################################################################################
# SampleEtoDialog.py
# Copyright (c) 2017 Robert McNeel & Associates.
# See License.md in the root of this repository for details.
################################################################################
import Rhino.UI
import Eto.Drawing as drawing
import Eto.Forms as forms



from functools import partial

def my_partial(func, *args, **keywords):
    def newfunc(*fargs, **fkeywords):
        newkeywords = keywords.copy()
        newkeywords.update(fkeywords)
        return func(*(args + fargs), **newkeywords)
    newfunc.func = func
    newfunc.args = args
    newfunc.keywords = keywords
    return newfunc


def my_func(sender, e, x, y, z):
    # do stuff here
    print(x)
    print(y)
    print(z)


################################################################################
# Sample dialog class extending the Eto Dialog()
# A guide for Rhino.Python Eto Dialog can be found at:
# http://developer.rhino3d.com/guides/rhinopython/eto-controls-python/
################################################################################
class SimpleEtoDialog(forms.Dialog):

    def __init__(self):
        self.Title = "Sample Eto Dialog"
        self.ClientSize = drawing.Size(200, 200)
        self.Padding = drawing.Padding(5)
        self.Resizable = False

        # Interesting code is here:
        button = forms.Button(Text = 'Test me')
        # This works:
        button.Click += my_partial(my_func, x=1, y=2, z=3)
        # This fails, even though it should work:
        button.Click += partial(my_func, x=1, y=2, z=3)
        self.Content = button

################################################################################
# Creating a dialog instance and displaying the dialog.
################################################################################
def TestSampleEtoDialog():
    dialog = SimpleEtoDialog()
    dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)

################################################################################
# Check to see if this file is being executed as the "main" python
# script instead of being used as a module by some other python script
# This allows us to use the module which ever way we want.
################################################################################
if __name__ == "__main__":
    TestSampleEtoDialog()

The partial type may be callable, but the events take a function type.

The exception raised is TypeError: <myobject> object is not callable, which is very confusing because a partial is callable. It’s just not a function. And it’s not documented anywhere. Only by trial and error did I figure it out.