Skip to content

depend: Update crossbeam-utils to "0.8.9" instead of "=0.8.9" #4293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
865 changes: 522 additions & 343 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions stdlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ num-bigint = "0.4.3"
num-integer = "0.1.44"
num-rational = "0.4.1"

crossbeam-utils = "=0.8.9"
crossbeam-utils = "0.8.9"
itertools = "0.10.3"
lexical-parse-float = "0.8.3"
num-traits = "0.2.14"
Expand All @@ -73,11 +73,11 @@ libz-sys = { version = "1.1.5", optional = true }
num_enum = "0.5.7"
ascii = "1.0.0"
parking_lot = "0.12.0"
once_cell = "1.13.0"

# uuid
[target.'cfg(not(any(target_os = "ios", target_os = "android", target_os = "windows", target_arch = "wasm32")))'.dependencies]
mac_address = "1.1.3"
once_cell = "1.13.0"
uuid = { version = "1.1.2", features = ["v1", "fast-rng", "macro-diagnostics"] }

# mmap
Expand Down
5 changes: 3 additions & 2 deletions stdlib/src/mmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ mod mmap {

impl AsSequence for PyMmap {
fn as_sequence() -> &'static PySequenceMethods {
static AS_SEQUENCE: PySequenceMethods = PySequenceMethods {
use once_cell::sync::Lazy;
static AS_SEQUENCE: Lazy<PySequenceMethods> = Lazy::new(|| PySequenceMethods {
length: atomic_func!(|seq, _vm| Ok(PyMmap::sequence_downcast(seq).len())),
item: atomic_func!(|seq, i, vm| {
let zelf = PyMmap::sequence_downcast(seq);
Expand All @@ -462,7 +463,7 @@ mod mmap {
}
}),
..PySequenceMethods::NOT_IMPLEMENTED
};
});
&AS_SEQUENCE
}
}
Expand Down
2 changes: 1 addition & 1 deletion vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ is-macro = "0.2.0"
result-like = "0.4.5"
num_enum = "0.5.7"
bstr = "0.2.17"
crossbeam-utils = "=0.8.9"
crossbeam-utils = "0.8.9"
parking_lot = "0.12.0"
thread_local = "1.1.4"
cfg-if = "1.0.0"
Expand Down
13 changes: 7 additions & 6 deletions vm/src/builtins/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use crate::{
TryFromBorrowedObject, TryFromObject, VirtualMachine,
};
use bstr::ByteSlice;
use once_cell::sync::Lazy;
use std::{mem::size_of, ops::Deref};

#[pyclass(module = false, name = "bytes")]
Expand Down Expand Up @@ -572,20 +573,20 @@ impl AsBuffer for PyBytes {

impl AsMapping for PyBytes {
fn as_mapping() -> &'static PyMappingMethods {
static AS_MAPPING: PyMappingMethods = PyMappingMethods {
static AS_MAPPING: Lazy<PyMappingMethods> = Lazy::new(|| PyMappingMethods {
length: atomic_func!(|mapping, _vm| Ok(PyBytes::mapping_downcast(mapping).len())),
subscript: atomic_func!(
|mapping, needle, vm| PyBytes::mapping_downcast(mapping)._getitem(needle, vm)
),
..PyMappingMethods::NOT_IMPLEMENTED
};
});
&AS_MAPPING
}
}

impl AsSequence for PyBytes {
fn as_sequence() -> &'static PySequenceMethods {
static AS_SEQUENCE: PySequenceMethods = PySequenceMethods {
static AS_SEQUENCE: Lazy<PySequenceMethods> = Lazy::new(|| PySequenceMethods {
length: atomic_func!(|seq, _vm| Ok(PyBytes::sequence_downcast(seq).len())),
concat: atomic_func!(|seq, other, vm| {
PyBytes::sequence_downcast(seq)
Expand All @@ -612,21 +613,21 @@ impl AsSequence for PyBytes {
PyBytes::sequence_downcast(seq).contains(other, vm)
}),
..PySequenceMethods::NOT_IMPLEMENTED
};
});
&AS_SEQUENCE
}
}

impl AsNumber for PyBytes {
fn as_number() -> &'static PyNumberMethods {
static AS_NUMBER: PyNumberMethods = PyNumberMethods {
static AS_NUMBER: Lazy<PyNumberMethods> = Lazy::new(|| PyNumberMethods {
remainder: atomic_func!(|number, other, vm| {
PyBytes::number_downcast(number)
.mod_(other.to_owned(), vm)
.to_pyresult(vm)
}),
..PyNumberMethods::NOT_IMPLEMENTED
};
});
&AS_NUMBER
}
}
Expand Down
5 changes: 3 additions & 2 deletions vm/src/builtins/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::{
};
use num_complex::Complex64;
use num_traits::Zero;
use once_cell::sync::Lazy;
use rustpython_common::{float_ops, hash};
use std::num::Wrapping;

Expand Down Expand Up @@ -447,7 +448,7 @@ impl Hashable for PyComplex {

impl AsNumber for PyComplex {
fn as_number() -> &'static PyNumberMethods {
static AS_NUMBER: PyNumberMethods = PyNumberMethods {
static AS_NUMBER: Lazy<PyNumberMethods> = Lazy::new(|| PyNumberMethods {
add: atomic_func!(|number, other, vm| PyComplex::number_complex_op(
number,
other,
Expand Down Expand Up @@ -481,7 +482,7 @@ impl AsNumber for PyComplex {
PyComplex::number_general_op(number, other, inner_div, vm)
}),
..PyNumberMethods::NOT_IMPLEMENTED
};
});
&AS_NUMBER
}
}
Expand Down
17 changes: 9 additions & 8 deletions vm/src/builtins/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use crate::{
vm::VirtualMachine,
AsObject, Context, Py, PyObject, PyObjectRef, PyPayload, PyRef, PyResult, TryFromObject,
};
use once_cell::sync::Lazy;
use rustpython_common::lock::PyMutex;
use std::fmt;

Expand Down Expand Up @@ -465,12 +466,12 @@ impl AsMapping for PyDict {

impl AsSequence for PyDict {
fn as_sequence() -> &'static PySequenceMethods {
static AS_SEQUENCE: PySequenceMethods = PySequenceMethods {
static AS_SEQUENCE: Lazy<PySequenceMethods> = Lazy::new(|| PySequenceMethods {
contains: atomic_func!(|seq, target, vm| PyDict::sequence_downcast(seq)
.entries
.contains(vm, target)),
..PySequenceMethods::NOT_IMPLEMENTED
};
});
&AS_SEQUENCE
}
}
Expand Down Expand Up @@ -1052,7 +1053,7 @@ impl Comparable for PyDictKeys {

impl AsSequence for PyDictKeys {
fn as_sequence() -> &'static PySequenceMethods {
static AS_SEQUENCE: PySequenceMethods = PySequenceMethods {
static AS_SEQUENCE: Lazy<PySequenceMethods> = Lazy::new(|| PySequenceMethods {
length: atomic_func!(|seq, _vm| Ok(PyDictKeys::sequence_downcast(seq).len())),
contains: atomic_func!(|seq, target, vm| {
PyDictKeys::sequence_downcast(seq)
Expand All @@ -1061,7 +1062,7 @@ impl AsSequence for PyDictKeys {
.contains(vm, target)
}),
..PySequenceMethods::NOT_IMPLEMENTED
};
});
&AS_SEQUENCE
}
}
Expand Down Expand Up @@ -1108,7 +1109,7 @@ impl Comparable for PyDictItems {

impl AsSequence for PyDictItems {
fn as_sequence() -> &'static PySequenceMethods {
static AS_SEQUENCE: PySequenceMethods = PySequenceMethods {
static AS_SEQUENCE: Lazy<PySequenceMethods> = Lazy::new(|| PySequenceMethods {
length: atomic_func!(|seq, _vm| Ok(PyDictItems::sequence_downcast(seq).len())),
contains: atomic_func!(|seq, target, vm| {
PyDictItems::sequence_downcast(seq)
Expand All @@ -1117,7 +1118,7 @@ impl AsSequence for PyDictItems {
.contains(vm, target)
}),
..PySequenceMethods::NOT_IMPLEMENTED
};
});
&AS_SEQUENCE
}
}
Expand All @@ -1133,10 +1134,10 @@ impl Unconstructible for PyDictValues {}

impl AsSequence for PyDictValues {
fn as_sequence() -> &'static PySequenceMethods {
static AS_SEQUENCE: PySequenceMethods = PySequenceMethods {
static AS_SEQUENCE: Lazy<PySequenceMethods> = Lazy::new(|| PySequenceMethods {
length: atomic_func!(|seq, _vm| Ok(PyDictValues::sequence_downcast(seq).len())),
..PySequenceMethods::NOT_IMPLEMENTED
};
});
&AS_SEQUENCE
}
}
Expand Down
5 changes: 3 additions & 2 deletions vm/src/builtins/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use num_bigint::{BigInt, ToBigInt};
use num_complex::Complex64;
use num_rational::Ratio;
use num_traits::{Signed, ToPrimitive, Zero};
use once_cell::sync::Lazy;

#[pyclass(module = false, name = "float")]
#[derive(Debug, Copy, Clone, PartialEq)]
Expand Down Expand Up @@ -549,7 +550,7 @@ impl Hashable for PyFloat {

impl AsNumber for PyFloat {
fn as_number() -> &'static PyNumberMethods {
static AS_NUMBER: PyNumberMethods = PyNumberMethods {
static AS_NUMBER: Lazy<PyNumberMethods> = Lazy::new(|| PyNumberMethods {
add: atomic_func!(|num, other, vm| PyFloat::number_float_op(
num,
other,
Expand Down Expand Up @@ -602,7 +603,7 @@ impl AsNumber for PyFloat {
PyFloat::number_general_op(num, other, inner_div, vm)
}),
..PyNumberMethods::NOT_IMPLEMENTED
};
});
&AS_NUMBER
}
}
Expand Down
6 changes: 4 additions & 2 deletions vm/src/builtins/genericalias.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use once_cell::sync::Lazy;

use super::type_;
use crate::{
atomic_func,
Expand Down Expand Up @@ -320,12 +322,12 @@ pub fn subs_parameters<F: Fn(&VirtualMachine) -> PyResult<String>>(

impl AsMapping for PyGenericAlias {
fn as_mapping() -> &'static PyMappingMethods {
static AS_MAPPING: PyMappingMethods = PyMappingMethods {
static AS_MAPPING: Lazy<PyMappingMethods> = Lazy::new(|| PyMappingMethods {
subscript: atomic_func!(|mapping, needle, vm| {
PyGenericAlias::mapping_downcast(mapping).getitem(needle.to_owned(), vm)
}),
..PyMappingMethods::NOT_IMPLEMENTED
};
});
&AS_MAPPING
}
}
Expand Down
5 changes: 3 additions & 2 deletions vm/src/builtins/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use num_bigint::{BigInt, BigUint, Sign};
use num_integer::Integer;
use num_rational::Ratio;
use num_traits::{One, Pow, PrimInt, Signed, ToPrimitive, Zero};
use once_cell::sync::Lazy;
use std::ops::{Div, Neg};
use std::{fmt, ops::Not};

Expand Down Expand Up @@ -728,7 +729,7 @@ impl Hashable for PyInt {

impl AsNumber for PyInt {
fn as_number() -> &'static PyNumberMethods {
static AS_NUMBER: PyNumberMethods = PyNumberMethods {
static AS_NUMBER: Lazy<PyNumberMethods> = Lazy::new(|| PyNumberMethods {
add: atomic_func!(|num, other, vm| PyInt::number_int_op(num, other, |a, b| a + b, vm)),
subtract: atomic_func!(|num, other, vm| PyInt::number_int_op(
num,
Expand Down Expand Up @@ -794,7 +795,7 @@ impl AsNumber for PyInt {
}),
index: atomic_func!(|num, vm| Ok(PyInt::number_int(num, vm))),
..PyNumberMethods::NOT_IMPLEMENTED
};
});
&AS_NUMBER
}
}
Expand Down
14 changes: 8 additions & 6 deletions vm/src/builtins/mappingproxy.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use once_cell::sync::Lazy;

use super::{PyDict, PyDictRef, PyGenericAlias, PyList, PyTuple, PyType, PyTypeRef};
use crate::{
atomic_func,
Expand Down Expand Up @@ -205,40 +207,40 @@ impl Comparable for PyMappingProxy {

impl AsMapping for PyMappingProxy {
fn as_mapping() -> &'static PyMappingMethods {
static AS_MAPPING: PyMappingMethods = PyMappingMethods {
static AS_MAPPING: Lazy<PyMappingMethods> = Lazy::new(|| PyMappingMethods {
length: atomic_func!(|mapping, vm| PyMappingProxy::mapping_downcast(mapping).len(vm)),
subscript: atomic_func!(|mapping, needle, vm| {
PyMappingProxy::mapping_downcast(mapping).getitem(needle.to_owned(), vm)
}),
..PyMappingMethods::NOT_IMPLEMENTED
};
});
&AS_MAPPING
}
}

impl AsSequence for PyMappingProxy {
fn as_sequence() -> &'static PySequenceMethods {
static AS_SEQUENCE: PySequenceMethods = PySequenceMethods {
static AS_SEQUENCE: Lazy<PySequenceMethods> = Lazy::new(|| PySequenceMethods {
contains: atomic_func!(
|seq, target, vm| PyMappingProxy::sequence_downcast(seq)._contains(target, vm)
),
..PySequenceMethods::NOT_IMPLEMENTED
};
});
&AS_SEQUENCE
}
}

impl AsNumber for PyMappingProxy {
fn as_number() -> &'static PyNumberMethods {
static AS_NUMBER: PyNumberMethods = PyNumberMethods {
static AS_NUMBER: Lazy<PyNumberMethods> = Lazy::new(|| PyNumberMethods {
or: atomic_func!(|num, args, vm| {
PyMappingProxy::number_downcast(num).or(args.to_pyobject(vm), vm)
}),
inplace_or: atomic_func!(|num, args, vm| {
PyMappingProxy::number_downcast(num).ior(args.to_pyobject(vm), vm)
}),
..PyNumberMethods::NOT_IMPLEMENTED
};
});
&AS_NUMBER
}
}
Expand Down
5 changes: 3 additions & 2 deletions vm/src/builtins/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use crate::{
};
use crossbeam_utils::atomic::AtomicCell;
use itertools::Itertools;
use once_cell::sync::Lazy;
use rustpython_common::lock::PyMutex;
use std::{cmp::Ordering, fmt::Debug, mem::ManuallyDrop, ops::Range};

Expand Down Expand Up @@ -996,7 +997,7 @@ impl AsMapping for PyMemoryView {

impl AsSequence for PyMemoryView {
fn as_sequence() -> &'static PySequenceMethods {
static AS_SEQUENCE: PySequenceMethods = PySequenceMethods {
static AS_SEQUENCE: Lazy<PySequenceMethods> = Lazy::new(|| PySequenceMethods {
length: atomic_func!(|seq, vm| {
let zelf = PyMemoryView::sequence_downcast(seq);
zelf.try_not_released(vm)?;
Expand All @@ -1008,7 +1009,7 @@ impl AsSequence for PyMemoryView {
zelf.getitem_by_idx(i, vm)
}),
..PySequenceMethods::NOT_IMPLEMENTED
};
});
&AS_SEQUENCE
}
}
Expand Down
9 changes: 5 additions & 4 deletions vm/src/builtins/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use crossbeam_utils::atomic::AtomicCell;
use num_bigint::{BigInt, Sign};
use num_integer::Integer;
use num_traits::{One, Signed, ToPrimitive, Zero};
use once_cell::sync::Lazy;
use std::cmp::max;

// Search flag passed to iter_search
Expand Down Expand Up @@ -391,22 +392,22 @@ impl PyRange {

impl AsMapping for PyRange {
fn as_mapping() -> &'static PyMappingMethods {
static AS_MAPPING: PyMappingMethods = PyMappingMethods {
static AS_MAPPING: Lazy<PyMappingMethods> = Lazy::new(|| PyMappingMethods {
length: atomic_func!(
|mapping, vm| PyRange::mapping_downcast(mapping).protocol_length(vm)
),
subscript: atomic_func!(|mapping, needle, vm| {
PyRange::mapping_downcast(mapping).getitem(needle.to_owned(), vm)
}),
..PyMappingMethods::NOT_IMPLEMENTED
};
});
&AS_MAPPING
}
}

impl AsSequence for PyRange {
fn as_sequence() -> &'static PySequenceMethods {
static AS_SEQUENCE: PySequenceMethods = PySequenceMethods {
static AS_SEQUENCE: Lazy<PySequenceMethods> = Lazy::new(|| PySequenceMethods {
length: atomic_func!(|seq, vm| PyRange::sequence_downcast(seq).protocol_length(vm)),
item: atomic_func!(|seq, i, vm| {
PyRange::sequence_downcast(seq)
Expand All @@ -418,7 +419,7 @@ impl AsSequence for PyRange {
Ok(PyRange::sequence_downcast(seq).contains(needle.to_owned(), vm))
}),
..PySequenceMethods::NOT_IMPLEMENTED
};
});
&AS_SEQUENCE
}
}
Expand Down
Loading