Message11137
Javen, thanks for looking into this!
I'd prefer to not change inspect, because long-term goal is to use an unmodified std-lib.
Also, it would be nice if the call inspect uses to detect a module (isinstance(object, types.ModuleType)) would be workable outside of inspect for Java-modules.
I see two places where this might be fixable inside of Jython:
1) Look at
PyJavaType.init
It sets up baseClass and bases (List<PyObject> visibleBases).
Maybe adding ModuleType somehow to bases could fix according isinstance-calls. (Not sure if plainly adding that type goes well through isinstance; additional tweaks might be required.)
2) Look at
Py.isInstance
Thant method backs Python's isinstance on Java-side. You could add special treatment for PyJavaType to fix inspect's module-detection call.
I feel like 1) would be the most "down to the root"-fix possible. If 1) isn't workable, 2) would be a good still Jython-internal alternative.
Maybe a combination of 1) and 2) would also be an option. E.g. in 1) add ModuleType to bases and fix 2) if it doesn't properly take them into account. |
|
Date |
User |
Action |
Args |
2017-02-27 14:55:43 | stefan.richthofer | set | messageid: <1488207343.14.0.687250413409.issue2545@psf.upfronthosting.co.za> |
2017-02-27 14:55:43 | stefan.richthofer | set | recipients:
+ stefan.richthofer, onealj |
2017-02-27 14:55:43 | stefan.richthofer | link | issue2545 messages |
2017-02-27 14:55:42 | stefan.richthofer | create | |
|