From: SourceForge.net <no...@so...> - 2006-12-21 16:51:20
|
Bugs item #608632, was opened at 2002-09-12 21:54 Message generated for change (Comment added) made by leouserz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=608632&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: Deferred Status: Open Resolution: None Priority: 4 Private: No Submitted By: Samuele Pedroni (pedronis) Assigned to: Nobody/Anonymous (nobody) Summary: __doc__foo should accept java String Initial Comment: See http://aspn.activestate.com/ASPN/Mail/Message/Jyth on-dev/1345173 ---------------------------------------------------------------------- Comment By: leouser (leouserz) Date: 2006-12-21 16:51 Message: Logged In: YES user_id=1277399 Originator: NO Id even say __doc__foo should accept any Java Object. It appers that there is also a bug in the code where it does all these checks to determine if it should set the doc and then goes ahead and tries to set it anyway. The result is if its not a PyString it causes a ClassCastException. The patch removes that and makes any Object(even null) acceptable. Test class: public class TestDoc{ public static String __doc__doIt ="HI"; public void doIt(){} public void doIt2(){} } PATCH: --- /org/python/core/PyJavaClass.java Tue Dec 5 23:58:32 2006 +++ org/python/core/PyJavaClass.java Thu Dec 21 10:47:28 2006 @@ -367,10 +367,10 @@ try { Field docField = proxyClass.getField("__doc__" + name); int mods = docField.getModifiers(); - if (docField.getType() == PyString.class && - Modifier.isPublic(mods) && - Modifier.isStatic(mods)); - func.__doc__ = (PyString) docField.get(null); + if (Modifier.isPublic(mods) && Modifier.isStatic(mods)) { + String __doc__ = String.valueOf(docField.get(null)); + func.__doc__ = new PyString(__doc__); + } } catch (NoSuchFieldException ex) { } catch (SecurityException ex) { } catch (IllegalAccessException ex) {} ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=608632&group_id=12867 |