Debian Codegraph @

doc/whatsnew/1/1.9/summary.rst

raw
1 :Release: 1.9
2 :Date: 2018-05-15
3
4
5 Summary -- Release highlights
6 =============================
7
8 * None so far
9
10 New checkers
11 ============
12
13 * A new Python 3 checker was added to warn about the removed ``operator.div`` function.
14
15 * A new Python 3 checker was added to warn about accessing functions that have been
16 moved from the urllib module in corresponding subpackages, such as ``urllib.request``.
17
18 .. code-block:: python
19
20 from urllib import urlencode
21
22 Instead the previous code should use ``urllib.parse`` or ``six.moves`` to import a
23 module in a Python 2 and 3 compatible fashion:
24
25 .. code-block:: python
26
27 from six.moves.urllib.parse import urlencode
28
29
30 To have this working on Python 3 as well, please use the ``six`` library:
31
32 .. code-block:: python
33
34 six.reraise(Exception, "value", tb)
35
36
37 * A new check was added to warn about using unicode raw string literals. This is
38 a syntax error in Python 3:
39
40 .. rstcheck: ignore-next-code-block
41 .. code-block:: python
42
43 a = ur'...'
44
45 * Added a new ``deprecated-sys-function`` check, emitted when accessing removed ``sys`` members.
46
47 * Added ``xreadlines-attribute`` check, emitted when the ``xreadlines()`` attribute is accessed
48 on a file object.
49
50 * Added two new Python 3 porting checks, ``exception-escape`` and ``comprehension-escape``
51
52 These two are emitted whenever pylint detects that a variable defined in the
53 said blocks is used outside of the given block. On Python 3 these values are deleted.
54
55 .. code-block:: python
56
57 try:
58 1/0
59 except ZeroDivisionError as exc:
60 ...
61 print(exc) # This will raise a NameError on Python 3
62
63 [i for i in some_iterator if some_condition(i)]
64 print(i) # This will raise a NameError on Python 3
65
66
67 Other Changes
68 =============
69
70 * ``defaultdict`` and subclasses of ``dict`` are now handled for `dict-iter-*` checks. That
71 means that the following code will now emit warnings for when ``iteritems`` and friends
72 are accessed:
73
74 .. code-block:: python
75
76 some_dict = defaultdict(list)
77 ...
78 some_dict.iterkeys()
79
80 * Enum classes no longer trigger ``too-few-methods``
81
82 * Special methods now count towards ``too-few-methods``,
83 and are considered part of the public API.
84 They are still not counted towards the number of methods for
85 ``too-many-methods``.
86
87 * docparams allows abstract methods to document returns documentation even
88 if the default implementation does not return something.
89 They also no longer need to document raising a NotImplementedError.