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 twouters
Recipients twouters
Date 2011-03-11.19:22:05
SpamBayes Score 1.7208457e-15
Marked as misclassified No
Message-id <1299871329.74.0.464645573136.issue11470@psf.upfronthosting.co.za>
In-reply-to
Content
As discussed at the language summit at PyCon 2011, some code takes some liberties with setting class attributes to callable objects, like CFunctions, that (C)Python does not turn into methods. This is problematic because 1) CPython can't then turn that CFunction into a regular function, and 2) other implementations have to specialcase the builtins to emulate the behaviour.

This patch adds a warning when a non-descriptor, non-class callable attribute is accessed in a context that would have fired the descriptor. It also fixes a bunch of these warnings that show up when running the testsuite. Some of these warnings are obviously (to me) incorrect code  -- like the io testsuite, which uses staticmethod around pyio.open but not io.open, or the encoding classes that use an encode function from an extension module as a class attribute. Some of the warnings are debatable, but have an obvious fix (wrap in staticmethod.) Some could be considered false-positives because they actually use (what amounts to) a a bound instance method as a class attribute (for example, re.compile('...').match.)

The patch is still a work in progress, I'm just uploading to start the discussion sooner rather than later.
History
Date User Action Args
2011-03-11 19:22:11twouterssetrecipients: + twouters
2011-03-11 19:22:09twouterssetmessageid: <1299871329.74.0.464645573136.issue11470@psf.upfronthosting.co.za>
2011-03-11 19:22:07twouterslinkissue11470 messages
2011-03-11 19:22:07twouterscreate