Update unit tests for Python 3.5 compatability

Bug #1473688 reported by Jason Gerard DeRose
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Dbase32
Fix Released
High
Jason Gerard DeRose

Bug Description

Python 3.5 makes some changes in the exact TypeError messages used when it comes to the Python Buffer Protocol.

Specifically for Dbase32, the C backend TypeError messages will differ on Python 3.4 vs 3.5 when the "y#" and "s#" formats are used with PyArg_ParseTuple(), which effects 4 of the 6 dbase32 functions:

dbase32.db32enc()
dbase32.db32dec()
dbase32.isdb32()
dbase32.check_db32()

For example, Python 3.4:

>>> from dbase32 import db32dec
>>> db32dec(76)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' does not support the buffer interface

Vs Python 3.5:

>>> from dbase32 import db32dec
>>> db32dec(76)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: a bytes-like object is required, not 'int'

So the Dbase32 unit tests need to be updated to test against the new TypeError message format for Python >= 3.5, while still also being able to test against the old TypeError format for Python < 3.5, as Python 3.4 support isn't being dropped. (Actually, Dbase32 should still be compatible with Python 3.3 as well, but that's not actively tested by me anymore, so YMMV.)

A small update is also needed in the pure-Python dbase32._dbase32py fallback/reference implementation as it emulates the TypeError behaviour of the "y#" and "s#" C formats.

Related branches

description: updated
Changed in dbase32:
importance: Undecided → High
assignee: nobody → Jason Gerard DeRose (jderose)
description: updated
description: updated
summary: - Update unit tests for Python 3.5 support
+ Update unit tests for Python 3.5 compatability
Changed in dbase32:
status: New → Fix Committed
Changed in dbase32:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.