Improve CPython compatibility related with PyBoundMethod#7476
Improve CPython compatibility related with PyBoundMethod#7476youknowone merged 3 commits intoRustPython:mainfrom
Conversation
CPython's method_descr_get always returns the bound method unchanged. This preserves the original binding when __get__ is called on an already-bound method (e.g. a.meth.__get__(b, B) still returns a). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Reject non-callable functions and None instances, matching CPython's method_new which checks PyCallable_Check(func) and instance != Py_None. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Previously swallowed errors from get_attr with .ok(), silently returning None. Now propagates errors matching CPython's method_reduce. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [ ] test: cpython/Lib/test/test_descr.py (TODO: 42) dependencies: dependent tests: (no tests depend on descr) Legend:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR enhances Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
This pull request adjusts PyBoundMethod for compatibility with CPython.
Behavior changes
__get____name__when callingPyBoundMethod__reduce__CPython (3.14.3)
RustPython (before this pull request)
RustPython (after this pull request)
Summary by CodeRabbit
Noneas the object parameter now correctly raises aTypeError.