Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fake_tempfile is using AddOpenFile incorrectly. #23

Closed
GoogleCodeExporter opened this issue Mar 16, 2015 · 1 comment
Closed

fake_tempfile is using AddOpenFile incorrectly. #23

GoogleCodeExporter opened this issue Mar 16, 2015 · 1 comment
Labels

Comments

@GoogleCodeExporter
Copy link

Code to reproduce:

def Repro():
  fd, fn = tempfile.mkstemp()
  fo = os.fdopen(fd, 'w+b')
  ...

I'd get a stack trace like this:

"myfile.py", line 3, in Repro
    fo = os.fdopen(fd, 'w+b')
  File ".../fakefs/fake_filesystem.py", line 1208, in _fdopen_ver2
    return FakeFileOpen(self.filesystem).Call(file_des, mode=mode)
  File ".../fakefs/fake_filesystem.py", line 1918, in Call
    file_object = self.filesystem.GetOpenFile(filedes).GetObject()
AttributeError: 'FakeFile' object has no attribute 'GetObject'

The offending part in fake_tempfile calls AddOpenFile() with a FakeFile object, 
but according to fake_filesystem.py line 2184 this should be FakeFileWrapper 
which is only visible from the FakeFileOpen class.

liulk

Original issue reported on code.google.com by [email protected] on 6 Dec 2013 at 12:09

@jmcgeheeiv
Copy link
Contributor

Fixed by @dougluce in pull request #66.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants