Skip to content

Commit c56196b

Browse files
authored
Merge branch 'master' into librt_base64_simd_cpu_dispatch
2 parents a0c90f5 + 0738db3 commit c56196b

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

mypy-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ typing_extensions>=4.6.0
44
mypy_extensions>=1.0.0
55
pathspec>=0.9.0
66
tomli>=1.1.0; python_version<'3.11'
7-
librt>=0.6.0
7+
librt>=0.6.2

mypy/checker.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3424,7 +3424,11 @@ def check_assignment(
34243424
and lvalue_type is not None
34253425
):
34263426
lvalue.node.type = remove_instance_last_known_values(lvalue_type)
3427-
elif self.options.allow_redefinition_new and lvalue_type is not None:
3427+
elif (
3428+
self.options.allow_redefinition_new
3429+
and lvalue_type is not None
3430+
and not isinstance(lvalue_type, PartialType)
3431+
):
34283432
# TODO: Can we use put() here?
34293433
self.binder.assign_type(lvalue, lvalue_type, lvalue_type)
34303434

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ requires = [
99
"mypy_extensions>=1.0.0",
1010
"pathspec>=0.9.0",
1111
"tomli>=1.1.0; python_version<'3.11'",
12-
"librt>=0.6.0",
12+
"librt>=0.6.2",
1313
# the following is from build-requirements.txt
1414
"types-psutil",
1515
"types-setuptools",
@@ -54,7 +54,7 @@ dependencies = [
5454
"mypy_extensions>=1.0.0",
5555
"pathspec>=0.9.0",
5656
"tomli>=1.1.0; python_version<'3.11'",
57-
"librt>=0.6.0",
57+
"librt>=0.6.2",
5858
]
5959
dynamic = ["version"]
6060

test-data/unit/check-redefine2.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,16 @@ class C4:
369369
reveal_type(self.x) # N: Revealed type is "builtins.list[builtins.str]"
370370

371371
reveal_type(C4().x) # N: Revealed type is "builtins.list[builtins.str]"
372+
373+
class C5:
374+
def __init__(self) -> None:
375+
if int():
376+
self.x = None
377+
return
378+
self.x = [""]
379+
reveal_type(self.x) # N: Revealed type is "builtins.list[builtins.str]"
380+
381+
reveal_type(C5().x) # N: Revealed type is "Union[builtins.list[builtins.str], None]"
372382
[builtins fixtures/list.pyi]
373383

374384
[case testNewRedefinePartialGenericTypes]

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ identify==2.6.15
2222
# via pre-commit
2323
iniconfig==2.1.0
2424
# via pytest
25-
librt==0.6.0
25+
librt==0.6.2
2626
# via -r mypy-requirements.txt
2727
lxml==6.0.2 ; python_version < "3.15"
2828
# via -r test-requirements.in

0 commit comments

Comments
 (0)