summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-08-13 13:34:52 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-08-13 13:34:52 (GMT)
commit3603cc5fdba912602dc714aff3d5d33d56887d23 (patch)
tree8a6ca89c5b28715ff347753e8c3901996a176be4 /Objects
parent1a4d12d74681d35a40474790925a8ec9c8069b4e (diff)
downloadcpython-3603cc5fdba912602dc714aff3d5d33d56887d23.zip
cpython-3603cc5fdba912602dc714aff3d5d33d56887d23.tar.gz
cpython-3603cc5fdba912602dc714aff3d5d33d56887d23.tar.bz2
Issue #9425: PyFile_FromFd() ignores the name argument
This function is only by imp.find_module() which does return the filename in a separated variable.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/fileobject.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 3709e00..9288e35 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -29,7 +29,7 @@ PyObject *
PyFile_FromFd(int fd, char *name, char *mode, int buffering, char *encoding,
char *errors, char *newline, int closefd)
{
- PyObject *io, *stream, *nameobj = NULL;
+ PyObject *io, *stream;
io = PyImport_ImportModule("io");
if (io == NULL)
@@ -40,16 +40,8 @@ PyFile_FromFd(int fd, char *name, char *mode, int buffering, char *encoding,
Py_DECREF(io);
if (stream == NULL)
return NULL;
- if (name != NULL) {
- nameobj = PyUnicode_DecodeFSDefault(name);
- if (nameobj == NULL)
- PyErr_Clear();
- else {
- if (PyObject_SetAttrString(stream, "name", nameobj) < 0)
- PyErr_Clear();
- Py_DECREF(nameobj);
- }
- }
+ /* ignore name attribute because the name attribute of _BufferedIOMixin
+ and TextIOWrapper is read only */
return stream;
}