Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
93d5ca75
Commit
93d5ca75
authored
Sep 21, 2007
by
Christian Theune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug 127182: Blobs weren't intended to be subclassable, now we're
actively preventing it.
parent
ac92c6ef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
NEWS.txt
NEWS.txt
+2
-0
src/ZODB/blob.py
src/ZODB/blob.py
+9
-3
src/ZODB/tests/blob_basic.txt
src/ZODB/tests/blob_basic.txt
+12
-0
No files found.
NEWS.txt
View file @
93d5ca75
...
@@ -79,6 +79,8 @@ Transactions
...
@@ -79,6 +79,8 @@ Transactions
Blobs
Blobs
-----
-----
- (3.8b4) Fixed bug #127182: Blobs were subclassable which was not desired.
- (3.8b3) Fixed bug #126007: tpc_abort had untested code path that was
- (3.8b3) Fixed bug #126007: tpc_abort had untested code path that was
broken.
broken.
...
...
src/ZODB/blob.py
View file @
93d5ca75
...
@@ -60,14 +60,20 @@ class Blob(persistent.Persistent):
...
@@ -60,14 +60,20 @@ class Blob(persistent.Persistent):
_p_blob_committed
=
None
# Filename of the committed data
_p_blob_committed
=
None
# Filename of the committed data
readers
=
writers
=
None
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
):
def
__setstate__
(
self
,
state
=
None
):
#
We use lists here because it will allow i
s to add and remove
#
we use lists here because it will allow u
s to add and remove
# atomically
# atomically
self
.
readers
=
[]
self
.
readers
=
[]
self
.
writers
=
[]
self
.
writers
=
[]
__init__
=
__setstate__
def
__getstate__
(
self
):
def
__getstate__
(
self
):
return
None
return
None
...
...
src/ZODB/tests/blob_basic.txt
View file @
93d5ca75
...
@@ -160,3 +160,15 @@ Some cleanup in this test is needed::
...
@@ -160,3 +160,15 @@ Some cleanup in this test is needed::
>>> import transaction
>>> import transaction
>>> transaction.get().abort()
>>> 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.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment