[IronPython] Two problems

Curt Hagenlocher curt at hagenlocher.org
Fri Aug 13 18:15:59 CEST 2004


Joao Grilo <grilo at netcabo.pt> writes:

> def callbackFunction(socket):
> 	socket.Close()

By the way, this is the wrong signature for an async callback.
It actually gets an IAsyncResult as an argument.  You'd have
to write something like

def callbackFunction(ar):
	ar.AsyncState.Close()


"Jim Hugunin" <jim at ironpython.com> writes:

> The big bug in IronPython-0.6 is that even this won't work as the
> created delegate won't have the right signature.  You can see
> Ops.GetDelegate if you're interested in the really weak code
> that's breaking for you.

The immediate need could probably be fixed by adding the following
function to PythonEventHandler:

	public void Handle(IAsyncResult ar) {
		Ops.Call(func, ar);
	}

This wouldn't do much, though, for the next delegate that has a
different signature.  Ultimately, you probably have to reflect
the delegate's type and build a class to return to CreateDelegate.

--
Curt Hagenlocher
curt at hagenlocher.org



More information about the Ironpython-users mailing list