Skip to content

Commit

Permalink
Fix for #281: string literal auto-encoded with 'ascii' for Py3
Browse files Browse the repository at this point in the history
  • Loading branch information
robbmcleod committed Sep 12, 2017
1 parent bece07a commit a2d3efe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Changes from 2.6.2 to 2.6.3
- Fix for #277 whereby arrays of shape (1,...) would be reduced as
if they were full reduction. Behavoir now matches that of NumPy.

- String literals are automatically encoded into 'ascii' bytes for
convience (see #281).

Changes from 2.6.1 to 2.6.2
===========================

Expand Down
2 changes: 2 additions & 0 deletions numexpr/necompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ def convertConstantToKind(x, kind):
# Exception for 'float' types that will return the NumPy float32 type
if kind == 'float':
return numpy.float32(x)
elif sys.version_info[0] >= 3 and isinstance(x,str):
return x.encode('ascii')
return kind_to_type[kind](x)


Expand Down

0 comments on commit a2d3efe

Please sign in to comment.