Skip to content

PYTHON-5172 Remove __init__ from BinaryVector dataclass #2171

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

Closed

Conversation

caseyclements
Copy link
Contributor

This is an alternative approach to #2162.

@blink1073
Copy link
Member

ImportError while loading conftest '/home/runner/work/mongo-python-driver/mongo-python-driver/test/conftest.py'.
test/__init__.py:35: in <module>
    from pymongo.uri_parser import parse_uri
pymongo/__init__.py:91: in <module>
    from pymongo.asynchronous.mongo_client import AsyncMongoClient
pymongo/asynchronous/mongo_client.py:61: in <module>
    from bson.codec_options import DEFAULT_CODEC_OPTIONS, CodecOptions, TypeRegistry
bson/__init__.py:105: in <module>
    from bson.binary import (
bson/binary.py:231: in <module>
    class BinaryVector:
E   ValueError: 'padding' in __slots__ conflicts with class variable

@caseyclements
Copy link
Contributor Author

caseyclements commented Mar 3, 2025

ImportError while loading conftest '/home/runner/work/mongo-python-driver/mongo-python-driver/test/conftest.py'.
test/__init__.py:35: in <module>
    from pymongo.uri_parser import parse_uri
pymongo/__init__.py:91: in <module>
    from pymongo.asynchronous.mongo_client import AsyncMongoClient
pymongo/asynchronous/mongo_client.py:61: in <module>
    from bson.codec_options import DEFAULT_CODEC_OPTIONS, CodecOptions, TypeRegistry
bson/__init__.py:105: in <module>
    from bson.binary import (
bson/binary.py:231: in <module>
    class BinaryVector:
E   ValueError: 'padding' in __slots__ conflicts with class variable

Yeah. This is why I opened this new one up. Thought maybe you or @ShaneHarvey could see the issue. In #2162, I've removed the dataclass decorator. I've already implemented init, repr, and don't want ==, >=.... What do you guys think?

@blink1073
Copy link
Member

Ah, that explains why we added __init__ in the first place. I think we have no choice since the slots feature isn't available until Python 3.10.

@ShaneHarvey
Copy link
Member

I see, then let's close this PR and continue with the other one.

@ShaneHarvey ShaneHarvey closed this Mar 3, 2025
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.

3 participants