-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-123596: Add missing tracebacklimit attribute to sys module #125719
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
base: main
Are you sure you want to change the base?
Conversation
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.
Hi, submitting your own PR is uncourteous when someone said they would already. For future reference, you should have asked @blhsing whether he was still working on it.
A few other things here:
- Needs a NEWS entry--this is a user-facing change.
- Please add a test.
This is a recurring issue, so I really suggest you read the pull request section of the devguide.
Regarding the technical aspect of this PR, don't redefine PyTraceBack_LIMIT
. I agree that it should be in a header file, but not pycore_call.h
. The proper place to move it to is pycore_traceback.h
, and then include that in sysmodule.c
if it isn't already.
Thanks!
Oh, I'm sorry, it seems that it has been a long time since it initiated the submission. It seems that it doesn't have time because it is busy. So I think maybe I can help finish it. |
There are two reasons why I don't add NEWS:
exist test: Line 1161 in e924bb6
exist docs: Lines 1917 to 1922 in e924bb6
|
No, it's a bug that it differs from the docs, so we need to document that we fixed it with a NEWS entry. That's the right place to put the test, but you need to add something to make sure that this issue was fixed. |
I think I'm making a change. Thank for your reply. |
It seems that there is a problem with the CI service's documentation build that does not seem to be caused by my commits. Maybe I should open an issue.
|
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.
Before adding sys.tracebacklimit
, I would prefer to fix #123596 : fix traceback.py
limit when sys.tracebacklimit
is not defined.
I understand that the fix is just about replacing getattr(sys, 'tracebacklimit', None)
with getattr(sys, 'tracebacklimit', 1_000)
, but tests should be written for that.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
I personally think that if we only replace |
I'm not against adding |
Maybe I should also make changes for python so that when the |
@rruuaanng: Apparently, you don't listen to my advices, so I will stop reviewing your PR. I asked you to create a new PR to fix traceback.py and add new tests only for this change, but you ignore your request. |
Oh, I'm sorry victor. I think I misunderstood you. I'll make the change now. |
I'll rollback this PR so that it only adds the |
Maybe remove the |
This doesn't have the |
I didn't expect the Spanish Inquisition |
Nobody expects the Spanish Inquisition! @vstinner: please review the changes made to this pull request. |
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.
I think this looks ok. Take my review as provisional, though--Victor certainly knows more about the underlying issue than I do.
Thank for your reviewer Peter! |
Misc/NEWS.d/next/Library/2024-10-20-11-45-50.gh-issue-123596.HONVYS.rst
Outdated
Show resolved
Hide resolved
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.
Please follow Victors remark:
Before adding
sys.tracebacklimit
, I would prefer to fix #123596 : fixtraceback.py
limit whensys.tracebacklimit
is not defined.I understand that the fix is just about replacing
getattr(sys, 'tracebacklimit', None)
withgetattr(sys, 'tracebacklimit', 1_000)
, but tests should be written for that.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
test code:
In fact, in
cpython/Python/sysmodule.c
Line 3647 in 322f14e
the
sys.tracebacklimit
attribute isn't set.However, in
cpython/Python/traceback.c
Line 722 in c3ed775
it tries to get the attribute and performs the same behavior in
cpython/Lib/traceback.py
Line 458 in c3ed775
Therefore, the number of tracebacks is inaccurate.