classification
Title: mmap, dbm, ossaudiodev, marshal & winreg return bytearray instead of bytes
Type: behavior Stage:
Components: Extension Modules Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: amaury.forgeotdarc, gregory.p.smith, ocean-city, pitrou
Priority: deferred blocker Keywords: easy, needs review, patch

Created on 2008-09-06 20:46 by gregory.p.smith, last changed 2008-09-06 21:35 by gregory.p.smith. This issue is now closed.

Files
File name Uploaded Description Edit
mmap-dbm-oss_bytes.patch gregory.p.smith, 2008-09-06 20:46 PyByteArray -> PyBytes
marshal-winreg_bytes.patch gregory.p.smith, 2008-09-06 20:50 more PyByteArray -> PyBytes
Messages (8)
msg72691 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008-09-06 20:46
As noted in issue #3492 the following py3k modules still erroneously
return bytearray objects instead of bytes objects from their read functions:

mmap
dbm
ossaudiodev

Attached is a trivial patch to fix those.
msg72693 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008-09-06 20:50
attached a patch for PC/winreg.c and Python/marshal.c.
msg72696 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-09-06 21:14
Hello. I confirmed test_winreg.py passed after applied
marshal-winreg_bytes.patch.
msg72698 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-09-06 21:18
Tests pass here as well, under Windows and Linux.
msg72699 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-09-06 21:19
- PyBytes_Resize takes a PyObject**, you should pass &rv. Didn't you get
a compiler warning?

- Here is an additional test for the winreg module, your patch is needed
for it to pass.
msg72700 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-09-06 21:20
As for ossaudiodev:

-    PyByteArray_Resize(rv, count);
+    _PyBytes_Resize(rv, count);

I think this should be _PyBytes_Resize(&rv, count) instead.
msg72701 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-09-06 21:21
Amaury beat me to the punch :-o
msg72706 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008-09-06 21:35
heh indeed it should be &rv.  i made the patch on a mac and hadn't run
it on my linux host before opening the issue.

fixed locally and given all of the reviews across all relevant
platforms.. committing.  py3k r66273.
History
Date User Action Args
2008-09-06 21:35:20gregory.p.smithsetstatus: open -> closed
resolution: fixed
messages: + msg72706
keywords: patch, patch, easy, needs review
2008-09-06 21:21:18pitrousetkeywords: patch, patch, easy, needs review
messages: + msg72701
2008-09-06 21:20:42pitrousetkeywords: patch, patch, easy, needs review
messages: + msg72700
2008-09-06 21:19:11amaury.forgeotdarcsetkeywords: patch, patch, easy, needs review
nosy: + amaury.forgeotdarc
messages: + msg72699
2008-09-06 21:18:48pitrousetkeywords: patch, patch, easy, needs review
nosy: + pitrou
messages: + msg72698
2008-09-06 21:14:29ocean-citysetkeywords: patch, patch, easy, needs review
nosy: + ocean-city
messages: + msg72696
2008-09-06 20:50:08gregory.p.smithsetkeywords: patch, patch, easy, needs review
files: + marshal-winreg_bytes.patch
messages: + msg72693
title: mmap, dbm and ossaudiodev return bytearray instead of bytes -> mmap, dbm, ossaudiodev, marshal & winreg return bytearray instead of bytes
2008-09-06 20:46:13gregory.p.smithcreate