Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #209 and #396 to avoid infinite recursion when printing a Parameterized object that contains an indirect reference to itself.
First tried using
reprlib.recursive_repr
, which seemed to work for repr itself, but did not addresspprint
, because it did not allow the decorated method to have any extra arguments. Luckily the implementation is straightforward, so I copied it from https://github.com/python/cpython/blob/3.2/Lib/reprlib.py and changed it to handle args and kwargs. I did have to changefrom _thread import get_ident
to avoid private API, but it seems the same asfrom threading import get_ident
, which appears to work the same.I haven't run the test suite yet, but it addresses #209:
'A(b=main.B(a=...))`
and #396:
"InputDataComponent(name='InputDataComponent00004', update_data=<bound method InputDataComponent._update_data of ...>)"