Skip to content

Conversation

@Valentin-Sarthou
Copy link

Hello,
I encountered an error when trying to use this module with Python 3.14, and I tried to suggest the appropriate changes in this PR.

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.

🚀

@allburov
Copy link
Member

TypeError: PurePath.init() got an unexpected keyword argument 'auth'

Tests for py 3.14 failed 🤔

Between Python 3.13 and Python 3.14:
- glob._Globber was renamed to glob._GlobberBase
- Support for passing keyword arguments to pathlib.Path has been removed

Guard changes with Python 3.14 version check.
@Valentin-Sarthou
Copy link
Author

It seems that many changes have been made to pathlib between Python 3.13 and 3.14 (python/cpython@f5ba74b), which seems to make the changes done in 32cdad0 irrelevant with Python 3.14, especially these lines:

artifactory/artifactory.py

Lines 1898 to 1905 in 32cdad0

def glob(self, *args, **kwargs):
if IS_PYTHON_3_13_OR_NEWER:
# In Python 3.13, the implementation of Path.glob() changed such that it assumes that it
# works only with real filesystem paths and will try to call real filesystem operations like
# os.scandir(). In Python 3.13, we explicitly intercept this and call PathBase's glob()
# implementation, which only depends on methods defined on the Path subclass.
return pathlib._abc.PathBase.glob(self, *args, **kwargs)
return super().glob(*args, **kwargs)

pathlib._abc.PathBase has been removed and kind of replaced by pathlib.types._ReadablePath, but I don't think _ReadablePath.glob() is a good replacement because it uses a hardcoded globber class _PathGlobber:
https://github.com/python/cpython/blob/7cafd76a7fc6e52d93dd11e454a49c4dbebdf080/Lib/pathlib/types.py#L300-L314

The _globber attribute has been removed anyway in python/cpython@f5ba74b, which makes the following lines also irrelevant with Python 3.14:

artifactory/artifactory.py

Lines 1599 to 1603 in 32cdad0

# In Python 3.13, this attribute is accessed by PurePath.glob(), and we need to
# override it to behave properly for ArtifactoryPaths with a custom subclass of
# glob._Globber.
if IS_PYTHON_3_13_OR_NEWER:
_globber = _ArtifactoryGlobber

@allburov I'm not sure what's the best approach here, so maybe I'll leave this to you.

@sverrehu
Copy link

Would love to see this fix reach artifactory-cleanup. :-)

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.

3 participants