Commit 9f07143c authored by Christian Theune's avatar Christian Theune

Fixed bug 127182: Blobs were not intended to be subclasses, now we're actively

preventing it.
parent 2db52418
......@@ -28,6 +28,8 @@ Transactions
Blobs
-----
- (3.9.0a1) Fixed bug #127182: Blobs were subclassable which was not desired.
- (3.9.0a1) Fixed bug #126007: tpc_abort had untested code path that was
broken.
......
......@@ -60,14 +60,20 @@ class Blob(persistent.Persistent):
_p_blob_committed = None # Filename of the committed data
readers = writers = None
def __init__(self):
# Raise exception if Blobs are getting subclassed
# refer to ZODB-Bug No.127182 by Jim Fulton on 2007-07-20
if (self.__class__ is not Blob):
raise TypeError('Blobs do not support subclassing.')
self.__setstate__()
def __setstate__(self, state=None):
# We use lists here because it will allow is to add and remove
# we use lists here because it will allow us to add and remove
# atomically
self.readers = []
self.writers = []
__init__ = __setstate__
def __getstate__(self):
return None
......
......@@ -160,3 +160,16 @@ Some cleanup in this test is needed::
>>> import transaction
>>> transaction.get().abort()
Subclassing Blobs
-----------------
Blobs are not subclassable::
>>> class SubBlob(Blob):
... pass
>>> my_sub_blob = SubBlob()
Traceback (most recent call last):
...
TypeError: Blobs do not support subclassing.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment