Skip to content

Remove Python 2 compatibility shims#34

Merged
uilianries merged 10 commits into
conan-io:masterfrom
xmo-odoo:patch-1
Oct 1, 2025
Merged

Remove Python 2 compatibility shims#34
uilianries merged 10 commits into
conan-io:masterfrom
xmo-odoo:patch-1

Conversation

@xmo-odoo
Copy link
Copy Markdown

@xmo-odoo xmo-odoo commented Aug 9, 2024

Python 2 compatibility was removed in #31 so these should not be useful / necessary anymore.

Python 2 compatibility was removed in conan-io#31 so these should not be useful / necessary anymore.
The CLI mode uses `sys` internally but has its own import.
It does almost nothing at this point and is only used by one caller, so can be inlined.
@memsharded
Copy link
Copy Markdown
Member

Thanks for your contribution, sorry it wasn't handled earlier.

@uilianries maybe this change helps a bit with conan-io/conan#16727?
As using the right with open() could be related to problems with large files, as file handlers not being correctly closed?

@lunacd
Copy link
Copy Markdown

lunacd commented Sep 30, 2025

Any update on this? I was meaning to add type hints to this, but the traces of Python2 in here is making things harder than it needs to be :)

Signed-off-by: Uilian Ries <uilianr@jfrog.com>
Signed-off-by: Uilian Ries <uilianr@jfrog.com>
Signed-off-by: Uilian Ries <uilianr@jfrog.com>
@uilianries
Copy link
Copy Markdown
Member

I just fixed some minor mistakes using replace all in the code, and added a new test to validate when applying a 30MB patch file.

Signed-off-by: Uilian Ries <uilianr@jfrog.com>
Signed-off-by: Uilian Ries <uilianr@jfrog.com>
Signed-off-by: Uilian Ries <uilianr@jfrog.com>
Copy link
Copy Markdown
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for your contribution @xmo-odoo and @uilianries for reviewing and testing

@uilianries uilianries merged commit e209ff9 into conan-io:master Oct 1, 2025
6 checks passed
@uilianries
Copy link
Copy Markdown
Member

@xmo-odoo Hello! Release 1.19.0 just arrived with your current PR!

You can find its changelog at https://github.com/conan-io/python-patch-ng/releases/tag/1.19.0

Please, update your local version of Python Patch-NG and feel free to give us your feedback:

pip install -U patch-ng

Regards!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants