public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/28820] New: gdb.parameter returns Non for Python integer user-defined parameter with value 0
@ 2022-01-25 15:06 simark at simark dot ca
  2022-01-26 20:05 ` [Bug python/28820] " tromey at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: simark at simark dot ca @ 2022-01-25 15:06 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28820

            Bug ID: 28820
           Summary: gdb.parameter returns Non for Python integer
                    user-defined parameter with value 0
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: simark at simark dot ca
  Target Milestone: ---

$ cat test.py 
class MonParam(gdb.Parameter):
    def __init__(self):
        super().__init__("foo", gdb.COMMAND_NONE, gdb.PARAM_INTEGER)

p = MonParam()
$ ./gdb -nx -q --data-directory=data-directory -x test.py
(gdb) python print(gdb.parameter('foo'))
0
(gdb) set foo 1
(gdb) python print(gdb.parameter('foo'))
1
(gdb) set foo 0
(gdb) python print(gdb.parameter('foo'))
None

That last "None" is suspicious, should be 0.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug python/28820] gdb.parameter returns Non for Python integer user-defined parameter with value 0
  2022-01-25 15:06 [Bug python/28820] New: gdb.parameter returns Non for Python integer user-defined parameter with value 0 simark at simark dot ca
@ 2022-01-26 20:05 ` tromey at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at sourceware dot org @ 2022-01-26 20:05 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28820

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
This code seems to date from the earliest days:

    case var_integer:
      if (var.get<int> () == INT_MAX)
        Py_RETURN_NONE;
      /* Fall through.  */

Maybe the mystery is why the initial value is 0,
since 0 is supposed to mean "unlimited" here.

I tend to think all the Py_RETURN_NONEs here should
be removed somehow.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-26 20:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 15:06 [Bug python/28820] New: gdb.parameter returns Non for Python integer user-defined parameter with value 0 simark at simark dot ca
2022-01-26 20:05 ` [Bug python/28820] " tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).