|
From: Samuele P. <pe...@in...> - 2000-12-21 02:17:45
|
Hi.
What follows as attachment is a proposal for a patch that encompasses three
points:
* Solves [Bug #12624] and more generally separates (partially) the import
logic from __findattr__
for py modules, this will make import more compliant with CPython but keeps
attribute-getting forced
import working (jython idiom).
* Makes __import__ hook effective also for the latter case of import through
attribute getting
(from py packages).
* Makes PyJavaPackage __mgr__ accessible and mutable from jython too.
More appropriate (than __import__) "expert" hook for java pkgs/classes std
import.
Patch design:
* A protected method PyObject impAttr(String name) is added to PyObject.
Default impl just
calls __findattr__(name). (Better name proposals are welcome).
* Import logic in org.python.core.imp using __findattr__ is modified and
calls
impAttr instead.
* In PyModule:
* (Forced) import logic in __findattr__ is moved to an impAttr impl.
* In the case an attribute attr is not there __findattr__ try to import it
trough
__builtin__.__import__. This makes __import__ hook effective for
attribute
-getting import.
I will check this in eventually, but only after feedback.
Let me know.
regards, Samuele Pedroni.
|