diff --git a/debian/changelog b/debian/changelog index 889ef7bb73a302de716f744513da14a249d680d9..5aff953b7d6ebb99b1ebff87078998c30c436ac5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ dh-python (6.20240402) UNRELEASED; urgency=medium * Add support for Python 3.11 and 3.12 in test_interpreter. * Add generic test for the current default Python 3 interpreter in test_interpreter. + * dh_python3: Don't rename _module to module. (Closes: #1068255) -- Stefano Rivera <stefanor@debian.org> Mon, 22 Apr 2024 18:33:09 -0400 diff --git a/dhpython/interpreter.py b/dhpython/interpreter.py index 517b0790a455b9b36dbb0989bab77ef8ca428487..2e1c06d5241b755db05acf85c2face3a16c5110b 100644 --- a/dhpython/interpreter.py +++ b/dhpython/interpreter.py @@ -450,7 +450,9 @@ class Interpreter: tmp_multiarch = info['multiarch'] or multiarch result = info['name'] - if result.endswith('module') and result != 'module' and self.impl == 'cpython3': + if (result.endswith('module') + and result not in ('module', '_module') + and self.impl == 'cpython3'): result = result[:-6] if tmp_soabi: diff --git a/tests/test_interpreter.py b/tests/test_interpreter.py index f1cf55b1848a4f46dc532d7865989c301068cce4..7f7dacdb4b69a64848b4e1803467579b7a2601f6 100644 --- a/tests/test_interpreter.py +++ b/tests/test_interpreter.py @@ -261,5 +261,12 @@ class TestInterpreter(unittest.TestCase): self.assertIsNone(i.check_extname('foo.abi3.so')) self.assertEqual(i.check_extname('foo/bar/bazmodule.so'), rf'foo/bar/baz.cpython-{pyver}d-MYARCH.so') + def test_bare_module(self): + i = Interpreter('python{}.{}'.format(*sys.version_info[:2])) + pyver = '{}{}'.format(*sys.version_info[:2]) + self.assertEqual(i.check_extname('module.so'), rf'module.cpython-{pyver}-MYARCH.so') + self.assertEqual(i.check_extname('_module.so'), rf'_module.cpython-{pyver}-MYARCH.so') + + if __name__ == '__main__': unittest.main()