-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix repr and str for lists with cycles
Functions which format a string from linked list (repr and str) need to handle the case where the list cyclically references itself. Failing to detect this scenario leads to infinite recursion (which is detected by Python interpreter and causes an exception). Two distinct list layouts can trigger this issue: - a list which contains a reference to itself in one of the nodes - a node which contains a reference to itself (which might be indirect) Both cases are handled by calling Py_ReprEnter/Py_ReprLeave and terminating infinite recursion in repr and str. Closes issue #10.
- Loading branch information
Showing
4 changed files
with
100 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters