Repository navigation
Undeprecate literal_(de)stringizer - #6943
Merged
jarrodmillman merged 1 commit intoSep 25, 2023
Merged
Conversation
rossbar
force-pushed
the
undeprecated-literal-stringizer
branch
from
September 25, 2023 05:28
8082754 to
1bc7cdd
Compare
dschult
approved these changes
Sep 25, 2023
dschult
left a comment
Member
There was a problem hiding this comment.
Thanks Ross!
I appreciate the effort spent diving into these functions. :)
jarrodmillman
approved these changes
Sep 25, 2023
jarrodmillman
left a comment
Member
There was a problem hiding this comment.
Thanks!! I spent too much time to trying to sort this out as well.
Alex-Markham
pushed a commit
to Alex-Markham/networkx
that referenced
this pull request
Oct 13, 2023
Undeprecate literal_(de)stringizer.
dschult
pushed a commit
to BrunoBaldissera/networkx
that referenced
this pull request
Oct 23, 2023
Undeprecate literal_(de)stringizer.
cvanelteren
pushed a commit
to cvanelteren/networkx
that referenced
this pull request
Apr 22, 2024
Undeprecate literal_(de)stringizer.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I propose to rescind the deprecation of
gml.literal_stringizerandgml.literal_destringizer.These functions have been deprecated since 2.5 but were never removed because it is not possible to do so without breaking tests. I spent a frustrating couple hours diving into this and gained a few insights. Currently,
literal_stringizeris necessary to handle two specific cases that are tested:The first one is relatively easy to "fix" without literal stringizer. For completeness sake, it would involved adding the following snippet:
before L761.
The 2nd one is really tough to crack. The default
stringizerfunction has anin_listfunction to decide how to handle elements inside lists, but this only works for "1D" lists - nested sequences break this pattern and will end up raising an exception.literal_stringizergets around this by only unpacking the outermost list, then directly repr-ing everything inside it. I'm not even sure that the GML standard supports nested lists as attributes! However, this currently "works" according totest_data_types, even if the result isn't actually valid, standards-compliant gml.IMO, the simplest thing to do would be to revert the deprecation. On the off-chance that there are users depending on this behavior,
literal_stringizeris currently the only simple way to achieve it. It looks like the original motivation for deprecating theliteral_*stringizerfunctions was Python 2->3 cleanup, but these corner cases are still relevant and unrelated to Python 2. Furthermore, I think reverting the deprecation will be relatively painless, as the deprecation warnings aren't currently visible due to the stack level.