Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalArgumentException: pointer == 0 #83

Open
devinrsmith opened this issue Aug 26, 2022 · 2 comments
Open

java.lang.IllegalArgumentException: pointer == 0 #83

devinrsmith opened this issue Aug 26, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@devinrsmith
Copy link
Member

devinrsmith commented Aug 26, 2022

java.lang.IllegalArgumentException: pointer == 0
        at org.jpy.PyObjectState.<init>(PyObjectState.java:20)
        at org.jpy.PyObject.<init>(PyObject.java:72)
        at org.jpy.PyObject.<init>(PyObject.java:67)
        at org.jpy.PyObject.executeCode(PyObject.java:138)
import io
import jpy

_j_out = jpy.get_type('java.lang.System').out

class BadFoo(io.TextIOBase):
    def __init__(self):
        raise Exception("I hate fun")

    def close(self):
        _j_out.println("time to close")

BadFoo()

With a java initiated python session, calling this as input to PyObject.executeCode(scriptAbove, PyInputMode.SCRIPT); causes the exception shown above.

@devinrsmith devinrsmith added the bug Something isn't working label Aug 26, 2022
@devinrsmith devinrsmith self-assigned this Aug 26, 2022
@devinrsmith
Copy link
Member Author

@jmao-denver @niloc132 have done a lot of the triage work:

we dont know conclusively what the exact path is to failure, but the JPy_ON_JAVA_EXCEPTION_GOTO that happens in jmethod's InvokeMethod might be seeing the java exception set when it returns, and translating that back to python and TextIOBase's close just eats any exception that happens during finalize

@devinrsmith
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant