mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
fix panic when parsing invalid decimal, close #3796
This commit is contained in:
1 parent
531f678706
commit
623a78dbf9
2 files changed
+10
-1
No files matched your search
@@ -0,0 +1,6 @@
|
||||
try:
|
||||
eval("0.E")
|
||||
except SyntaxError:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
+4
-1
@@ -300,7 +300,10 @@ where
|
||||
value_text.push_str(&self.radix_run(10));
|
||||
}
|
||||
|
||||
let value = f64::from_str(&value_text).unwrap();
|
||||
let value = f64::from_str(&value_text).map_err(|_| LexicalError {
|
||||
error: LexicalErrorType::OtherError("Invalid decimal literal".to_owned()),
|
||||
location: self.get_pos(),
|
||||
})?;
|
||||
// Parse trailing 'j':
|
||||
if self.chr0 == Some('j') || self.chr0 == Some('J') {
|
||||
self.next_char();
|
||||
|
||||
Reference in new issue
Block a user