-
Notifications
You must be signed in to change notification settings - Fork 256
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
if the VM was already open, provide a stacktrace where it was started #502
Conversation
hm, interesting, but it does feel a bit hacky, especially doing it for any run, maybe it should be behind a debug option/flag? maybe controlled by the debug log level? (though that doesn't seem great either). Maybe a more generic way to do it would be to allow a hook to be ran when the jvm starts, so the user would be able to get a pdb there and explore the frames that got them there themselves? edit: also, i see you have the commit for autocloseable, and then a revert for it in there, if we are to merge that, i'd rather see these two removed through rebasing, or the whole thing squashed on merge, to avoid this making the history more confusing. |
I failed to rebase earlier. Could we resort to a new PR? |
sure. |
arf, i just tried my idea of a startup hook system, but it doesn't work because importing reflect is triggering the creation of the jvm, and reflect is imported in the I guess that's not a very pressing feature, so no need to break things left and right to make it work, i'll wait for better ideas :). |
and I bet you wanted to know where the JVM had started... |
haha indeed, but i cheated and added a default hook in my list and put pdb inside it, and indeed that avoided me a lot of research. |
my current "best idea" is to use env varibles, something like in say def hook():
# this function will be called in shell
And when in jnius, if that env var is detected, use importlib to load that symbol and call it. |
hi, I think this is overcomplicating things. If a dev is developing code, they get the exception, and they want to know where that happened. The formatting of a traceback in the exception isnt great, but it does the trick cheaply. Your solution would involve restarting an additional time to add the debugger, when the dev could have already fixed the error by inspecting the stacktrace the first time? |
true, i agree it's more practical, but it does feel dirty. and it's a bit confusing that the traceback displayed on the second start is the one from the first run, I'll think some more about it. |
I think both are shown; could the previous traceback be appended to the first? (I found it difficult to change this in Python, as the stacktraces arent attached to the Exception.) The error is a coding error in one of the two places, so both stacktraces are valid/useful information. Or is there the idea of exceptions with nested causes (each with a stacktrace)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, this is certainly a useful feature, and i don't think anymore the way it's implemented is so bad it should prevent the feature to be merged, i wish there was a more generic way to do this, but it's not horrible.
rebase/merged localy in 384ae08 |
Thanks @tshirtman |
Simple `check_vm_running()` for a single source of truth, refs: kivy#502 (review)
Simple `check_vm_running()` for a single source of truth, refs: kivy#502 (review)
Full Changelog: 1.2.1...1.3.0 Implemented enhancements: - (#483) allow passing a `signature` argument to constructors, to force selection of the desired one - (#497) support for more "dunder" methods/protocols on compatible interfaces than just `__len__`, and allow users to provide their own. - (#500) allow ignoring private methods and fields in autoclass (both default to False) - (#503) auto detect java_home on OSX, using `/usr/libexec/java_home` (if JAVA_HOME is not declared) - (#514) writing to static fields (and fix reading from them) - (#517) make signature exceptions more useful - (#502) provide a stacktrace for where JVM was started. - (#523) expose the class's class attribute - (#524) fix handling of Java chars > 256 in Python3 - (#519) Always show the exception name Fixed bugs: - (#481) wrong use of strip on JRE path - (#465) correct reflection to avoid missing any methods from parent classes or interfaces - (#508) don't had error details with a custom exception when java class is not found - (#510) add missing references to .pxi files in setup.py, speeding up recompilation - (#518) ensure autoclass prefers methods over properties - (#520) improved discovery of libjvm.so + provide a workaround if it doesn't work Documentation: - (#478) document automatic Thread detach feature - (#512) document the requirement to keep reference to object/functions passed to java, for as long as it might use them - (#521) fix inheritance in example Many thanks to the contributors that stepped up to help this release, it wouldn't have been possible without them. Craig Macdonald, Gabriel Pettier, Jim, André Miras, Young Ryul Bae, yyang, Pascal Chambon, Kevin Ollivier, Guillaume Gay, Christian M. Salamut, collaborated for this release.
No description provided.