Codebase list python-magic-ahupp / 8852eaf
Fix https://github.com/ahupp/python-magic/issues/190 Adam Hupp 4 years ago
4 changed file(s) with 15 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
6464
6565 magic_load(self.cookie, magic_file)
6666
67
68 # For https://github.com/ahupp/python-magic/issues/190
69 # libmagic has fixed internal limits that some files exceed, causing
70 # an error. We can avoid this (at least for the sample file given)
71 # by bumping the limit up. It's not clear if this is a general solution
72 # or whether other internal limits should be increased, but given
73 # the lack of other reports I'll assume this is rare.
74 self.setparam(MAGIC_PARAM_NAME_MAX, 64)
75
6776 def from_buffer(self, buf):
6877 """
6978 Identify the contents of `buf`
66 THISDIR=`dirname $0`
77 export PYTHONPATH=${THISDIR}/..
88
9 PYTHONS="python2.7 python3.5"
9 PYTHONS="python2.7 python3.5 python3.7"
1010
1111 for pyver in $PYTHONS; do
1212 if which $pyver > /dev/null; then
147147 m.setparam(magic.MAGIC_PARAM_INDIR_MAX, 1)
148148 self.assertEqual(m.getparam(magic.MAGIC_PARAM_INDIR_MAX), 1)
149149
150 def test_name_count(self):
151 m = magic.Magic()
152 with open('testdata/python-3.7.2-python-magic-0.4.15.jpg', 'rb') as f:
153 m.from_buffer(f.read())
154
150155 if __name__ == '__main__':
151156 unittest.main()