diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-08-17 23:37:11 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-08-17 23:37:11 (GMT) |
commit | 6c00c1464f03deaafbbd5fdd212514cbf36b9bd4 (patch) | |
tree | 6928203bf836291bb890f9ebdfb7d71ac670ca98 /Doc | |
parent | 6951157475dd22893a2c5813cbbdac63de5c043f (diff) | |
download | cpython-6c00c1464f03deaafbbd5fdd212514cbf36b9bd4.zip cpython-6c00c1464f03deaafbbd5fdd212514cbf36b9bd4.tar.gz cpython-6c00c1464f03deaafbbd5fdd212514cbf36b9bd4.tar.bz2 |
Issue #9425: Create PyModule_GetFilenameObject() function
... to get the filename as a unicode object, instead of a byte string. Function
needed to support unencodable filenames. Deprecate PyModule_GetFilename() in
favor on the new function.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/module.rst | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 2c7faf0..40acc4e 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -64,13 +64,24 @@ There are only a few functions special to module objects. .. cfunction:: char* PyModule_GetFilename(PyObject *module) + Similar to :cfunc:`PyModule_GetFilenameObject` but return the filename + encoded to 'utf-8'. + + .. deprecated:: 3.2 + :cfunc:`PyModule_GetFilename` raises :ctype:`UnicodeEncodeError` on + unencodable filenames, use :cfunc:`PyModule_GetFilenameObject` instead. + + +.. cfunction:: PyObject* PyModule_GetFilenameObject(PyObject *module) + .. index:: single: __file__ (module attribute) single: SystemError (built-in exception) Return the name of the file from which *module* was loaded using *module*'s - :attr:`__file__` attribute. If this is not defined, or if it is not a string, - raise :exc:`SystemError` and return *NULL*. + :attr:`__file__` attribute. If this is not defined, or if it is not a + unicode string, raise :exc:`SystemError` and return *NULL*; otherwise return + a reference to a :ctype:`PyUnicodeObject`. .. cfunction:: void* PyModule_GetState(PyObject *module) |