Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-32604: [_xxsubinterpreters] Propagate exceptions. #19768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Drop _copy_raw_string().
  • Loading branch information
ericsnowcurrently committed Apr 28, 2020
commit d9ecbeb925ed48c294b69cf409a1c8c996113bea
28 changes: 4 additions & 24 deletions 28 Modules/_xxsubinterpretersmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,6 @@ _pyobj_get_str_and_size(PyObject *obj, Py_ssize_t *psize)
}
}

static char *
_copy_raw_string(PyObject *strobj)
{
const char *str = PyUnicode_AsUTF8(strobj);
if (str == NULL) {
return NULL;
}
char *copied = PyMem_Malloc(strlen(str)+1);
if (copied == NULL) {
PyErr_NoMemory();
return NULL;
}
strcpy(copied, str);
return copied;
}

/* "raw" strings */

typedef struct _rawstring {
Expand Down Expand Up @@ -920,7 +904,7 @@ _excsnapshot_resolve(_excsnapshot *es)
/* shared "object" */

struct _sharednsitem {
char *name;
_rawstring name;
_PyCrossInterpreterData data;
};

Expand All @@ -929,8 +913,7 @@ static void _sharednsitem_clear(struct _sharednsitem *); // forward
static int
_sharednsitem_init(struct _sharednsitem *item, PyObject *key, PyObject *value)
{
item->name = _copy_raw_string(key);
if (item->name == NULL) {
if (_rawstring_from_pyobj(&item->name, key) != 0) {
return -1;
}
if (_PyObject_GetCrossInterpreterData(value, &item->data) != 0) {
Expand All @@ -943,17 +926,14 @@ _sharednsitem_init(struct _sharednsitem *item, PyObject *key, PyObject *value)
static void
_sharednsitem_clear(struct _sharednsitem *item)
{
if (item->name != NULL) {
PyMem_RawFree(item->name);
item->name = NULL;
}
_rawstring_clear(&item->name);
_PyCrossInterpreterData_Release(&item->data);
}

static int
_sharednsitem_apply(struct _sharednsitem *item, PyObject *ns)
{
PyObject *name = PyUnicode_FromString(item->name);
PyObject *name = PyUnicode_FromString(item->name.data);
if (name == NULL) {
return -1;
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.