Merge pull request #81 from marcintustin/master

Add further pickle protocol 2 support

Signed-off-by: David Aguilar <davvid@gmail.com>
tests: move stuff into the test classes

We might want to consider eliminating jsonpickle._samples (again)
if we can move everything inline instead.

Signed-off-by: David Aguilar <davvid@gmail.com>
pickler: add support for iterable __slots__

An interesting edge case in Python is:

    class ObjectWithIterableSlots(object):
         __slots__ = iter('a')
         def __init__(self, a):
             self.a = a

    print(jsonpickle.encode(ObjectWithIterableSlots('a')))

The reason this is tricky is because __slots__ is an iterator
object and is consumed the first time it is used.  The initial
consumer may be python itself when building the class object.

There's no way to reset an iterator in Python but we can at
least use dir() to find attribute names when the __slots__
iterator has already been consumed.

Fallback to using dir() if we don't find any attributes when
iterating over __slots__.

Closes #67

Reported-by: Jason R. Coombs <jaraco@jaraco.com>
Helped-by: Marcin Tustin <marcin.tustin@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
tests: fix tests on python3

u'' is not portable.

Signed-off-by: David Aguilar <davvid@gmail.com>
tests: minor whitespace and comment cleanup

Signed-off-by: David Aguilar <davvid@gmail.com>
tests: fix tests on Python 3.4

Python 3.4's object.__new__() takes a single parameter only.

Signed-off-by: David Aguilar <davvid@gmail.com>
pickler: add support for string __slots__

Closes #66

Reported-by: Jason R. Coombs <jaraco@jaraco.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
jsonpickle: add an optional `warn` flag to encode()

Teach jsonpickle to warn about objects that it cannot directly
serialize, e.g. file descriptors.

Add tests to verify that we properly serialize these objects as None.

Closes #3

Signed-off-by: David Aguilar <davvid@gmail.com>
Merge pull request #1 from jsonpickle/master

refresh from jsonpickle master