File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -668,8 +668,6 @@ def testChainingDescriptors(self):
668668 e .__suppress_context__ = False
669669 self .assertFalse (e .__suppress_context__ )
670670
671- # TODO: RUSTPYTHON
672- @unittest .expectedFailure
673671 def testKeywordArgs (self ):
674672 # test that builtin exception don't take keyword args,
675673 # but user-defined subclasses can if they want
Original file line number Diff line number Diff line change @@ -649,6 +649,9 @@ impl Constructor for PyBaseException {
649649 type Args = FuncArgs ;
650650
651651 fn py_new ( cls : PyTypeRef , args : FuncArgs , vm : & VirtualMachine ) -> PyResult {
652+ if cls. is ( PyBaseException :: class ( & vm. ctx ) ) && !args. kwargs . is_empty ( ) {
653+ return Err ( vm. new_type_error ( "BaseException() takes no keyword arguments" . to_owned ( ) ) ) ;
654+ }
652655 PyBaseException :: new ( args. args , vm)
653656 . into_ref_with_type ( vm, cls)
654657 . map ( Into :: into)
You can’t perform that action at this time.
0 commit comments