Skip to content

Fix the bug when passing a sequence that contains True to a parameter #3982

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seisman
Copy link
Member

@seisman seisman commented Jun 19, 2025

See #3981 for the bug report. Syntax like frame=[True, "+tThe Caribbean Sea"] is not intuitive but is still valid. This PR fixes the issue by checking if a sequence contains True.

Other values like False/None are not checked, since they make no sense, e.g., frame=[False, "+tThe Caribbean Sea"]

Closes #3981.

@seisman seisman added this to the 0.17.0 milestone Jun 19, 2025
@seisman seisman added bug Something isn't working needs review This PR has higher priority and needs review. labels Jun 19, 2025
@seisman seisman changed the title Fix the bug that passing a sequence that contains True to a parameter Fix the bug when passing a sequence that contains True to a parameter Jun 19, 2025
@seisman seisman requested a review from Copilot June 20, 2025 02:58
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request fixes the bug when passing a sequence containing True to a parameter by modifying the argument list construction in pygmt.

  • Adds a check inside the iterable processing to handle True values correctly.
  • Updates the behavior in build_arg_list to distinguish between a bare True and other iterable elements.
Comments suppressed due to low confidence (1)

pygmt/helpers/utils.py:570

  • [nitpick] Consider adding an inline comment to explain why the comprehension conditionally checks for True values within the iterable, for future maintainers.
            gmt_args.extend(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs review This PR has higher priority and needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Combine bool and string in a list
1 participant