Issue #3080: Add PyModule_GetNameObject() · python/cpython@bd47511 · GitHub
Skip to content

Commit bd47511

Browse files
author
Victor Stinner
committed
Issue #3080: Add PyModule_GetNameObject()
repr(module) uses %R to format module name and filenames, instead of '%s' and '%U', so surrogates from undecodable bytes in a filename (PEP 383) are escaped.
1 parent 501c09a commit bd47511

3 files changed

Lines changed: 45 additions & 21 deletions

File tree

Doc/c-api/module.rst

Lines changed: 15 additions & 7 deletions

Include/moduleobject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ PyAPI_FUNC(PyObject *) PyModule_New(
1616
const char *name /* UTF-8 encoded string */
1717
);
1818
PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
19+
PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *);
1920
PyAPI_FUNC(const char *) PyModule_GetName(PyObject *);
2021
PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
2122
PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *);

Objects/moduleobject.c

Lines changed: 29 additions & 14 deletions

0 commit comments

Comments
 (0)