gdb python LineTable.source_lines docstring returns List, not FrozenSet

Message ID CAFXrp_e=YCGSE76c=hqhUa+pC00BLxnB=ThgESff7s6yQbfCAw@mail.gmail.com
State New, archived
Headers

Commit Message

Ciro Santilli July 4, 2015, 8:14 p.m. UTC
  This can be seen at
https://github.com/cirosantilli/binutils-gdb/blob/2edf562a17871d32b814acda9ced29856d405d6c/gdb/python/py-linetable.c#L285:

    source_list = PyDict_Keys (source_dict);
    return source_list;

PyDict_Keys makes list, not a frozen set:
https://docs.python.org/3/c-api/dict.html#c.PyDict_Keys

The python.texi is correct and says List. I wish we could concentrate
all documentation on a single place to avoid such clashes (only texi
or only docstrings).

From 2edf562a17871d32b814acda9ced29856d405d6c Mon Sep 17 00:00:00 2001
From: Ciro Santilli <ciro.santilli@gmail.com>
Date: Sat, 4 Jul 2015 21:56:58 +0200
Subject: [PATCH] gdb python LineTable.source_lines docstring returns List, not
 FrozenSet

---
 gdb/python/py-linetable.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Ciro Santilli July 14, 2015, 7:01 p.m. UTC | #1
Ping.

Tromey, taking the liberty of pinging you directly because you seem
like "the Python guy".

Let me know if there is someone or a method more appropriate to ping /
submit for this type of patch.

Cheers.

On Sat, Jul 4, 2015 at 10:14 PM, Ciro Santilli <ciro.santilli@gmail.com> wrote:
> This can be seen at
> https://github.com/cirosantilli/binutils-gdb/blob/2edf562a17871d32b814acda9ced29856d405d6c/gdb/python/py-linetable.c#L285:
>
>     source_list = PyDict_Keys (source_dict);
>     return source_list;
>
> PyDict_Keys makes list, not a frozen set:
> https://docs.python.org/3/c-api/dict.html#c.PyDict_Keys
>
> The python.texi is correct and says List. I wish we could concentrate
> all documentation on a single place to avoid such clashes (only texi
> or only docstrings).
>
> From 2edf562a17871d32b814acda9ced29856d405d6c Mon Sep 17 00:00:00 2001
> From: Ciro Santilli <ciro.santilli@gmail.com>
> Date: Sat, 4 Jul 2015 21:56:58 +0200
> Subject: [PATCH] gdb python LineTable.source_lines docstring returns List, not
>  FrozenSet
>
> ---
>  gdb/python/py-linetable.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
> index 195a8b3..82b4cfc 100644
> --- a/gdb/python/py-linetable.c
> +++ b/gdb/python/py-linetable.c
> @@ -227,8 +227,8 @@ ltpy_has_line (PyObject *self, PyObject *args)
>    Py_RETURN_FALSE;
>  }
>
> -/* Implementation of gdb.LineTable.source_lines (self) -> FrozenSet.
> -   Returns a Python FrozenSet that contains source line entries in the
> +/* Implementation of gdb.LineTable.source_lines (self) -> List.
> +   Returns a Python List that contains source line entries in the
>     line table.  This function will just return the source lines
>     without corresponding addresses.  */
>
> @@ -488,8 +488,8 @@ Return executable locations for a given source line." },
>      "has_line (lineno) -> Boolean\n\
>  Return TRUE if this line has executable information, FALSE if not." },
>    { "source_lines", ltpy_get_all_source_lines, METH_NOARGS,
> -    "source_lines () -> FrozenSet\n\
> -Return a frozen set of all executable source lines." },
> +    "source_lines () -> List\n\
> +Return a list of all executable source lines." },
>    { "is_valid", ltpy_is_valid, METH_NOARGS,
>      "is_valid () -> Boolean.\n\
>  Return True if this Linetable is valid, False if not." },
> --
> 1.9.1
  
Ciro Santilli July 22, 2015, 7:48 a.m. UTC | #2
Ping 2. Let me know your desired ping frequency, currently weekly as
per Tromey's suggestion.

On Tue, Jul 14, 2015 at 9:01 PM, Ciro Santilli <ciro.santilli@gmail.com> wrote:
> Ping.
>
> Tromey, taking the liberty of pinging you directly because you seem
> like "the Python guy".
>
> Let me know if there is someone or a method more appropriate to ping /
> submit for this type of patch.
>
> Cheers.
>
> On Sat, Jul 4, 2015 at 10:14 PM, Ciro Santilli <ciro.santilli@gmail.com> wrote:
>> This can be seen at
>> https://github.com/cirosantilli/binutils-gdb/blob/2edf562a17871d32b814acda9ced29856d405d6c/gdb/python/py-linetable.c#L285:
>>
>>     source_list = PyDict_Keys (source_dict);
>>     return source_list;
>>
>> PyDict_Keys makes list, not a frozen set:
>> https://docs.python.org/3/c-api/dict.html#c.PyDict_Keys
>>
>> The python.texi is correct and says List. I wish we could concentrate
>> all documentation on a single place to avoid such clashes (only texi
>> or only docstrings).
>>
>> From 2edf562a17871d32b814acda9ced29856d405d6c Mon Sep 17 00:00:00 2001
>> From: Ciro Santilli <ciro.santilli@gmail.com>
>> Date: Sat, 4 Jul 2015 21:56:58 +0200
>> Subject: [PATCH] gdb python LineTable.source_lines docstring returns List, not
>>  FrozenSet
>>
>> ---
>>  gdb/python/py-linetable.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
>> index 195a8b3..82b4cfc 100644
>> --- a/gdb/python/py-linetable.c
>> +++ b/gdb/python/py-linetable.c
>> @@ -227,8 +227,8 @@ ltpy_has_line (PyObject *self, PyObject *args)
>>    Py_RETURN_FALSE;
>>  }
>>
>> -/* Implementation of gdb.LineTable.source_lines (self) -> FrozenSet.
>> -   Returns a Python FrozenSet that contains source line entries in the
>> +/* Implementation of gdb.LineTable.source_lines (self) -> List.
>> +   Returns a Python List that contains source line entries in the
>>     line table.  This function will just return the source lines
>>     without corresponding addresses.  */
>>
>> @@ -488,8 +488,8 @@ Return executable locations for a given source line." },
>>      "has_line (lineno) -> Boolean\n\
>>  Return TRUE if this line has executable information, FALSE if not." },
>>    { "source_lines", ltpy_get_all_source_lines, METH_NOARGS,
>> -    "source_lines () -> FrozenSet\n\
>> -Return a frozen set of all executable source lines." },
>> +    "source_lines () -> List\n\
>> +Return a list of all executable source lines." },
>>    { "is_valid", ltpy_is_valid, METH_NOARGS,
>>      "is_valid () -> Boolean.\n\
>>  Return True if this Linetable is valid, False if not." },
>> --
>> 1.9.1
  

Patch

diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
index 195a8b3..82b4cfc 100644
--- a/gdb/python/py-linetable.c
+++ b/gdb/python/py-linetable.c
@@ -227,8 +227,8 @@  ltpy_has_line (PyObject *self, PyObject *args)
   Py_RETURN_FALSE;
 }

-/* Implementation of gdb.LineTable.source_lines (self) -> FrozenSet.
-   Returns a Python FrozenSet that contains source line entries in the
+/* Implementation of gdb.LineTable.source_lines (self) -> List.
+   Returns a Python List that contains source line entries in the
    line table.  This function will just return the source lines
    without corresponding addresses.  */

@@ -488,8 +488,8 @@  Return executable locations for a given source line." },
     "has_line (lineno) -> Boolean\n\
 Return TRUE if this line has executable information, FALSE if not." },
   { "source_lines", ltpy_get_all_source_lines, METH_NOARGS,
-    "source_lines () -> FrozenSet\n\
-Return a frozen set of all executable source lines." },
+    "source_lines () -> List\n\
+Return a list of all executable source lines." },
   { "is_valid", ltpy_is_valid, METH_NOARGS,
     "is_valid () -> Boolean.\n\
 Return True if this Linetable is valid, False if not." },