Skip to content

MAINT: Rm meaningless checks in determining typeless data#22586

Merged
seberg merged 1 commit intonumpy:mainfrom
rossbar:maint/arrayprint-type-cleanup
Nov 14, 2022
Merged

MAINT: Rm meaningless checks in determining typeless data#22586
seberg merged 1 commit intonumpy:mainfrom
rossbar:maint/arrayprint-type-cleanup

Conversation

@rossbar
Copy link
Copy Markdown
Contributor

@rossbar rossbar commented Nov 14, 2022

Cleanup some checks that were only relevant for Python2

The issubclass should always be false in Python3, so this change
should not change behavior.
@seberg seberg changed the title MAINT: Rm unnecessary checks in determining typeless data. MAINT: Rm meaningless checks in determining typeless data Nov 14, 2022
@seberg
Copy link
Copy Markdown
Member

seberg commented Nov 14, 2022

Going to put it in, thanks. But the check still had a purpose: hiding the dtype=... for longlong and for long both when they have the same itemsize.
So to get that back working, as an enhancement, you would need to add it back as an itemsize check.

@seberg seberg merged commit 2b5328c into numpy:main Nov 14, 2022
@rossbar
Copy link
Copy Markdown
Contributor Author

rossbar commented Nov 14, 2022

But the check still had a purpose: hiding the dtype=... for longlong and for long both when they have the same itemsize.

IIUC, long is an alias for int_ so is already covered. So then the missing case is when longlong has the same number of bytes as int_, is that right? So the check might look something like:

if np.longlong(1).itemsize == np.int_(1).itemsize:
    _typelessdata.append(np.longlong)

or have I misunderstood?

@seberg
Copy link
Copy Markdown
Member

seberg commented Nov 15, 2022

Int is long, so its either longlong or cint. Both paths that existed are necessary. One for windows (mainly) one for others (the longlong).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants