Menu

#408 preserve_quotes not taken into account

invalid
nobody
None
minor
bug
2021-11-11
2021-11-11
No

In YAML class, method get_constructor_parser, the preserve_quotes parameter is not passed.

                class XLoader(self.Parser, self.Constructor, rslvr):  # type: ignore
                    def __init__(selfx, stream, version=self.version, preserve_quotes=None):
                        # type: (StreamTextType, Optional[VersionType], Optional[bool]) -> None  # NOQA
                        CParser.__init__(selfx, stream)
                        selfx._parser = selfx._composer = selfx
                        self.Constructor.__init__(selfx, loader=selfx)
                        selfx.allow_duplicate_keys = self.allow_duplicate_keys
                        rslvr.__init__(selfx, version=version, loadumper=selfx)

                self._stream = stream
                loader = XLoader(stream)

I have resolved like this:

                        self.Constructor.__init__(selfx, loader=selfx, preserve_quotes=preserve_quotes)

...

                loader = XLoader(stream, preserve_quotes=self.preserve_quotes)

Discussion

  • Anthon van der Neut

    • status: open --> invalid
     
  • Anthon van der Neut

    The preserve_quotes parameter pre-dates the new API so it had to be added as an argument to all constructors. But only the RoundTripConstructor uses it, and that is not created if you go through get_constructor_parser.

    Without actual failing code that calls this , I fail to see what problem this solves.

     

Log in to post a comment.

Monday.com Logo