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

Implement __iter__ for wxList iterator classes #2680

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

swt2c
Copy link
Collaborator

@swt2c swt2c commented Jan 24, 2025

This fixes being able to use these classes in for loops, for example. Specifically it fixes the cmdproc tests with Python 3.13.1.

This fixes being able to use these classes in for loops, for example.
Specifically it fixes the cmdproc tests with Python 3.13.1.
@swt2c
Copy link
Collaborator Author

swt2c commented Jan 24, 2025

@DietmarSchwertberger can you confirm this resolves the issues you were seeing with wxGlade too?

@DietmarSchwertberger
Copy link
Contributor

DietmarSchwertberger commented Jan 25, 2025

@swt2c : Yes, that fixes the issue. Thanks. I will leave the workaround for some time, though.

Just checked why my minimal code sample was not able to reproduce the problem.
This one was failing:

children = [c for c in app.frame.notebook_1_pane_1.GetChildren()]

In my sample I was using this code, which was working:

for c in app.frame.notebook_1_pane_1.GetChildren():
    print(c)

I would have expected both to use the same iterator.

@swt2c
Copy link
Collaborator Author

swt2c commented Jan 25, 2025

I would have expected both to use the same iterator.

I think it's probably the difference between iter(x), which worked, and iter(iter(x)), which did not work, where x is a wxList class.

@swt2c swt2c merged commit 2adbeaa into wxWidgets:master Jan 25, 2025
13 checks passed
@swt2c swt2c deleted the wxlistwrapper_iter branch January 25, 2025 18:49
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.

2 participants