Match CPython error wording for __slots__ conflict and __doc__ delete - #7698
Conversation
The behavior already matched CPython (the slot conflict is detected, the __doc__ delete is rejected); only the message text drifted. - "__slots__ conflicts with a class variable" -> drop the stray "a" to match CPython's "conflicts with class variable". - "cannot delete '__doc__' attribute of type 'X'" -> insert "immutable" before "type" to match CPython's wording (CPython surfaces the same phrase even for user-defined classes since the descriptor refuses the delete unconditionally).
|
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)
📝 WalkthroughWalkthroughTwo exception message strings in the type module were refined: removing "a" from a class variable conflict error and clarifying Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [ ] test: cpython/Lib/test/test_descr.py (TODO: 39) dependencies: dependent tests: (no tests depend on descr) Legend:
|
Two small wording differences from CPython's type-attribute error messages, both flagged by
test_descr.ClassPropertiesAndMethods:__slots__conflicts with class attr (type.rs:2007)"...conflicts with a class variable""...conflicts with class variable"del cls.__doc__(type.rs:2407)"cannot delete '__doc__' attribute of type 'X'""cannot delete '__doc__' attribute of immutable type 'X'"The behavior in both cases already matched CPython (the conflict is detected, the delete is rejected); only the message text drifted. CPython surfaces the "immutable" phrase even for user-defined classes because the
__doc__descriptor refuses the delete unconditionally.Tests unmasked
test_descr.ClassPropertiesAndMethods.test_slot_shadows_class_variabletest_descr.ClassPropertiesAndMethods.test_set_docVerification
test_descr test_class test_super test_abc test_property test_metaclass test_call test_module test_typing test_inspect test_decorators(1,645 tests)Lib/test/andcrates/)Summary by CodeRabbit