mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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.
This commit is contained in:
parent
264f4af506
commit
d8f32be5b6
9 changed files with 23 additions and 16 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue