Fix Xmethod for shared_ptr::use_count()
diff mbox series

Message ID 20190911113914.GA31206@redhat.com
State New
Headers show
Series
  • Fix Xmethod for shared_ptr::use_count()
Related show

Commit Message

Jonathan Wakely Sept. 11, 2019, 11:39 a.m. UTC
This was reported in https://bugzilla.redhat.com/show_bug.cgi?id=1749578

	* python/libstdcxx/v6/xmethods.py (SharedPtrUseCountWorker.__call__):
	Fix syntax error.

Tested x86_64-linux (although I can't get tests for the use_count() or
unique() Xmethods to actually work ...)

Committed to trunk. I'll backport it too.
commit 0f5caaa9b5fedebc6117cae5f3bc57c5cb3448d8
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Sep 11 11:38:23 2019 +0000

    Fix Xmethod for shared_ptr::use_count()
    
    This was reported in https://bugzilla.redhat.com/show_bug.cgi?id=1749578
    
            * python/libstdcxx/v6/xmethods.py (SharedPtrUseCountWorker.__call__):
            Fix syntax error.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@275644 138bc75d-0d04-0410-961f-82ee72b054a4

Patch
diff mbox series

diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
index 623cb80bc0e..a720a63fa1a 100644
--- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py
+++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
@@ -739,7 +739,7 @@  class SharedPtrUseCountWorker(gdb.xmethod.XMethodWorker):
         return gdb.lookup_type('long')
 
     def __call__(self, obj):
-        refcounts = ['_M_refcount']['_M_pi']
+        refcounts = obj['_M_refcount']['_M_pi']
         return refcounts['_M_use_count'] if refcounts else 0
 
 class SharedPtrUniqueWorker(SharedPtrUseCountWorker):