Message218619
| Author |
ryder.lewis |
| Recipients |
ryder.lewis |
| Date |
2014年05月15日.17:50:18 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1400176218.84.0.180838501812.issue21512@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I'm not sure if this is a bug or expected behavior, but basically what I want to do is log the timestamp when an application exits. Sample script to illustrate the issue:
==== try.py ====
import time
class A():
def __init__(self):
print("Initializing A. The time is {}".format(time.time()))
def __del__(self):
if time is None:
print("time is None!")
else:
print("Deleting A. The time is {}".format(time.time()))
a = A()
raise SystemExit()
=====
When running this script multiple times, there are 3 possible outcomes:
==== outcome #1 (happens about 25% of my trial runs, what I would expect is correct behavior) ====
Initializing A. The time is 1400175810.4806361
Deleting A. The time is 1400175810.483156
==== outcome #2 (happens about 50% of my trial runs) ====
Initializing A. The time is 1400175814.1646852
time is None!
==== outcome #3 (happens about 25% of my trial runs) ====
Initializing A. The time is 1400175809.6802816
Exception ignored in: <bound method A.__del__ of <__main__.A object at 0x7fb125eab5f8>>
Traceback (most recent call last):
File "./try.py", line 12, in __del__
TypeError: 'NoneType' object is not callable |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年05月15日 17:50:18 | ryder.lewis | set | recipients:
+ ryder.lewis |
| 2014年05月15日 17:50:18 | ryder.lewis | set | messageid: <1400176218.84.0.180838501812.issue21512@psf.upfronthosting.co.za> |
| 2014年05月15日 17:50:18 | ryder.lewis | link | issue21512 messages |
| 2014年05月15日 17:50:18 | ryder.lewis | create |
|