@@ -255,7 +255,7 @@ def proxyval(self, visited):
255
255
256
256
Derived classes will override this.
257
257
258
- For example, a PyIntObject * with ob_ival 42 in the inferior process
258
+ For example, a PyLongObjectPtr * with long_value 42 in the inferior process
259
259
should result in an int(42) in this process.
260
260
261
261
visited: a set of all gdb.Value pyobject pointers already visited
@@ -867,7 +867,7 @@ class PyLongObjectPtr(PyObjectPtr):
867
867
868
868
def proxyval (self , visited ):
869
869
'''
870
- Python's Include/longobjrep .h has this declaration:
870
+ Python's Include/longinterpr .h has this declaration:
871
871
872
872
typedef struct _PyLongValue {
873
873
uintptr_t lv_tag; /* Number of digits, sign and flags */
@@ -876,14 +876,18 @@ def proxyval(self, visited):
876
876
877
877
struct _longobject {
878
878
PyObject_HEAD
879
- _PyLongValue long_value;
879
+ _PyLongValue long_value;
880
880
};
881
881
882
882
with this description:
883
883
The absolute value of a number is equal to
884
- SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i)
885
- Negative numbers are represented with ob_size < 0;
886
- zero is represented by ob_size == 0.
884
+ SUM(for i=0 through ndigits-1) ob_digit[i] * 2**(PyLong_SHIFT*i)
885
+ The sign of the value is stored in the lower 2 bits of lv_tag.
886
+ - 0: Positive
887
+ - 1: Zero
888
+ - 2: Negative
889
+ The third lowest bit of lv_tag is reserved for an immortality flag, but is
890
+ not currently used.
887
891
888
892
where SHIFT can be either:
889
893
#define PyLong_SHIFT 30
0 commit comments