Skip to content

r/l shift on uint64 scalar and python int failing #4151

Closed

Description

@mattip

#64 bit ubuntu

np.array(123, dtype='uint64') >> np.array(1, dtype='uint64')
61

np.array(123, dtype='uint64') >> 0
Traceback (most recent call last):
File "", line 1, in
TypeError: ufunc 'right_shift' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

np.version.version
'1.8.0.dev-4a9d23b'

platform.architecture()
('64bit', 'ELF')

Activity

  1. charris commented on Feb 24, 2014

    @charris
    Member

    The problem is that an attempt is made cast the signed 0 and unit64 to a common type. The problem looks specific to array scalar types

    In [46]: a = np.array([123]*2, dtype='uint64')
    
    In [47]: a >> 2
    Out[47]: array([30, 30], dtype=uint64)
    

    Due to the difference in array/scalar and scalar/scalar casting rules. This isn't the only place this causes a problem.

  2. ianwlarson commented on Jul 28, 2017

    @ianwlarson

    This issue also affects me.

  3. mattip commented on Sep 18, 2023

    @mattip
    MemberAuthor

    On 1.26 this raises a (conceptually correct) TypeError("ufunc 'right_shift' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule 'safe'"). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions