mirror of
https://github.com/python/cpython.git
synced 2025-12-10 02:50:09 +00:00
Added a new fileno() method. ZODB's repozo.py wants this so it can
apply os.fsync() to the GzipFile backup files it creates.
This commit is contained in:
parent
fe393f47c6
commit
5cfb05eef0
3 changed files with 22 additions and 2 deletions
|
|
@ -16,8 +16,16 @@ data2 = """/* zlibmodule.c -- gzip-compatible data compression */
|
|||
/* See http://www.winimage.com/zLibDll for Windows */
|
||||
"""
|
||||
|
||||
f = gzip.GzipFile(filename, 'wb') ; f.write(data1 * 50) ; f.close()
|
||||
f = gzip.GzipFile(filename, 'wb') ; f.write(data1 * 50)
|
||||
|
||||
# Try flush and fileno.
|
||||
f.flush()
|
||||
f.fileno()
|
||||
if hasattr(os, 'fsync'):
|
||||
os.fsync(f.fileno())
|
||||
f.close()
|
||||
|
||||
# Try reading.
|
||||
f = gzip.GzipFile(filename, 'r') ; d = f.read() ; f.close()
|
||||
verify(d == data1*50)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue