Skip to content

Commit 9b8e52d

Browse files
committed
New distribution [0.15.5]
* bugfix for potential DictDumper unsupported data exceptions (introduced a fallback encoder) * thanks for #65 to raise this issue
1 parent da8025e commit 9b8e52d

File tree

8 files changed

+34
-4
lines changed

8 files changed

+34
-4
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ insert_final_newline = true
1010

1111
[*.yml]
1212
indent_size = 2
13+
14+
[*.json]
15+
indent_size = 2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ sample/test
2525
test/pcapkit
2626
test/dictdumper
2727
deprecated/
28+
temp
2829

2930
# Created by https://www.gitignore.io/api/macos,python,visualstudiocode
3031

doc/sphinx/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = 'Jarry Shaw'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = '0.15.4'
25+
release = '0.15.5'
2626

2727

2828
# -- General configuration ---------------------------------------------------

pcapkit/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from pcapkit.interface import JSON, PLIST, TREE
1616

1717
#: version number
18-
__version__ = '0.15.4'
18+
__version__ = '0.15.5'
1919

2020

2121
def get_parser():

pcapkit/foundation/extraction.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,19 @@ def object_hook(self, o):
694694
return o.info2dict()
695695
return super().object_hook(o)
696696

697+
def default(self, o):
698+
"""Check content type for function call."""
699+
return 'fallback'
700+
701+
def _append_fallback(self, value, file):
702+
if hasattr(value, '__slots__'):
703+
new_value = {key: getattr(value, key) for key in value.__slots__}
704+
else:
705+
new_value = vars(value)
706+
707+
func = self._encode_func(new_value)
708+
func(new_value, file)
709+
697710
self._ofile = DictDumper if self._flag_f else DictDumper(ofnm) # output file
698711

699712
self.check() # check layer & protocol

pcapkit/foundation/traceflow.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,19 @@ def object_hook(self, o):
187187
return o.info2dict()
188188
return super().object_hook(o)
189189

190+
def default(self, o):
191+
"""Check content type for function call."""
192+
return 'fallback'
193+
194+
def _append_fallback(self, value, file):
195+
if hasattr(value, '__slots__'):
196+
new_value = {key: getattr(value, key) for key in value.__slots__}
197+
else:
198+
new_value = vars(value)
199+
200+
func = self._encode_func(new_value)
201+
func(new_value, file)
202+
190203
return DictDumper, fmt
191204

192205
def dump(self, packet):

pcapkit/vendor/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pcapkit.vendor import __all__ as vendor_all
1212

1313
#: version string
14-
__version__ = '0.15.4'
14+
__version__ = '0.15.5'
1515

1616

1717
def get_parser():

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import sys
55

66
# version string
7-
__version__ = '0.15.4.post1'
7+
__version__ = '0.15.5'
88

99
# README
1010
with open('README.md', encoding='utf-8') as file:

0 commit comments

Comments
 (0)