Message136948
> We can use a class attribute to set the attribute before calling __init__
Ah, yes, I thought about adding a class attribute as well, but the class currently does not have any and initializes instance attributes to default values in __init__, so I chose getattr.
> How can this be tested? According to the initial report, exceptions raised in __del__ seem to be ignored.
Exceptions raised in __del__ are printed to sys.stderr, even if it has been reassigned by Python code:
>>> import sys, io, subprocess
>>> sys.stderr = io.StringIO()
>>> subprocess.Popen(fdsa=1)
>>> sys.stderr.getvalue()
'Exception AttributeError: "\'Popen\' object has no attribute \'_child_created\'" in <bound method Popen.__del__ of <subprocess.Popen object at 0x1006ee710>> ignored\nTraceback (most recent call last):\n File "<stdin>", line 1, in <module>\nTypeError: __init__() got an unexpected keyword argument \'fdsa\'\n'
test_generators.py already uses this trick in a test similar to what would be needed for this issue around line 1856.
Should I attempt to modify my patch to include a comment and a test? |
|
Date |
User |
Action |
Args |
2011-05-26 12:00:02 | chortos | set | recipients:
+ chortos, vstinner, petri.lehtinen |
2011-05-26 12:00:02 | chortos | set | messageid: <1306411202.07.0.610064018463.issue12085@psf.upfronthosting.co.za> |
2011-05-26 12:00:01 | chortos | link | issue12085 messages |
2011-05-26 12:00:01 | chortos | create | |
|