Bug 19864 - Subclassing gdb.Value with additional arguments produces a Type Error
Summary: Subclassing gdb.Value with additional arguments produces a Type Error
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: 7.7
: P2 normal
Target Milestone: 12.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-24 20:31 UTC by m.lam
Modified: 2023-12-15 21:13 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Example script to reproduce issue (217 bytes, text/plain)
2016-03-24 20:31 UTC, m.lam
Details

Note You need to log in before you can comment on or make changes to this bug.
Description m.lam 2016-03-24 20:31:38 UTC
Created attachment 9128 [details]
Example script to reproduce issue

Overview
When subclassing gdb.Value in Python, adding additional arguments to the __init__() method causes a "TypeError: Value object creation takes only 1 argument."  This error is not a normal Python error, as it doesn't contain the information on the number of arguments passed to it.

Steps to reproduce
1.Run GDB

2.load a core file

3.run attatched python script "inheirTest.py" through command `source inheirTest.py"

4.error occurs

Actual Result
Traceback (most recent call last):
  File "inheirTest.py", line 16, in <module>
    main()
  File "inheirTest.py", line 13, in main
    testObj = testVal(symbol.value(curFrame), "bleh")
TypeError: Value object creation takes only 1 argument

Expected Result
The object will instantiate correctly, and behave like a gdb.Value object with one additional field called 'blah.'
Comment 1 Hannes Domani 2023-12-15 21:13:18 UTC
I didn't know that subclassing of gdb.Value was even allowed, but the provided example works for me without errors since at least gdb-12.1, so I'm going to close this.