Skip to content

Commit 25ecd7c

Browse files
committed
Upgrade dependencies
1 parent 9b0a86d commit 25ecd7c

File tree

14 files changed

+204
-182
lines changed

14 files changed

+204
-182
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ ssl = ["rustpython-vm/ssl"]
2626

2727
[dependencies]
2828
log = "0.4"
29-
env_logger = "0.7"
29+
env_logger = "0.8.3"
3030
clap = "2.33"
3131
rustpython-compiler = { path = "compiler/porcelain", version = "0.1.1" }
3232
rustpython-parser = { path = "parser", version = "0.1.1" }
3333
rustpython-vm = { path = "vm", version = "0.1.1", default-features = false, features = ["compile-parse"] }
3434
pylib = { package = "rustpython-pylib", path = "vm/pylib-crate", version = "0.1.0", default-features = false, optional = true }
35-
dirs = { package = "dirs-next", version = "1.0" }
35+
dirs = { package = "dirs-next", version = "2.0.0" }
3636
num-traits = "0.2.8"
3737
cfg-if = "1.0"
3838
libc = "0.2"

ast/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ authors = ["RustPython Team"]
55
edition = "2018"
66

77
[dependencies]
8-
num-bigint = "0.3"
8+
num-bigint = "0.4.0"

bytecode/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ license = "MIT"
1212
bincode = "1.1"
1313
bitflags = "1.1"
1414
lz4_flex = "0.7"
15-
num-bigint = { version = "0.3", features = ["serde"] }
16-
num-complex = { version = "0.3", features = ["serde"] }
15+
num-bigint = { version = "0.4.0", features = ["serde"] }
16+
num-complex = { version = "0.4.0", features = ["serde"] }
1717
serde = { version = "1.0", features = ["derive"] }
18-
itertools = "0.9"
18+
itertools = "0.10.0"
1919
bstr = "0.2"

common/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ threading = ["parking_lot"]
1111
lock_api = "0.4"
1212
parking_lot = { version = "0.11.0", optional = true }
1313
num-traits = "0.2"
14-
num-complex = "0.3"
15-
num-bigint = "0.3"
14+
num-complex = "0.4.0"
15+
num-bigint = "0.4.0"
1616
lexical-core = "0.7"
1717
hexf-parse = "0.1.0"
1818
cfg-if = "1.0"

compiler/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ edition = "2018"
99

1010
[dependencies]
1111
indexmap = "1.0"
12-
itertools = "0.9"
12+
itertools = "0.10.0"
1313
rustpython-bytecode = { path = "../bytecode", version = "0.1.1" }
1414
rustpython-ast = { path = "../ast" }
15-
num-complex = { version = "0.3", features = ["serde"] }
15+
num-complex = { version = "0.4.0", features = ["serde"] }
1616
num-traits = "0.2"
1717
log = "0.4"
18-
ahash = "0.6"
18+
ahash = "0.7.2"
1919

2020
[dev-dependencies]
2121
rustpython-parser = { path = "../parser" }
22-
insta = "1.5"
22+
insta = "1.7.0"

derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ 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.3.1"
22-
textwrap = "0.12.1"
22+
textwrap = "0.13.4"
2323
indexmap = "^1"

jit/Cargo.toml

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

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

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

2525
[[test]]

parser/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ lalrpop = "0.19"
1515
rustpython-ast = { path = "../ast" }
1616
lalrpop-util = "0.19.1"
1717
log = "0.4.1"
18-
num-bigint = "0.3"
18+
num-bigint = "0.4.0"
1919
num-traits = "0.2"
2020
unic-emoji-char = "0.9"
2121
unic-ucd-ident = "0.9"
2222
unicode_names2 = "0.4"
2323
phf = { version = "0.8", features = ["macros"] }
24-
ahash = "0.6"
24+
ahash = "0.7.2"
2525

2626
[dev-dependencies]
2727
insta = "1.5"

src/shell/helper.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,9 @@ cfg_if::cfg_if! {
163163
.unwrap_or_else(|| (line.len(), vec!["\t".to_owned()])))
164164
}
165165
}
166+
166167
impl Hinter for ShellHelper<'_> {
167-
type Hint = String;
168+
type Hint = String;
168169
}
169170
impl Highlighter for ShellHelper<'_> {}
170171
impl Validator for ShellHelper<'_> {}

vm/Cargo.toml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ ssl = ["openssl", "openssl-sys", "openssl-probe"]
2626

2727
[dependencies]
2828
# Crypto:
29-
digest = "0.8.1"
30-
md-5 = "0.8"
31-
sha-1 = "0.8"
32-
sha2 = "0.8"
33-
sha3 = "0.8"
34-
blake2 = "0.8"
35-
36-
num-complex = { version = "0.3", features = ["serde"] }
37-
num-bigint = { version = "0.3", features = ["serde"] }
29+
digest = "0.9.0"
30+
md-5 = "0.9.1"
31+
sha-1 = "0.9.4"
32+
sha2 = "0.9.3"
33+
sha3 = "0.9.1"
34+
blake2 = "0.9.1"
35+
36+
num-complex = { version = "0.4.0", features = ["serde"] }
37+
num-bigint = { version = "0.4.0", features = ["serde"] }
3838
num-traits = "0.2.8"
3939
num-integer = "0.1.41"
40-
num-rational = "0.3"
40+
num-rational = "0.4.0"
4141
num-iter = "0.1.39"
4242
rand = "0.8"
4343
rand_core = "0.6"
@@ -54,22 +54,22 @@ rustpython-pylib = { path = "pylib-crate", optional = true, version = "0.1.0" }
5454
serde = { version = "1.0.66", features = ["derive"] }
5555
serde_json = "1.0"
5656
regex = "1"
57-
rustc_version_runtime = "0.1.*"
57+
rustc_version_runtime = "0.2.0"
5858
puruspe = "0.1"
5959
caseless = "0.2.1"
6060
chrono = { version = "0.4", features = ["wasmbind"] }
6161
lexical-core = "0.7"
62-
itertools = "0.9"
62+
itertools = "0.10.0"
6363
hex = "0.4.0"
6464
hexf-parse = "0.1.0"
6565
indexmap = "1.0.2"
66-
ahash = "0.6"
66+
ahash = "0.7.2"
6767
crc = "^1.0.0"
6868
bitflags = "1.2.1"
6969
libc = "0.2"
70-
nix = "0.19"
70+
nix = "0.20.0"
7171
csv-core = "0.1"
72-
paste = "0.1"
72+
paste = "1.0.5"
7373
base64 = "0.13"
7474
is-macro = "0.1"
7575
result-like = "^0.3"
@@ -121,7 +121,7 @@ uname = "0.1.1"
121121

122122
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
123123
gethostname = "0.2.0"
124-
socket2 = "0.3.19"
124+
socket2 = "0.4.0"
125125
rustyline = "8.0"
126126
openssl = { version = "0.10.32", features = ["vendored"], optional = true }
127127
openssl-sys = { version = "0.9", optional = true }
@@ -135,7 +135,7 @@ num_cpus = "1"
135135
dns-lookup = "1.0"
136136

137137
[target.'cfg(windows)'.dependencies]
138-
winreg = "0.7"
138+
winreg = "0.8.0"
139139
schannel = "0.1"
140140

141141
[target.'cfg(windows)'.dependencies.winapi]
@@ -153,4 +153,4 @@ wasm-bindgen = "0.2"
153153
filepath = "0.1.1"
154154

155155
[build-dependencies]
156-
itertools = "0.9"
156+
itertools = "0.10.0"

vm/src/builtins/memory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl PyMemoryView {
264264
#[pymethod]
265265
fn release(&self) {
266266
// avoid double release
267-
if !self.released.compare_and_swap(false, true) && self.exports.load() == 0 {
267+
if self.released.compare_exchange(false, true).is_ok() && self.exports.load() == 0 {
268268
self.buffer.release();
269269
}
270270
}

vm/src/stdlib/hashlib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ mod hashlib {
270270
}
271271

272272
fn input(&mut self, data: &[u8]) {
273-
self.inner.input(data);
273+
self.inner.update(data);
274274
}
275275

276276
fn digest_size(&self) -> usize {
@@ -279,7 +279,7 @@ mod hashlib {
279279

280280
fn get_digest(&self) -> Vec<u8> {
281281
let cloned = self.inner.box_clone();
282-
cloned.result().to_vec()
282+
cloned.finalize().into_vec()
283283
}
284284
}
285285
}

vm/src/stdlib/socket.rs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use nix::unistd::sethostname;
55
use socket2::{Domain, Protocol, Socket, Type as SocketType};
66
use std::convert::TryFrom;
77
use std::io;
8+
use std::mem::MaybeUninit;
89
use std::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr, ToSocketAddrs};
910
use std::time::{Duration, Instant};
1011

@@ -317,12 +318,12 @@ impl PySocket {
317318
vm: &VirtualMachine,
318319
) -> PyResult<Vec<u8>> {
319320
let flags = flags.unwrap_or(0);
320-
let mut buffer = vec![0u8; bufsize];
321+
let mut buffer = Vec::with_capacity(bufsize);
321322
let sock = self.sock();
322323
let n = self.sock_op(vm, SelectKind::Read, || {
323-
sock.recv_with_flags(&mut buffer, flags)
324+
sock.recv_with_flags(spare_capacity_mut(&mut buffer), flags)
324325
})?;
325-
buffer.truncate(n);
326+
unsafe { buffer.set_len(n) };
326327
Ok(buffer)
327328
}
328329

@@ -336,7 +337,7 @@ impl PySocket {
336337
let flags = flags.unwrap_or(0);
337338
let sock = self.sock();
338339
self.sock_op(vm, SelectKind::Read, || {
339-
buf.with_ref(|buf| sock.recv_with_flags(buf, flags))
340+
buf.with_ref(|buf| sock.recv_with_flags(slice_as_uninit(buf), flags))
340341
})
341342
}
342343

@@ -348,11 +349,12 @@ impl PySocket {
348349
vm: &VirtualMachine,
349350
) -> PyResult<(Vec<u8>, PyObjectRef)> {
350351
let flags = flags.unwrap_or(0);
351-
let mut buffer = vec![0u8; bufsize];
352+
let mut buffer = Vec::with_capacity(bufsize);
352353
let (n, addr) = self.sock_op(vm, SelectKind::Read, || {
353-
self.sock().recv_from_with_flags(&mut buffer, flags)
354+
self.sock()
355+
.recv_from_with_flags(spare_capacity_mut(&mut buffer), flags)
354356
})?;
355-
buffer.truncate(n);
357+
unsafe { buffer.set_len(n) };
356358
Ok((buffer, get_addr_tuple(addr, vm)))
357359
}
358360

@@ -657,7 +659,7 @@ impl Address {
657659

658660
fn get_addr_tuple<A: Into<socket2::SockAddr>>(addr: A, vm: &VirtualMachine) -> PyObjectRef {
659661
let addr = addr.into();
660-
match addr.as_std() {
662+
match addr.as_socket() {
661663
Some(SocketAddr::V4(addr)) => (addr.ip().to_string(), addr.port()).into_pyobject(vm),
662664
Some(SocketAddr::V6(addr)) => (
663665
addr.ip().to_string(),
@@ -716,6 +718,17 @@ fn _socket_getservbyname(
716718
Ok(vm.ctx.new_int(u16::from_be(port as u16)))
717719
}
718720

721+
// TODO: use `Vec::spare_capacity_mut` once stable.
722+
fn spare_capacity_mut<T>(v: &mut Vec<T>) -> &mut [MaybeUninit<T>] {
723+
let (len, cap) = (v.len(), v.capacity());
724+
unsafe {
725+
std::slice::from_raw_parts_mut(v.as_mut_ptr().add(len) as *mut MaybeUninit<T>, cap - len)
726+
}
727+
}
728+
fn slice_as_uninit<T>(v: &mut [T]) -> &mut [MaybeUninit<T>] {
729+
unsafe { &mut *(v as *mut [T] as *mut [MaybeUninit<T>]) }
730+
}
731+
719732
#[derive(Copy, Clone)]
720733
enum SelectKind {
721734
Read,

0 commit comments

Comments
 (0)