Author chortos
Recipients chortos, petri.lehtinen, vstinner
Date 2011-05-26.12:00:01
SpamBayes Score 1.90426e-11
Marked as misclassified No
Message-id <1306411202.07.0.610064018463.issue12085@psf.upfronthosting.co.za>
In-reply-to
Content
> 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?
History
Date User Action Args
2011-05-26 12:00:02chortossetrecipients: + chortos, vstinner, petri.lehtinen
2011-05-26 12:00:02chortossetmessageid: <1306411202.07.0.610064018463.issue12085@psf.upfronthosting.co.za>
2011-05-26 12:00:01chortoslinkissue12085 messages
2011-05-26 12:00:01chortoscreate