gh-127555: Document that sys.tracebacklimit can be set to None#127556
gh-127555: Document that sys.tracebacklimit can be set to None#127556srittau wants to merge 9 commits intopython:mainfrom
Conversation
Add `versionchanged` marker Closes: python#127555
ZeroIntensity
left a comment
There was a problem hiding this comment.
I don't think this is the intended behavior. The source is here:
Line 723 in 979bf24
Setting to any type that isn't an integer will result in this happening. To me, seeing sys.tracebacklimit = None looks like "no limit," not "default limit." I'm not sure we should document that.
|
Considering that this behavior is explicitly called out in the NEWS entries for 3.6.4 and 3.7.0a3, it sounds deliberate to me. |
|
If we really do want |
|
Please remember the issue wnd the changelog corresponding to that NEWS entry. I do no remember such issue. I most likely did not invent that behavior, but simply fixed crashes or error handling in corner cases, or/and synchronized the C and the Python implementations. L9k also at the Python code. |
|
Thanks, @srittau. What does the corresponding Python code do? There should be a code using |
|
The only instance is this: Line 458 in 8ba9f5b So, |
Can support (It's fix appears in another PR of mine.) |
ZeroIntensity
left a comment
There was a problem hiding this comment.
Yeah, I manually checked locally, and setting tracebacklimit to None does the same for the Python implementation (it still might be incidental, but it doesn't matter anyway). Anyways, intentional or not, this seems to be the proper behavior for both implementations of traceback, so this LGTM.
@serhiy-storchaka we no longer have C and Python implementations of the traceback formatting logic. It's all in Python now. |
|
Are there tests for setting it to |
|
There is still C code in There are tests for setting And it seems to me that setting |
|
I think it's vice-versa: we're testing the Python implementation, not the C-level |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Thank you for your patience, @srittau.
Looking at this again, I think that the current documentation is technically correct. It says what happens when set the variable to integer (intended behavior). It specifies the default behavior (if it is not set to integer). This is what you should know, the rest is an implementation detail.
Also, this behavior is not new in 3.6.4. You will get the same behavior for None even in 2.7. But there are differences between the Python and the C code in handling values other than integer and None. In C, they all are ignored. In Python, they usually cause a TypeError (but can work by accident). It does not matter, this is an unspecified behavior, and other implementations may not follow CPython.
Add
versionchangedmarker📚 Documentation preview 📚: https://cpython-previews--127556.org.readthedocs.build/