Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4)

Unified Diff: Objects/memoryobject.c

Issue 15944: memoryviews and ctypes
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_memoryview.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Objects/memoryobject.c Thu Aug 06 13:17:27 2015 +0300
+++ b/Objects/memoryobject.c Thu Aug 06 16:47:44 2015 +0000
@@ -1197,13 +1197,6 @@
assert(view->strides == mv->ob_array + view->ndim);
assert(view->suboffsets == mv->ob_array + 2*view->ndim);
- if (get_native_fmtchar(&srcchar, view->format) < 0) {
- PyErr_SetString(PyExc_ValueError,
- "memoryview: source format must be a native single character "
- "format prefixed with an optional '@'");
- return ret;
- }
-
asciifmt = PyUnicode_AsASCIIString(format);
if (asciifmt == NULL)
return ret;
@@ -1216,7 +1209,8 @@
goto out;
}
- if (!IS_BYTE_FORMAT(srcchar) && !IS_BYTE_FORMAT(destchar)) {
+ if ((get_native_fmtchar(&srcchar, view->format) < 0 ||
+ !IS_BYTE_FORMAT(srcchar)) && !IS_BYTE_FORMAT(destchar)) {
PyErr_SetString(PyExc_TypeError,
"memoryview: cannot cast between two non-byte formats");
goto out;
« no previous file with comments | « Lib/test/test_memoryview.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+