azazel75 / macropy

Macros in Python: quasiquotes, case classes, LINQ and more!
29 stars 4 forks source link

Fix handling of multiple block macros in the same with statement #22

Open Technologicat opened 6 years ago

Technologicat commented 6 years ago

See issue #21 for details.

azazel75 commented 6 years ago

Can you please add a testcase for this? thanks

Technologicat commented 5 years ago

Sure, I'll add a test for this too.

Since I originally posted this PR, I've discovered that my fix still doesn't handle the fully general case correctly, but I haven't had time to investigate it further or to create a minimal example that reproduces the bug.

What I've noticed is problems may occur with two-pass macros (that both yield and return stuff), for an example see namedlambda in unpythonic.syntax. (The macro itself works fine, when using a separate with block for it.)

Technologicat commented 5 years ago

Here's a test for the basic case for two block macros in the same with, where both macros operate only in the second pass.

I think the more complex cases could be handled at some later time?

Technologicat commented 4 years ago

Ping? Need more complex test cases, or is this fine now?