-
Notifications
You must be signed in to change notification settings - Fork 796
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
Restore compatibility with Rust 1.41(.1). #1421
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,7 @@ where | |
crate::pyclass::default_new::<Self>(py, subtype) as _ | ||
} | ||
|
||
#[allow(clippy::clippy::collapsible_if)] // for if cfg! | ||
unsafe fn dealloc(py: Python, self_: *mut Self::Layout) { | ||
(*self_).py_drop(py); | ||
let obj = PyAny::from_borrowed_ptr_or_panic(py, self_ as _); | ||
|
@@ -93,9 +94,10 @@ where | |
let free = get_type_free(ty).unwrap_or_else(|| tp_free_fallback(ty)); | ||
free(obj as *mut c_void); | ||
|
||
#[cfg(Py_3_8)] | ||
if ffi::PyType_HasFeature(ty, ffi::Py_TPFLAGS_HEAPTYPE) != 0 { | ||
ffi::Py_DECREF(ty as *mut ffi::PyObject); | ||
if cfg!(Py_3_8) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you prefer this instead of cfg_if::cfg_if! {
if #[cfg(Py_3_8)] {
if ffi::PyType_HasFeature(ty, ffi::Py_TPFLAGS_HEAPTYPE) != 0 {
ffi::Py_DECREF(ty as *mut ffi::PyObject);
}
}
} Though I'm not sure which is bettter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking of later, when the In general I hate the "collapsible_if" lint, since it is in at least 50% of cases not an oversight and makes the code clearer. |
||
if ffi::PyType_HasFeature(ty, ffi::Py_TPFLAGS_HEAPTYPE) != 0 { | ||
ffi::Py_DECREF(ty as *mut ffi::PyObject); | ||
} | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.