Skip to content
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

lib: Replaced __cmp__ method with compensating methods for Python3 functionality #4684

Merged
merged 3 commits into from
Dec 27, 2024

Conversation

arohanajit
Copy link
Contributor

wrt to #1809
This PR updates the __cmp__ method in saferef.py to be compatible with Python 3. Comparison methods __eq__
and __lt__ are implemented to maintain the same functionality without requiring changes elsewhere in the code.

Changes:

  • Added __eq__ method for equality comparison.
  • Added __lt__ method for less-than comparison.
  • The __cmp__ method now uses the rich comparison methods for its logic.

This shouldn't change overall behavior of saferef class.

@github-actions github-actions bot added Python Related code is in Python libraries labels Nov 11, 2024
@arohanajit arohanajit changed the title grass: Updated __cmp__ method for Python3 functionality lib: Updated __cmp__ method for Python3 functionality Nov 11, 2024
@petrasovaa
Copy link
Contributor

@echoix any suggestions here? Upstream has no fix for it. It's not used.

@echoix
Copy link
Member

echoix commented Nov 11, 2024

@echoix any suggestions here? Upstream has no fix for it. It's not used.

I'd need to have a deep look for this, as it might be impactful. I think we needed to revert one of my PRs that touched this if I remember well.

I'd be cautious and read well. Was it @wenzeslaus that has experience with this file?

Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

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

I would remove the __cmp__ (it is not used in Python3) and keep the rest.

@echoix
Copy link
Member

echoix commented Dec 26, 2024

Can you update the title too?

@arohanajit arohanajit changed the title lib: Updated __cmp__ method for Python3 functionality lib: Replaced __cmp__ method with compensating methods for Python3 functionality Dec 26, 2024
@echoix
Copy link
Member

echoix commented Dec 26, 2024

Great!

@echoix echoix dismissed petrasovaa’s stale review December 27, 2024 00:54

Removing cmp was adressed

@echoix echoix merged commit 306d596 into OSGeo:main Dec 27, 2024
27 checks passed
@github-actions github-actions bot added this to the 8.5.0 milestone Dec 27, 2024
@nilason
Copy link
Contributor

nilason commented Dec 28, 2024

This has broken GUI.

@echoix
Copy link
Member

echoix commented Dec 28, 2024

This has broken GUI.

Can you show a situation where it occurs?

@nilason
Copy link
Contributor

nilason commented Dec 28, 2024

GUI ”freezes” with an hourglass the end of startup.

@echoix
Copy link
Member

echoix commented Dec 28, 2024

GUI ”freezes” with an hourglass the end of startup.

In the meantime, I figured how to reproduce it. I'm almost finished validating the solution for it, and from what I understand, the implementation of eq isn't really the problem, it is its presence that has a problem. Let me finish debugging, after lunch

echoix added a commit to echoix/grass that referenced this pull request Dec 28, 2024
echoix pushed a commit to echoix/grass that referenced this pull request Dec 31, 2024
…nctionality (OSGeo#4684)

* updated cmp

* updated gt

* removed cmp
echoix added a commit to echoix/grass that referenced this pull request Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libraries Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants