Skip to content

Commit fb5e0f8

Browse files
Tweaks for swig v4.4
I've started testing the development version of swig, and these small changes enable it to work satisfactorily.
1 parent 1e6e15e commit fb5e0f8

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# python-exiv2 - Python interface to libexiv2
22
# http://github.com/jim-easterbrook/python-exiv2
3-
# Copyright (C) 2021-24 Jim Easterbrook jim@jim-easterbrook.me.uk
3+
# Copyright (C) 2021-25 Jim Easterbrook jim@jim-easterbrook.me.uk
44
#
55
# This program is free software: you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License as published by
@@ -153,6 +153,8 @@ def get_mod_src_dir(exiv2_version):
153153
extra_compile_args = []
154154
define_macros = [('PY_SSIZE_T_CLEAN', None),
155155
('SWIG_TYPE_TABLE', 'exiv2')]
156+
if sys.version_info < (3, 9):
157+
define_macros.append(('SWIG_NO_HEAPTYPES', None))
156158
if platform in ('linux', 'darwin', 'mingw'):
157159
extra_compile_args = [
158160
'-O3', '-Wno-unused-variable', '-Wno-unused-function',

tests/test_value.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,9 @@ def test_Date(self):
355355
self.assertEqual(dict(value), {
356356
'year': today.year, 'month': today.month, 'day': today.day})
357357
value['day'] = 1
358-
with self.assertRaises(TypeError):
358+
with self.assertRaises((AttributeError, TypeError)):
359359
del value['day']
360-
with self.assertRaises(TypeError):
360+
with self.assertRaises((AttributeError, TypeError)):
361361
del value.day
362362

363363
def do_test_DateValue(self, py_date):
@@ -421,9 +421,9 @@ def test_Time(self):
421421
'hour': now.hour, 'minute': now.minute, 'second': now.second,
422422
'tzHour': 1, 'tzMinute': 30})
423423
value['second'] = 1
424-
with self.assertRaises(TypeError):
424+
with self.assertRaises((AttributeError, TypeError)):
425425
del value['second']
426-
with self.assertRaises(TypeError):
426+
with self.assertRaises((AttributeError, TypeError)):
427427
del value.second
428428

429429
def do_test_TimeValue(self, py_time):

utils/build_swig.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# python-exiv2 - Python interface to exiv2
22
# http://github.com/jim-easterbrook/python-exiv2
3-
# Copyright (C) 2021-24 Jim Easterbrook jim@jim-easterbrook.me.uk
3+
# Copyright (C) 2021-25 Jim Easterbrook jim@jim-easterbrook.me.uk
44
#
55
# This program is free software: you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License as published by
@@ -152,7 +152,7 @@ def main():
152152
# Functions with just one parameter and a default value don't
153153
# work with fastunpack.
154154
# See https://github.com/swig/swig/issues/2786
155-
if swig_version < (4, 4, 0) and ext_name in (
155+
if swig_version < (4, 5, 0) and ext_name in (
156156
'basicio', 'exif', 'iptc', 'metadatum', 'value', 'xmp'):
157157
cmd.append('-nofastunpack')
158158
cmd += ['-o', os.path.join(output_dir, ext_name + '_wrap.cxx')]

0 commit comments

Comments
 (0)