public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/29245] New: [gdb/testsuite, python2] FAIL: gdb.python/py-mi-cmd.exp: -pycmd bk3 (unexpected output)
@ 2022-06-11 16:05 vries at gcc dot gnu.org
  2022-06-11 16:20 ` [Bug python/29245] " vries at gcc dot gnu.org
  2022-06-13 16:14 ` vries at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2022-06-11 16:05 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29245
           Summary: [gdb/testsuite, python2] FAIL:
                    gdb.python/py-mi-cmd.exp: -pycmd bk3 (unexpected
                    output)
           Product: gdb
           Version: 12.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

For a gdb build with python 2, I run into:
...
Expecting: ^(-pycmd bk3[^M
]+)?(&"TypeError: __repr__ returned non-string \(type BadKey\).."^M
\^error,msg="Error occurred in Python: __repr__ returned non-string \(type
BadKey\)"[^M
]+[(]gdb[)] ^M
[ ]*)
-pycmd bk3^M
&"TypeError: __repr__ returned non-string (type instance)\n"^M
^error,msg="Error occurred in Python: __repr__ returned non-string (type
instance)"^M
(gdb) ^M
...

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

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

* [Bug python/29245] [gdb/testsuite, python2] FAIL: gdb.python/py-mi-cmd.exp: -pycmd bk3 (unexpected output)
  2022-06-11 16:05 [Bug python/29245] New: [gdb/testsuite, python2] FAIL: gdb.python/py-mi-cmd.exp: -pycmd bk3 (unexpected output) vries at gcc dot gnu.org
@ 2022-06-11 16:20 ` vries at gcc dot gnu.org
  2022-06-13 16:14 ` vries at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2022-06-11 16:20 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Using a standalone reproducer:
...
$ cat test.py
class BadKey:
    def __repr__(self):
        return "Bad Key"


class ReallyBadKey:
    def __repr__(self):
        return BadKey()

a = {"result": {ReallyBadKey(): "world"}}

print (a)
...
we can see the behaviour with python3:
...
$ python3 test.py
Traceback (most recent call last):
  File "test.py", line 12, in <module>
    print (a)
TypeError: __repr__ returned non-string (type BadKey)
...
and python2:
...
$ python2 test.py
{'result': {Traceback (most recent call last):
  File "test.py", line 12, in <module>
    print (a)
TypeError: __repr__ returned non-string (type instance)
...

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

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

* [Bug python/29245] [gdb/testsuite, python2] FAIL: gdb.python/py-mi-cmd.exp: -pycmd bk3 (unexpected output)
  2022-06-11 16:05 [Bug python/29245] New: [gdb/testsuite, python2] FAIL: gdb.python/py-mi-cmd.exp: -pycmd bk3 (unexpected output) vries at gcc dot gnu.org
  2022-06-11 16:20 ` [Bug python/29245] " vries at gcc dot gnu.org
@ 2022-06-13 16:14 ` vries at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2022-06-13 16:14 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
This fixes it:
...
diff --git a/gdb/testsuite/gdb.python/py-mi-cmd.exp
b/gdb/testsuite/gdb.python/py-mi-cmd.ex
p
index 300ab956892..5e4b6cd076e 100644
--- a/gdb/testsuite/gdb.python/py-mi-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-mi-cmd.exp
@@ -68,8 +68,8 @@ mi_gdb_test "-pycmd bk2" \

 mi_gdb_test "-pycmd bk3" \
     [multi_line \
-        "&\"TypeError: __repr__ returned non-string \\(type BadKey\\)..\"" \
-        "\\^error,msg=\"Error occurred in Python: __repr__ returned non-string
\\(type BadKey
\\)\""] \
+        "&\"TypeError: __repr__ returned non-string \\(type
(BadKey|instance)\\)..\"" \
+        "\\^error,msg=\"Error occurred in Python: __repr__ returned non-string
\\(type (B
adKey|instance)\\)\""] \
     "-pycmd bk3"

 mi_gdb_test "-pycmd tpl" \
...

I don't see a pressing need to fix this on the gdb-12-branch, so I'm closing
this as resolved-wontfix.

Anybody running into this with gdb 12.x and finding it annoying can use the
patch posted in this comment.

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

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

end of thread, other threads:[~2022-06-13 16:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11 16:05 [Bug python/29245] New: [gdb/testsuite, python2] FAIL: gdb.python/py-mi-cmd.exp: -pycmd bk3 (unexpected output) vries at gcc dot gnu.org
2022-06-11 16:20 ` [Bug python/29245] " vries at gcc dot gnu.org
2022-06-13 16:14 ` vries at gcc dot gnu.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).