kosqx / better-bencode

Fast, standard compliant Bencode serialization
Other
20 stars 5 forks source link

Use Py_ssize_t rather than int for sizes #10

Closed jelmer closed 3 years ago

jelmer commented 3 years ago

Use Py_ssize_t rather than int for sizes.

This fixes warnings from the C Python library at run time on newer versions of Python 3, e.g. during the test suite:

tests/test_bencode.py: 28 warnings /home/jelmer/src/better-bencode/tests/test_bencode.py:78: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats assert module.loads(binary) == struct

tests/test_bencode.py: 28 warnings /home/jelmer/src/better-bencode/tests/test_bencode.py:89: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats assert module.dumps(struct) == binary

tests/test_bencode.py: 56 warnings /home/jelmer/src/better-bencode/tests/test_bencode.py:95: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats module.dump(struct, fp)

tests/test_bencode.py: 46 warnings /home/jelmer/src/better-bencode/tests/test_bencode.py:224: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats module.loads(binary)

tests/test_bencode.py: 12 warnings /home/jelmer/src/better-bencode/tests/test_bencode.py:284: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats dumped = module.dumps(indata, cast=True)

tests/test_bencode.py: 12 warnings /home/jelmer/src/better-bencode/tests/test_bencode.py:286: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats