Skip to content

Commit

Permalink
Version 3.2.3 (cdgriffith#66)
Browse files Browse the repository at this point in the history
Fixing pickling with default box (thanks to sdementen)
  • Loading branch information
cdgriffith authored Nov 13, 2018
1 parent f3ec16e commit 4291d6f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Code contributions:
- Matan Rosenberg (matan129)
- Matt Wisniewski (polishmatt)
- Martijn Pieters (mjpieters)
- (sdementen)

Suggestions and bug reporting:

Expand Down
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
---------

Version 3.2.3
~~~~~~~~~~~~~

* Fixing pickling with default box (thanks to sdementen)

Version 3.2.2
~~~~~~~~~~~~~

Expand Down
4 changes: 3 additions & 1 deletion box.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
__all__ = ['Box', 'ConfigBox', 'BoxList', 'SBox',
'BoxError', 'BoxKeyError']
__author__ = 'Chris Griffith'
__version__ = '3.2.1'
__version__ = '3.2.3'

BOX_PARAMETERS = ('default_box', 'default_box_attr', 'conversion_box',
'frozen_box', 'camel_killer_box', 'box_it_up',
Expand Down Expand Up @@ -492,6 +492,8 @@ def __getattr__(self, item):
except KeyError:
value = object.__getattribute__(self, item)
except AttributeError as err:
if item == "__getstate__":
raise AttributeError(item)
if item == '_box_config':
raise BoxError('_box_config key must exist')
kill_camel = self._box_config['camel_killer_box']
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
tests_require=["pytest", "coverage >= 3.6", "tox", "pytest-cov"],
install_requires=[],
author_email='[email protected]',
description='Python dictionaries with recursive dot notation access',
description='Advanced Python dictionaries with dot notation access',
long_description=long_description,
scripts=['box.py'],
py_modules=['box'],
Expand All @@ -43,6 +43,7 @@
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Development Status :: 5 - Production/Stable',
Expand Down
5 changes: 5 additions & 0 deletions test/test_functional_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,11 @@ def test_pickle(self):
assert bx == loaded2
loaded2.box_options = bx.box_options

def test_pickle_default_box(self):
bb = Box(default_box=True)
loaded = pickle.loads(pickle.dumps(bb))
assert bb == loaded

def test_conversion_dup_only(self):
with pytest.raises(BoxError):
Box(movie_data, conversion_box=False, box_duplicates='error')
Expand Down

0 comments on commit 4291d6f

Please sign in to comment.