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

Python 3.11 #424

Merged
merged 3 commits into from
Jul 24, 2023
Merged

Python 3.11 #424

merged 3 commits into from
Jul 24, 2023

Conversation

flichtenheld
Copy link
Contributor

@flichtenheld flichtenheld commented Jul 18, 2023

I see no way of reusing the current versions of mkdir and rmdir from pathlib. So we just need to copy them and implement on our own. The versions here are copied verbatim from Python 3.10.

Edit: Extended the patch to also fix glob. Slightly different problem. We don't need to override glob itself,
but the newly added _scandir which we need to redirect to our accessor.

I implemented a basic UT for mkdir to understand how the UTs work. Note that this UT does not actually test the
bug since it tests directly the ArtifactoryAccessor and not the ArtifactoryPath.

Fixes: #415
Fixes: #396

pathlib in Python 3.11 implements mkdir and rmdir directly
in terms of calling os.<func> without any accessor layer.
So copy the implementations of those functions from Python
3.10 to get the previous behavior back.

Fixes: devopshq#415

Signed-off-by: Frank Lichtenheld <[email protected]>
Python 3.11 replaced _accessor.scandir with _scandir.
Override _scandir to still use our implementation.
Should be a noop on older Python versions because they
didn't have _scandir at all.

Fixes: devopshq#396

Signed-off-by: Frank Lichtenheld <[email protected]>
Copy link
Member

@allburov allburov left a comment

Choose a reason for hiding this comment

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

LGTM

@ktdreyer
Copy link
Contributor

Thank you for fixing these methods!

I've also found iterdir() is broken in py311, and I've fixed it in #433

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

Successfully merging this pull request may close these issues.

dohq-artifactory doesn't work with Python 3.11.2 glob method broken in python 3.11
4 participants