Issue409930

classification
Title: __bases__ should not be immutable
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: bckfnn Nosy List: bckfnn, bzimmer
Priority: normal Keywords: test failure causes

Created on 2001-03-20.04:17:20 by bzimmer, last changed 2001-04-25.18:40:03 by bckfnn.

Messages
msg290 (view) Author: Brian Zimmer (bzimmer) Date: 2001-03-20.04:17:20
Jython differs from CPython in that it does not allow
the attribute __bases__ to be mutable.  The method
__setattr__ in PyClass.java explicitly checks for
__bases__ and throws a TypeError.

The example is contrived, but demonstrates the point:

D:\home\development\src\sourceforge\zxJDBC>python
ActivePython 2.0, build 202 (ActiveState Tool Corp.)
based on Python 2.0 (#8, Oct 19 2000, 11:30:05) [MSC 32
bit (Intel)] on win32
Type "copyright", "credits" or "license" for more
information.
>>> from UserList import UserList
>>> from UserDict import UserDict
>>> UserList.__bases__
()
>>> UserList.__bases__ += (UserDict,)
>>> UserList.__bases__
(<class UserDict.UserDict at 007D99CC>,)
>>> ^Z


D:\home\development\src\sourceforge\zxJDBC>jython
Jython 2.1a1 on java1.3.0 (JIT: null)
Type "copyright", "credits" or "license" for more
information.
>>> from UserList import UserList
>>> from UserDict import UserDict
>>> UserList.__bases__
()
>>> UserList.__bases__ += (UserDict,)
Traceback (innermost last):
  File "<console>", line 1, in ?
TypeError: read-only special attribute: __bases__
>>>

Also, refer to the article:

http://noframes.linuxjournal.com/lj-issues/issue84/4540.html
msg291 (view) Author: Finn Bock (bckfnn) Date: 2001-04-25.18:40:03
Logged In: YES 
user_id=4201

Fixed PyClass.java: 2.24;
History
Date User Action Args
2001-03-20 04:17:20bzimmercreate