public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/15978] New: support weakref for all python classes
@ 2013-09-24 20:37 b.r.longbons at gmail dot com
  2013-09-24 23:20 ` [Bug python/15978] " naesten at gmail dot com
  2022-06-07 21:26 ` tromey at sourceware dot org
  0 siblings, 2 replies; 3+ messages in thread
From: b.r.longbons at gmail dot com @ 2013-09-24 20:37 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 15978
           Summary: support weakref for all python classes
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: b.r.longbons at gmail dot com

IWBN if all of gdb's classes allowed weak references, via python's weakref
module. This provides a much better lifetime model than events.

Most python objects (that have __dict__) automatically support weakref. If a
classes uses __slots__, it must include '__weakref__'. I have no clue how to
implement this for classes created in C though.

test code for a -gdb.py file is:

import gdb
import weakref
print(weakref.ref(gdb.current_objfile()))

-- 
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/15978] support weakref for all python classes
  2013-09-24 20:37 [Bug python/15978] New: support weakref for all python classes b.r.longbons at gmail dot com
@ 2013-09-24 23:20 ` naesten at gmail dot com
  2022-06-07 21:26 ` tromey at sourceware dot org
  1 sibling, 0 replies; 3+ messages in thread
From: naesten at gmail dot com @ 2013-09-24 23:20 UTC (permalink / raw)
  To: gdb-prs

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

Samuel Bronson <naesten at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |naesten at gmail dot com

--- Comment #1 from Samuel Bronson <naesten at gmail dot com> ---
I have a clue:
http://docs.python.org/2/extending/newtypes.html#weak-reference-support

-- 
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/15978] support weakref for all python classes
  2013-09-24 20:37 [Bug python/15978] New: support weakref for all python classes b.r.longbons at gmail dot com
  2013-09-24 23:20 ` [Bug python/15978] " naesten at gmail dot com
@ 2022-06-07 21:26 ` tromey at sourceware dot org
  1 sibling, 0 replies; 3+ messages in thread
From: tromey at sourceware dot org @ 2022-06-07 21:26 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

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

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Supporting weakref seems fine & pretty easy.
I wish there was some idiom for supporting the common gdb situation
where there is a Python wrapper for some underlying object that
has its own independent lifetime.

-- 
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-07 21:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-24 20:37 [Bug python/15978] New: support weakref for all python classes b.r.longbons at gmail dot com
2013-09-24 23:20 ` [Bug python/15978] " naesten at gmail dot com
2022-06-07 21:26 ` 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).