diff options
author | Victor Stinner <vstinner@python.org> | 2023-10-20 17:29:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-20 17:29:27 (GMT) |
commit | d8f32be5b6a736dc2fc9dca3f1bf176c82fc9b44 (patch) | |
tree | 371af41d6ec06a2d00f17212d1047d2b026ec9d3 /Modules/_multiprocessing/posixshmem.c | |
parent | 264f4af506bf5b587105eab37fcfb7dfa62d6587 (diff) | |
download | cpython-d8f32be5b6a736dc2fc9dca3f1bf176c82fc9b44.zip cpython-d8f32be5b6a736dc2fc9dca3f1bf176c82fc9b44.tar.gz cpython-d8f32be5b6a736dc2fc9dca3f1bf176c82fc9b44.tar.bz2 |
gh-111089: Add PyUnicode_AsUTF8() to the limited C API (#111121)
Add PyUnicode_AsUTF8() function to the limited C API.
multiprocessing posixshmem now uses PyUnicode_AsUTF8() instead of
PyUnicode_AsUTF8AndSize(): the extension is built with the limited C
API. The function now raises an exception if the filename contains an
embedded null character instead of truncating silently the filename.
Diffstat (limited to 'Modules/_multiprocessing/posixshmem.c')
-rw-r--r-- | Modules/_multiprocessing/posixshmem.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_multiprocessing/posixshmem.c b/Modules/_multiprocessing/posixshmem.c index 317381a..c4d1138 100644 --- a/Modules/_multiprocessing/posixshmem.c +++ b/Modules/_multiprocessing/posixshmem.c @@ -44,7 +44,7 @@ _posixshmem_shm_open_impl(PyObject *module, PyObject *path, int flags, { int fd; int async_err = 0; - const char *name = PyUnicode_AsUTF8AndSize(path, NULL); + const char *name = PyUnicode_AsUTF8(path); if (name == NULL) { return -1; } @@ -83,7 +83,7 @@ _posixshmem_shm_unlink_impl(PyObject *module, PyObject *path) { int rv; int async_err = 0; - const char *name = PyUnicode_AsUTF8AndSize(path, NULL); + const char *name = PyUnicode_AsUTF8(path); if (name == NULL) { return NULL; } |