mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Merge pull request #3408 from coolreader18/fix-panic
Fix panic in debug mode
This commit is contained in:
27
Cargo.lock
generated
27
Cargo.lock
generated
@@ -138,9 +138,9 @@ checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "blake2"
|
||||
@@ -1145,9 +1145,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.22.2"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3bb9a13fa32bc5aeb64150cd3f32d6cf4c748f8f8a417cce5d2eb976a8370ba"
|
||||
checksum = "cf1e25ee6b412c2a1e3fcb6a4499a5c1bfe7f43e014bdce9a6b6666e5aa2d187"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
@@ -1876,7 +1889,7 @@ dependencies = [
|
||||
"md-5",
|
||||
"memchr",
|
||||
"mt19937",
|
||||
"nix",
|
||||
"nix 0.23.0",
|
||||
"num-bigint",
|
||||
"num-complex",
|
||||
"num-integer",
|
||||
@@ -1941,7 +1954,7 @@ dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"memchr",
|
||||
"nix",
|
||||
"nix 0.23.0",
|
||||
"num-bigint",
|
||||
"num-complex",
|
||||
"num-integer",
|
||||
@@ -2024,7 +2037,7 @@ dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"memchr",
|
||||
"nix",
|
||||
"nix 0.22.0",
|
||||
"radix_trie",
|
||||
"scopeguard",
|
||||
"smallvec",
|
||||
|
||||
@@ -68,7 +68,7 @@ pub(crate) fn impl_pyimpl(attr: AttributeArgs, item: Item) -> Result<TokenStream
|
||||
quote! {
|
||||
#imp
|
||||
impl ::rustpython_vm::PyClassImpl for #ty {
|
||||
const TP_FLAGS: ::rustpython_vm::types::PyTypeFlags = ::rustpython_vm::types::PyTypeFlags::from_bits_truncate(#flags);
|
||||
const TP_FLAGS: ::rustpython_vm::types::PyTypeFlags = #flags;
|
||||
|
||||
fn impl_extend_class(
|
||||
ctx: &::rustpython_vm::PyContext,
|
||||
@@ -863,13 +863,17 @@ struct ExtractedImplAttrs {
|
||||
fn extract_impl_attrs(attr: AttributeArgs, item: &Ident) -> Result<ExtractedImplAttrs> {
|
||||
let mut withs = Vec::new();
|
||||
let mut with_slots = Vec::new();
|
||||
let mut flags = vec![quote! { ::rustpython_vm::types::PyTypeFlags::DEFAULT.bits() }];
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
flags.push(quote! {
|
||||
| ::rustpython_vm::types::PyTypeFlags::_CREATED_WITH_FLAGS.bits()
|
||||
});
|
||||
}
|
||||
let mut flags = vec![quote! {
|
||||
{
|
||||
#[cfg(not(debug_assertions))] {
|
||||
::rustpython_vm::types::PyTypeFlags::DEFAULT
|
||||
}
|
||||
#[cfg(debug_assertions)] {
|
||||
::rustpython_vm::types::PyTypeFlags::DEFAULT
|
||||
.union(::rustpython_vm::types::PyTypeFlags::_CREATED_WITH_FLAGS)
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
for attr in attr {
|
||||
match attr {
|
||||
@@ -905,7 +909,7 @@ fn extract_impl_attrs(attr: AttributeArgs, item: &Ident) -> Result<ExtractedImpl
|
||||
NestedMeta::Meta(Meta::Path(path)) => {
|
||||
if let Some(ident) = path.get_ident() {
|
||||
flags.push(quote_spanned! { ident.span() =>
|
||||
| ::rustpython_vm::types::PyTypeFlags::#ident.bits()
|
||||
.union(::rustpython_vm::types::PyTypeFlags::#ident)
|
||||
});
|
||||
} else {
|
||||
bail_span!(
|
||||
|
||||
@@ -55,7 +55,7 @@ base64 = "0.13"
|
||||
csv-core = "0.1"
|
||||
hex = "0.4.0"
|
||||
puruspe = "0.1"
|
||||
nix = "0.22.1"
|
||||
nix = "0.23"
|
||||
xml-rs = "0.8"
|
||||
libc = "0.2.102"
|
||||
cfg-if = "1.0.0"
|
||||
|
||||
@@ -47,9 +47,9 @@ hex = "0.4.0"
|
||||
hexf-parse = "0.2.1"
|
||||
indexmap = "1.0.2"
|
||||
ahash = "0.7.2"
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "1.3"
|
||||
libc = "0.2.99"
|
||||
nix = "0.22.1"
|
||||
nix = "0.23"
|
||||
paste = "1.0.5"
|
||||
is-macro = "0.1"
|
||||
result-like = "0.4.2"
|
||||
|
||||
Reference in New Issue
Block a user