Skip to content
Merged
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
11 changes: 7 additions & 4 deletions peps/pep-0793.rst
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,15 @@ will return 0 on success and -1 on failure:

A new ``PyType_GetModuleByToken`` function will be added, with a signature
like the existing ``PyType_GetModuleByDef`` but a ``void *token`` argument,
and the same behaviour except matching tokens rather than only defs.
and the same behaviour except matching tokens rather than only defs,
and returning a strong reference.

For easier backwards compatibility, the existing ``PyType_GetModuleByDef``
will be changed to work exactly like ``PyType_GetModuleByToken`` -- that is,
it will allow a token (cast to a ``PyModuleDef *`` pointer) as the
*def* argument.
will be changed to also allow a token (cast to a ``PyModuleDef *`` pointer) as
the *def* argument.
That is, ``PyType_GetModuleByToken`` and ``PyType_GetModuleByDef`` will differ
only in the formal signature of the second argument and by returning a
borrowed vs. strong reference.
(The ``PyModule_GetDef`` function will not get a similar change, as users may
access members of its result.)

Expand Down