Skip to content

Commit 1f1acdd

Browse files
authored
Fix issue with keyword fns erroring out on vectors (#771)
Hi, could you please review patch to fix an issue with keyword fns throwing a type error on vectors. Fixes #770. thanks Co-authored-by: ikappaki <[email protected]>
1 parent cc606e8 commit 1f1acdd

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
* Fix issue with `(count nil)` throwing an exception (#759)
1717
* Fix issue with keyword fn not testing for test membership in sets (#762)
1818
* Fix an issue for executing Basilisp scripts via a shebang where certain platforms may not support more than one argument in the shebang line (#764)
19+
* Fix issue with keyword fns throwing type error on vectors (#770)
1920

2021
## [v0.1.0b0]
2122
### Added

src/basilisp/lang/keyword.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __call__(self, m: Union[IAssociative, IPersistentSet], default=None):
6363
return self if self in m else default
6464
try:
6565
return m.val_at(self, default)
66-
except AttributeError:
66+
except (AttributeError, TypeError):
6767
return None
6868

6969
def __reduce__(self):

tests/basilisp/keyword_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from basilisp.lang import map as lmap
66
from basilisp.lang import set as lset
7+
from basilisp.lang import vector as lvector
78
from basilisp.lang.keyword import Keyword, complete, keyword
89

910

@@ -51,6 +52,8 @@ def test_keyword_as_function():
5152
assert None is kw(lset.s(1))
5253
assert "hi" is kw(lset.s(1), default="hi")
5354

55+
assert None is kw(lvector.v(1))
56+
5457

5558
@pytest.mark.parametrize(
5659
"o",

0 commit comments

Comments
 (0)