mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
parent
6274fff287
commit
e9901f325e
1 changed files with 4 additions and 4 deletions
|
|
@ -92,16 +92,16 @@ class _posixfile_:
|
|||
def dup(self):
|
||||
import posix
|
||||
|
||||
try: ignore = posix.fdopen
|
||||
except: raise AttributeError, 'dup() method unavailable'
|
||||
if not hasattr(posix, 'fdopen'):
|
||||
raise AttributeError, 'dup() method unavailable'
|
||||
|
||||
return posix.fdopen(posix.dup(self._file_.fileno()), self._file_.mode)
|
||||
|
||||
def dup2(self, fd):
|
||||
import posix
|
||||
|
||||
try: ignore = posix.fdopen
|
||||
except: raise AttributeError, 'dup() method unavailable'
|
||||
if not hasattr(posix, 'fdopen'):
|
||||
raise AttributeError, 'dup() method unavailable'
|
||||
|
||||
posix.dup2(self._file_.fileno(), fd)
|
||||
return posix.fdopen(fd, self._file_.mode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue