move PyTypeInfo::NAME and ::MODULE into #[pyclass] machinery
#5579
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.
Alternative to #5352
The idea is that
PyTypeInfo::NAMEis a constant value which we've historically populated incorrectly for native types anyway. Also Python is a dynamic language, let's just encourage users to get that state at runtime.PyTypeInfo::MODULEis even worse, it is really only useful for the#[pyclass]machinery and is not populated consistently (or at all in many cases).This PR deprecates those two constants, and:
PyClass::NAMEconstant for the name which is given to the#[pyclass]by the machinery. I think it's fine for this to be public as it seems obvious how it should work.PyClassImpl, as I think that might change in the future anyway.