ofek ยท GitHub

@provinzkraut

Copy link Copy Markdown

Member

Allow msgspec.structs.field on types that use metaclass=StructMeta.

Fixes #941.

@provinzkraut

@ofek

Copy link Copy Markdown

Member

Thanks! Have you confirmed that this also fixes the second comment in that issue? It appears to be a different error.

@provinzkraut

Copy link Copy Markdown

Member Author

Ah, I didn't see that a second comment was added! I'll take a look at this as well and update this PR

@ofek

Copy link Copy Markdown

Member

Do you have an estimate on when you might be able to check? I was planning on releasing in a few hours.

@provinzkraut

@provinzkraut

Copy link Copy Markdown

Member Author

I've fixed inspect.type_info. asdict did work as expected already.

@ofek

@ofek

Copy link Copy Markdown

Member

I added another test to confirm the expected behavior!

@provinzkraut

@provinzkraut

Copy link Copy Markdown

Member Author

@ofek seems like that test you added uncovered another case that was still buggy. I've pushed an additional fix for that.

I've got the feeling though that there might still have some cases left elsewhere in the library where StructMeta isn't handled as expected ๐Ÿ‘€

@ofek

@ofek

Copy link Copy Markdown

Member

I pushed some code changes and a doc update. What we want to express in the type system currently is not possible, example discussion in python/typing#1489.

@ofek

ofek

ofek approved these changes Nov 23, 2025

@ofek ofek left a comment

Copy link Copy Markdown

Member

Choose a reason for hiding this comment

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

Thanks a lot for taking the initiative here!

@ofek

@ofek ofek mentioned this pull request

Nov 23, 2025

Merged

@provinzkraut

Read the original on github.com โ†—