On 19 January 2018 at 16:08, Marc-Andre Lureau <mlur...@redhat.com> wrote: > Hi > > On Fri, Jan 19, 2018 at 4:29 PM, Peter Maydell <peter.mayd...@linaro.org> > wrote: >> On 19 January 2018 at 15:24, Peter Maydell <peter.mayd...@linaro.org> wrote: >>> On 19 January 2018 at 14:35, Marc-Andre Lureau <mlur...@redhat.com> wrote: >>>> I have not found how to translate a python 'buffer' to a bytes string >>>> in 2.6. >>> >>> A local python expert suggests that "bytes(buffer)" should work. >> >> ...and that it ought to work if handed a memoryview too, so do we >> just want >> >> self.elf.add_vmcoreinfo_note(bytes(vmcoreinfo)) >> > > Yes, I tested on 2.6 and 3.6, it works. I'll send a new patch.
Testing 2.7 as well would probably not be a bad plan. Apparently this works because: * on python 3, bytes(memoryview) and memoryview.to_bytes() are the same * gdb gives us a memoryview only if python 3 * so we don't have to handle the case of getting a memoryview and being python 2 (in which case we would need to use memoryview.to_bytes() as bytes() would do the wrong thing) thanks -- PMM