File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
7
7
## [ Unreleased]
8
8
### Changed
9
- * Exceptions occurring during inlining during macroexpansion are no longer obscured by the outer macroexpansion exception (#1013 )
9
+ * Exceptions occurring during inlining during macroexpansion are no longer obscured by the outer macroexpansion exception (#1013 )
10
10
11
11
### Fixed
12
12
* Fix the behaviour of ` nil ` with several collection functions (#1011 )
13
13
* Fix a bug where ` keys ` and ` vals ` did not yield keys and values from sequences of map entries (#1018 )
14
14
* Fix a bug where ` set ` and ` vec ` do not produce collections of map entries when called on map arguments (#1020 )
15
+ * Fix lazy sequences not propagating ` AttributeError ` (#1019 )
15
16
16
17
## [ v0.2.0]
17
18
### Added
Original file line number Diff line number Diff line change @@ -194,17 +194,15 @@ def is_empty(self) -> bool:
194
194
195
195
@property
196
196
def first (self ) -> Optional [T ]:
197
- try :
198
- return self .seq ().first # type: ignore[union-attr]
199
- except AttributeError :
197
+ if self .is_empty :
200
198
return None
199
+ return self .seq ().first # type: ignore[union-attr]
201
200
202
201
@property
203
202
def rest (self ) -> "ISeq[T]" :
204
- try :
205
- return self .seq ().rest # type: ignore[union-attr]
206
- except AttributeError :
203
+ if self .is_empty :
207
204
return EMPTY
205
+ return self .seq ().rest # type: ignore[union-attr]
208
206
209
207
def cons (self , * elems : T ) -> ISeq [T ]: # type: ignore[override]
210
208
l : ISeq = self
Original file line number Diff line number Diff line change
1
+ import pytest
2
+
1
3
from basilisp .lang import keyword as kw
2
4
from basilisp .lang import list as llist
3
5
from basilisp .lang import runtime as runtime
@@ -72,6 +74,16 @@ def inner_inner_seq():
72
74
73
75
assert [1 , 2 , 3 ] == [e for e in s ]
74
76
77
+ def raise_error (er ):
78
+ raise er
79
+
80
+ s = lseq .LazySeq (lambda : raise_error (BaseException ))
81
+ with pytest .raises (BaseException ):
82
+ s .first
83
+ s = lseq .LazySeq (lambda : raise_error (AttributeError ))
84
+ with pytest .raises (AttributeError ):
85
+ s .first
86
+
75
87
76
88
def test_empty_sequence ():
77
89
empty = lseq .sequence ([])
You can’t perform that action at this time.
0 commit comments