[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2009-05-13 Thread Daniel Diniz
Daniel Diniz added the comment: This now works correctly (returns False) in release26-maint, trunk and py3k. -- nosy: +ajaksu2 resolution: -> out of date stage: -> committed/rejected status: open -> closed ___ Python tracker

[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2008-06-30 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: I think the best is to ignore __instancecheck__ when "cls.__instancecheck__" is returned as an unbound method. In this case, we try "type(cls).__instancecheck__" instead. Here is a patch along this idea. I had to disable a test named "E

[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2008-06-29 Thread Jeffrey Yasskin
Jeffrey Yasskin <[EMAIL PROTECTED]> added the comment: I don't think so. It wouldn't be a bug if I wrote: >>> class Meta(type): ... def __instancecheck__(self, other): ... return True >>> isinstance(3, Meta) ... False but it is a bug that the isinstance call raises an exception. If recent

[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2008-06-29 Thread Benjamin Peterson
Changes by Benjamin Peterson <[EMAIL PROTECTED]>: -- resolution: -> invalid status: open -> closed ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2008-06-29 Thread Matias Gonzalez
Matias Gonzalez <[EMAIL PROTECTED]> added the comment: Yes, it should be. I don't have permissions to. ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2008-06-29 Thread Rafael Zanella
Rafael Zanella <[EMAIL PROTECTED]> added the comment: So..., could this issue be closed ? -- nosy: +zanella ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2008-06-21 Thread Matias Gonzalez
Matias Gonzalez <[EMAIL PROTECTED]> added the comment: This is not a bug. Function __instancecheck__ should be a classmethod. >>> class Meta(type): ... @classmethod ... def __instancecheck__(self, other): ... return False ... >>> isinstance(3, Meta) False -- nosy: +

[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2008-05-02 Thread Pedro Werneck
Pedro Werneck <[EMAIL PROTECTED]> added the comment: Seems like that's the wrong usage and the PEP 3119 notices that it's hard to get the right semantics. To use it that way you need to define the methods as a classmethod(). http://www.python.org/dev/peps/pep-3119/#one-trick-ponies

[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2008-05-02 Thread Pedro Werneck
Changes by Pedro Werneck <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file10174/issue2325.patch __ Tracker <[EMAIL PROTECTED]> __ ___ Pytho

[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2008-05-02 Thread Pedro Werneck
Pedro Werneck <[EMAIL PROTECTED]> added the comment: In 3.0 it happens with any class. Just the cls argument missing on the call to instancecheck. -- keywords: +patch nosy: +werneck Added file: http://bugs.python.org/file10174/issue2325.patch __ Tracker <

[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2008-03-17 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin <[EMAIL PROTECTED]>: >>> class Meta(type): ... def __instancecheck__(self, other): ... return False >>> isinstance(3, Meta) In 2.6, this results in: Traceback (most recent call last): File "", line 1, in RuntimeError: maximum recursion depth exceeded