Message78315
| Author |
ggenellina |
| Recipients |
fabioz, ggenellina, pitrou |
| Date |
2008年12月26日.23:03:21 |
| SpamBayes Score |
1.5444041e-06 |
| Marked as misclassified |
No |
| Message-id |
<1230332603.03.0.910900048123.issue4716@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Yes, this is exactly the problem. The execution never goes beyond print
('here'); if you print frame.f_lineno you'll see it blocks at io.py
line 1036, waiting for a Lock for the second time.
So the trace function cannot use print, not write to regular files
(because io.py is written in Python). This is a severe limitation.
As a workaround, you can use the _fileio module (written in C):
import _fileio
f = _fileio._FileIO("output.txt", "w", True)
def tracing_func(frame, event, arg):
f.write('%s %s %d\n' % (frame.f_code.co_filename, frame.f_code.co_
name, frame.f_lineno))
return tracing_func
A possible fix would be to use an RLock instead of a Lock object, but
I haven't investigated it. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2008年12月26日 23:03:23 | ggenellina | set | recipients:
+ ggenellina, pitrou, fabioz |
| 2008年12月26日 23:03:23 | ggenellina | set | messageid: <1230332603.03.0.910900048123.issue4716@psf.upfronthosting.co.za> |
| 2008年12月26日 23:03:22 | ggenellina | link | issue4716 messages |
| 2008年12月26日 23:03:21 | ggenellina | create |
|