Wesley <nisp...@gmail.com> writes: > ... > Actually, I can now see the varialbe names at Python level and C level. > I just want to verify x command to monitor the memory content. > So, in my origin post, I can get variable i's address, and see the value is 1, > then, I wanna have a try x command, the issue is, when use x/format i's > address, the output is not 1, but other things:-(
All Python objects start (at C level) with a header (containing the reference count, a pointer to the associated type and maybe other things); the "real" value starts behind this header. This means, to see the "1" in your example, you must skip the associated object header -- either in the output or by adding the size of the header to the initial address. -- https://mail.python.org/mailman/listinfo/python-list