-
Notifications
You must be signed in to change notification settings - Fork 760
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
ffi cleanup: object.h #1429
ffi cleanup: object.h #1429
Conversation
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.
Looks great, thanks very much again. This is definitely one of the more awkward files; as always thank you for your diligent reconciliation.
src/ffi/cpython/object.rs
Outdated
#[cfg(py_sys_config = "COUNT_ALLOCS")] | ||
#[deprecated(note = "not present in Python headers; to be removed")] | ||
pub const PyTypeObject_INIT: PyTypeObject = type_object_init! { | ||
tp_allocs: 0, | ||
tp_frees: 0, | ||
tp_maxalloc: 0, | ||
tp_prev: ptr::null_mut(), | ||
tp_next: ptr::null_mut(), | ||
}; | ||
|
||
#[cfg(not(py_sys_config = "COUNT_ALLOCS"))] | ||
#[deprecated(note = "not present in Python headers; to be removed")] | ||
pub const PyTypeObject_INIT: PyTypeObject = type_object_init!(); |
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.
TBH I think this falls under the same bracket of the other _INIT
constants which aren't actually defined upstream; we can just throw it away for the 0.14 release. Nobody should be using it.
Looks like that would allow quite a lot of macro code above to be deleted too!
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.
I thought so, but didn't want to presume. Updated.
Shall we also remove PyObject_Check
, PySuper_Check
, and FreeFunc
? They're not in the Python API either, and I struggle to imagine why, for example, a downstream user would need need a function to verify that a PyObject is a Python object (always returns 1).
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.
Agreed that we can remove those three too!
This should only be used internally. See discussion: PyO3#1429 (comment)
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.
Awesome 💯 , thank you.
This one's a fairly big change to account for the new
cpython/object.h
file.Deprecate some FFI definitions which are not in the API
freefunc
which is subtly different -- fixed_PyEval_RequestCodeExtraIndex
, which takes afreefunc
as an argument)I thought the INCREF, DECREF, ... methods were a bit off.
See review (soon).EDIT:will open new issuethis is fine