Issue730082

classification
Title: manually creating unbound methods
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: cgroves, fwierzbicki
Priority: high Keywords:

Created on 2003-04-30.08:34:29 by anonymous, last changed 2006-09-12.03:31:22 by cgroves.

Files
File name Uploaded Description Edit Remove
PyMethod.diff nobody, 2003-04-30.08:34:29 patch against PyMethod.java to fix the bug
Messages
msg828 (view) Author: Nobody/Anonymous (nobody) Date: 2003-04-30.08:34:29
The the new module can be used to create unbound mothod
objects, but this doesn't work with the current jython
implementations.

import new
class C: pass
def a(self): pass
C.a = new.instancemethod( a, None, C )
print str( C.a )

prints

  <method C.null of org.python.core.PyNone instance at
32058896>

expected output (cpython) 

  <unbound method C.a>

The problem is a missing check for Py.None, either in
org.python.modules.newmodule or in
org.python.core.PyMethod
I consider org.python.core.PyMethod the right place,
because
None may never have any instance methods.

Attached is a patch against the current CVS version of 
org.python.core.PyMethod.

Many thanks for jython.
  Anselm Kruis

A.Kruis@science-computing.de

msg829 (view) Author: Charlie Groves (cgroves) Date: 2006-09-12.03:31:22
Logged In: YES 
user_id=1174327

Patch applied in r2932.
History
Date User Action Args
2003-04-30 08:34:29anonymouscreate