[Python-bugs-list] [ python-Bugs-736892 ] forcing function to act like an unbound method dumps core

SourceForge.net noreply@sourceforge.net
Tue, 13 May 2003 00:57:16 -0700


Bugs item #736892, was opened at 2003-05-13 00:57
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=736892&group_id=5470

Category: Python Interpreter Core
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Paul Du Bois (df-dubois)
Assigned to: Nobody/Anonymous (nobody)
Summary: forcing function to act like an unbound method dumps core

Initial Comment:
Using ActivePython, v2.2.2

I was reading PEP252 and trying stupid things, like this:

k [ 0:51] python
ActivePython 2.2.2 Build 224 (ActiveState Corp.) based 
on
Python 2.2.2 (#37, Nov 26 2002, 10:24:37) [MSC 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more 
information.
>>> def func(): pass
...
>>> f = func.__get__()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: function takes at least 1 argument (0 given)
>>> f = func.__get__(None)
>>> f()    # This gives a reasonable result
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: unbound method func() must be called with ? 
instance as first argument (got nothing instead)
>>> f(1)    # This crashes accessing a null pointer

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=736892&group_id=5470