Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions src/_path_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject *
return NULL;
}
codes[i] = PyBytes_AsString(item);
Py_DECREF(item);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just change the PyArg_ParseTuple call to use a (yyyyy) format for parsing the codes argument instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am 50/50 on that. It lets python do more of the work, but is also a bigger change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all of our callers pass the right length lists, but as I'm targeting 3.0.3 with this, I'm not sure if it's quite as safe to be backporting that version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we already error out a few lines above if the length is not 5.
Anyways I don't want to insist too much on this, if you don't want to make the bigger change that's fine with me too.

if (codes[i] == NULL) {
return NULL;
}
Expand Down
1 change: 1 addition & 0 deletions src/py_adaptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ class PathGenerator
throw py::exception();
}
if (!convert_path(item, &path)) {
Py_DECREF(item);
throw py::exception();
}
Py_DECREF(item);
Expand Down