This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jasontiller
Recipients georg.brandl, jasontiller
Date 2009-07-18.08:23:40
SpamBayes Score 7.272516e-13
Marked as misclassified No
Message-id <1247905423.14.0.152000712905.issue6513@psf.upfronthosting.co.za>
In-reply-to
Content
The example provided in section 28.5.4 (warnings) of the Standard
Library documentation fails.  This example assumes that the context
manager instance ('w' in "warnings.catch_warnings(record=True) as w")
supplies a list of objects, each of which has a data attribute
'.category' that is an instance.  However, the '.category' data
attribute is actually a class.

The example code fails in this way on 2.6.2:

-----
Traceback (most recent call last):
  File "bob.py", line 14, in <module>
    assert isinstance(w[-1].category, DeprecationWarning)
AssertionError
-----

Replacing 'isinstance' with 'issubclass' appears to satisfy the assertion.
History
Date User Action Args
2009-07-18 08:23:44jasontillersetrecipients: + jasontiller, georg.brandl
2009-07-18 08:23:43jasontillersetmessageid: <1247905423.14.0.152000712905.issue6513@psf.upfronthosting.co.za>
2009-07-18 08:23:41jasontillerlinkissue6513 messages
2009-07-18 08:23:40jasontillercreate