File tree 6 files changed +51
-18
lines changed
6 files changed +51
-18
lines changed Original file line number Diff line number Diff line change
1
+ Fixed a false positive ``unreachable-code`` when using ``typing.Any`` as return type in python
2
+ 3.8, the ``typing.NoReturn`` are not taken into account anymore for python 3.8 however.
3
+
4
+ Closes #9751
Original file line number Diff line number Diff line change @@ -2184,7 +2184,9 @@ def is_terminating_func(node: nodes.Call) -> bool:
2184
2184
* TYPING_NEVER ,
2185
2185
* TYPING_NORETURN ,
2186
2186
# In Python 3.7 - 3.8, NoReturn is alias of '_SpecialForm'
2187
- "typing._SpecialForm" ,
2187
+ # "typing._SpecialForm",
2188
+ # But 'typing.Any' also inherits _SpecialForm
2189
+ # See #9751
2188
2190
)
2189
2191
):
2190
2192
return True
Original file line number Diff line number Diff line change
1
+ """
2
+ pylint 3.2.4 regression
3
+ https://github.com/pylint-dev/pylint/issues/9751
4
+ """
5
+
6
+ # pylint: disable=missing-function-docstring
7
+
8
+ from typing import Any
9
+
10
+ def repro () -> Any :
11
+ return 5
12
+
13
+ def main ():
14
+ x = repro () + 5
15
+ print (x )
Original file line number Diff line number Diff line change 2
2
# pylint: disable=consider-using-f-string, missing-function-docstring
3
3
import datetime
4
4
import sys
5
- from typing import NoReturn
5
+ # from typing import NoReturn # uncomment when we reunite with used_before_assignment_py38.py
6
6
7
7
MSG = "hello %s" % MSG # [used-before-assignment]
8
8
@@ -206,19 +206,3 @@ def inner_if_continues_outer_if_has_no_other_statements():
206
206
else :
207
207
order = None
208
208
print (order )
209
-
210
-
211
- class PlatformChecks :
212
- """https://github.com/pylint-dev/pylint/issues/9674"""
213
- def skip (self , msg ) -> NoReturn :
214
- raise Exception (msg ) # pylint: disable=broad-exception-raised
215
-
216
- def print_platform_specific_command (self ):
217
- if sys .platform == "linux" :
218
- cmd = "ls"
219
- elif sys .platform == "win32" :
220
- cmd = "dir"
221
- else :
222
- self .skip ("only runs on Linux/Windows" )
223
-
224
- print (cmd )
Original file line number Diff line number Diff line change
1
+ """
2
+ Temporary file until we drop python 3.8
3
+ See https://github.com/pylint-dev/pylint/issues/9751
4
+ Please reunite with used_before_assignment.py at this point
5
+ """
6
+
7
+ # pylint: disable=missing-docstring
8
+
9
+ import sys
10
+ from typing import NoReturn
11
+
12
+
13
+ class PlatformChecks :
14
+ """https://github.com/pylint-dev/pylint/issues/9674"""
15
+ def skip (self , msg ) -> NoReturn :
16
+ raise Exception (msg ) # pylint: disable=broad-exception-raised
17
+
18
+ def print_platform_specific_command (self ):
19
+ if sys .platform == "linux" :
20
+ cmd = "ls"
21
+ elif sys .platform == "win32" :
22
+ cmd = "dir"
23
+ else :
24
+ self .skip ("only runs on Linux/Windows" )
25
+
26
+ print (cmd )
Original file line number Diff line number Diff line change
1
+ [testoptions]
2
+ min_pyver=3.9
You can’t perform that action at this time.
0 commit comments