On Nov 23, 2007 11:10 PM, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Guido van Rossum wrote:
> >
> > Index: Objects/funcobject.c
> > ===================================================================
> > --- Objects/funcobject.c        (revision 59154)
> > +++ Objects/funcobject.c        (working copy)
> > @@ -643,8 +643,10 @@
> >  static PyObject *
> >  func_descr_get(PyObject *func, PyObject *obj, PyObject *type)
> >  {
> > -       if (obj == Py_None)
> > -               obj = NULL;
> > +       if (obj == Py_None || obj == NULL) {
> > +               Py_INCREF(func);
> > +               return func;
> > +       }
> >         return PyMethod_New(func, obj, type);
> >  }
> >
> > [well, except those should be tabs not spaces]
>
> I've created a preliminary patch. Several unit tests are still failing.

Thanks for the patch! Now I'm hoping someone will look into those
remaining six test failures.

Also, there was discussion of this before:
http://mail.python.org/pipermail/python-dev/2005-January/050625.html
-- why didn't we decide to do it then?

> The patch is also changing some semantics. For example in Python 2.5:
>
> >>> import inspect
> >>> class Class(object):
> ...     def method(self): pass
> ...
> >>> inspect.ismethod(Class().method)
> True
> >>> inspect.ismethod(Class.method)
> True
>
> But in py3k:
>
> >>> import inspect
> >>> class Class:
> ...     def method(self): pass
> ...
> >>> inspect.ismethod(Class().method)
> True
> >>> inspect.ismethod(Class.method)
> False # !!!

As it should be.


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to