Skip to content

Commit ca2f7d4

Browse files
Document "Incompatible Import of"
Fixes #13031 I just copied the relevant test case into here. I think the syntax is intuitive enough that the reader will understand.
1 parent 3cda6ec commit ca2f7d4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/source/error_code_list.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,19 @@ Example:
438438
# variable has type "str") [assignment]
439439
r.name = 5
440440
441+
Less obviously, this can also occur when importing, for the same underlying reason:
442+
443+
.. code-block:: python
444+
445+
from m1 import *
446+
from m2 import * # E: Incompatible import of "x" (imported name has type "int", local name has type "str") [assignment]
447+
448+
[file m1.py]
449+
x = ''
450+
451+
[file m2.py]
452+
x = 1
453+
441454
.. _code-method-assign:
442455

443456
Check that assignment target is not a method [method-assign]

0 commit comments

Comments
 (0)