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 API case for external data passed as vectors #6521

Merged
merged 5 commits into from
Apr 5, 2022
Merged

Conversation

maxrjones
Copy link
Member

@maxrjones maxrjones commented Apr 4, 2022

Description of proposed changes

This PR adds a version of the bug report from GenericMappingTools/pygmt#1691 to the C API tests. Currently crashes.

Fixes #

Reminders

  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Describe changes to function behavior and arguments in a comment below the function declaration.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

@maxrjones
Copy link
Member Author

@PaulWessel, I found that this test uses GMT_IS_REFERENCE and crashes as-is but passes if I modify y to be GMT_UINT (similar to GenericMappingTools/pygmt#1691). Do you think you could use this to debug the issues related to #5953, to circumvent the issues with conda on M1?

@maxrjones maxrjones changed the title Add test for GMT API crash WIP: Add test for GMT API crash Apr 4, 2022
@PaulWessel
Copy link
Member

Yes possibly, I will give it a check tomorrow morning.

@maxrjones
Copy link
Member Author

Yes possibly, I will give it a check tomorrow morning.

Thanks

@PaulWessel
Copy link
Member

I had a conceptual error in my thinking when it came to data sets being passed in via vectors and GMT_IS_REFERENCE: Since we are creating a DATASET container for the input and we set its pointers to the external arrays, we do not need to consult which columns were allocated externally or internally since all of them shall be treated as external so that when the module (here psxy) finishes it does not attempt to free any of them (even one that was allocated by GMT in main) since it will be freed at that level instead.

@PaulWessel
Copy link
Member

See if this also fixes the original pyGMT issue, @meghanrjones . That crash is gone for me.

@maxrjones maxrjones changed the title WIP: Add test for GMT API crash Add test for GMT API crash Apr 5, 2022
@maxrjones
Copy link
Member Author

maxrjones commented Apr 5, 2022

See if this also fixes the original pyGMT issue, @meghanrjones . That crash is gone for me.

Yes, the PyGMT issue is fixed. Thanks. I will need your approval on the PR before merging.

@maxrjones maxrjones requested a review from PaulWessel April 5, 2022 15:25
Copy link
Member

@PaulWessel PaulWessel left a comment

Choose a reason for hiding this comment

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

Oops

@maxrjones maxrjones changed the title Add test for GMT API crash Fix API case for external data passed as vectors Apr 5, 2022
@maxrjones maxrjones merged commit 10df489 into master Apr 5, 2022
@maxrjones maxrjones deleted the times-crash branch April 5, 2022 15:41
@maxrjones maxrjones added the bug Something isn't working label Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants