Skip to content

Commit

Permalink
Python 3 fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Jul 24, 2012
1 parent bdc795d commit 1ac7603
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions pyopencl/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
local_fetch_expr_args = set(
arg_name
for arg_name, ife_offsets in fetch_expr_offsets.iteritems()
for arg_name, ife_offsets in fetch_expr_offsets.items()
if -1 in ife_offsets or len(ife_offsets) > 1)
%>
Expand Down Expand Up @@ -758,7 +758,7 @@ def replace_id(match):
from warnings import warn
warn("leftover words in identifier prefixing: " + " ".join(leftovers))

return mako.template.Template(s, strict_undefined=True, disable_unicode=True)
return mako.template.Template(s, strict_undefined=True)

from pytools import Record
class _ScanKernelInfo(Record):
Expand Down Expand Up @@ -1265,7 +1265,7 @@ def copy_if(ary, predicate, extra_args=[], queue=None, preamble=""):
is an on-device scalar (fetch to host with `count.get()`) indicating
how many elements satisfied *predicate*.
"""
if len(ary) > np.iinfo(np.uint32):
if len(ary) > np.iinfo(np.uint32).max:
scan_dtype = np.uint64
else:
scan_dtype = np.uint32
Expand Down Expand Up @@ -1334,7 +1334,7 @@ def partition(ary, predicate, extra_args=[], queue=None, preamble=""):
is an on-device scalar (fetch to host with `count.get()`) indicating
how many elements satisfied the predicate.
"""
if len(ary) > np.iinfo(np.uint32):
if len(ary) > np.iinfo(np.uint32).max:
scan_dtype = np.uint64
else:
scan_dtype = np.uint32
Expand Down Expand Up @@ -1395,7 +1395,7 @@ def unique(ary, is_equal_expr="a == b", extra_args=[], queue=None, preamble=""):
how many elements satisfied the predicate.
"""

if len(ary) > np.iinfo(np.uint32):
if len(ary) > np.iinfo(np.uint32).max:
scan_dtype = np.uint64
else:
scan_dtype = np.uint32
Expand Down
4 changes: 2 additions & 2 deletions test/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ def test_dot(ctx_factory):

for a_dtype in dtypes:
for b_dtype in dtypes:
print a_dtype, b_dtype
print(a_dtype, b_dtype)
a_gpu = general_clrand(queue, (200000,), a_dtype)
a = a_gpu.get()
b_gpu = general_clrand(queue, (200000,), b_dtype)
Expand Down Expand Up @@ -943,7 +943,7 @@ def test_segmented_scan(ctx_factory):
seg_boundaries_values = []
for i in range(10):
seg_boundary_count = max(2, min(100, randrange(0, int(0.4*n))))
seg_boundaries = [randrange(n) for i in xrange(seg_boundary_count)]
seg_boundaries = [randrange(n) for i in range(seg_boundary_count)]
if n >= 1029:
seg_boundaries.insert(0, 1028)
seg_boundaries.sort()
Expand Down

0 comments on commit 1ac7603

Please sign in to comment.