Issue 7703: Replace buffer()-->memoryview() in Lib/ctypes/test/ (original) (raw)

Created on 2010-01-14 14:17 by flox, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue7703_ctypes_memoryview.diff flox,2010-01-14 14:20 Patch, apply to trunk
issue7703_test_ctypes.diff flox,2010-01-14 14:23 Patch, apply to trunk
Messages (13)
msg97765 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-14 14:17
In order to upgrate the tests for ctypes, following changes are required: - binascii.hexlify should accept memoryview() objects - the ctypes character buffer should accept assignment of memoryview() objects using their "raw" property Then we can backport the Py3 ctypes tests to Py2.
msg97766 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-14 14:23
Patches attached: - partial backport of Modules/binascii.c - partial backport of Modules/_ctypes/_ctypes.c (preserving 2.3 compat.) - update ctypes tests (buffer -> memoryview)
msg97768 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-01-14 14:47
Does binascii still work with array.array objects? Also, there should be additional tests for compatibility of binascii with memoryview objects.
msg97769 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-14 15:17
Additional tests for binascii.
msg97772 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-01-14 16:01
Please be careful with the coding style. Stuff like: + if (_PyString_Resize(&rv, 2*out_len) < 0) \ + { Py_DECREF(rv); PyBuffer_Release(&pin); return NULL; } \ should be spread out on several lines. Otherwise, the binascii patch looks good.
msg97773 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-01-14 16:35
I've now committed the binascii patch + tests to trunk, and merged the tests into py3k. Note: binascii_a2b_hqx() still uses the "t#" argument specifier in py3k as well as in trunk, this would deserve a separate patch.
msg97867 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-16 10:10
Patch for the last "t#" format string in binascii module. And provide additional tests. PS: I removed this comment. IMHO, it is a wrong assertion: "# The hqx test is in test_binhex.py"
msg97868 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-01-16 10:46
I don't think the bytes -> bytearray changes are useful, e.g.: - fillers = "" + fillers = bytearray() As for: + try: + f(empty) + except SystemError, err: + self.fail("{}({!r}) raises SystemError: {}".format(func, empty, err)) + except Exception, err: + self.fail("{}({!r}) raises {!r}".format(func, empty, err)) The "except SystemError" is pointless, since "except Exception" will catch SystemError anyway.
msg97872 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-16 11:45
Changed.
msg97877 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-16 13:14
Removed no-op str("...") conversions.
msg97885 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-01-16 17:42
When the following snippet is taken: if (_PyString_Resize(&rv, (bin_data - (unsigned char *)PyString_AS_STRING(rv))) < 0) { PyBuffer_Release(&pascii); Py_DECREF(rv); rv = NULL; } pascii will get released a second time at the end of function. The rest is fine, I'm gonna fix it myself.
msg97886 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-01-16 17:57
The a2b_hqx() patch was committed in r77528 (trunk) and r77529 (py3k). Thanks again!
msg101518 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-03-22 16:09
Fixed with r79288 and r79295.
History
Date User Action Args
2022-04-11 14:56:56 admin set github: 51952
2010-03-22 16:09:41 flox set status: open -> closedpriority: normalmessages: + resolution: fixedstage: patch review -> resolved
2010-01-16 17:57:49 pitrou set files: - issue7703_binascii_a2b_hqx_v3.diff
2010-01-16 17:57:44 pitrou set messages: +
2010-01-16 17:42:44 pitrou set messages: +
2010-01-16 13:14:17 flox set files: + issue7703_binascii_a2b_hqx_v3.diffmessages: +
2010-01-16 13:11:53 flox set files: - issue7703_binascii_a2b_hqx_v2.diff
2010-01-16 11:45:38 flox set files: + issue7703_binascii_a2b_hqx_v2.diffmessages: +
2010-01-16 11:45:09 flox set files: - issue7703_binascii_a2b_hqx.diff
2010-01-16 10:46:20 pitrou set messages: +
2010-01-16 10:10:57 flox set files: + issue7703_binascii_a2b_hqx.diffmessages: +
2010-01-14 16:35:48 pitrou set files: - issue7703_binascii_memoryview.diff
2010-01-14 16:35:46 pitrou set files: - issue7703_test_binascii.diff
2010-01-14 16:35:36 pitrou set messages: +
2010-01-14 16:01:54 pitrou set messages: +
2010-01-14 15:17:13 flox set files: + issue7703_test_binascii.diffmessages: +
2010-01-14 14:47:14 pitrou set nosy: + pitroumessages: +
2010-01-14 14:23:34 flox set files: + issue7703_test_ctypes.diffassignee: thellercomponents: + ctypesnosy: + thellermessages: + stage: needs patch -> patch review
2010-01-14 14:20:02 flox set files: + issue7703_ctypes_memoryview.diff
2010-01-14 14:19:48 flox set files: + issue7703_binascii_memoryview.diffkeywords: + patch
2010-01-14 14:17:09 flox create