jsonpickle/jsonpickle — pull request #105 by aldanor (2014-12-29 22:58:55+00:00)
Title: Basic support for pickling types with metaclasses

This now works out of the box on both Python 2 and Python 3:
```python
>>> import enum
>>> class Foo(enum.IntEnum):
... A = 1
... B = 2
...
>>> import jsonpickle
>>> jsonpickle.encode(Foo.A)
'{"py/reduce": [{"py/type": "__main__.Foo"}, {"py/tuple": [1]}, null, null, null], "py/object": "__main__.Foo", "py/newargs": {"py/tuple": [1]}}'
>>> jsonpickle.decode(jsonpickle.encode(Foo.A))

```
There were two problems about this: `has_get*` flags in `_flatten_obj_instance` were not set correctly and `util.is_type` was returning false for types with metaclasses.

There may be some unobvious edge cases with twisted usage of metaclasses, but it at the very least seems to handle `enum` which is not the simplest example of all (https://hg.python.org/cpython/file/3.4/Lib/enum.py).