@@ -1061,6 +1061,10 @@ as internal buffering of data.
1061
1061
current position; :const: `SEEK_END ` or ``2 `` to set it relative to the end of
1062
1062
the file. Return the new cursor position in bytes, starting from the beginning.
1063
1063
1064
+ .. versionchanged :: 3.3
1065
+
1066
+ Add support for :const: `SEEK_HOLE ` and :const: `SEEK_DATA `.
1067
+
1064
1068
1065
1069
.. data :: SEEK_SET
1066
1070
SEEK_CUR
@@ -1069,9 +1073,30 @@ as internal buffering of data.
1069
1073
Parameters to the :func: `lseek ` function. Their values are 0, 1, and 2,
1070
1074
respectively.
1071
1075
1076
+
1077
+ .. data :: SEEK_HOLE
1078
+ SEEK_DATA
1079
+
1080
+ Parameters to the :func: `lseek ` function and the :meth: `~io.IOBase.seek `
1081
+ method on file objects, for seeking file data and holes on sparsely
1082
+ allocated files.
1083
+
1084
+ :data: `!SEEK_DATA `
1085
+ Adjust the file offset to the next location containing data,
1086
+ relative to the seek position.
1087
+
1088
+ :data: `!SEEK_HOLE `
1089
+ Adjust the file offset to the next location containing a hole,
1090
+ relative to the seek position.
1091
+ A hole is defined as a sequence of zeros.
1092
+
1093
+ .. note ::
1094
+
1095
+ These operations only make sense for filesystems that support them.
1096
+
1097
+ .. availability :: Linux >= 3.1, macOS, Unix
1098
+
1072
1099
.. versionadded :: 3.3
1073
- Some operating systems could support additional values, like
1074
- :const: `os.SEEK_HOLE ` or :const: `os.SEEK_DATA `.
1075
1100
1076
1101
1077
1102
.. function :: open(path, flags, mode=0o777, *, dir_fd=None)
0 commit comments