Issue222792
Created on 2000-11-18.18:48:11 by bckfnn, last changed 2000-11-18.21:53:58 by bckfnn.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2000-11-18 18:48:11 | bckfnn | create | |
Created on 2000-11-18.18:48:11 by bckfnn, last changed 2000-11-18.21:53:58 by bckfnn.
| Messages | |||
|---|---|---|---|
| msg21 (view) | Author: Finn Bock (bckfnn) | Date: 2000-11-18.18:48:11 | |
Properly not a real bug, but JimH expressed his hope, that this would
be possible in JPython-1.1, even without the extra stripping of the
wrapper.
------------------ FILE: test127.py ------------------
import org, sys
s = """
def foo():
print "foo bar zot"
"""
mod = org.python.core.PyModule("test127m", {})
#mod = org.python.core.PyInstance.__tojava__(mod,
org.python.core.PyModule)
code = compile(s, "test127m.py", "exec" )
exec s in mod.__dict__, mod.__dict__
sys.modules["test127m"] = mod
import test127m
test127m.foo()
------------------ END ------------------
Jim Hugunin wrote:
The following code will give you a brand new empty module called
"test".
>>> from org.python.core import PyModule, PyInstance
>>> test = PyModule("test", {})
>>> test = PyInstance.__tojava__(test, PyModule)
The cryptic last line is removing a wrapper layer from the PyModule
object -- this turns it from a generic Java object being proxied into
the Python world into a real PyModule object (which subclasses
directly from PyObject). This is the sort of thing that I hope will
go away in JPython-1.1.
|
|||
| msg22 (view) | Author: Finn Bock (bckfnn) | Date: 2000-11-18.21:53:58 | |
This is fixed in PyJavaClass. The solution is a bit of a hack and a higher performing patch that didn't create a temporary PyJavaInstance would be better. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2000-11-18 18:48:11 | bckfnn | create | |
Supported by Python Software Foundation,
Powered by Roundup