Skip to content

Commit

Permalink
Merge branch 'yield-ret'
Browse files Browse the repository at this point in the history
Conflicts:
	NEWS
  • Loading branch information
tuturto committed Mar 19, 2017
2 parents 504e563 + 7c82c01 commit 2ee91f6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
32 changes: 17 additions & 15 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Changes from 0.12.1
* partition no longer prematurely exhausts input iterators
* read and read-str no longer raise an error when the input
parses to a false value (e.g., the empty string)
* A `yield` inside of a `with` statement will properly suppress implicit
returns.

Changes from 0.12.0

Expand Down Expand Up @@ -163,7 +165,7 @@ Changes from 0.10.0
* doto macro added
* keyword? to find out keywords
* setv no longer allows "." in names

[Internals ]
* Builtins reimplemented in terms of python stdlib
* gensyms (defmacro/g!) handles non-string types better
Expand All @@ -190,12 +192,12 @@ Changes from 0.9.12
- Hy Society

[ Breaking Changes ]

We're calling this release 0.10 because we broke
API. Sorry about that. We've removed kwapply in
API. Sorry about that. We've removed kwapply in
favor of using `apply`. Please be sure to upgrade
all code to work with `apply`.

(apply function-call args kwargs) ; is the signature

[Thanks]
Expand All @@ -204,17 +206,17 @@ Changes from 0.9.12
As always, massive hugs to olasd for the constant reviews and for
implementing HyCons cells. Thanks to @kenanb for redesigning the
new Hy logo.

Many thanks to algernon for working on adderall, which helped
push Hy further this cycle. Adderall is an implementation of miniKanren
in Hy. If you're interested in using Adderall, check out hydiomatic,
which prettifies Hy source using Adderall rules.

This release saw an increase of about 11 contributors for a point
release, you guys rock!

-Hy Society

[ Language Changes ]

* `for' revamped again (Last time, we hope!), this time using a saner
Expand All @@ -232,19 +234,19 @@ Changes from 0.9.12
* `disassemble' added to core, which dumps the AST or equivalent python code
* `coll?' added to core to check for a collection
* `identity' function added to core

[ Misc. Fixes ]
* Lots of doc fixes. Reorganization as well as better docs on Hy internals
* Universal Wheel Support
* Pygments > 1.6 supports Hy now. All codeblocks in docs have been changed
from clojure to hy
* Hy REPL supports invoking with --spy & -i options [reword]
* `first' and `rest' are functions and not macros anymore
* "clean" target added to Makefile
* "clean" target added to Makefile
* hy2py supports a bunch of commandline options to show AST, source etc.
* Sub-object mangling: every identifier is split along the dots & mangled
separately

[ Bug Fixes ]
* Empty MacroExpansions work as expected
* Python 3.4 port. Sorry this wasn't in a 3.4 release time, we forgot to do
Expand All @@ -268,18 +270,18 @@ Changes from Hy 0.9.11
0.9.12 comes with some massive changes,
We finally took the time to implement gensym, as well as a few
other bits that help macro writing. Check the changelog for
what exactly was added.
what exactly was added.

The biggest feature, Reader Macros, landed later
in the cycle, but were big enough to warrant a release on its
own. A huge thanks goes to Foxboron for implementing them
and a massive hug goes out to olasd for providing ongoing
reviews during the development.

Welcome to the new Hy contributors, Henrique Carvalho Alves,
Kevin Zita and Kenan Bölükbaşı. Thanks for your work so far,
folks!

Hope y'all enjoy the finest that 2013 has to offer,
- Hy Society

Expand Down Expand Up @@ -390,7 +392,7 @@ Changes from Hy 0.9.10
Changes from Hy 0.9.9

[ Stupid Fixes ]

* I forgot to include hy.core.language in the sdist. (PT)

Changes from Hy 0.9.8
Expand Down
1 change: 1 addition & 0 deletions hy/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,7 @@ def compile_with_expression(self, expr):
optional_vars=thing)]

ret = ctx + the_with
ret.contains_yield = ret.contains_yield or body.contains_yield
# And make our expression context our temp variable
expr_name = ast.Name(id=ast_str(var), arg=ast_str(var),
ctx=ast.Load(),
Expand Down
10 changes: 9 additions & 1 deletion tests/native_tests/language.hy
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,14 @@
(with [(open "README.md" "r")] (do)))


(defn test-context-yield []
"NATIVE: test yields inside of with statements don't try to return before Python 3.3"
(defn f []
(with [(open "README.md")] (yield 123)))

(assert (= (next (f)) 123)))


(defn test-with-return []
"NATIVE: test that with returns stuff"
(defn read-file [filename]
Expand Down Expand Up @@ -896,7 +904,7 @@

(defn test-and []
"NATIVE: test the and function"

(setv and123 (and 1 2 3)
and-false (and 1 False 3)
and-true (and)
Expand Down

0 comments on commit 2ee91f6

Please sign in to comment.