Inspect Patch for IronPython (and Jython?) Compatibility
Hello all, I've just submitted a patch on sourceforge to make inspect compatible with IronPython (and Jython I think). This patch originally comes from the IPCE ( http://fepy.sf.net ) project by Seo Sanghyeon. It is a trivial change really. The patch is number 1739696 http://sourceforge.net/tracker/index.php?func=detail&aid=1739696&group_id=5470&atid=305470 It moves getting a reference to 'code.co_code' into the body of the loop responsible for inspecting anonymous (tuple) arguments. In IronPython, accessing 'co_code' raises a NotImplementedError - meaning that inspect.get_argspec is broken. This patch means that *except* for functions with anonymous tuple arguments, it will work again on IronPython - whilst maintaining full compatibility with the previous behaviour. Jython has a similar patch to overcome the same issue by the way. See http://jython.svn.sourceforge.net/viewvc/jython?view=rev&revision=3200 As it is a bugfix - backporting to 2.5 would be great. Should I generate a separate patch? All the best, Michael Foord
Let's definitely add this to the trunk (2.6). It sounds fine to me as
a bugfix too, since (from your description) it doesn't change the
behavior at all in CPython.
I won't have the time to submit this, but I'm sure there are others here who do.
--Guido
On 6/19/07, Michael Foord
Hello all,
I've just submitted a patch on sourceforge to make inspect compatible with IronPython (and Jython I think). This patch originally comes from the IPCE ( http://fepy.sf.net ) project by Seo Sanghyeon. It is a trivial change really.
The patch is number 1739696 http://sourceforge.net/tracker/index.php?func=detail&aid=1739696&group_id=5470&atid=305470
It moves getting a reference to 'code.co_code' into the body of the loop responsible for inspecting anonymous (tuple) arguments.
In IronPython, accessing 'co_code' raises a NotImplementedError - meaning that inspect.get_argspec is broken.
This patch means that *except* for functions with anonymous tuple arguments, it will work again on IronPython - whilst maintaining full compatibility with the previous behaviour.
Jython has a similar patch to overcome the same issue by the way. See http://jython.svn.sourceforge.net/viewvc/jython?view=rev&revision=3200
As it is a bugfix - backporting to 2.5 would be great. Should I generate a separate patch?
All the best,
Michael Foord _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
Guido van Rossum wrote:
Let's definitely add this to the trunk (2.6). It sounds fine to me as a bugfix too, since (from your description) it doesn't change the behavior at all in CPython. Great.
It looks to me like the patch will apply fine against release25-maint. No behaviour change. Thanks Michael Foord
I won't have the time to submit this, but I'm sure there are others here who do.
--Guido
On 6/19/07, Michael Foord
wrote: Hello all,
I've just submitted a patch on sourceforge to make inspect compatible with IronPython (and Jython I think). This patch originally comes from the IPCE ( http://fepy.sf.net ) project by Seo Sanghyeon. It is a trivial change really.
The patch is number 1739696 http://sourceforge.net/tracker/index.php?func=detail&aid=1739696&group_id=5470&atid=305470
It moves getting a reference to 'code.co_code' into the body of the loop responsible for inspecting anonymous (tuple) arguments.
In IronPython, accessing 'co_code' raises a NotImplementedError - meaning that inspect.get_argspec is broken.
This patch means that *except* for functions with anonymous tuple arguments, it will work again on IronPython - whilst maintaining full compatibility with the previous behaviour.
Jython has a similar patch to overcome the same issue by the way. See http://jython.svn.sourceforge.net/viewvc/jython?view=rev&revision=3200
As it is a bugfix - backporting to 2.5 would be great. Should I generate a separate patch?
All the best,
Michael Foord _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
participants (2)
-
Guido van Rossum
-
Michael Foord