[Python] Deprecate TObject __eq__ pythonization#19145
[Python] Deprecate TObject __eq__ pythonization#19145guitargeek merged 1 commit intoroot-project:masterfrom
__eq__ pythonization#19145Conversation
|
Just a fly-by thought, this pythonization has been around for so many years that, while I still strongly believe its current implementation is buggy, I am afraid this will introduce a backwards-incompatible behaviour far, far worse than #19061. One possible way to mitigate this is to have a check that if there is no |
Test Results 20 files 20 suites 3d 19h 51m 59s ⏱️ Results for commit 37f4365. |
|
That's exactly my intention! I wanted to see what the CI says, and if there are no problems deprecate this Pythonization.
In my opinion, the silent behavior changes that are far worse. Removing a method like suggested by this PR at least gives you an error (or warning after this PR is updated). You also have to see the picture with ROOT 6.34 before the UHI introduction in 6.36. What you guys did with the new
Yes, and this is a bonus 🙂 |
Only if we make sure this won't disrupt users' code. As things stand, this PR cannot be merged. My suggestion is to start a deprecation phase with a warning, then make it an exception or not implemented in a later ROOT release like 6.40 or 6.42 |
37f4365 to
49ca964
Compare
__eq__ pythonization__eq__ pythonization
Good idea! I have implemented what you suggested, and also added an entry in the release notes. |
49ca964 to
c0d6501
Compare
vepadulano
left a comment
There was a problem hiding this comment.
Great thank you! Let's see if it doesn't break any existing test in the CI, then this can be merged 👍
The TObject `__eq__` pythonization calls `TObject::Equals()`, which by default does a pointer comparison. That can be very confusing for Python users.
c0d6501 to
6dd67b2
Compare
This is bad practice in Python, because it only works if the type of the operand implements the equality operator. In particular, it will fail with newer ROOT versions, because the `TObject` base class won't implement the equality operator anymore: root-project/root#19145
This is bad practice in Python, because it only works if the type of the operand implements the equality operator. In particular, it will fail with newer ROOT versions, because the `TObject` base class won't implement the equality operator anymore: root-project/root#19145 This commit was done automatically with code modernization tools.
This is bad practice in Python, because it only works if the type of the operand implements the equality operator. In particular, it will fail with newer ROOT versions, because the `TObject` base class won't implement the equality operator anymore: root-project/root#19145 This commit was done automatically with code modernization tools.
This is bad practice in Python, because it only works if the type of the operand implements the equality operator. In particular, it will fail with newer ROOT versions, because the `TObject` base class won't implement the equality operator anymore: root-project/root#19145 This commit was done automatically with code modernization tools.
The TObject
__eq__pythonization callsTObject::Equals(), which by default does a pointer comparison. That can be very confusing for Python users.Here is how the current warning will look like: