[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59122] jsonencode change's user's warning set

From: Rik
Subject: [Octave-bug-tracker] [bug #59122] jsonencode change's user's warning setting for "Octave:classdef-to-struct"
Date: Thu, 17 Sep 2020 10:54:38 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36


                 Summary: jsonencode change's user's warning setting for
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Thu 17 Sep 2020 07:54:36 AM PDT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Other
                  Status: Confirmed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any



When classdef objects or a containers.Map object are encoded to JSON they are
first converted to structs.  The C++ code disables the warning ID
"Octave:classdef-to-struct" and then turns it back on after conversion. 
However, if the user had this ID turned off to begin with then this code
changes the setting without the user's consent.

Code in jsonencode.cc:

      set_warning_state ("Octave:classdef-to-struct", "off");
      encode_struct (writer, obj.scalar_map_value (), ConvertInfAndNaN);
      set_warning_state ("Octave:classdef-to-struct", "on");

Sample m-file code

octave:2> warning ("off", "Octave:classdef-to-struct")
octave:3> jsonencode (containers.Map ());
octave:4> warning ("query", "Octave:classdef-to-struct")
"Octave:classdef-to-struct" warning state is "on"


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]