Skip to content

Fix subtype/subclass miss branch issue#398

Merged
geatpy-dev merged 1 commit into
geatpy-dev:masterfrom
WhiskyChoy:patch-1
Feb 5, 2026
Merged

Fix subtype/subclass miss branch issue#398
geatpy-dev merged 1 commit into
geatpy-dev:masterfrom
WhiskyChoy:patch-1

Conversation

@WhiskyChoy

Copy link
Copy Markdown
Contributor

Use isinstance(*) rather than type(*)== to avoid the miss of branch when subclass of ea.Population is used.

Use `isinstance(*)` rather than `type(*)==` to avoid the miss of branch when subclass of `ea.Population` is used.
Copilot AI review requested due to automatic review settings February 5, 2026 10:25
@zeroraiser

zeroraiser commented Feb 5, 2026 via email

Copy link
Copy Markdown

@zzxzfy

zzxzfy commented Feb 5, 2026 via email

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 a type checking issue in the optimize function that would cause subclasses of ea.Population to be incorrectly rejected. The fix changes from exact type comparison (type(*) == ea.Population) to proper inheritance checking (isinstance(*, ea.Population)).

Changes:

  • Changed line 96 from type(prophet) == ea.Population to isinstance(prophet, ea.Population) to properly handle subclasses

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@geatpy-dev
geatpy-dev merged commit f919fe3 into geatpy-dev:master Feb 5, 2026
5 of 6 checks passed
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.

5 participants