Python3 Compat Problem: "Cannot use a bytes pattern on a string-like object"
Bug #1782416 reported by
Thomas Ward
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dkimpy |
Invalid
|
Undecided
|
Unassigned | ||
dkimpy (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
When attempting to call dkim.dkim_sign, and provide a message to the dkim_sign argument as either bytes or str, we get a type error that triggers in rfc822_parse within the __init__ of the DKIM class.
The type error states: "TypeError: cannot use a bytes pattern on a string-like object"
The line that errors is line 310 in the __init__.py:
lines = re.split(b"\r?\n", message)
I think we are attempting to do some type of regex split with bytes on message which is a string. Shouldn't the pattern be r"\r?\n" to indicate a regex pattern instead of a bytes pattern?
Note that this breaks the DKIM signature functions entirely, making signing useless in Python 3 on Ubuntu 18.04.
To post a comment you must log in.
Testing the package in `python3-dkim` this same problem occurs. Adding as "Affects dkimpy" in Ubuntu.