classification
Title: winsound.PlaySound doesn't accept non-unicode string
Type: Stage: resolved
Components: Extension Modules, Windows Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: loewis, ocean-city
Priority: normal Keywords: patch

Created on 2009-06-21 01:36 by ocean-city, last changed 2010-11-07 22:46 by loewis. This issue is now closed.

Files
File name Uploaded Description Edit
py3k_winsound.patch ocean-city, 2009-06-21 06:29 for python3.x review
py2x_winsound.patch ocean-city, 2009-06-21 14:15 review
py3k_winsound_v2.patch ocean-city, 2010-11-07 02:36
Messages (9)
msg89554 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-06-21 01:36
winsound.PlaySound doesn't accept non-unicode string.

Python 3.1rc2+ (py3k, Jun 14 2009, 14:07:51) [MSC v.1200 32 bit (Intel)]
on win3
2
Type "help", "copyright", "credits" or "license" for more information.
>>> import winsound
>>> winsound.PlaySound("あ.wav", winsound.SND_LOOP | winsound.SND_ASYNC)

# Rings bell forever.

It's easy to fix this on python3x. I'm not sure this should be fixed in
python2.x, and if should be fixed, probably needs some code like in
posixmodule.c.

  /* try parse args as unicode */
      /* call PlaySoundW */
  /* if fail, try parse args as ascii */
      /* call PlaySoundA */
msg89557 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-06-21 07:13
Even for 3k, I would defer this patch after the 3.1 release, as it is an
incompatible change (requiring a Unicode string where a byte string was
acceptable before).
msg89561 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-06-21 14:15
I agree. By the way, I created the patch for trunk experimentally.
msg120660 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2010-11-07 02:36
I updated the patch. (I hope we can remove ANSI version
of Win32 API, though)
msg120663 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2010-11-07 09:27
I've committed in r86283(py3k). I'll merge this into
release31-maint and release27-maint.
msg120664 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-11-07 09:59
As for back-porting: I'm not sure this is a bug in 2.7. It just doesn't support Unicode filenames, but that's not (inherently) a bug. In 3.1, I can agree that it's a bug - but we need to preserve the bytes support for compatibility.

For 3.2, dropping the bytes support is fine with me.
msg120666 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2010-11-07 10:46
> As for back-porting: I'm not sure this is a bug in 2.7. It just
> doesn't support Unicode filenames, but that's not (inherently)
> a bug.

> In 3.1, I can agree that it's a bug - but we need to preserve the
> bytes support for compatibility.

I agree.

> For 3.2, dropping the bytes support is fine with me.

Is this also applied to *all* ANSI Win32 API
in other sources?
msg120671 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2010-11-07 11:58
I've committed in r86291(release31-maint).
msg120693 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-11-07 22:46
> Is this also applied to *all* ANSI Win32 API
> in other sources?

No. I think there are backwards compatibility concerns in some of the
APIs, so this must be discussed on python-dev.
History
Date User Action Args
2010-11-07 22:46:41loewissetmessages: + msg120693
2010-11-07 11:58:12ocean-citysetmessages: + msg120671
2010-11-07 10:46:19ocean-citysetmessages: + msg120666
2010-11-07 09:59:46loewissetmessages: + msg120664
2010-11-07 09:27:20ocean-citysetstatus: open -> closed
versions: - Python 2.6, Python 3.0
messages: + msg120663

resolution: fixed
stage: resolved
2010-11-07 02:36:40ocean-citysetfiles: + py3k_winsound_v2.patch

messages: + msg120660
2009-06-21 14:15:55ocean-citysetfiles: + py2x_winsound.patch

messages: + msg89561
2009-06-21 07:14:40loewissetpriority: release blocker -> normal
2009-06-21 07:13:32loewissetnosy: + loewis
messages: + msg89557
2009-06-21 06:29:49ocean-citysetfiles: - py3k_winsound.patch
2009-06-21 06:29:32ocean-citysetfiles: + py3k_winsound.patch
2009-06-21 01:38:36ocean-citysetpriority: release blocker
2009-06-21 01:36:30ocean-citycreate