---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP036 [*] Version block is outdated for minimum Python version
 --> UP036_0.py:3:4
  |
1 | import sys
2 |
3 | if sys.version_info < (3,0):
  |    ^^^^^^^^^^^^^^^^^^^^^^^^
4 |     print("py2")
5 | else:
  |
help: Remove outdated version block
  |
2 |
  - if sys.version_info < (3,0):
  -     print("py2")
  - else:
  -     print("py3")
3 + print("py3")
4 |
  |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:8:4
   |
 6 |     print("py3")
 7 |
 8 | if sys.version_info < (3,0):
   |    ^^^^^^^^^^^^^^^^^^^^^^^^
 9 |     if True:
10 |         print("py2!")
   |
help: Remove outdated version block
  |
7 |
  - if sys.version_info < (3,0):
  -     if True:
  -         print("py2!")
  -     else:
  -         print("???")
  - else:
  -     print("py3")
8 + print("py3")
9 |
  |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:16:4
   |
14 |     print("py3")
15 |
16 | if sys.version_info < (3,0): print("PY2!")
   |    ^^^^^^^^^^^^^^^^^^^^^^^^
17 | else: print("PY3!")
   |
help: Remove outdated version block
   |
15 |
   - if sys.version_info < (3,0): print("PY2!")
   - else: print("PY3!")
16 + print("PY3!")
17 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:20:8
   |
19 | if True:
20 |     if sys.version_info < (3,0):
   |        ^^^^^^^^^^^^^^^^^^^^^^^^
21 |         print("PY2")
22 |     else:
   |
help: Remove outdated version block
   |
19 | if True:
   -     if sys.version_info < (3,0):
   -         print("PY2")
   -     else:
   -         print("PY3")
20 +     print("PY3")
21 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:25:4
   |
23 |         print("PY3")
24 |
25 | if sys.version_info < (3,0): print(1 if True else 3)
   |    ^^^^^^^^^^^^^^^^^^^^^^^^
26 | else:
27 |     print("py3")
   |
help: Remove outdated version block
   |
24 |
   - if sys.version_info < (3,0): print(1 if True else 3)
   - else:
   -     print("py3")
25 + print("py3")
26 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:29:4
   |
27 |     print("py3")
28 |
29 | if sys.version_info < (3,0):
   |    ^^^^^^^^^^^^^^^^^^^^^^^^
30 |     def f():
31 |         print("py2")
   |
help: Remove outdated version block
   |
28 |
   - if sys.version_info < (3,0):
   -     def f():
   -         print("py2")
   - else:
   -     def f():
   -         print("py3")
   -         print("This the next")
29 + def f():
30 +     print("py3")
31 +     print("This the next")
32 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:37:4
   |
35 |         print("This the next")
36 |
37 | if sys.version_info > (3,0):
   |    ^^^^^^^^^^^^^^^^^^^^^^^^
38 |     print("py3")
39 | else:
   |
help: Remove outdated version block
   |
36 |
   - if sys.version_info > (3,0):
   -     print("py3")
   - else:
   -     print("py2")
37 + print("py3")
38 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:45:4
   |
43 | x = 1
44 |
45 | if sys.version_info > (3,0):
   |    ^^^^^^^^^^^^^^^^^^^^^^^^
46 |     print("py3")
47 | else:
   |
help: Remove outdated version block
   |
44 |
   - if sys.version_info > (3,0):
   -     print("py3")
   - else:
   -     print("py2")
45 + print("py3")
46 |     # ohai
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:53:4
   |
51 | x = 1
52 |
53 | if sys.version_info > (3,0): print("py3")
   |    ^^^^^^^^^^^^^^^^^^^^^^^^
54 | else: print("py2")
   |
help: Remove outdated version block
   |
52 |
   - if sys.version_info > (3,0): print("py3")
   - else: print("py2")
53 + print("py3")
54 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:56:4
   |
54 | else: print("py2")
55 |
56 | if sys.version_info > (3,):
   |    ^^^^^^^^^^^^^^^^^^^^^^^
57 |     print("py3")
58 | else:
   |
help: Remove outdated version block
   |
55 |
   - if sys.version_info > (3,):
   -     print("py3")
   - else:
   -     print("py2")
56 + print("py3")
57 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:62:8
   |
61 | if True:
62 |     if sys.version_info > (3,):
   |        ^^^^^^^^^^^^^^^^^^^^^^^
63 |         print("py3")
64 |     else:
   |
help: Remove outdated version block
   |
61 | if True:
   -     if sys.version_info > (3,):
   -         print("py3")
   -     else:
   -         print("py2")
62 +     print("py3")
63 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:67:4
   |
65 |         print("py2")
66 |
67 | if sys.version_info < (3,):
   |    ^^^^^^^^^^^^^^^^^^^^^^^
68 |     print("py2")
69 | else:
   |
help: Remove outdated version block
   |
66 |
   - if sys.version_info < (3,):
   -     print("py2")
   - else:
   -     print("py3")
67 + print("py3")
68 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:73:8
   |
72 | def f():
73 |     if sys.version_info < (3,0):
   |        ^^^^^^^^^^^^^^^^^^^^^^^^
74 |         try:
75 |             yield
   |
help: Remove outdated version block
   |
72 | def f():
   -     if sys.version_info < (3,0):
   -         try:
   -             yield
   -         finally:
   -             pass
   -     else:
   -         yield
73 +     yield
74 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:86:8
   |
84 |         pass
85 |
86 |     if sys.version_info < (3,0):
   |        ^^^^^^^^^^^^^^^^^^^^^^^^
87 |         def f(py2):
88 |             pass
   |
help: Remove outdated version block
   |
85 |
   -     if sys.version_info < (3,0):
   -         def f(py2):
   -             pass
   -     else:
   -         def f(py3):
   -             pass
86 +     def f(py3):
87 +         pass
88 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
  --> UP036_0.py:97:8
   |
96 | if True:
97 |     if sys.version_info < (3,0):
   |        ^^^^^^^^^^^^^^^^^^^^^^^^
98 |         2
99 |     else:
   |
help: Remove outdated version block
   |
96 | if True:
   -     if sys.version_info < (3,0):
   -         2
   -     else:
   -         3
97 +     3
98 |
   |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:104:4
    |
102 |     # comment
103 |
104 | if sys.version_info < (3,0):
    |    ^^^^^^^^^^^^^^^^^^^^^^^^
105 |     def f():
106 |         print("py2")
    |
help: Remove outdated version block
    |
103 |
    - if sys.version_info < (3,0):
    -     def f():
    -         print("py2")
    -     def g():
    -         print("py2")
    - else:
    -     def f():
    -         print("py3")
    -     def g():
    -         print("py3")
104 + def f():
105 +     print("py3")
106 + def g():
107 +     print("py3")
108 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:116:8
    |
115 | if True:
116 |     if sys.version_info > (3,):
    |        ^^^^^^^^^^^^^^^^^^^^^^^
117 |         print(3)
118 |     # comment
    |
help: Remove outdated version block
    |
115 | if True:
    -     if sys.version_info > (3,):
    -         print(3)
116 +     print(3)
117 |     # comment
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:122:8
    |
121 | if True:
122 |     if sys.version_info > (3,): print(3)
    |        ^^^^^^^^^^^^^^^^^^^^^^^
123 |
124 | if True:
    |
help: Remove outdated version block
    |
121 | if True:
    -     if sys.version_info > (3,): print(3)
122 +     print(3)
123 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:125:8
    |
124 | if True:
125 |     if sys.version_info > (3,):
    |        ^^^^^^^^^^^^^^^^^^^^^^^
126 |         print(3)
    |
help: Remove outdated version block
    |
124 | if True:
    -     if sys.version_info > (3,):
    -         print(3)
125 +     print(3)
126 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:130:8
    |
129 | if True:
130 |     if sys.version_info <= (3, 0):
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^
131 |         expected_error = []
132 |     else:
    |
help: Remove outdated version block
    |
129 | if True:
    -     if sys.version_info <= (3, 0):
    -         expected_error = []
    -     else:
    -         expected_error = [
130 +     expected_error = [
131 | "<stdin>:1:5: Generator expression must be parenthesized",
132 | "max(1 for i in range(10), key=lambda x: x+1)",
133 | "    ^",
    -         ]
134 +     ]
135 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:140:4
    |
140 | if sys.version_info <= (3, 0):
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^
141 |     expected_error = []
142 | else:
    |
help: Remove outdated version block
    |
139 |
    - if sys.version_info <= (3, 0):
    -     expected_error = []
    - else:
    -     expected_error = [
140 + expected_error = [
141 | "<stdin>:1:5: Generator expression must be parenthesized",
142 | "max(1 for i in range(10), key=lambda x: x+1)",
143 | "    ^",
    -     ]
144 + ]
145 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:150:4
    |
150 | if sys.version_info > (3,0):
    |    ^^^^^^^^^^^^^^^^^^^^^^^^
151 |     """this
152 | is valid"""
    |
help: Remove outdated version block
    |
149 |
    - if sys.version_info > (3,0):
    -     """this
150 + """this
151 | is valid"""
152 |
    -     """the indentation on
153 + """the indentation on
154 |     this line is significant"""
155 |
    -     "this is" \
156 + "this is" \
157 |     "allowed too"
158 |
    -     ("so is"
    -      "this for some reason")
159 + ("so is"
160 +  "this for some reason")
161 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:163:4
    |
161 |      "this for some reason")
162 |
163 | if sys.version_info > (3, 0): expected_error = \
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^
164 |     []
    |
help: Remove outdated version block
    |
162 |
    - if sys.version_info > (3, 0): expected_error = \
163 + expected_error = \
164 |     []
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:166:4
    |
164 |     []
165 |
166 | if sys.version_info > (3, 0): expected_error = []
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^
167 |
168 | if sys.version_info > (3, 0): \
    |
help: Remove outdated version block
    |
165 |
    - if sys.version_info > (3, 0): expected_error = []
166 + expected_error = []
167 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:168:4
    |
166 | if sys.version_info > (3, 0): expected_error = []
167 |
168 | if sys.version_info > (3, 0): \
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^
169 |     expected_error = []
    |
help: Remove outdated version block
    |
167 |
    - if sys.version_info > (3, 0): \
    -     expected_error = []
168 + expected_error = []
169 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:172:8
    |
171 | if True:
172 |     if sys.version_info > (3, 0): expected_error = \
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^
173 |     []
    |
help: Remove outdated version block
    |
171 | if True:
    -     if sys.version_info > (3, 0): expected_error = \
172 +     expected_error = \
173 |     []
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:176:8
    |
175 | if True:
176 |     if sys.version_info > (3, 0): expected_error = []
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^
177 |
178 | if True:
    |
help: Remove outdated version block
    |
175 | if True:
    -     if sys.version_info > (3, 0): expected_error = []
176 +     expected_error = []
177 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:179:8
    |
178 | if True:
179 |     if sys.version_info > (3, 0): \
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^
180 |     expected_error = []
    |
help: Remove outdated version block
    |
178 | if True:
    -     if sys.version_info > (3, 0): \
179 |     expected_error = []
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:182:4
    |
180 |     expected_error = []
181 |
182 | if sys.version_info < (3,13):
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^
183 |     print("py3")
    |
help: Remove outdated version block
    |
181 |
    - if sys.version_info < (3,13):
    -     print("py3")
182 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:185:4
    |
183 |     print("py3")
184 |
185 | if sys.version_info <= (3,13):
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^
186 |     print("py3")
    |
help: Remove outdated version block
    |
184 |
    - if sys.version_info <= (3,13):
    -     print("py3")
185 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:188:4
    |
186 |     print("py3")
187 |
188 | if sys.version_info <= (3,13):
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^
189 |     print("py3")
    |
help: Remove outdated version block
    |
187 |
    - if sys.version_info <= (3,13):
    -     print("py3")
188 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 Version specifier is invalid
   --> UP036_0.py:191:24
    |
189 |     print("py3")
190 |
191 | if sys.version_info == 10000000:
    |                        ^^^^^^^^
192 |     print("py3")
    |

UP036 Version specifier is invalid
   --> UP036_0.py:194:23
    |
192 |     print("py3")
193 |
194 | if sys.version_info < (3,10000000):
    |                       ^^^^^^^^^^^^
195 |     print("py3")
    |

UP036 Version specifier is invalid
   --> UP036_0.py:197:24
    |
195 |     print("py3")
196 |
197 | if sys.version_info <= (3,10000000):
    |                        ^^^^^^^^^^^^
198 |     print("py3")
    |

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:200:4
    |
198 |     print("py3")
199 |
200 | if sys.version_info > (3,13):
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^
201 |     print("py3")
    |
help: Remove outdated version block
    |
199 |
    - if sys.version_info > (3,13):
    -     print("py3")
200 + print("py3")
201 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:203:4
    |
201 |     print("py3")
202 |
203 | if sys.version_info >= (3,13):
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^
204 |     print("py3")
    |
help: Remove outdated version block
    |
202 |
    - if sys.version_info >= (3,13):
    -     print("py3")
203 + print("py3")
204 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:207:4
    |
206 | # Slices on `sys.version_info` should be treated equivalently.
207 | if sys.version_info[:2] >= (3,0):
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
208 |     print("py3")
    |
help: Remove outdated version block
    |
206 | # Slices on `sys.version_info` should be treated equivalently.
    - if sys.version_info[:2] >= (3,0):
    -     print("py3")
207 + print("py3")
208 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:210:4
    |
208 |     print("py3")
209 |
210 | if sys.version_info[:3] >= (3,0):
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
211 |     print("py3")
    |
help: Remove outdated version block
    |
209 |
    - if sys.version_info[:3] >= (3,0):
    -     print("py3")
210 + print("py3")
211 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:219:4
    |
217 |     print("py3")
218 |
219 | if sys.version_info > (3,0):
    |    ^^^^^^^^^^^^^^^^^^^^^^^^
220 |     f"this is\
221 |     allowed too"
    |
help: Remove outdated version block
    |
218 |
    - if sys.version_info > (3,0):
    -     f"this is\
219 + f"this is\
220 |     allowed too"
221 |
    -     f"""the indentation on
222 + f"""the indentation on
223 |     this line is significant"""
224 |
    -     "this is\
225 + "this is\
226 |     allowed too"
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:229:4
    |
227 |     allowed too"
228 |
229 | if sys.version_info[0] == 3:
    |    ^^^^^^^^^^^^^^^^^^^^^^^^
230 |     print("py3")
    |
help: Remove outdated version block
    |
228 |
    - if sys.version_info[0] == 3:
    -     print("py3")
229 + print("py3")
230 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:232:4
    |
230 |     print("py3")
231 |
232 | if sys.version_info[0] <= 3:
    |    ^^^^^^^^^^^^^^^^^^^^^^^^
233 |     print("py3")
    |
help: Remove outdated version block
    |
231 |
    - if sys.version_info[0] <= 3:
    -     print("py3")
232 + print("py3")
233 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:235:4
    |
233 |     print("py3")
234 |
235 | if sys.version_info[0] < 3:
    |    ^^^^^^^^^^^^^^^^^^^^^^^
236 |     print("py3")
    |
help: Remove outdated version block
    |
234 |
    - if sys.version_info[0] < 3:
    -     print("py3")
235 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:238:4
    |
236 |     print("py3")
237 |
238 | if sys.version_info[0] >= 3:
    |    ^^^^^^^^^^^^^^^^^^^^^^^^
239 |     print("py3")
    |
help: Remove outdated version block
    |
237 |
    - if sys.version_info[0] >= 3:
    -     print("py3")
238 + print("py3")
239 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:241:4
    |
239 |     print("py3")
240 |
241 | if sys.version_info[0] > 3:
    |    ^^^^^^^^^^^^^^^^^^^^^^^
242 |     print("py3")
    |
help: Remove outdated version block
    |
240 |
    - if sys.version_info[0] > 3:
    -     print("py3")
241 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:244:4
    |
242 |     print("py3")
243 |
244 | if sys.version_info[0] == 2:
    |    ^^^^^^^^^^^^^^^^^^^^^^^^
245 |     print("py3")
    |
help: Remove outdated version block
    |
243 |
    - if sys.version_info[0] == 2:
    -     print("py3")
244 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:247:4
    |
245 |     print("py3")
246 |
247 | if sys.version_info[0] <= 2:
    |    ^^^^^^^^^^^^^^^^^^^^^^^^
248 |     print("py3")
    |
help: Remove outdated version block
    |
246 |
    - if sys.version_info[0] <= 2:
    -     print("py3")
247 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:250:4
    |
248 |     print("py3")
249 |
250 | if sys.version_info[0] < 2:
    |    ^^^^^^^^^^^^^^^^^^^^^^^
251 |     print("py3")
    |
help: Remove outdated version block
    |
249 |
    - if sys.version_info[0] < 2:
    -     print("py3")
250 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:253:4
    |
251 |     print("py3")
252 |
253 | if sys.version_info[0] >= 2:
    |    ^^^^^^^^^^^^^^^^^^^^^^^^
254 |     print("py3")
    |
help: Remove outdated version block
    |
252 |
    - if sys.version_info[0] >= 2:
    -     print("py3")
253 + print("py3")
254 |
    |
note: This is an unsafe fix and may change runtime behavior

UP036 [*] Version block is outdated for minimum Python version
   --> UP036_0.py:256:4
    |
254 |     print("py3")
255 |
256 | if sys.version_info[0] > 2:
    |    ^^^^^^^^^^^^^^^^^^^^^^^
257 |     print("py3")
    |
help: Remove outdated version block
    |
255 |
    - if sys.version_info[0] > 2:
    -     print("py3")
256 + print("py3")
    |
note: This is an unsafe fix and may change runtime behavior
