-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Impl Drop for PyAtomicRef #5970
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
Caution Review failedThe pull request is closed. WalkthroughA Changes
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
vm/src/object/ext.rs (1)
248-259
: Consider using stronger memory ordering for consistency and safety.The Drop implementation looks correct for preventing memory leaks, but there are a couple of considerations:
Memory ordering: You're using
Ordering::Relaxed
for the swap operation, but all other swap methods in this file useOrdering::AcqRel
(lines 319, 360, 405, 451). For consistency and to ensure proper synchronization in multi-threaded scenarios, consider usingAcqRel
ordering.Import consistency: Use the imported
null_mut
from line 20 instead ofstd::ptr::null_mut()
.Apply this diff to address the concerns:
- let ptr = self.inner.swap(std::ptr::null_mut(), Ordering::Relaxed); + let ptr = self.inner.swap(null_mut(), Ordering::AcqRel);
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
vm/src/object/ext.rs
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .github/copilot-instructions.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Check the WASM package and demo
- GitHub Check: Run snippets and cpython tests on wasm-wasi
- GitHub Check: Run snippets and cpython tests (windows-latest)
- GitHub Check: Run snippets and cpython tests (ubuntu-latest)
- GitHub Check: Run snippets and cpython tests (macos-latest)
- GitHub Check: Run tests under miri
- GitHub Check: Check Rust code with rustfmt and clippy
- GitHub Check: Run rust tests (windows-latest)
- GitHub Check: Ensure compilation on various targets
dd09503
to
1e23d9a
Compare
#5968 is calling Drop, and it looks fine! |
1e23d9a
to
ef1d292
Compare
@qingshi163 basically everything is PyObjectRef. So this will be fine, right?
Summary by CodeRabbit