forked from Rust-related/RustPython
Merge pull request #1748 from youknowone/syntax-error
Fix SyntaxError initial value
This commit is contained in:
@@ -65,3 +65,11 @@ try:
|
||||
raise NewException("test")
|
||||
except NewException as e:
|
||||
assert e.value == "test"
|
||||
|
||||
|
||||
exc = SyntaxError('msg', 1, 2, 3, 4, 5)
|
||||
assert exc.msg == 'msg'
|
||||
assert exc.filename is None
|
||||
assert exc.lineno is None
|
||||
assert exc.offset is None
|
||||
assert exc.text is None
|
||||
|
||||
@@ -645,6 +645,11 @@ pub fn init(ctx: &PyContext) {
|
||||
|
||||
extend_class!(ctx, &excs.syntax_error, {
|
||||
"msg" => ctx.new_readonly_getset("msg", make_arg_getter(0)),
|
||||
// TODO: members
|
||||
"filename" => ctx.none(),
|
||||
"lineno" => ctx.none(),
|
||||
"offset" => ctx.none(),
|
||||
"text" => ctx.none(),
|
||||
});
|
||||
|
||||
extend_class!(ctx, &excs.import_error, {
|
||||
|
||||
Reference in New Issue
Block a user