-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Removing unncessary class states in bdb.Breakpoint #127392
Comments
Next time please wait for a discussion before making such a big PR. I agree, if we start the design from the beginning, we should not keep the state in the Your change is a breaking one, meaning it would make plenty of the code in the market fail, which is something we are trying to avoid for projects like CPython. You can get the idea when you were changing the tests - each test changed could be some code out there that would break. Historically, sharing breakpoints between different This might not be the best design, but over the years, it worked without any issue. Yes, it does not work well when we have two active So my thought about this is - the change is a big risk, without enough justification. We don't have a real life use case to support the breaking change. |
Thank you for the feedback! The PR I submitted was an attempt to address the design concern mentioned in the comment, as I thought it would be more direct to share the idea through code rather than just words. I realize now that it would have been better to include the code in the issue itself. I’ll make sure to do that next time. I created this issue because of the comment in the codebase. I’m also okay with removing that comment, given it has been there for 26 years and hasn’t caused significant problems in practice. However, if we decide to keep the comment and treat it as a backlog item, it might be better to address it sooner rather than later, regardless of whether the solution is mine or another approach. Regarding my proposed change, I understand it doesn’t solve an immediate, practical issue. However, I view it as an improvement in flexibility for potential future use cases, such as managing multiple Bdb instances. Its potential is unknown because the current design has restrained such use cases for decades, leaving no room for exploration. It’s similar to how the Global Interpreter Lock (GIL) has been a constraint: it has worked well enough for decades, but removing it could pave the way for new possibilities, albeit at some risk. If the consensus is to leave the current design unchanged, I completely understand. My goal was to explore the comment’s implication and propose an alternative while respecting the project’s priorities. If this is the case, I think we should consider deleting the comment and committing to the current design for good. Looking forward to any additional thoughts! |
I agree we shouldn't change this. My only suggestion would be to add a sentence or two from @gaogaotiantian's message to the comment. |
Hi @ericvsmith, Thanks for your input! While I appreciate the idea of adding a sentence or two to clarify the comment, I’m concerned it might not significantly contribute to resolving the underlying issue. The comment has been in the codebase for 26 years and hasn’t caused practical issues, but it still points out a design limitation. Adding more detail to the comment might only defer the discussion further. Instead, I think we should either: I feel this approach would better serve the long-term maintainability of the code. Let me know your thoughts! |
I think changing the comment to "Because state is stored in this class there cannot be multiple instances of Bdb. This was an unfortunate design choice, but it's too late to change it now.". |
Feature or enhancement
Proposal:
According to the comment in the Breakpoint class
I can support this idea further. Currently,
Breakpoint
has three class states,next
,bplist
, andbpbynumber
.These states are used to enable the reuse of previously set breakpoint instances across multiple interactive sessions or other use cases. However, relying on class states is not the only way to achieve this goal.
Using class states in this case has several clear limitations. As noted in the comment, it makes it difficult to maintain more than one active Bdb instance. Additionally, logic dependent on class state can make the behavior of a new Bdb instance unpredictable in many scenarios unless the exact states of Breakpoint is fully known. Another drawback of maintaining states in the Breakpoint class is that it tightly couples the behavior of all
Bdb
instances. For example, thedeleteMe
method must be called periodically by aBdb
instance to ensure the Breakpoint class remains in a valid state.As an alternative, instance-level state can be maintained within
Bdb
or derived classes such asPdb
, allowing each instance to manage its own breakpoint data independently. This approach can still support the reuse of previously set breakpoint instances across multiple interactive sessions.Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: