Message169816
There is an inconsistency in PyUnicode_EncodeFSDefault(), on Linux its argument is checked to be unicode, and NULL is returned when its not. On windows however, this throws an assertion.
The problem with this is, in some CAPI code you may pass an argument and check for NULL as an error case, and allow the python API's exception to be exposed to the script author.
The problem here is a linux developer can use PyUnicode_EncodeFSDefault() this way, but not a windows developer.
A simplified use case below of a case where PyUnicode_EncodeFSDefault would fail.
Attached a fix so windows and posix systems behave the same.
---
const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
{
if (PyBytes_Check(py_str)) {
return PyBytes_AS_STRING(py_str);
}
else if ((*coerce = PyUnicode_EncodeFSDefault(py_str))) {
return PyBytes_AS_STRING(*coerce);
}
---
Also: heres a list to the bug report in blenders tracker, where the bug was found.
https://projects.blender.org/tracker/index.php?func=detail&aid=31856&group_id=9&atid=498 |
|
Date |
User |
Action |
Args |
2012-09-04 05:24:43 | ideasman42 | set | recipients:
+ ideasman42 |
2012-09-04 05:24:43 | ideasman42 | set | messageid: <1346736283.51.0.0156916220677.issue15859@psf.upfronthosting.co.za> |
2012-09-04 05:24:42 | ideasman42 | link | issue15859 messages |
2012-09-04 05:24:41 | ideasman42 | create | |
|