Skip to content

os.rst: Mark os.preadv and os.pwritev as available on Unix - #162381

Merged
cmaloney merged 3 commits into
python:mainfrom
maurycy:os-preadv-macos-avail
Nov 21, 2026
Merged

cmaloney merged 3 commits into
python:mainfrom
maurycy:os-preadv-macos-avail

Conversation

@maurycy

@maurycy maurycy commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

They're available:

# define HAVE_PWRITEV_RUNTIME __builtin_available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)

cpython/Modules/posixmodule.c

Lines 19110 to 19124 in e0d0f2e

#if defined(HAVE_PWRITEV)
if (HAVE_PWRITEV_RUNTIME) {} else {
PyObject* dct = PyModule_GetDict(m);
if (dct == NULL) {
return -1;
}
if (PyDict_PopString(dct, "pwritev", NULL) < 0) {
return -1;
}
if (PyDict_PopString(dct, "preadv", NULL) < 0) {
return -1;
}
}

https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/sys/uio.h#L275-L276

(macos(10.16) is macOS 11.0.)

[1] 2026-11-21T12:43:39.636910000+0100 maurycy@gimel /Users/maurycy/src/github.com/maurycy/cpython (main e0d0f2e?) % ./python.exe -c "
import os, tempfile
fd = os.open(tempfile.mkstemp()[1], os.O_RDWR)
print(os.pwritev(fd, [b'ab', b'cd'], 0))
b = bytearray(4)
print(os.preadv(fd, [b], 0), b)"
4
4 bytearray(b'abcd')

3.14, 3.15 backport

@read-the-docs-community

read-the-docs-community Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #36070678 | 📁 Comparing b7edd45 against main (91c4c6b)

  🔍 Preview build  

2 files changed
± library/os.html
± whatsnew/changelog.html

@aisk

aisk commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Current change looks good to me.

However, according to https://github.com/aosp-mirror/platform_bionic/blob/731631f300090436d7f5df80d50b6275c8c60a93/libc/include/sys/uio.h#L73-L74, Android also supports these two functions since API level 24. Since that is also CPython's minimum supported API level, maybe we can add Android here too.

@aisk aisk added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 21, 2026
@maurycy

maurycy commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

@aisk Thank you! bdab488 Left out the version, since since #125946 we always support 24. I've missed this, as I'm doing a macOS sweep but this is a great catch

@maurycy maurycy changed the title os.rst: List os.preadv and os.pwritev as available on macOS os.rst: List os.preadv and os.pwritev as available on Android, macOS Nov 21, 2026
Comment thread Doc/library/os.rst Resolved
Comment thread Doc/library/os.rst Resolved
@maurycy maurycy changed the title os.rst: List os.preadv and os.pwritev as available on Android, macOS os.rst: Mark os.preadv and os.pwritev as available on Unix Nov 21, 2026
@cmaloney
cmaloney merged commit 639c34b into python:main Nov 21, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Nov 21, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @maurycy for the PR, and @cmaloney for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Nov 21, 2026

Copy link
Copy Markdown

GH-162403 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 21, 2026
@bedevere-app

bedevere-app Bot commented Nov 21, 2026

Copy link
Copy Markdown

GH-162404 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 21, 2026
@maurycy
maurycy deleted the os-preadv-macos-avail branch November 21, 2026 21:14
cmaloney pushed a commit that referenced this pull request Nov 22, 2026
…ix (GH-162381) (#162404)

`os.rst`: Mark `os.preadv` and `os.pwritev` as available on Unix (GH-162381)
(cherry picked from commit 639c34b)

Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
cmaloney pushed a commit that referenced this pull request Nov 22, 2026
…ix (GH-162381) (#162403)

`os.rst`: Mark `os.preadv` and `os.pwritev` as available on Unix (GH-162381)
(cherry picked from commit 639c34b)

Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip issue skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants