Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c08c9bcc
Kaydet (Commit)
c08c9bcc
authored
Kas 07, 2010
tarafından
Hirokazu Yamamoto
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #6317: Now winsound.PlaySound can accept non ascii filename.
üst
2e598faa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
7 deletions
+31
-7
NEWS
Misc/NEWS
+2
-0
winsound.c
PC/winsound.c
+29
-7
No files found.
Misc/NEWS
Dosyayı görüntüle @
c08c9bcc
...
...
@@ -251,6 +251,8 @@ Library
Extensions
----------
- Issue #6317: Now winsound.PlaySound can accept non ascii filename.
- Issue #9377: Use Unicode API for gethostname on Windows.
- Issue #10143: Update "os.pathconf" values.
...
...
PC/winsound.c
Dosyayı görüntüle @
c08c9bcc
...
...
@@ -72,30 +72,52 @@ PyDoc_STRVAR(sound_module_doc,
static
PyObject
*
sound_playsound
(
PyObject
*
s
,
PyObject
*
args
)
{
Py_UNICODE
*
wsound
;
PyObject
*
osound
;
const
char
*
sound
;
int
flags
;
int
length
;
int
ok
;
if
(
!
PyArg_ParseTuple
(
args
,
"z#i:PlaySound"
,
&
sound
,
&
length
,
&
flags
))
{
return
NULL
;
if
(
PyArg_ParseTuple
(
args
,
"Zi:PlaySound"
,
&
wsound
,
&
flags
))
{
if
(
flags
&
SND_ASYNC
&&
flags
&
SND_MEMORY
)
{
/* Sidestep reference counting headache; unfortunately this also
prevent SND_LOOP from memory. */
PyErr_SetString
(
PyExc_RuntimeError
,
"Cannot play asynchronously from memory"
);
return
NULL
;
}
Py_BEGIN_ALLOW_THREADS
ok
=
PlaySoundW
(
wsound
,
NULL
,
flags
);
Py_END_ALLOW_THREADS
if
(
!
ok
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"Failed to play sound"
);
return
NULL
;
}
Py_INCREF
(
Py_None
);
return
Py_None
;
}
/* Drop the argument parsing error as narrow strings
are also valid. */
PyErr_Clear
();
if
(
!
PyArg_ParseTuple
(
args
,
"O&i:PlaySound"
,
PyUnicode_FSConverter
,
&
osound
,
&
flags
))
return
NULL
;
if
(
flags
&
SND_ASYNC
&&
flags
&
SND_MEMORY
)
{
/* Sidestep reference counting headache; unfortunately this also
prevent SND_LOOP from memory. */
PyErr_SetString
(
PyExc_RuntimeError
,
"Cannot play asynchronously from memory"
);
Py_DECREF
(
osound
);
return
NULL
;
}
sound
=
PyBytes_AsString
(
osound
);
Py_BEGIN_ALLOW_THREADS
ok
=
PlaySound
(
sound
,
NULL
,
flags
);
ok
=
PlaySound
A
(
sound
,
NULL
,
flags
);
Py_END_ALLOW_THREADS
if
(
!
ok
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"Failed to play sound"
);
Py_DECREF
(
osound
);
return
NULL
;
}
Py_DECREF
(
osound
);
Py_INCREF
(
Py_None
);
return
Py_None
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment