Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Technologicat
Copy link

See issue #21 for details.

… ordering), even if new_tree completely replaces in_tree.body
@azazel75
Copy link
Owner

Can you please add a testcase for this? thanks

@Technologicat
Copy link
Author

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.)

…here the inner macro returns a completely new tree
@Technologicat
Copy link
Author

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants