-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
RemoteError._render_traceback_ calls self.render_traceback #2305
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
Conversation
rather than an alias There are two options here: 1. `_render_traceback_` should *call* render_traceback 2. any subclass that redefines render_traceback must also redefine `_render_traceback_` I went with 1., which is more efficient code-wise when subclassing RemoteError (would prevent future cases of this same mistake), but less efficient execution-wise, because it involves an extra function call. closes ipython#2303
|
Just adding a test first |
|
+1 to this approach. When a traceback is being rendered, execution is stopping anyway, so micro-optimizing to make the stack one frame shallower isn't really necessary. Please check, however, that after this patch the traceback in various scenarios look OK. We have some fairly brittle logic in a few places that has hardcoded the 'distance' (measured in number of stack frames) between the user code and the traceback-handling code. So this extra frame may mess up that logic and need adjusting (I'm not sure it does, just asking that you check to be sure, as errors like that may not be detected in our test suite). |
|
What isn't clear from this whole discussion is why we have two different functions |
|
render_traceback() is a public API in that we haven't marked it private in |
|
Okay, I'll bite... the third party could just as easily have named it Anyway, my point is that |
|
They shouldn't be different.
So the choice is:
There's not a huge difference between any of these. As @bfroehle mentioned, one further option would be for the IPython-specific method to have a more IPython-specific name, e.g. |
|
Okay, thanks for the history. I guess I'd advocate for 2 ("use 1 is, as you point out, not acceptable for backport and the names in 3 are imho too similar. Nevertheless, I'm okay with just merging the current pull request (i.e., 3) for the sake of expediency. |
|
Shall I change |
|
Could do - my logic in using the more generic name was that other |
|
I'd be happy with just a docstring on the method to describe why it exists |
|
docstring added |
|
Thanks. Looks ok to me now. |
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.
We have an AssertPrints context manager that makes this sort of test easy. It can't do the counting you use below, though.
|
Looks fine to me too. |
RemoteError._render_traceback_ calls self.render_traceback rather than an alias, which can be broken by subclassing closes #2303
…raceback rather than an alias There are two options here: 1. `_render_traceback_` should *call* render_traceback 2. any subclass that redefines render_traceback must also redefine `_render_traceback_` I went with 1., which is more efficient code-wise when subclassing RemoteError (would prevent future cases of this same mistake), but less efficient execution-wise, because it involves an extra function call. closes #2303
adjust division error message checking to account for Python 3 fixes Python3-specific typo introduced #2305
…for Python 3 fix Python3-specific typo introduced #2305
…raceback rather than an alias There are two options here: 1. `_render_traceback_` should *call* render_traceback 2. any subclass that redefines render_traceback must also redefine `_render_traceback_` I went with 1., which is more efficient code-wise when subclassing RemoteError (would prevent future cases of this same mistake), but less efficient execution-wise, because it involves an extra function call. closes #2303
…for Python 3 fix Python3-specific typo introduced #2305
* commit 'rel-0.13-33-gcfc5692': (33 commits) Backport PR ipython#2347: adjust division error message checking to account for Python 3 Backport PR ipython#2305: RemoteError._render_traceback_ calls self.render_traceback Backport PR ipython#2280: fix SSH passwordless check for OpenSSH Backport PR ipython#2270: SSHLauncher tweaks Backport PR ipython#2261: Fix: longest_substr([]) -> '' Backport PR ipython#2250: fix html in notebook example Backport PR ipython#2235: remove spurious print statement from setupbase.py fixup Backport PR ipython#2223: Custom tracebacks Backport PR ipython#2214: use KernelApp.exec_lines/files in IPEngineApp Backport PR ipython#2212: catch errors in markdown javascript Backport PR ipython#2194: clean nan/inf in json_clean Backport PR ipython#2177: remove numpy install from travis/tox scripts Backport PR ipython#2169: ipdb: pdef, pdoc, pinfo magics all broken Backport PR ipython#2186: removed references to h5py dependence in octave magic documentation Backport PR ipython#2185: added test for %store, fixed storemagic Backport PR ipython#2170: Fix tab completion with IPython.embed_kernel(). Backport PR ipython#2163: fix 'remote_profie_dir' typo in SSH launchers Backport PR ipython#2117: use explicit url in notebook example Backport PR ipython#2126: ipcluster broken with any batch (PBS/LSF/SGE) ...
RemoteError._render_traceback_ calls self.render_traceback rather than an alias, which can be broken by subclassing closes ipython#2303
adjust division error message checking to account for Python 3 fixes Python3-specific typo introduced ipython#2305
rather than an alias
There are two options here:
_render_traceback_should call render_traceback_render_traceback_I went with 1., which is more efficient code-wise when subclassing RemoteError
(would prevent future cases of this same mistake),
but less efficient execution-wise, because it involves an extra function call.
closes #2303