@@ -1171,6 +1171,10 @@ as internal buffering of data.
1171
1171
current position; :const: `SEEK_END ` or ``2 `` to set it relative to the end of
1172
1172
the file. Return the new cursor position in bytes, starting from the beginning.
1173
1173
1174
+ .. versionchanged :: 3.3
1175
+
1176
+ Add support for :const: `SEEK_HOLE ` and :const: `SEEK_DATA `.
1177
+
1174
1178
1175
1179
.. data :: SEEK_SET
1176
1180
SEEK_CUR
@@ -1179,9 +1183,30 @@ as internal buffering of data.
1179
1183
Parameters to the :func: `lseek ` function. Their values are 0, 1, and 2,
1180
1184
respectively.
1181
1185
1186
+
1187
+ .. data :: SEEK_HOLE
1188
+ SEEK_DATA
1189
+
1190
+ Parameters to the :func: `lseek ` function and the :meth: `~io.IOBase.seek `
1191
+ method on file objects, for seeking file data and holes on sparsely
1192
+ allocated files.
1193
+
1194
+ :data: `!SEEK_DATA `
1195
+ Adjust the file offset to the next location containing data,
1196
+ relative to the seek position.
1197
+
1198
+ :data: `!SEEK_HOLE `
1199
+ Adjust the file offset to the next location containing a hole,
1200
+ relative to the seek position.
1201
+ A hole is defined as a sequence of zeros.
1202
+
1203
+ .. note ::
1204
+
1205
+ These operations only make sense for filesystems that support them.
1206
+
1207
+ .. availability :: Linux >= 3.1, macOS, Unix
1208
+
1182
1209
.. versionadded :: 3.3
1183
- Some operating systems could support additional values, like
1184
- :const: `os.SEEK_HOLE ` or :const: `os.SEEK_DATA `.
1185
1210
1186
1211
1187
1212
.. function :: open(path, flags, mode=0o777, *, dir_fd=None)
0 commit comments