mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
1 parent
51c3f71eed
commit
00823dd923
3 files changed
+10
-1
No files matched your search
Generated
+1
@@ -1221,6 +1221,7 @@ dependencies = [
|
||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"js-sys 0.3.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustpython-compiler 0.1.0",
|
||||
"rustpython-parser 0.1.0",
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from testutils import assert_raises
|
||||
|
||||
|
||||
# Spec: https://docs.python.org/2/library/types.html
|
||||
print(None)
|
||||
# TypeType
|
||||
@@ -36,6 +39,9 @@ try:
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
with assert_raises(ValueError):
|
||||
bytes(-1)
|
||||
|
||||
a = bytearray([1, 2, 3])
|
||||
# assert a[1] == 2
|
||||
|
||||
|
||||
@@ -117,7 +117,9 @@ impl ByteInnerNewOptions {
|
||||
let value = if let OptionalArg::Present(ival) = self.val_option {
|
||||
match_class!(match ival.clone() {
|
||||
i @ PyInt => {
|
||||
let size = objint::get_value(&i.into_object()).to_usize().unwrap();
|
||||
let size = objint::get_value(&i.into_object())
|
||||
.to_usize()
|
||||
.ok_or_else(|| vm.new_value_error("negative count".to_string()))?;
|
||||
Ok(vec![0; size])
|
||||
}
|
||||
_l @ PyString => {
|
||||
|
||||
Reference in new issue
Block a user