Skip to content

Commit

Permalink
Prepare for 6.3.1 release (#1579)
Browse files Browse the repository at this point in the history
* Bump version for development towards 6.3.1

* Backwards compatibility fix: make `PrefixMap._map` available (#1578)

* Backwards compatibility fix for those subclassing PrefixMap

* Add changelog entry

(cherry picked from commit 3a5ba84)
  • Loading branch information
mdickinson authored Oct 11, 2021
1 parent cf60014 commit 4066fad
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
15 changes: 15 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
Traits CHANGELOG
================

Release 6.3.1
-------------

Released: 2021-10-12

Traits 6.3.1 is a bugfix release, fixing an incompatibility between
Traits 6.3.0 and Mayavi <= 4.7.3.

Fixes
~~~~~

* Make ``PrefixMap._map`` available again, for compatibility with Mayavi.
(#1578)


Release 6.3.0
-------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# into the package source.
MAJOR = 6
MINOR = 3
MICRO = 0
MICRO = 1
PRERELEASE = ""
IS_RELEASED = False

Expand Down
9 changes: 9 additions & 0 deletions traits/tests/test_prefix_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,12 @@ class Person(HasTraits):
default_value_callable = reconstituted.default_value()[1]

self.assertEqual(default_value_callable(p), 1)

def test_existence_of__map(self):
# This test can be removed once Mayavi no longer depends on the
# existence of the _map attribute.
# xref: enthought/traits#1577
# xref: enthought/mayavi#1094

prefix_map = PrefixMap({"yes": 1, "yeah": 1, "no": 0, "nah": 0})
self.assertEqual(prefix_map._map["yes"], "yes")
7 changes: 7 additions & 0 deletions traits/trait_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3294,6 +3294,13 @@ def __init__(self, map, *, default_value=None, **metadata):
if not map:
raise ValueError("map must be nonempty")
self.map = map
# Provide backwards compatibility for Mayavi, which currently
# subclasses PrefixMap and depends on the existence of the _map
# attribute. This attribute can be removed as soon as RevPrefixMap in
# Mayavi has been fixed.
# xref: enthought/traits#1577
# xref: enthought/mayavi#1094
self._map = {value: value for value in map}

if default_value is not None:
default_value = self._complete_value(default_value)
Expand Down

0 comments on commit 4066fad

Please sign in to comment.