Skip to content

Commit 7b99d13

Browse files
authored
Merge pull request RustPython#3050 from RustPython/upd-deps
Run cargo update + upgrade
2 parents 8bfc904 + 5b780e7 commit 7b99d13

20 files changed

Lines changed: 340 additions & 377 deletions

File tree

Cargo.lock

Lines changed: 218 additions & 270 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ssl-vendor = ["rustpython-stdlib/ssl-vendor"]
3232

3333
[dependencies]
3434
log = "0.4"
35-
env_logger = { version = "0.8", default-features = false, features = ["atty", "termcolor"] }
35+
env_logger = { version = "0.9.0", default-features = false, features = ["atty", "termcolor"] }
3636
clap = "2.33"
3737
rustpython-compiler = { path = "compiler/porcelain", version = "0.1.1" }
3838
rustpython-parser = { path = "parser", version = "0.1.1" }
@@ -50,8 +50,8 @@ flamescope = { version = "0.1", optional = true }
5050
rustyline = "9"
5151

5252
[dev-dependencies]
53-
cpython = "0.6"
54-
python3-sys = "0.6"
53+
cpython = "0.7.0"
54+
python3-sys = "0.7.0"
5555
criterion = "0.3"
5656

5757
[[bench]]

Lib/test/test_float.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ def test_underscores(self):
8989
# Check that we handle bytes values correctly.
9090
self.assertRaises(ValueError, float, b'0_.\xff9')
9191

92-
# TODO: RUSTPYTHON
93-
@unittest.expectedFailure
9492
def test_non_numeric_input_types(self):
9593
# Test possible non-numeric types for the argument x, including
9694
# subclasses of the explicitly documented accepted types.
@@ -120,8 +118,6 @@ class CustomByteArray(bytearray): pass
120118
with self.assertRaisesRegex(ValueError, "could not convert"):
121119
float(f(b'A' * 0x10))
122120

123-
# TODO: RUSTPYTHON
124-
@unittest.expectedFailure
125121
def test_float_memoryview(self):
126122
self.assertEqual(float(memoryview(b'12.3')[1:4]), 2.3)
127123
self.assertEqual(float(memoryview(b'12.3\x00')[1:4]), 2.3)

Lib/test/test_runpy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ def test_basic_script_no_suffix(self):
676676

677677
# TODO: RUSTPYTHON
678678
@unittest.expectedFailure
679+
@unittest.skipIf(sys.platform == 'win32', "TODO: RUSTPYTHON; weird panic in lz4-flex")
679680
def test_script_compiled(self):
680681
with temp_dir() as script_dir:
681682
mod_name = 'script'

bytecode/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ license = "MIT"
99

1010

1111
[dependencies]
12-
bincode = "1.1"
13-
bitflags = "1.1"
14-
lz4_flex = "0.7"
12+
bincode = "1.3.3"
13+
bitflags = "1.2.1"
14+
lz4_flex = "0.9.0"
1515
num-bigint = { version = "0.4.2", features = ["serde"] }
1616
num-complex = { version = "0.4.0", features = ["serde"] }
1717
serde = { version = "1.0", features = ["derive"] }

common/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ parking_lot = { version = "0.11.0", optional = true }
1313
num-traits = "0.2"
1414
num-complex = "0.4.0"
1515
num-bigint = "0.4.2"
16-
lexical-core = "0.7"
17-
hexf-parse = "0.1.0"
16+
lexical-parse-float = { version = "0.8.0", features = ["format"] }
17+
hexf-parse = "0.2.1"
1818
cfg-if = "1.0"
1919
once_cell = "1.4.1"
2020
siphasher = "0.3"

common/src/float_ops.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -64,36 +64,36 @@ pub fn gt_int(value: f64, other_int: &BigInt) -> bool {
6464
}
6565

6666
pub fn parse_str(literal: &str) -> Option<f64> {
67-
if literal.starts_with('_') || literal.ends_with('_') {
68-
return None;
69-
}
70-
71-
let mut buf = String::with_capacity(literal.len());
72-
let mut last_tok: Option<char> = None;
73-
for c in literal.chars() {
74-
if !(c.is_ascii_alphanumeric() || c == '_' || c == '+' || c == '-' || c == '.') {
75-
return None;
76-
}
67+
parse_inner(literal.trim().as_bytes())
68+
}
7769

78-
if !c.is_ascii_alphanumeric() {
79-
if let Some(l) = last_tok {
80-
if !l.is_ascii_alphanumeric() && !(c == '.' && (l == '-' || l == '+')) {
81-
return None;
82-
}
83-
}
84-
}
70+
pub fn parse_bytes(literal: &[u8]) -> Option<f64> {
71+
parse_inner(trim_slice(literal, |b| b.is_ascii_whitespace()))
72+
}
8573

86-
if c != '_' {
87-
buf.push(c);
88-
}
89-
last_tok = Some(c);
74+
fn trim_slice<T>(v: &[T], mut trim: impl FnMut(&T) -> bool) -> &[T] {
75+
let mut it = v.iter();
76+
// it.take_while_ref(&mut trim).for_each(drop);
77+
// hmm.. `&mut slice::Iter<_>` is not `Clone`
78+
// it.by_ref().rev().take_while_ref(&mut trim).for_each(drop);
79+
while it.clone().next().map_or(false, &mut trim) {
80+
it.next();
9081
}
91-
92-
if let Ok(f) = lexical_core::parse(buf.as_bytes()) {
93-
Some(f)
94-
} else {
95-
None
82+
while it.clone().next_back().map_or(false, &mut trim) {
83+
it.next_back();
9684
}
85+
it.as_slice()
86+
}
87+
88+
fn parse_inner(literal: &[u8]) -> Option<f64> {
89+
use lexical_parse_float::{
90+
format::PYTHON3_LITERAL, FromLexicalWithOptions, NumberFormatBuilder, Options,
91+
};
92+
// lexical-core's format::PYTHON_STRING is inaccurate
93+
const PYTHON_STRING: u128 = NumberFormatBuilder::rebuild(PYTHON3_LITERAL)
94+
.no_special(false)
95+
.build();
96+
f64::from_lexical_with_options::<PYTHON_STRING>(literal, &Options::new()).ok()
9797
}
9898

9999
pub fn is_integer(v: f64) -> bool {

compiler/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT"
88
edition = "2021"
99

1010
[dependencies]
11-
indexmap = "1.0"
11+
indexmap = "1.7.0"
1212
itertools = "0.10.0"
1313
rustpython-bytecode = { path = "../bytecode", version = "0.1.1" }
1414
rustpython-ast = { path = "../ast", features = ["unparse"] }

derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ rustpython-compiler = { path = "../compiler/porcelain", version = "0.1.1" }
1919
rustpython-bytecode = { path = "../bytecode", version = "0.1.1" }
2020
maplit = "1.0"
2121
once_cell = "1.8.0"
22-
textwrap = "0.13.4"
22+
textwrap = { version = "0.14.2", default-features = false }
2323
indexmap = "^1"
2424
serde_json = "1.0.68"

jit/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ edition = "2021"
1010
autotests = false
1111

1212
[dependencies]
13-
cranelift = "0.72.0"
14-
cranelift-module = "0.72.0"
15-
cranelift-jit = "0.72.0"
13+
cranelift = "0.76.0"
14+
cranelift-module = "0.76.0"
15+
cranelift-jit = "0.76.0"
1616
num-traits = "0.2"
17-
libffi = "1.0"
17+
libffi = "2.0.0"
1818
rustpython-bytecode = { path = "../bytecode", version = "0.1.2" }
1919
thiserror = "1.0"
2020

2121
[dev-dependencies]
22-
approx = "0.4.0"
22+
approx = "0.5.0"
2323
rustpython-derive = { path = "../derive", version = "0.1.2" }
2424

2525
[[test]]

0 commit comments

Comments
 (0)