Commit 2ae41705 authored by Tres Seaver's avatar Tres Seaver

Better straddling Py2/Py3 for 'FilePool.flush'.

Incididentally, should make the Py26 winbot happy too, until we can get
it disabled.
parent 9a393efc
...@@ -20,13 +20,13 @@ import contextlib ...@@ -20,13 +20,13 @@ import contextlib
import errno import errno
import logging import logging
import os import os
import sys
import threading import threading
import time import time
from struct import pack from struct import pack
from struct import unpack from struct import unpack
from persistent.TimeStamp import TimeStamp from persistent.TimeStamp import TimeStamp
from six import PY3
from six import string_types as STRING_TYPES from six import string_types as STRING_TYPES
from zc.lockfile import LockFile from zc.lockfile import LockFile
from zope.interface import alsoProvides from zope.interface import alsoProvides
...@@ -2103,14 +2103,12 @@ class FilePool: ...@@ -2103,14 +2103,12 @@ class FilePool:
This is required if they contain data of rolled back transactions. This is required if they contain data of rolled back transactions.
""" """
with self.write_lock(): with self.write_lock():
for f in self._files: if PY3:
f.flush() # Unfortunately, Python 3.x has no API to flush read buffers.
# Unfortunately, Python 3.x has no API to flush read buffers.
if sys.version_info.major > 2:
def flush(self):
with self.write_lock():
self.empty() self.empty()
else:
for f in self._files:
f.flush()
def close(self): def close(self):
with self._cond: with self._cond:
......
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