[pypy-svn] r49411 - pypy/branch/pypy-interp-file/module/_file
arigo at codespeak.net
arigo at codespeak.net
Wed Dec 5 20:07:54 CET 2007
Author: arigo
Date: Wed Dec 5 20:07:54 2007
New Revision: 49411
Modified:
pypy/branch/pypy-interp-file/module/_file/app_file.py
pypy/branch/pypy-interp-file/module/_file/interp_file.py
Log:
file.isatty().
Modified: pypy/branch/pypy-interp-file/module/_file/app_file.py
==============================================================================
--- pypy/branch/pypy-interp-file/module/_file/app_file.py (original)
+++ pypy/branch/pypy-interp-file/module/_file/app_file.py Wed Dec 5 20:07:54 2007
@@ -296,7 +296,7 @@
raise ValueError('I/O operation on closed file')
return self.fd
- def isatty(self):
+ #def isatty(self):
"""isatty() -> true or false. True if the file is connected to a tty device."""
if self._closed:
raise ValueError('I/O operation on closed file')
Modified: pypy/branch/pypy-interp-file/module/_file/interp_file.py
==============================================================================
--- pypy/branch/pypy-interp-file/module/_file/interp_file.py (original)
+++ pypy/branch/pypy-interp-file/module/_file/interp_file.py Wed Dec 5 20:07:54 2007
@@ -1,4 +1,5 @@
import py
+import os
from pypy.rlib import streamio
from pypy.module._file.interp_stream import W_AbstractStream
from pypy.module._file.interp_stream import StreamErrors, wrap_streamerror
@@ -84,6 +85,7 @@
stream = self.stream
if stream is not None:
self.stream = None
+ self.fd = -1
openstreams = getopenstreams(self.space)
try:
del openstreams[stream]
@@ -170,6 +172,9 @@
return self
direct_xreadlines = direct___iter__
+ def direct_isatty(self):
+ return os.isatty(self.fd)
+
# ____________________________________________________________
#
# The 'file_' methods are the one exposed to app-level.
@@ -242,6 +247,9 @@
# NB. close() need to use the stream lock to avoid double-closes or
# close-while-another-thread-uses-it.
+ _decl(locals(), "isatty", ['self'],
+ """isatty() -> true or false. True if the file is connected to a tty device.""")
+
_decl(locals(), "next", ['self'],
"""next() -> the next line in the file, or raise StopIteration""")
More information about the Pypy-commit
mailing list