From 544aeb2f98dc1ef8860dc5e411670f1ef4bf19fb Mon Sep 17 00:00:00 2001 From: ffelixg <142172984+ffelixg@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:48:41 +0200 Subject: [PATCH 1/3] Explain naming rules for struct sequence types When no module name is specified, a warning is raised upon type creation. --- Doc/c-api/tuple.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Doc/c-api/tuple.rst b/Doc/c-api/tuple.rst index 7a8a6134282ade..919653e46e83ab 100644 --- a/Doc/c-api/tuple.rst +++ b/Doc/c-api/tuple.rst @@ -167,7 +167,13 @@ type. .. c:member:: const char *name - Name of the struct sequence type. + Pointer to a NUL-terminated string containing the fully qualified name of the + type. For types that are accessible as module globals, the string should be + the full module name, followed by a dot, followed by the type name. If the + module is a submodule of a package, the full package name is part of the full + module name. For example, a type named :class:`!T` defined in module :mod:`!M` + in subpackage :mod:`!Q` in package :mod:`!P` should have the name ``"P.Q.M.T"``. + The name must include at least one dot. .. c:member:: const char *doc From 95045c6a47301197c2617fe5b03cf2ed322a5a3d Mon Sep 17 00:00:00 2001 From: ffelixg <142172984+ffelixg@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:07:03 +0200 Subject: [PATCH 2/3] Update documentation for struct sequence name --- Doc/c-api/tuple.rst | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Doc/c-api/tuple.rst b/Doc/c-api/tuple.rst index 919653e46e83ab..ead03b1af9c931 100644 --- a/Doc/c-api/tuple.rst +++ b/Doc/c-api/tuple.rst @@ -167,13 +167,7 @@ type. .. c:member:: const char *name - Pointer to a NUL-terminated string containing the fully qualified name of the - type. For types that are accessible as module globals, the string should be - the full module name, followed by a dot, followed by the type name. If the - module is a submodule of a package, the full package name is part of the full - module name. For example, a type named :class:`!T` defined in module :mod:`!M` - in subpackage :mod:`!Q` in package :mod:`!P` should have the name ``"P.Q.M.T"``. - The name must include at least one dot. + Fully qualified name of the type; null-terminated UTF-8 encoded. .. c:member:: const char *doc From 64cbd591a5c39bcedc1d9e66e351fb5301c8260b Mon Sep 17 00:00:00 2001 From: ffelixg <142172984+ffelixg@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:21:16 +0200 Subject: [PATCH 3/3] Specifically mention module name Co-authored-by: Victor Stinner --- Doc/c-api/tuple.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/c-api/tuple.rst b/Doc/c-api/tuple.rst index ead03b1af9c931..815afddad19df1 100644 --- a/Doc/c-api/tuple.rst +++ b/Doc/c-api/tuple.rst @@ -168,6 +168,7 @@ type. .. c:member:: const char *name Fully qualified name of the type; null-terminated UTF-8 encoded. + The name must contain the module name. .. c:member:: const char *doc