Commit da718a07 authored by Tim Peters's avatar Tim Peters

Putative fix for Collector 1912.

File._read_data():  This uses savepoints just to get oids assigned
and to free memory, with no possibility of rollback.  Therefore
"optimistic" savepoints should be used:  there's no reason here to
insist that any data managers involved support rollback.
parent a21ac356
...@@ -219,7 +219,7 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -219,7 +219,7 @@ class File(Persistent, Implicit, PropertyManager,
return True return True
ranges = HTTPRangeSupport.expandRanges(ranges, self.size) ranges = HTTPRangeSupport.expandRanges(ranges, self.size)
if len(ranges) == 1: if len(ranges) == 1:
# Easy case, set extra header and return partial set. # Easy case, set extra header and return partial set.
start, end = ranges[0] start, end = ranges[0]
...@@ -402,10 +402,10 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -402,10 +402,10 @@ class File(Persistent, Implicit, PropertyManager,
return result return result
self.ZCacheable_set(None) self.ZCacheable_set(None)
data=self.data data=self.data
if type(data) is type(''): if type(data) is type(''):
RESPONSE.setBase(None) RESPONSE.setBase(None)
return data return data
while data is not None: while data is not None:
...@@ -516,7 +516,7 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -516,7 +516,7 @@ class File(Persistent, Implicit, PropertyManager,
# Make sure we have an _p_jar, even if we are a new object, by # Make sure we have an _p_jar, even if we are a new object, by
# doing a sub-transaction commit. # doing a sub-transaction commit.
transaction.savepoint() transaction.savepoint(optimistic=True)
if self._p_jar is None: if self._p_jar is None:
# Ugh # Ugh
...@@ -533,7 +533,7 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -533,7 +533,7 @@ class File(Persistent, Implicit, PropertyManager,
if pos < n: if pos < n:
pos = 0 # we always want at least n bytes pos = 0 # we always want at least n bytes
seek(pos) seek(pos)
# Create the object and assign it a next pointer # Create the object and assign it a next pointer
# in the same transaction, so that there is only # in the same transaction, so that there is only
# a single database update for it. # a single database update for it.
...@@ -542,7 +542,7 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -542,7 +542,7 @@ class File(Persistent, Implicit, PropertyManager,
data.next = next data.next = next
# Save the object so that we can release its memory. # Save the object so that we can release its memory.
transaction.savepoint() transaction.savepoint(optimistic=True)
data._p_deactivate() data._p_deactivate()
# The object should be assigned an oid and be a ghost. # The object should be assigned an oid and be a ghost.
assert data._p_oid is not None assert data._p_oid is not None
......
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