mirror of
https://github.com/python/cpython.git
synced 2025-10-15 03:10:29 +00:00
gdb/libpython.py: Update PyLongObjectPtr docstring (GH-118438)
This commit is contained in:
parent
a6b610a94b
commit
f8e088df2a
1 changed files with 10 additions and 6 deletions
|
@ -255,7 +255,7 @@ class PyObjectPtr(object):
|
||||||
|
|
||||||
Derived classes will override this.
|
Derived classes will override this.
|
||||||
|
|
||||||
For example, a PyIntObject* with ob_ival 42 in the inferior process
|
For example, a PyLongObjectPtr* with long_value 42 in the inferior process
|
||||||
should result in an int(42) in this process.
|
should result in an int(42) in this process.
|
||||||
|
|
||||||
visited: a set of all gdb.Value pyobject pointers already visited
|
visited: a set of all gdb.Value pyobject pointers already visited
|
||||||
|
@ -867,7 +867,7 @@ class PyLongObjectPtr(PyObjectPtr):
|
||||||
|
|
||||||
def proxyval(self, visited):
|
def proxyval(self, visited):
|
||||||
'''
|
'''
|
||||||
Python's Include/longobjrep.h has this declaration:
|
Python's Include/longinterpr.h has this declaration:
|
||||||
|
|
||||||
typedef struct _PyLongValue {
|
typedef struct _PyLongValue {
|
||||||
uintptr_t lv_tag; /* Number of digits, sign and flags */
|
uintptr_t lv_tag; /* Number of digits, sign and flags */
|
||||||
|
@ -876,14 +876,18 @@ class PyLongObjectPtr(PyObjectPtr):
|
||||||
|
|
||||||
struct _longobject {
|
struct _longobject {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
_PyLongValue long_value;
|
_PyLongValue long_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
with this description:
|
with this description:
|
||||||
The absolute value of a number is equal to
|
The absolute value of a number is equal to
|
||||||
SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i)
|
SUM(for i=0 through ndigits-1) ob_digit[i] * 2**(PyLong_SHIFT*i)
|
||||||
Negative numbers are represented with ob_size < 0;
|
The sign of the value is stored in the lower 2 bits of lv_tag.
|
||||||
zero is represented by ob_size == 0.
|
- 0: Positive
|
||||||
|
- 1: Zero
|
||||||
|
- 2: Negative
|
||||||
|
The third lowest bit of lv_tag is reserved for an immortality flag, but is
|
||||||
|
not currently used.
|
||||||
|
|
||||||
where SHIFT can be either:
|
where SHIFT can be either:
|
||||||
#define PyLong_SHIFT 30
|
#define PyLong_SHIFT 30
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue