8000 BUG: Disable hex(np.floating) and oct(np.floating) on python 2 by eric-wieser · Pull Request #10765 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Disable hex(np.floating) and oct(np.floating) on python 2 #10765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

eric-wieser
Copy link
Member
@eric-wieser eric-wieser commented Mar 19, 2018

This makes them match the behavior of hex(float) and oct(float) on python 2

Note that np.float16.__hex__ still exists, which calls np.generic.__hex__ndarray.__hex__np.float16::tp_number.nb_hex. Unfortunately #9972 means __hex__ and nb_hex are out of sync.

* cfloat, cdouble, clongdouble)*2#
* #oper = oct*7, hex*7#
*/
#define @name@_@oper@ NULL
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's precedent for this approach with #define @name@_invert NULL

@charris
Copy link
Member
charris commented Apr 10, 2018

I wonder if this is worth doing at this late point when we are about to drop 2.7 support. It has the potential to cause some pain downstream and I don't see that we gain much benefit.

@eric-wieser
Copy link
Member Author

For users planning to upgrade to python 3 anyway, this is pain they'll experience when they transition - arguably it's worth getting some of the pain out of the way.

@eric-wieser
Copy link
Member Author

I'd be surprised if this causes pain downstream - hex(1.5) and oct(1.5) already fail on python 2 - it's just a weird quirk that hex(np.float64(1.5)) == '0x1L'.

@mattip
Copy link
Member
mattip commented Feb 17, 2019

We should either close this or add tests and get it in

@eric-wieser
Copy link
Member Author

@mattip: Into 1.16.x, you mean?

@mattip
Copy link
Member
mattip commented Feb 17, 2019

yes

@eric-wieser
Copy link
Member Author

Updated with tests

@eric-wieser eric-wieser changed the base branch from master to maintenance/1.16.x February 17, 2019 23:07
This makes them match the behavior of hex(float) and oct(float)
@mattip
8000
Copy link
Member
mattip commented Feb 18, 2019

Tests are failing with infinite recursion

@eric-wieser
Copy link
Member Author

Bizarre...

@eric-wieser
Copy link
Member Author
eric-wieser commented Feb 18, 2019

Ah, this is the fun scalar type recursion where generic.__meth__(self) calls np.asarray(self).__meth(), and ndarray.__meth__() calls self.item().__meth__().

Longdouble seem to be the only type that forms a loop here (#8547)

@mattip mattip added 57 - Close? Issues which may be closable unless discussion continued and removed 54 - Needs decision labels Apr 26, 2019
@charris
Copy link
Member
charris commented May 11, 2019

Leave be to avoid churn.

@charris charris closed this May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 57 - Close? Issues which may be closable unless discussion continued component: numpy._core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0