Exceptions with no argument should not set it to 'None'

This commit is contained in:
K. Lange 2022-07-03 19:37:46 +09:00
parent 3167888187
commit 2d2691710c
5 changed files with 7 additions and 5 deletions

View File

@ -28,7 +28,9 @@
*/
static KrkValue krk_initException(int argc, const KrkValue argv[], int hasKw) {
KrkInstance * self = AS_INSTANCE(argv[0]);
krk_attachNamedValue(&self->fields, "arg", argc > 1 ? argv[1] : NONE_VAL());
if (argc > 1) {
krk_attachNamedValue(&self->fields, "arg", argv[1]);
}
return argv[0];
}

View File

@ -1,4 +1,4 @@
ValueError(None)
ValueError()
Done?
try
finally

View File

@ -12,4 +12,4 @@ Before
Entering
Raising
Exiting with [<class 'type'>, <class 'ValueError'>, <class 'list'>]
ValueError(None)
ValueError()

View File

@ -2,4 +2,4 @@ Before
Entering
Raising
Exiting with [<class 'type'>, <class 'ValueError'>, <class 'list'>]
TypeError(None)
TypeError()

View File

@ -16,4 +16,4 @@ Running finally
Function exit
with <class 'NameError'>
Running finally
NameError was not caught: NameError(None)
NameError was not caught: NameError()