[issue46900] marshal.dumps represents the same list object differently

2022-03-02 Thread William Dreese
Change by William Dreese : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue46900] marshal.dumps represents the same list object differently

2022-03-02 Thread William Dreese
William Dreese added the comment: You two are both correct, this is not a bug and is the intended functionality. > The difference between 41 and 169 is 128: This realization helps a ton. Thanks. -- ___ Python tracker

[issue46900] marshal.dumps represents the same list object differently

2022-03-02 Thread Eric V. Smith
Eric V. Smith added the comment: >From https://github.com/python/cpython/blob/main/Python/marshal.c: 41 is: #define TYPE_SMALL_TUPLE')' The difference between 41 and 169 is 128: #define FLAG_REF'\x80' /* with a type, add obj to index */ So the difference is the

[issue46900] marshal.dumps represents the same list object differently

2022-03-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: The difference is the FLAG_REF which is set to 128 (0x80). >>> import marshal >>> var_example = [(1,2,3),(4,5,6)] >>> vm = marshal.dumps(var_example) >>> rm = marshal.dumps([(1,2,3),(4,5,6)]) >>> [v ^ r for v, r in zip(vm, rm)] [128, 0, 0, 0, 0, 128, 0,

[issue46900] marshal.dumps represents the same list object differently

2022-03-02 Thread William Dreese
William Dreese added the comment: I've made a very bad copy & paste error with the terminal output below, I apologize. The corrected output is >>> pp(var_marshaled) 91 2 0 0 0 41 3 233 1 0 0 0 233 2 0 0 0 233 3 0 0 0 41 3 233 4 0 0 0 233 5 0 0 0 233 6 0 0 0 >>> pp(raw_marshaled) 91 2 0 0 0

[issue46900] marshal.dumps represents the same list object differently

2022-03-02 Thread William Dreese
New submission from William Dreese : Hello, I've been working with the marshal package and came across this issue (I think) - Python 3.9.10 Interpreter (Same output in 3.11.0a5+ (heads/master:b6b711a1aa) on darwin) >>> import marshal >>> var_example = [(1,2,3),(4,5,6)] >>> var_marshaled =