Skip to content

Commit f7f6bc2

Browse files
authored
Add initial changelog for 1.16 (#18652)
Create changelog entries for - #18510 - #18641
1 parent 1edb1d2 commit f7f6bc2

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

CHANGELOG.md

+42-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,48 @@
22

33
## Next Release
44

5-
...
5+
### Different Property Getter and Setter Types
6+
7+
Mypy now supports using different types for property getter and setter.
8+
```python
9+
class A:
10+
value: int
11+
12+
@property
13+
def f(self) -> int:
14+
return self.value
15+
@f.setter
16+
def f(self, x: str | int) -> None:
17+
try:
18+
self.value = int(x)
19+
except ValueError:
20+
raise Exception(f"'{x}' is not a valid value for 'f'")
21+
```
22+
23+
Contributed by Ivan Levkivskyi (PR [18510](https://github.com/python/mypy/pull/18510))
24+
25+
### Selectively Disable Deprecated Warnings
26+
27+
It's now possible to selectively disable warnings generated from
28+
[`warnings.deprecated`](https://docs.python.org/3/library/warnings.html#warnings.deprecated)
29+
using the [`--deprecated-calls-exclude`](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-deprecated-calls-exclude)
30+
option.
31+
32+
```python
33+
# mypy --enable-error-code deprecated
34+
# --deprecated-calls-exclude=foo.A
35+
import foo
36+
37+
foo.A().func() # OK, the deprecated warning is ignored
38+
39+
# file foo.py
40+
from typing_extensions import deprecated
41+
class A:
42+
@deprecated("Use A.func2 instead")
43+
def func(self): pass
44+
```
45+
46+
Contributed by Marc Mueller (PR [18641](https://github.com/python/mypy/pull/18641))
647

748
## Mypy 1.15
849

0 commit comments

Comments
 (0)