Skip to content

Commit bf1dc18

Browse files
authored
attempt to use str() to get object name
lots of things possibly wrong with this - i don't know if this works on python2.7 - i don't know if this is a good fix - i don't know what this might break - i did not run it through any testsuite (does a testsuite exist? if it does, i am unaware) however, previously this ``` import ctypes import ctypes.wintypes from var_dump import var_dump foo = ctypes.wintypes.ULARGE_INTEGER(123) print(foo) var_dump(foo) ``` would produce ``` c_ulonglong(123) #0 object(c_ulonglong) (0) ``` and print() actually did a better job than var_dump() here, but now it produce: ``` c_ulonglong(123) #0 object(c_ulonglong(123)) (0) ``` doing at least as good a job as print :) this also fixes `ctypes.wintypes.HANDLE` which has the same problem as `ctypes.wintypes.ULARGE_INTEGER` this is an alternative to sha256#16 and fixes sha256#15
1 parent 14613f6 commit bf1dc18

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

var_dump/_var_dump.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ def display(o, space, num, key, typ, proret):
5858

5959
elif isinstance(o, object):
6060
st += "object(%s) (%s)"
61-
l.append(o.__class__.__name__)
61+
try:
62+
l.append(str(o))
63+
except:
64+
l.append(o.__class__.__name__)
6265
try:
6366
l.append(len(o.__dict__))
6467
except AttributeError:

0 commit comments

Comments
 (0)