[issue1493] Patch to remove unbound methods

2007-11-25 Thread Guido van Rossum

Guido van Rossum added the comment:

On Nov 24, 2007 11:37 AM, Christian Heimes [EMAIL PROTECTED] wrote:
 Do you still believe in the tooth fairy, too? :p

Yes, and in the Easter Bunny, Santa Claus, and Sinterklaas. But in
this particular case I believe in Kaboutertjes. (Dutch gnomes.) And it
turns out I was right. :-)

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1493
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1493] Patch to remove unbound methods

2007-11-24 Thread Guido van Rossum

Guido van Rossum added the comment:

I'm waiting for those failing tests to magically start passing. :-)

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1493
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1493] Patch to remove unbound methods

2007-11-24 Thread Christian Heimes

Christian Heimes added the comment:

Do you still believe in the tooth fairy, too? :p

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1493
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1493] Patch to remove unbound methods

2007-11-24 Thread Georg Brandl

Georg Brandl added the comment:

Okay, got test_descr too -- the problem was introduced by the patch
itself :)

Added file: http://bugs.python.org/file8802/py3k_remove_unbound_4.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1493
__

py3k_remove_unbound_4.patch
Description: Binary data
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1493] Patch to remove unbound methods

2007-11-24 Thread Georg Brandl

Changes by Georg Brandl:


Removed file: http://bugs.python.org/file8800/py3k_remove_unbound_2.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1493
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1493] Patch to remove unbound methods

2007-11-24 Thread Georg Brandl

Changes by Georg Brandl:


Removed file: http://bugs.python.org/file8801/py3k_remove_unbound_3.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1493
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1493] Patch to remove unbound methods

2007-11-24 Thread Georg Brandl

Georg Brandl added the comment:

I think it is correct -- normally the __get__ call gets a second
argument of C.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1493
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1493] Patch to remove unbound methods

2007-11-23 Thread Christian Heimes

New submission from Christian Heimes:

Here is a first patch to remove unbound method objects.

6 tests failed:
test_descr test_inspect test_pyclbr test_typechecks test_unittest
test_weakref

--
assignee: gvanrossum
components: Interpreter Core
files: py3k_remove_unbound.patch
keywords: patch, py3k
messages: 57798
nosy: gvanrossum, tiran
priority: high
severity: normal
status: open
title: Patch to remove unbound methods
type: rfe
versions: Python 3.0
Added file: http://bugs.python.org/file8799/py3k_remove_unbound.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1493
__Index: Objects/funcobject.c
===
--- Objects/funcobject.c	(Revision 59163)
+++ Objects/funcobject.c	(Arbeitskopie)
@@ -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);
 }
 
Index: Lib/DocXMLRPCServer.py
===
--- Lib/DocXMLRPCServer.py	(Revision 59163)
+++ Lib/DocXMLRPCServer.py	(Arbeitskopie)
@@ -74,7 +74,7 @@
 title = 'a name=%sstrong%s/strong/a' % (anchor, name)
 
 if inspect.ismethod(object):
-args, varargs, varkw, defaults = inspect.getargspec(object.im_func)
+args, varargs, varkw, defaults = inspect.getargspec(object)
 # exclude the argument bound to the instance, it will be
 # confusing to the non-Python user
 argspec = inspect.formatargspec (
Index: Lib/test/test_extcall.py
===
--- Lib/test/test_extcall.py	(Revision 59163)
+++ Lib/test/test_extcall.py	(Arbeitskopie)
@@ -231,18 +231,8 @@
 x = Foo()
 print(Foo.method(*(x, 1, 2)))
 print(Foo.method(x, *(1, 2)))
-try:
-print(Foo.method(*(1, 2, 3)))
-except TypeError as err:
-pass
-else:
-print('expected a TypeError for unbound method call')
-try:
-print(Foo.method(1, *(2, 3)))
-except TypeError as err:
-pass
-else:
-print('expected a TypeError for unbound method call')
+print(Foo.method(*(1, 2, 3)))
+print(Foo.method(1, *(2, 3)))
 
 # A PyCFunction that takes only positional parameters should allow an
 # empty keyword dictionary to pass without a complaint, but raise a
Index: Lib/test/test_repr.py
===
--- Lib/test/test_repr.py	(Revision 59163)
+++ Lib/test/test_repr.py	(Arbeitskopie)
@@ -280,8 +280,8 @@
 ''')
 from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import qux
 # Unbound methods first
-eq(repr(qux..amethod),
-'unbound method .amethod')
+self.failUnless(repr(qux..amethod).startswith(
+'function amethod'))
 # Bound method next
 iqux = qux.()
 self.failUnless(repr(iqux.amethod).startswith(
Index: Lib/test/test_descrtut.py
===
--- Lib/test/test_descrtut.py	(Revision 59163)
+++ Lib/test/test_descrtut.py	(Arbeitskopie)
@@ -444,9 +444,7 @@
 ... B.foo(self)
 
  C().foo()
-Traceback (most recent call last):
- ...
-TypeError: unbound method foo() must be called with B instance as first argument (got C instance instead)
+called A.foo()
 
  class C(A):
 ... def foo(self):
Index: Lib/test/test_descr.py
===
--- Lib/test/test_descr.py	(Revision 59163)
+++ Lib/test/test_descr.py	(Arbeitskopie)
@@ -280,12 +280,12 @@
 
 c = C()
 vereq(interesting(dir(c)), cstuff)
-verify('im_self' in dir(C.Cmethod))
+#verify('im_self' in dir(C.Cmethod))
 
 c.cdata = 2
 c.cmethod = lambda self: 0
 vereq(interesting(dir(c)), cstuff + ['cdata', 'cmethod'])
-verify('im_self' in dir(c.Cmethod))
+#verify('im_self' in dir(c.Cmethod))
 
 class A(C):
 Adata = 1
@@ -293,13