This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ideasman42
Recipients ideasman42
Date 2012-09-04.05:24:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346736283.51.0.0156916220677.issue15859@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2012-09-04 05:24:43ideasman42setrecipients: + ideasman42
2012-09-04 05:24:43ideasman42setmessageid: <1346736283.51.0.0156916220677.issue15859@psf.upfronthosting.co.za>
2012-09-04 05:24:42ideasman42linkissue15859 messages
2012-09-04 05:24:41ideasman42create