[Pydev-cvs] org.python.pydev.debug/pysrc pydevd.py,1.43,1.44
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2006-04-07 12:38:27
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12670/pysrc Modified Files: pydevd.py Log Message: Index: pydevd.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** pydevd.py 25 Feb 2006 02:10:11 -0000 1.43 --- pydevd.py 7 Apr 2006 12:38:20 -0000 1.44 *************** *** 11,14 **** --- 11,15 ---- PyDBCtx_threadToCtx = {} PyDBCtx_Lock = threading.RLock() + PyDBCtx_Threads = {}#weakref.WeakValueDictionary() def PyDBCtx_GetCtxs(): *************** *** 25,30 **** PyDBCtx_Lock.acquire() try: ! #we create a context for each thread threadId = id(currThread) ctxs = PyDBCtx_threadToCtx.get(threadId) if ctxs is None: --- 26,36 ---- PyDBCtx_Lock.acquire() try: ! #keep the last frame for each thread (previously we were keeping all the frames, in the context, ! #but that was a bad thing, as things in the frames did not die). threadId = id(currThread) + PyDBCtx_Threads[threadId] = weakref.ref(currThread) + currThread._lastFrame = frame + + #we create a context for each thread ctxs = PyDBCtx_threadToCtx.get(threadId) if ctxs is None: *************** *** 50,54 **** for ctx in PyDBCtx_GetCtxs(): if ctx.filename == f: ! ctx.frame.f_trace = g.trace_dispatch finally: PyDBCtx_Lock.release() --- 56,67 ---- for ctx in PyDBCtx_GetCtxs(): if ctx.filename == f: ! thread = PyDBCtx_Threads.get(ctx.thread_id)()#it is a weakref ! if thread is not None: ! frame = thread._lastFrame ! while frame: ! currFile = NormFile(frame.f_code.co_filename) ! if f == currFile: ! frame.f_trace = g.trace_dispatch ! frame = frame.f_back finally: PyDBCtx_Lock.release() *************** *** 61,70 **** self.filename = NormFile(frame.f_code.co_filename) self.base = os.path.basename( self.filename ) - self.frame = frame self.thread_id = threadId self.lock = threading.RLock() def __str__(self): ! return 'PyDBCtx [%s %s %s]' % (self.base, self.thread_id, self.frame) def acquire(self): --- 74,82 ---- self.filename = NormFile(frame.f_code.co_filename) self.base = os.path.basename( self.filename ) self.thread_id = threadId self.lock = threading.RLock() def __str__(self): ! return 'PyDBCtx [%s %s %s]' % (self.base, self.thread_id) def acquire(self): |