feat(test): Failure test case for mypyc dictionary subclass views
I've created a failing test case for a mypyc bug with dict views as seen here: https://github.com/BobTheBuidler/checksum_dict/actions/runs/14843222374/job/41670896987
I added some new (working) test cases:
- dict
- keys
- values
- items
- dict subclass
- keys
- values
- items
and the failure cases:
- dict subclass with 2 bases
- keys
- values
- items
@JukkaL Would you happen to know what I need to change so the tests are able to find the DefaultDict object in the typing module? Or is there someone better to ask about this?
Fascinating, I've managed to make it work using a type: ignore comment, and now we have our successful (wut?) failure case!
It's unclear what's the best approach here. @mypyc_attr(native_class=False) could act as a workaround (with some performance cost). We could also declare this as an unsupported use case, and generate an error with a note suggesting the @mypyc_attr workaround, in case it works.
Hmm. That could work but I'd first like to try a bit to resolve it, I just need some help to know where I should look for the relevant code. Is there not a strightforward way to tell mypyc to only use the dict.keys c function when obj.keys actually resolves to dict.keys, and fallback to python's name resolution when it does not?