🔨 handle OSError cases where traceback frames occur from built… #13964
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
… files
Hello. I'm not very familiar with open source contributions, so please bear with me if I'm a bit inexperienced.
Introduction
First of all, let me explain the background. I've been using the
_render_traceback_
method of the traceback object, provided by theIPython.core.interactiveshell.InteractiveShell
object that you created, in theshowtraceback
method. Thanks to this, I was able to create better error messages. I appreciate it. The following issue is related to the use of this method.Description
I noticed that in the recent
8.11
version, code was added to generate a traceback when the source code is too long. In this case, if theetb.tb_frame
object is a built file or something similar, theinspect.getsourcelines(etb.tb_frame)
method may raise an error. So I implemented a change to set themax_len
to the minimum value and avoid the following condition when anOSError
occurs. I think this approach can handle cases where errors occur while using theinspect.getsourcelines()
method.If there is anything I have done wrong or any procedures I should follow, please let me know. I would greatly appreciate it if you could leave a comment and I will make the necessary changes immediately. Thank you.