[issue33039] int() and math.trunc don't accept objects that only define __index__

2019-05-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Then let to continue the discussion on the older issue which has larger discussion. -- resolution: -> duplicate stage: patch review -> resolved status: open -> closed superseder: -> type() constructor should bind __int__ to __index__ when __index

[issue33039] int() and math.trunc don't accept objects that only define __index__

2019-05-06 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi Cheryl, thanks for the ping. I wasn't sure my patch was correct but reading typeobject.c:add_operators(), it is actually more straight-forward than I thought. Serhiy Storchaka: This is indeed a duplicate of issue20092. I believe the solution proposed by N

[issue33039] int() and math.trunc don't accept objects that only define __index__

2019-05-06 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- keywords: +patch pull_requests: +13020 stage: needs patch -> patch review ___ Python tracker ___ ___ Pyth

[issue33039] int() and math.trunc don't accept objects that only define __index__

2019-04-17 Thread Cheryl Sabella
Cheryl Sabella added the comment: Rémi, Are you still working on the patch for this? Thanks! -- nosy: +cheryl.sabella ___ Python tracker ___ _

[issue33039] int() and math.trunc don't accept objects that only define __index__

2019-02-21 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Yes it is. Thanks for finding that @Serhiy. Since nobody objected to the change on the mailing list and people seem to agree in issue 20092: [R. David Murray] To summarize for anyone like me who didn't follow that issue: __index__ means the object can

[issue33039] int() and math.trunc don't accept objects that only define __index__

2019-02-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Is not this a duplicate of issue20092? -- ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue33039] int() and math.trunc don't accept objects that only define __index__

2019-02-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue33039. -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mai

[issue33039] int() and math.trunc don't accept objects that only define __index__

2019-01-12 Thread Nick Coghlan
Nick Coghlan added the comment: @Rémi Aye, filling out derived slots is one of the things PyType_Ready does. This would need a discussion on python-dev before going ahead and doing it though, as the closest equivalent we have to this right now is the "negative" derivation, where overriding __

[issue33039] int() and math.trunc don't accept objects that only define __index__

2018-12-31 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: >I think we should also consider changing the type creation behaviour in 3.8 @ncoghlan is this what's being done in PyTypeReady? -- nosy: +remi.lapeyre ___ Python tracker

[issue33039] int() and math.trunc don't accept objects that only define __index__

2018-09-22 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue33039] int() and math.trunc don't accept objects that only define __index__

2018-03-10 Thread Nick Coghlan
Nick Coghlan added the comment: Marking this as a documentation enhancement request for now, but I think we should also consider changing the type creation behaviour in 3.8 to implicitly add __int__ and __trunc__ definitions when __index__ is defined, but they aren't. That way, no behaviour

[issue33039] int() and math.trunc don't accept objects that only define __index__

2018-03-10 Thread Nick Coghlan
New submission from Nick Coghlan : (Note: I haven't categorised this yet, as I'm not sure how it *should* be categorised) Back when the __index__/nb_index slot was added, the focus was on allowing 3rd party integer types to be used in places where potentially lossy conversion with __int__/nb_