-
Notifications
You must be signed in to change notification settings - Fork 782
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
cleanup: deprecate PyTypeObject trait #2287
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
davidhewitt
force-pushed
the
kill-type-object
branch
from
April 8, 2022 19:03
36dd248
to
5d16b0a
Compare
adamreichold
reviewed
Apr 8, 2022
davidhewitt
force-pushed
the
kill-type-object
branch
from
April 9, 2022 10:49
5d16b0a
to
b998ead
Compare
davidhewitt
commented
Apr 9, 2022
#[cfg(test)] | ||
mod tests { | ||
#[test] | ||
#[allow(deprecated)] |
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.
If this line is commented out and <PyList as crate::PyTypeInfo>
replaced with just PyList
, this is the compiler output:
warning: use of deprecated trait `type_object::PyTypeObject`: PyTypeObject::type_object was moved to PyTypeInfo::type_object
--> src/type_object.rs:240:20
|
240 | use super::PyTypeObject;
| ^^^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated trait `type_object::PyTypeObject`: PyTypeObject::type_object was moved to PyTypeInfo::type_object
--> src/type_object.rs:243:31
|
243 | fn get_type_object<T: PyTypeObject>(py: Python<'_>) -> &PyType {
| ^^^^^^^^^^^^
error[E0599]: no function or associated item named `type_object` found for struct `PyList` in the current scope
--> src/type_object.rs:249:58
|
249 | get_type_object::<PyList>(py).is(PyList::type_object(py)))
| ^^^^^^^^^^^ function or associated item not found in `PyList`
|
::: src/types/list.rs:18:1
|
18 | pub struct PyList(PyAny);
| ------------------------- function or associated item `type_object` not found for this
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
237 | use crate::type_object::PyTypeInfo;
|
... hopefully this is enough for users to figure out how to upgrade.
davidhewitt
force-pushed
the
kill-type-object
branch
from
April 9, 2022 10:53
b998ead
to
eaf23ca
Compare
adamreichold
approved these changes
Apr 9, 2022
davidhewitt
force-pushed
the
kill-type-object
branch
from
April 9, 2022 15:48
eaf23ca
to
0534195
Compare
Will wait for merging this until 0.16.4 is done. |
davidhewitt
force-pushed
the
kill-type-object
branch
from
April 14, 2022 18:24
0534195
to
6f1e341
Compare
davidhewitt
force-pushed
the
kill-type-object
branch
from
April 23, 2022 12:36
6f1e341
to
fa8ef98
Compare
davidhewitt
force-pushed
the
kill-type-object
branch
from
April 23, 2022 12:36
fa8ef98
to
7e2d311
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
PyTypeObject
trait has become a bit meaningless over time. ThePyTypeInfo
trait essentially covers the same role with additional functionality; there is even a blanket implementation ofPyTypeObject for T: PyTypeInfo
which is the only implementation I'm aware of.To make things simpler, I suggest we fold the trait into
PyTypeInfo
.