Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BUG: Fix crackfortran parsing error when a division occurs within a common block #28396

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

Merged
merged 11 commits into from
Apr 2, 2025

Conversation

nchristensen
Copy link
Contributor

@nchristensen nchristensen commented Feb 26, 2025

The analyzeline function currently passes over all / characters, presumably assuming they only indicate the name of the common block. However, this means division operations after the common block name are also passed over.
For instance
common /mortmp/ ctmp((lub*(lub+1)*(lub+1))/lpmin+1)
fails to parse correctly.

This pull request attempts to rectify this by counting the number of slashes encountered in the line and only passing over the first two.

@melissawm
Copy link
Member

Hi @nchristensen - can you add a test for this? Thanks!

@nchristensen

This comment was marked as resolved.

@nchristensen
Copy link
Contributor Author

I had to simplify the example code, but the test seems to work now.

@melissawm melissawm moved this from Pending authors' response to Awaiting a code review in NumPy first-time contributor PRs Feb 28, 2025
@ngoldbaum
Copy link
Member

I don't think the test failure is related.

Ping @HaoZeke - would you mind taking a look at this?

@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Mar 9, 2025
@charris
Copy link
Member

charris commented Mar 25, 2025

@HaoZeke ping.

Copy link
Member

@HaoZeke HaoZeke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nchristensen. I have an enhancement suggestion but otherwise this looks like a pragmatic solution.

numpy/f2py/crackfortran.py Outdated Show resolved Hide resolved
@nchristensen nchristensen requested a review from HaoZeke March 31, 2025 21:17
Copy link
Member

@HaoZeke HaoZeke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very elegant fix, thanks @nchristensen !

@charris
Copy link
Member

charris commented Apr 2, 2025

Please squash when merging.

@charris charris merged commit df9d175 into numpy:main Apr 2, 2025
73 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting a code review to Completed in NumPy first-time contributor PRs Apr 2, 2025
@charris
Copy link
Member

charris commented Apr 2, 2025

Thanks @nchristensen .

charris pushed a commit to charris/numpy that referenced this pull request Apr 2, 2025
…ommon block (numpy#28396)

* BUG: Fix crackpython parsing error when a division occurs within a common block

* Add test for more complicated array sizing expression

* fix typos

* Simplify tests to currently supported syntax

* Use regular expression to find common block name

* Revert from broken regular expression version to prior version, add comment

* Add space before inline comment

* Use regular expression to split line

* Add missing white space to appease linter

* More linting fixes

* Pass maxsplit as a keyword argument
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Apr 2, 2025
MaanasArora pushed a commit to MaanasArora/numpy that referenced this pull request Apr 11, 2025
…ommon block (numpy#28396)

* BUG: Fix crackpython parsing error when a division occurs within a common block

* Add test for more complicated array sizing expression

* fix typos

* Simplify tests to currently supported syntax

* Use regular expression to find common block name

* Revert from broken regular expression version to prior version, add comment

* Add space before inline comment

* Use regular expression to split line

* Add missing white space to appease linter

* More linting fixes

* Pass maxsplit as a keyword argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.