Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ Build Changes
* Building CPython now requires a compiler with support for the C11 atomic
library, GCC built-in atomic functions, or MSVC interlocked intrinsics.

* The ``errno``, ``md5``, ``_ctypes_test``, ``_stat`` and
* The ``errno``, ``md5``, ``winsound``, ``_ctypes_test``, ``_stat`` and
``_testimportmultiple`` C extensions are now built with the :ref:`limited C
API <limited-c-api>`.
(Contributed by Victor Stinner in :gh:`85283`.)
Expand Down
3 changes: 0 additions & 3 deletions Include/internal/pycore_global_objects_fini_generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Include/internal/pycore_global_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ struct _Py_global_strings {
STRUCT_FOR_ID(dont_inherit)
STRUCT_FOR_ID(dst)
STRUCT_FOR_ID(dst_dir_fd)
STRUCT_FOR_ID(duration)
STRUCT_FOR_ID(e)
STRUCT_FOR_ID(eager_start)
STRUCT_FOR_ID(effective_ids)
Expand Down Expand Up @@ -431,7 +430,6 @@ struct _Py_global_strings {
STRUCT_FOR_ID(flush)
STRUCT_FOR_ID(follow_symlinks)
STRUCT_FOR_ID(format)
STRUCT_FOR_ID(frequency)
STRUCT_FOR_ID(from_param)
STRUCT_FOR_ID(fromlist)
STRUCT_FOR_ID(fromtimestamp)
Expand Down Expand Up @@ -675,7 +673,6 @@ struct _Py_global_strings {
STRUCT_FOR_ID(sleep)
STRUCT_FOR_ID(sock)
STRUCT_FOR_ID(sort)
STRUCT_FOR_ID(sound)
STRUCT_FOR_ID(source)
STRUCT_FOR_ID(source_traceback)
STRUCT_FOR_ID(src)
Expand Down
3 changes: 0 additions & 3 deletions Include/internal/pycore_runtime_init_generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions Include/internal/pycore_unicodeobject_generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
The ``errno``, ``md5``, ``_ctypes_test`` and ``_testimportmultiple`` C
extensions are now built with the :ref:`limited C API <limited-c-api>`. Patch
by Victor Stinner.
The ``errno``, ``md5``, ``winsound``, ``_ctypes_test``, ``_stat`` and
``_testimportmultiple`` C extensions are now built with the :ref:`limited C API
<limited-c-api>`.
Patch by Victor Stinner.
138 changes: 16 additions & 122 deletions PC/clinic/winsound.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions PC/winsound.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@
winsound.PlaySound(None, 0)
*/

// clinic/winsound.c.h uses internal pycore_modsupport.h API
#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
#endif
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000

#include <Python.h>
#include <windows.h>
Expand Down Expand Up @@ -100,9 +98,13 @@ winsound_PlaySound_impl(PyObject *module, PyObject *sound, int flags)
}
wsound = (wchar_t *)view.buf;
} else if (PyBytes_Check(sound)) {
PyErr_Format(PyExc_TypeError,
"'sound' must be str, os.PathLike, or None, not '%s'",
Py_TYPE(sound)->tp_name);
PyObject *type_name = PyType_GetQualName(Py_TYPE(sound));
if (type_name != NULL) {
PyErr_Format(PyExc_TypeError,
"'sound' must be str, os.PathLike, or None, not %S",
type_name);
Py_DECREF(type_name);
}
return NULL;
} else {
PyObject *obj = PyOS_FSPath(sound);
Expand Down