Skip to content
Snippets Groups Projects
  • Vladimir Davydov's avatar
    cce01025
    lua-yaml: enable aliasing for objects returned by __serialize · cce01025
    Vladimir Davydov authored
    The YAML serializer fails to detect aliases in objects returned by
    the __serialize method:
    
    tarantool> x = {}
    ---
    ...
    
    tarantool> {a = x, b = x}
    ---
    - a: &0 []
      b: *0
    ...
    
    tarantool> setmetatable({}, {
             >     __serialize = function() return {a = x, b = x} end,
             > })
    ---
    - a: []
      b: []
    ...
    
    Fix this by scanning the object returned by the __serialize method
    (called by luaL_checkfield) for references.
    
    Closes #8240
    
    NO_DOC=bug fix
    
    (cherry picked from commit b42302f5)
    cce01025
    History
    lua-yaml: enable aliasing for objects returned by __serialize
    Vladimir Davydov authored
    The YAML serializer fails to detect aliases in objects returned by
    the __serialize method:
    
    tarantool> x = {}
    ---
    ...
    
    tarantool> {a = x, b = x}
    ---
    - a: &0 []
      b: *0
    ...
    
    tarantool> setmetatable({}, {
             >     __serialize = function() return {a = x, b = x} end,
             > })
    ---
    - a: []
      b: []
    ...
    
    Fix this by scanning the object returned by the __serialize method
    (called by luaL_checkfield) for references.
    
    Closes #8240
    
    NO_DOC=bug fix
    
    (cherry picked from commit b42302f5)