Skip to content

bpo-30570: fix an issubclass infinite recursion crash #29017

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

Closed
wants to merge 1 commit into from

Conversation

gpshead
Copy link
Member

@gpshead gpshead commented Oct 18, 2021

issubclass() could crash due to infinite recursion on the values user supplied code emits for __bases__.

https://bugs.python.org/issue30570

@gpshead
Copy link
Member Author

gpshead commented Oct 18, 2021

While this appears to work, I'd like to see the python benchmark suite run with it to make sure it doesn't have a notable performance impact. there are faster implementation alternatives. even just storing the visited pointers in a linear C array that we realloc when it needs to grow and doing a linear search in that or keeping it sorted for faster than O(n) lookup would be sufficient and waay less complex than using the PySet code.

@gpshead gpshead changed the title bpo-30570: fix an issubclass infinite recurision crash bpo-30570: fix an issubclass infinite recursion crash Oct 18, 2021
@gpshead gpshead added needs backport to 3.10 only security fixes type-bug An unexpected behavior, bug, or error labels Oct 18, 2021
@gpshead
Copy link
Member Author

gpshead commented Oct 22, 2021

#29048 is much simpler and nicer than this one. closing. :)

@gpshead gpshead closed this Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review DO-NOT-MERGE needs backport to 3.10 only security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants