Skip to content

Instantly share code, notes, and snippets.

@davidwtbuxton
Created January 9, 2018 18:00
Show Gist options
  • Save davidwtbuxton/5a818ef54b93233964707f43f7353939 to your computer and use it in GitHub Desktop.
Save davidwtbuxton/5a818ef54b93233964707f43f7353939 to your computer and use it in GitHub Desktop.
you can't sub-class cStringIO.StringIO on Python 2.7
$ python
Python 2.7.14 (default, Sep 22 2017, 00:06:07)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cStringIO, StringIO, io
>>> class Foo(io.StringIO): pass
...
>>> class Bar(StringIO.StringIO): pass
...
>>> class Baz(cStringIO.StringIO): pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Error when calling the metaclass bases
cannot create 'builtin_function_or_method' instances
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment