golang bindings dirty in tree after libxl build
Hello,
I've just done a libxl build and got things such as:
tools/golang/xenlight/helpers.gen.go +0 -0
@@ -431,14 +431,14 @@ x.Evtch = int(xc.evtch)
x.Rref = int(xc.rref)
x.Connection = ChannelConnection(xc.connection) switch x.Connection{
-case ChannelConnectionUnknown:
-x.ConnectionUnion = nil
case ChannelConnectionPty:
var connectionPty ChannelinfoConnectionUnionPty
if err := connectionPty.fromC(xc);err != nil { return fmt.Errorf("converting field connectionPty: %v", err) }
x.ConnectionUnion = connectionPty
+case ChannelConnectionUnknown:
+x.ConnectionUnion = nil
case ChannelConnectionSocket:
x.ConnectionUnion = nil
default:
dirty in tree. They are all case labels, and only their order in the switch has changed.
Does the current binding generation rely on the order of entries in a python dictionary by any chance?
~Andrew
Quoted 28 lines · Andrew Cooper
Hello,
I've just done a libxl build and got things such as:
tools/golang/xenlight/helpers.gen.go +2
-2@@ -431,14 +431,14 @@ x.Evtch = int(xc.evtch) x.Rref = int(xc.rref) x.Connection = ChannelConnection(xc.connection) switch x.Connection{ -case ChannelConnectionUnknown: -x.ConnectionUnion = nil case ChannelConnectionPty: var connectionPty ChannelinfoConnectionUnionPty if err := connectionPty.fromC(xc);err != nil { return fmt.Errorf("converting field connectionPty: %v", err) } x.ConnectionUnion = connectionPty +case ChannelConnectionUnknown: +x.ConnectionUnion = nil case ChannelConnectionSocket: x.ConnectionUnion = nil default:
Quoted 5 lines
dirty in tree. They are all case labels, and only their order in the switch has changed.
Does the current binding generation rely on the order of entries in a python dictionary by any chance?
Not explicitly, but obviously somewhat implicitly.
Is this a python2/3 issue, or would different versions of python within 2/3 end up with different sort orders?
If python3 will always put them in the same order, then we might consider just switching the script to being explicitly python3. Otherwise, we’ll probably have to add sorts.
-George
Quoted 30 lines · George Dunlap
Quoted 30 lines · Andrew Cooper
Hello,
I've just done a libxl build and got things such as:
tools/golang/xenlight/helpers.gen.go +2
-2@@ -431,14 +431,14 @@ x.Evtch = int(xc.evtch) x.Rref = int(xc.rref) x.Connection = ChannelConnection(xc.connection) switch x.Connection{ -case ChannelConnectionUnknown: -x.ConnectionUnion = nil case ChannelConnectionPty: var connectionPty ChannelinfoConnectionUnionPty if err := connectionPty.fromC(xc);err != nil { return fmt.Errorf("converting field connectionPty: %v", err) } x.ConnectionUnion = connectionPty +case ChannelConnectionUnknown: +x.ConnectionUnion = nil case ChannelConnectionSocket: x.ConnectionUnion = nil default:dirty in tree. They are all case labels, and only their order in the switch has changed.
Quoted 7 lines
Quoted 2 lines
Does the current binding generation rely on the order of entries in a python dictionary by any chance?
Not explicitly, but obviously somewhat implicitly.
Is this a python2/3 issue, or would different versions of python within 2/3 end up with different sort orders?
If python3 will always put them in the same order, then we might consider just switching the script to being explicitly python3. Otherwise, we’ll probably have to add sorts.
Python 3.6 now guarantees that the insert order of elements will be preserved. Before that, there are no guarantees at all.
It sounds like some sprinkling of sorted() will be needed.
~Andrew
Quoted 36 lines · Andrew Cooper
Quoted 34 lines · George Dunlap
Quoted 27 lines · Andrew Cooper
Hello,
I've just done a libxl build and got things such as:
tools/golang/xenlight/helpers.gen.go +2
-2@@ -431,14 +431,14 @@ x.Evtch = int(xc.evtch) x.Rref = int(xc.rref) x.Connection = ChannelConnection(xc.connection) switch x.Connection{ -case ChannelConnectionUnknown: -x.ConnectionUnion = nil case ChannelConnectionPty: var connectionPty ChannelinfoConnectionUnionPty if err := connectionPty.fromC(xc);err != nil { return fmt.Errorf("converting field connectionPty: %v", err) } x.ConnectionUnion = connectionPty +case ChannelConnectionUnknown: +x.ConnectionUnion = nil case ChannelConnectionSocket: x.ConnectionUnion = nil default:Quoted 5 lines
dirty in tree. They are all case labels, and only their order in the switch has changed.
Does the current binding generation rely on the order of entries in a python dictionary by any chance?
Not explicitly, but obviously somewhat implicitly.
Quoted 8 lines
Quoted 3 lines
Is this a python2/3 issue, or would different versions of python within 2/3 end up with different sort orders?
If python3 will always put them in the same order, then we might consider just switching the script to being explicitly python3. Otherwise, we’ll probably have to add sorts.
Python 3.6 now guarantees that the insert order of elements will be preserved. Before that, there are no guarantees at all.
It sounds like some sprinkling of
sorted()will be needed.
George,
Unless you have a burning desire, I can take care of this patch today or tomorrow.
-NR