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 codegen line break #292

Merged
merged 2 commits into from
Oct 21, 2015
Merged

Conversation

oliverlee
Copy link
Contributor

Some generated expressions, particularly those that contain only '' and
'/' operands, have no whitespace. In this case, the textwrap module may
break the line in the middle of a symbol or mathematical expression if
the line is long, resulting in code that cannot compile. This commit
adds whitespace before and after the '
', '/' operands so that textwrap
will have more options for inserting line breaks. The textwrap option
'break_long_words' is also set to True, allowing long lines in the event
that no whitespace is present.

A test has been added that reproduces the bug.

This pull request resolves #263.

This pull request depends on #291. Please merge that request first.

@moorepants
Copy link
Member

This looks good to me.

@oliverlee oliverlee force-pushed the fix-codegen-line-break branch 3 times, most recently from 73e8bae to bfac43e Compare October 21, 2015 18:11
@oliverlee
Copy link
Contributor Author

I've removed the commit that's included in #291. Feel free to merge after you've taken a look, assuming there are no other problems.

@moorepants
Copy link
Member

Looks good. After the #291 merge and travis tests pass, then this is good to go in. Thanks for the fix!

Some generated expressions, particularly those that contain only '*' and
'/' operands, have no whitespace. In this case, the textwrap module may
break the line in the middle of a symbol or mathematical expression if
the line is long, resulting in code that cannot compile. This commit
adds whitespace before and after the '*', '/' operands so that textwrap
will have more options for inserting line breaks. The textwrap option
'break_long_words' is also set to True, allowing long lines in the event
that no whitespace is present.

This commit resolves pydy#263.
@oliverlee oliverlee force-pushed the fix-codegen-line-break branch from bfac43e to e11f2fe Compare October 21, 2015 18:46
oliverlee added a commit that referenced this pull request Oct 21, 2015
Fix codegen line break. This resolves #263.
@oliverlee oliverlee merged commit 239b6da into pydy:master Oct 21, 2015
@oliverlee oliverlee deleted the fix-codegen-line-break branch October 21, 2015 22:52
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.

C code generation line break issue
2 participants