Skip to content

Conversation

Tpt
Copy link
Contributor

@Tpt Tpt commented Aug 22, 2025

No description provided.

@Tpt Tpt marked this pull request as draft August 22, 2025 10:01
@Tpt Tpt changed the title fill PyTypeInfo::NAME with a Pythonic value fill PyTypeInfo::NAME with Pythonic values (e.g. BasedException) instead of C ones (e.g. PyBasedException) Aug 22, 2025
pyobject_native_static_type_object!(ffi::PyBaseObject_Type),
Some("builtins"),
"object",
None,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should set "builtins" there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. It seems sorta useless but maybe could have unexpected effects removing, what was the motivation to remove?

Copy link
Contributor Author

@Tpt Tpt Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No real motivation at the moment. Added back. See also #5364 for an aside related to this topic.

@Tpt Tpt force-pushed the tpt/name branch 4 times, most recently from ede5c0d to 41a554c Compare August 22, 2025 15:00
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, overall makes the error messages look much better IMO and I guess gives us opportunities to clean other stuff up 🤞

pyobject_native_static_type_object!(ffi::PyBaseObject_Type),
Some("builtins"),
"object",
None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. It seems sorta useless but maybe could have unexpected effects removing, what was the motivation to remove?

@Tpt Tpt marked this pull request as ready for review August 25, 2025 14:58
@davidhewitt davidhewitt changed the title fill PyTypeInfo::NAME with Pythonic values (e.g. BasedException) instead of C ones (e.g. PyBasedException) fill PyTypeInfo::NAME with Pythonic values (e.g. BaseException) instead of C ones (e.g. PyBaseException) Aug 31, 2025
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, generally I think this looks great. A few questions / final adjustments.

I wonder if, for sake of not breaking users, we should consider deprecating NAME and just having FULLY_QUALIFIED_NAME, if we can make that work. Otherwise, I think we'd want to mention this in the migration guide.

Tpt and others added 4 commits September 1, 2025 17:45
Co-authored-by: David Hewitt <[email protected]>
Co-authored-by: David Hewitt <[email protected]>
Co-authored-by: David Hewitt <[email protected]>
@davidhewitt
Copy link
Member

With #5387 merging, I wonder, is the solution now to deprecate PyTypeInfo::NAME instead (and instead use the TypeHint struct from #5438)?

@Tpt
Copy link
Contributor Author

Tpt commented Sep 15, 2025

With #5387 merging, I wonder, is the solution now to deprecate PyTypeInfo::NAME instead (and instead use the TypeHint struct from #5438)?

Yes! I think this MR is still relevant: we will just concatenate the module name and the type name to generate the TypeHint struct (note that it will also require converting all module=Some("builtins") into module=None but it's not a big deal, the MODULE constant is not used anywhere in pyO3 outside of pyclasses)

# Conflicts:
#	src/exceptions.rs
#	src/types/code.rs
#	src/types/datetime.rs
@Tpt Tpt marked this pull request as draft October 8, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants