Skip to content

Commit

Permalink
Fixed TypeError when a unicode generator name was passed on Python 2.7
Browse files Browse the repository at this point in the history
Fixes #388.
  • Loading branch information
agronholm committed Dec 4, 2020
1 parent e6102e5 commit 3eb5ff9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Release Notes
=============

**UNRELEASED**

- Fixed regression introduced in 0.36.0 on Python 2.7 when a custom generator
name was passed as unicode (Scikit-build)
(``TypeError: 'unicode' does not have the buffer interface``)

**0.36.0 (2020-12-01)**

- Added official Python 3.9 support
Expand Down
5 changes: 5 additions & 0 deletions src/wheel/bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ def run(self):

def write_wheelfile(self, wheelfile_base, generator='bdist_wheel (' + wheel_version + ')'):
from email.message import Message

# Workaround for Python 2.7 for when "generator" is unicode
if sys.version_info < (3,) and not isinstance(generator, str):
generator = generator.encode('utf-8')

msg = Message()
msg['Wheel-Version'] = '1.0' # of the spec
msg['Generator'] = generator
Expand Down

0 comments on commit 3eb5ff9

Please sign in to comment.