diff options
-rw-r--r-- | src/if_py_both.h | 1 | ||||
-rw-r--r-- | src/if_python.c | 5 | ||||
-rw-r--r-- | src/if_python3.c | 4 | ||||
-rw-r--r-- | src/testdir/test86.in | 5 | ||||
-rw-r--r-- | src/testdir/test86.ok | 7 | ||||
-rw-r--r-- | src/testdir/test87.in | 5 | ||||
-rw-r--r-- | src/testdir/test87.ok | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
8 files changed, 33 insertions, 3 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h index de3e8680b..a0385f9a5 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -503,6 +503,7 @@ static struct PyMethodDef OutputMethods[] = { {"readable", (PyCFunction)AlwaysFalse, METH_NOARGS, ""}, {"seekable", (PyCFunction)AlwaysFalse, METH_NOARGS, ""}, {"writable", (PyCFunction)AlwaysTrue, METH_NOARGS, ""}, + {"closed", (PyCFunction)AlwaysFalse, METH_NOARGS, ""}, {"__dir__", (PyCFunction)OutputDir, METH_NOARGS, ""}, { NULL, NULL, 0, NULL} }; diff --git a/src/if_python.c b/src/if_python.c index a54a0e217..622634da7 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -1195,7 +1195,10 @@ OutputGetattr(PyObject *self, char *name) return PyInt_FromLong(((OutputObject *)(self))->softspace); else if (strcmp(name, "__members__") == 0) return ObjectDir(NULL, OutputAttrs); - + else if (strcmp(name, "errors") == 0) + return PyString_FromString("strict"); + else if (strcmp(name, "encoding") == 0) + return PyString_FromString(ENC_OPT); return Py_FindMethod(OutputMethods, self, name); } diff --git a/src/if_python3.c b/src/if_python3.c index d2f6066cb..10984cdfe 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -1100,6 +1100,10 @@ OutputGetattro(PyObject *self, PyObject *nameobj) if (strcmp(name, "softspace") == 0) return PyLong_FromLong(((OutputObject *)(self))->softspace); + else if (strcmp(name, "errors") == 0) + return PyString_FromString("strict"); + else if (strcmp(name, "encoding") == 0) + return PyString_FromString(ENC_OPT); return PyObject_GenericGetAttr(self, nameobj); } diff --git a/src/testdir/test86.in b/src/testdir/test86.in index 6f47ff681..71fe920ad 100644 --- a/src/testdir/test86.in +++ b/src/testdir/test86.in @@ -1289,6 +1289,11 @@ ee('assert sys.stdout.writable()==True') ee('assert sys.stdout.readable()==False') ee('assert sys.stderr.writable()==True') ee('assert sys.stderr.readable()==False') +ee('assert sys.stdout.closed()==False') +ee('assert sys.stderr.closed()==False') +ee('assert sys.stdout.errors=="strict"') +ee('assert sys.stderr.errors=="strict"') +ee('assert sys.stdout.encoding==sys.stderr.encoding') ee('sys.stdout.write(None)') cb.append(">> OutputWriteLines") ee('sys.stdout.writelines(None)') diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index fe27c05a7..85290402c 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -449,7 +449,7 @@ range:__dir__,__members__,append,end,start dictionary:__dir__,__members__,get,has_key,items,keys,locked,pop,popitem,scope,update,values list:__dir__,__members__,extend,locked function:__dir__,__members__,args,self,softspace -output:__dir__,__members__,close,flush,isatty,readable,seekable,softspace,writable,write,writelines +output:__dir__,__members__,close,closed,flush,isatty,readable,seekable,softspace,writable,write,writelines {} {'a': 1} {'a': 1} @@ -600,6 +600,11 @@ assert sys.stdout.writable()==True:NOT FAILED assert sys.stdout.readable()==False:NOT FAILED assert sys.stderr.writable()==True:NOT FAILED assert sys.stderr.readable()==False:NOT FAILED +assert sys.stdout.closed()==False:NOT FAILED +assert sys.stderr.closed()==False:NOT FAILED +assert sys.stdout.errors=="strict":NOT FAILED +assert sys.stderr.errors=="strict":NOT FAILED +assert sys.stdout.encoding==sys.stderr.encoding:NOT FAILED sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',) >> OutputWriteLines sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",) diff --git a/src/testdir/test87.in b/src/testdir/test87.in index e3bc994ba..0df002feb 100644 --- a/src/testdir/test87.in +++ b/src/testdir/test87.in @@ -1283,6 +1283,11 @@ ee('assert sys.stdout.writable()==True') ee('assert sys.stdout.readable()==False') ee('assert sys.stderr.writable()==True') ee('assert sys.stderr.readable()==False') +ee('assert sys.stdout.closed()==False') +ee('assert sys.stderr.closed()==False') +ee('assert sys.stdout.errors=="strict"') +ee('assert sys.stderr.errors=="strict"') +ee('assert sys.stdout.encoding==sys.stderr.encoding') ee('sys.stdout.write(None)') cb.append(">> OutputWriteLines") ee('sys.stdout.writelines(None)') diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index 25c0b5103..10069b995 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -449,7 +449,7 @@ range:__dir__,append,end,start dictionary:__dir__,get,has_key,items,keys,locked,pop,popitem,scope,update,values list:__dir__,extend,locked function:__dir__,args,self,softspace -output:__dir__,close,flush,isatty,readable,seekable,softspace,writable,write,writelines +output:__dir__,close,closed,flush,isatty,readable,seekable,softspace,writable,write,writelines {} {'a': 1} {'a': 1} @@ -600,6 +600,11 @@ assert sys.stdout.writable()==True:NOT FAILED assert sys.stdout.readable()==False:NOT FAILED assert sys.stderr.writable()==True:NOT FAILED assert sys.stderr.readable()==False:NOT FAILED +assert sys.stdout.closed()==False:NOT FAILED +assert sys.stderr.closed()==False:NOT FAILED +assert sys.stdout.errors=="strict":NOT FAILED +assert sys.stderr.errors=="strict":NOT FAILED +assert sys.stdout.encoding==sys.stderr.encoding:NOT FAILED sys.stdout.write(None):(<class 'TypeError'>, TypeError("Can't convert 'NoneType' object to str implicitly",)) >> OutputWriteLines sys.stdout.writelines(None):(<class 'TypeError'>, TypeError("'NoneType' object is not iterable",)) diff --git a/src/version.c b/src/version.c index 9c0387253..4599f8827 100644 --- a/src/version.c +++ b/src/version.c @@ -749,6 +749,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1769, +/**/ 1768, /**/ 1767, |