Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a239fb82
Commit
a239fb82
authored
May 07, 2010
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
module_repr(): use %U to format the file name
Avoid useless encode/decode of the filename
parent
257bd444
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
Objects/moduleobject.c
Objects/moduleobject.c
+15
-5
No files found.
Objects/moduleobject.c
View file @
a239fb82
...
...
@@ -191,8 +191,8 @@ PyModule_GetName(PyObject *m)
return
_PyUnicode_AsString
(
nameobj
);
}
const
char
*
PyModule_GetF
ilename
(
PyObject
*
m
)
static
PyObject
*
module_getf
ilename
(
PyObject
*
m
)
{
PyObject
*
d
;
PyObject
*
fileobj
;
...
...
@@ -208,6 +208,16 @@ PyModule_GetFilename(PyObject *m)
PyErr_SetString
(
PyExc_SystemError
,
"module filename missing"
);
return
NULL
;
}
return
fileobj
;
}
const
char
*
PyModule_GetFilename
(
PyObject
*
m
)
{
PyObject
*
fileobj
;
fileobj
=
module_getfilename
(
m
);
if
(
fileobj
==
NULL
)
return
NULL
;
return
_PyUnicode_AsString
(
fileobj
);
}
...
...
@@ -327,19 +337,19 @@ static PyObject *
module_repr
(
PyModuleObject
*
m
)
{
const
char
*
name
;
const
char
*
filename
;
PyObject
*
filename
;
name
=
PyModule_GetName
((
PyObject
*
)
m
);
if
(
name
==
NULL
)
{
PyErr_Clear
();
name
=
"?"
;
}
filename
=
PyModule_GetF
ilename
((
PyObject
*
)
m
);
filename
=
module_getf
ilename
((
PyObject
*
)
m
);
if
(
filename
==
NULL
)
{
PyErr_Clear
();
return
PyUnicode_FromFormat
(
"<module '%s' (built-in)>"
,
name
);
}
return
PyUnicode_FromFormat
(
"<module '%s' from '%
s
'>"
,
name
,
filename
);
return
PyUnicode_FromFormat
(
"<module '%s' from '%
U
'>"
,
name
,
filename
);
}
static
int
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment