mypy icon indicating copy to clipboard operation
mypy copied to clipboard

[mypyc] fix name generation for modules with similar full names

Open aatle opened this issue 4 months ago • 0 comments

Fixes https://github.com/mypyc/mypyc/issues/1071 Adds a test to cover this case

Building certain package layouts now succeeds instead of failing. The behavior for all package layouts not affected by the error is unchanged.

In namegen.make_module_translation_map(names), if argument names have "foo" and "foo.foo", all suffixes found for "foo" are also found for "foo.foo". This means that module foo has no unique suffixes, which currently causes an AssertionError. The fix forces a module to take the last, fullest suffix if none are unique. It is guaranteed that no other module will also take the same suffix because they either will have a unique suffix to take, or they will take the fullest suffix for their name which is always going to be different.

P.S. 'suffix' or 'prefix'?

aatle avatar Oct 20 '24 01:10 aatle