Skip to content

Commit ca06613

Browse files
committed
Prepare 17.4.0
1 parent b778e5c commit ca06613

File tree

2 files changed

+91
-7
lines changed

2 files changed

+91
-7
lines changed

CHANGELOG.rst

Lines changed: 90 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,100 @@ Changelog
44
Versions follow `CalVer <http://calver.org>`_ with a strict backwards compatibility policy.
55
The third digit is only for regressions.
66

7-
Changes for the upcoming release can be found in the `"changelog.d" directory <https://github.com/python-attrs/attrs/tree/master/changelog.d>`_ in our repository.
87

9-
..
10-
Do *NOT* add changelog entries here!
8+
.. towncrier release notes start
119
12-
This changelog is managed by towncrier and is compiled at release time.
10+
17.4.0 (2017-12-30)
11+
-------------------
1312

14-
See http://www.attrs.org/en/latest/contributing.html#changelog for details.
13+
Backward-incompatible Changes
14+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1515

16-
.. towncrier release notes start
16+
- The traversal of MROs when using multiple inheritance was backward:
17+
If you defined a class ``C`` that subclasses ``A`` and ``B`` like ``C(A, B)``, ``attrs`` would have collected the attributes from ``B`` *before* those of ``A``.
18+
19+
This is now fixed and means that in classes that employ multiple inheritance, the output of ``__repr__`` and the order of positional arguments in ``__init__`` changes.
20+
Due to the nature of this bug, a proper deprecation cycle was unfortunately impossible.
21+
22+
Generally speaking, it's advisable to prefer ``kwargs``-based initialization anyways – *especially* if you employ multiple inheritance and diamond-shaped hierarchies.
23+
24+
`#298 <https://github.com/python-attrs/attrs/issues/298>`_,
25+
`#299 <https://github.com/python-attrs/attrs/issues/299>`_,
26+
`#304 <https://github.com/python-attrs/attrs/issues/304>`_
27+
- The ``__repr__`` set by ``attrs``
28+
no longer produces an ``AttributeError``
29+
when the instance is missing some of the specified attributes
30+
(either through deleting
31+
or after using ``init=False`` on some attributes).
32+
33+
This can break code
34+
that relied on ``repr(attr_cls_instance)`` raising ``AttributeError``
35+
to check if any attr-specified members were unset.
36+
37+
If you were using this,
38+
you can implement a custom method for checking this::
39+
40+
def has_unset_members(self):
41+
for field in attr.fields(type(self)):
42+
try:
43+
getattr(self, field.name)
44+
except AttributeError:
45+
return True
46+
return False
47+
48+
`#308 <https://github.com/python-attrs/attrs/issues/308>`_
49+
50+
51+
Deprecations
52+
^^^^^^^^^^^^
53+
54+
- The ``attr.ib(convert=callable)`` option is now deprecated in favor of ``attr.ib(converter=callable)``.
55+
56+
This is done to achieve consistency with other noun-based arguments like *validator*.
57+
58+
*convert* will keep working until at least January 2019 while raising a ``DeprecationWarning``.
59+
60+
`#307 <https://github.com/python-attrs/attrs/issues/307>`_
61+
62+
63+
Changes
64+
^^^^^^^
65+
66+
- Generated ``__hash__`` methods now hash the class type along with the attribute values.
67+
Until now the hashes of two classes with the same values were identical which was a bug.
68+
69+
The generated method is also *much* faster now.
70+
71+
`#261 <https://github.com/python-attrs/attrs/issues/261>`_,
72+
`#295 <https://github.com/python-attrs/attrs/issues/295>`_,
73+
`#296 <https://github.com/python-attrs/attrs/issues/296>`_
74+
- ``attr.ib``\ ’s ``metadata`` argument now defaults to a unique empty ``dict`` instance instead of sharing a common empty ``dict`` for all.
75+
The singleton empty ``dict`` is still enforced.
76+
77+
`#280 <https://github.com/python-attrs/attrs/issues/280>`_
78+
- ``ctypes`` is optional now however if it's missing, a bare ``super()`` will not work in slots classes.
79+
This should only happen in special environments like Google App Engine.
80+
81+
`#284 <https://github.com/python-attrs/attrs/issues/284>`_,
82+
`#286 <https://github.com/python-attrs/attrs/issues/286>`_
83+
- The attribute redefinition feature introduced in 17.3.0 now takes into account if an attribute is redefined via multiple inheritance.
84+
In that case, the definition that is closer to the base of the class hierarchy wins.
85+
86+
`#285 <https://github.com/python-attrs/attrs/issues/285>`_,
87+
`#287 <https://github.com/python-attrs/attrs/issues/287>`_
88+
- Subclasses of ``auto_attribs=True`` can be empty now.
89+
90+
`#291 <https://github.com/python-attrs/attrs/issues/291>`_,
91+
`#292 <https://github.com/python-attrs/attrs/issues/292>`_
92+
- Equality tests are *much* faster now.
93+
94+
`#306 <https://github.com/python-attrs/attrs/issues/306>`_
95+
- All generated methods now have correct ``__module__``, ``__name__``, and (on Python 3) ``__qualname__`` attributes.
96+
97+
`#309 <https://github.com/python-attrs/attrs/issues/309>`_
98+
99+
100+
----
17101

18102

19103
17.3.0 (2017-11-08)

src/attr/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
)
1111

1212

13-
__version__ = "17.4.0.dev0"
13+
__version__ = "17.4.0"
1414

1515
__title__ = "attrs"
1616
__description__ = "Classes Without Boilerplate"

0 commit comments

Comments
 (0)