Skip to content

Commit 8d21d59

Browse files
authored
Merge branch 'master' into PYTHON-5075
2 parents b5a9a0a + b922868 commit 8d21d59

File tree

107 files changed

+6819
-522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+6819
-522
lines changed

.evergreen/generated_configs/tasks.yml

Lines changed: 540 additions & 0 deletions
Large diffs are not rendered by default.

.evergreen/generated_configs/variants.yml

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -817,97 +817,110 @@ buildvariants:
817817
PYTHON_BINARY: /opt/python/3.13/bin/python3
818818

819819
# Ocsp tests
820-
- name: ocsp-rhel8-v4.4-python3.9
820+
- name: ocsp-rhel8-v4.2-python3.9
821821
tasks:
822822
- name: .ocsp
823-
display_name: OCSP RHEL8 v4.4 Python3.9
823+
display_name: OCSP RHEL8 v4.2 Python3.9
824824
run_on:
825825
- rhel87-small
826826
batchtime: 20160
827827
expansions:
828828
AUTH: noauth
829829
SSL: ssl
830830
TOPOLOGY: server
831-
VERSION: "4.4"
831+
VERSION: "4.2"
832832
PYTHON_BINARY: /opt/python/3.9/bin/python3
833-
- name: ocsp-rhel8-v5.0-python3.10
833+
- name: ocsp-rhel8-v4.4-python3.10
834834
tasks:
835835
- name: .ocsp
836-
display_name: OCSP RHEL8 v5.0 Python3.10
836+
display_name: OCSP RHEL8 v4.4 Python3.10
837837
run_on:
838838
- rhel87-small
839839
batchtime: 20160
840840
expansions:
841841
AUTH: noauth
842842
SSL: ssl
843843
TOPOLOGY: server
844-
VERSION: "5.0"
844+
VERSION: "4.4"
845845
PYTHON_BINARY: /opt/python/3.10/bin/python3
846-
- name: ocsp-rhel8-v6.0-python3.11
846+
- name: ocsp-rhel8-v5.0-python3.11
847847
tasks:
848848
- name: .ocsp
849-
display_name: OCSP RHEL8 v6.0 Python3.11
849+
display_name: OCSP RHEL8 v5.0 Python3.11
850850
run_on:
851851
- rhel87-small
852852
batchtime: 20160
853853
expansions:
854854
AUTH: noauth
855855
SSL: ssl
856856
TOPOLOGY: server
857-
VERSION: "6.0"
857+
VERSION: "5.0"
858858
PYTHON_BINARY: /opt/python/3.11/bin/python3
859-
- name: ocsp-rhel8-v7.0-python3.12
859+
- name: ocsp-rhel8-v6.0-python3.12
860860
tasks:
861861
- name: .ocsp
862-
display_name: OCSP RHEL8 v7.0 Python3.12
862+
display_name: OCSP RHEL8 v6.0 Python3.12
863863
run_on:
864864
- rhel87-small
865865
batchtime: 20160
866866
expansions:
867867
AUTH: noauth
868868
SSL: ssl
869869
TOPOLOGY: server
870-
VERSION: "7.0"
870+
VERSION: "6.0"
871871
PYTHON_BINARY: /opt/python/3.12/bin/python3
872-
- name: ocsp-rhel8-v8.0-python3.13
872+
- name: ocsp-rhel8-v7.0-python3.13
873873
tasks:
874874
- name: .ocsp
875-
display_name: OCSP RHEL8 v8.0 Python3.13
875+
display_name: OCSP RHEL8 v7.0 Python3.13
876876
run_on:
877877
- rhel87-small
878878
batchtime: 20160
879879
expansions:
880880
AUTH: noauth
881881
SSL: ssl
882882
TOPOLOGY: server
883-
VERSION: "8.0"
883+
VERSION: "7.0"
884884
PYTHON_BINARY: /opt/python/3.13/bin/python3
885-
- name: ocsp-rhel8-rapid-pypy3.10
885+
- name: ocsp-rhel8-v8.0-pypy3.10
886886
tasks:
887887
- name: .ocsp
888-
display_name: OCSP RHEL8 rapid PyPy3.10
888+
display_name: OCSP RHEL8 v8.0 PyPy3.10
889889
run_on:
890890
- rhel87-small
891891
batchtime: 20160
892892
expansions:
893893
AUTH: noauth
894894
SSL: ssl
895895
TOPOLOGY: server
896-
VERSION: rapid
896+
VERSION: "8.0"
897897
PYTHON_BINARY: /opt/python/pypy3.10/bin/python3
898-
- name: ocsp-rhel8-latest-python3.9
898+
- name: ocsp-rhel8-rapid-python3.9
899899
tasks:
900900
- name: .ocsp
901-
display_name: OCSP RHEL8 latest Python3.9
901+
display_name: OCSP RHEL8 rapid Python3.9
902902
run_on:
903903
- rhel87-small
904904
batchtime: 20160
905905
expansions:
906906
AUTH: noauth
907907
SSL: ssl
908908
TOPOLOGY: server
909-
VERSION: latest
909+
VERSION: rapid
910910
PYTHON_BINARY: /opt/python/3.9/bin/python3
911+
- name: ocsp-rhel8-latest-python3.10
912+
tasks:
913+
- name: .ocsp
914+
display_name: OCSP RHEL8 latest Python3.10
915+
run_on:
916+
- rhel87-small
917+
batchtime: 20160
918+
expansions:
919+
AUTH: noauth
920+
SSL: ssl
921+
TOPOLOGY: server
922+
VERSION: latest
923+
PYTHON_BINARY: /opt/python/3.10/bin/python3
911924
- name: ocsp-win64-v4.4-python3.9
912925
tasks:
913926
- name: .ocsp-rsa !.ocsp-staple
@@ -1338,6 +1351,7 @@ buildvariants:
13381351
- name: storage-inmemory-rhel8-python3.9
13391352
tasks:
13401353
- name: .standalone .noauth .nossl .4.0 .sync_async
1354+
- name: .standalone .noauth .nossl .4.2 .sync_async
13411355
- name: .standalone .noauth .nossl .4.4 .sync_async
13421356
- name: .standalone .noauth .nossl .5.0 .sync_async
13431357
- name: .standalone .noauth .nossl .6.0 .sync_async

.evergreen/scripts/generate_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# Globals
2727
##############
2828

29-
ALL_VERSIONS = ["4.0", "4.4", "5.0", "6.0", "7.0", "8.0", "rapid", "latest"]
29+
ALL_VERSIONS = ["4.0", "4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "rapid", "latest"]
3030
CPYTHONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]
3131
PYPYS = ["pypy3.10"]
3232
ALL_PYTHONS = CPYTHONS + PYPYS

.github/workflows/dist.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ jobs:
3535
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
3636
buildplat:
3737
- [ubuntu-20.04, "manylinux_x86_64", "cp3*-manylinux_x86_64"]
38-
- [ubuntu-24.04-arm, "manylinux_aarch64", "cp3*-manylinux_aarch64"]
39-
# Disabled pending PYTHON-5058
40-
# - [ubuntu-24.04, "manylinux_ppc64le", "cp3*-manylinux_ppc64le"]
41-
# - [ubuntu-24.04, "manylinux_s390x", "cp3*-manylinux_s390x"]
38+
- [ubuntu-20.04, "manylinux_aarch64", "cp3*-manylinux_aarch64"]
39+
- [ubuntu-20.04, "manylinux_ppc64le", "cp3*-manylinux_ppc64le"]
40+
- [ubuntu-20.04, "manylinux_s390x", "cp3*-manylinux_s390x"]
4241
- [ubuntu-20.04, "manylinux_i686", "cp3*-manylinux_i686"]
4342
- [windows-2019, "win_amd6", "cp3*-win_amd64"]
4443
- [windows-2019, "win32", "cp3*-win32"]
@@ -63,6 +62,10 @@ jobs:
6362
if: runner.os == 'Linux'
6463
uses: docker/setup-qemu-action@v3
6564
with:
65+
# setup-qemu-action by default uses `tonistiigi/binfmt:latest` image,
66+
# which is out of date. This causes seg faults during build.
67+
# Here we manually fix the version.
68+
image: tonistiigi/binfmt:qemu-v8.1.5
6669
platforms: all
6770

6871
- name: Install cibuildwheel

.github/workflows/release-python.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
pre-publish:
3838
environment: release
3939
runs-on: ubuntu-latest
40+
if: github.repository_owner == 'mongodb' || github.event_name == 'workflow_dispatch'
4041
permissions:
4142
id-token: write
4243
contents: write

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ To prevent the `synchro` hook from accidentally overwriting code, it first check
261261
of a file is changing and not its async counterpart, and will fail.
262262
In the unlikely scenario that you want to override this behavior, first export `OVERRIDE_SYNCHRO_CHECK=1`.
263263

264+
Sometimes, the `synchro` hook will fail and introduce changes many previously unmodified files. This is due to static
265+
Python errors, such as missing imports, incorrect syntax, or other fatal typos. To resolve these issues,
266+
run `pre-commit run --all-files --hook-stage manual ruff` and fix all reported errors before running the `synchro`
267+
hook again.
268+
264269
## Converting a test to async
265270
The `tools/convert_test_to_async.py` script takes in an existing synchronous test file and outputs a
266271
partially-converted asynchronous version of the same name to the `test/asynchronous` directory.

bson/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ def is_valid(bson: bytes) -> bool:
13861386
:param bson: the data to be validated
13871387
"""
13881388
if not isinstance(bson, bytes):
1389-
raise TypeError("BSON data must be an instance of a subclass of bytes")
1389+
raise TypeError(f"BSON data must be an instance of a subclass of bytes, not {type(bson)}")
13901390

13911391
try:
13921392
_bson_to_dict(bson, DEFAULT_CODEC_OPTIONS)

bson/binary.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def __new__(
290290
subtype: int = BINARY_SUBTYPE,
291291
) -> Binary:
292292
if not isinstance(subtype, int):
293-
raise TypeError("subtype must be an instance of int")
293+
raise TypeError(f"subtype must be an instance of int, not {type(subtype)}")
294294
if subtype >= 256 or subtype < 0:
295295
raise ValueError("subtype must be contained in [0, 256)")
296296
# Support any type that implements the buffer protocol.
@@ -321,7 +321,7 @@ def from_uuid(
321321
.. versionadded:: 3.11
322322
"""
323323
if not isinstance(uuid, UUID):
324-
raise TypeError("uuid must be an instance of uuid.UUID")
324+
raise TypeError(f"uuid must be an instance of uuid.UUID, not {type(uuid)}")
325325

326326
if uuid_representation not in ALL_UUID_REPRESENTATIONS:
327327
raise ValueError(
@@ -470,7 +470,7 @@ def as_vector(self) -> BinaryVector:
470470
"""
471471

472472
if self.subtype != VECTOR_SUBTYPE:
473-
raise ValueError(f"Cannot decode subtype {self.subtype} as a vector.")
473+
raise ValueError(f"Cannot decode subtype {self.subtype} as a vector")
474474

475475
position = 0
476476
dtype, padding = struct.unpack_from("<sB", self, position)

bson/code.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __new__(
5656
**kwargs: Any,
5757
) -> Code:
5858
if not isinstance(code, str):
59-
raise TypeError("code must be an instance of str")
59+
raise TypeError(f"code must be an instance of str, not {type(code)}")
6060

6161
self = str.__new__(cls, code)
6262

@@ -67,7 +67,7 @@ def __new__(
6767

6868
if scope is not None:
6969
if not isinstance(scope, _Mapping):
70-
raise TypeError("scope must be an instance of dict")
70+
raise TypeError(f"scope must be an instance of dict, not {type(scope)}")
7171
if self.__scope is not None:
7272
self.__scope.update(scope) # type: ignore
7373
else:

bson/codec_options.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,23 @@ def __new__(
401401
"uuid_representation must be a value from bson.binary.UuidRepresentation"
402402
)
403403
if not isinstance(unicode_decode_error_handler, str):
404-
raise ValueError("unicode_decode_error_handler must be a string")
404+
raise ValueError(
405+
f"unicode_decode_error_handler must be a string, not {type(unicode_decode_error_handler)}"
406+
)
405407
if tzinfo is not None:
406408
if not isinstance(tzinfo, datetime.tzinfo):
407-
raise TypeError("tzinfo must be an instance of datetime.tzinfo")
409+
raise TypeError(
410+
f"tzinfo must be an instance of datetime.tzinfo, not {type(tzinfo)}"
411+
)
408412
if not tz_aware:
409413
raise ValueError("cannot specify tzinfo without also setting tz_aware=True")
410414

411415
type_registry = type_registry or TypeRegistry()
412416

413417
if not isinstance(type_registry, TypeRegistry):
414-
raise TypeError("type_registry must be an instance of TypeRegistry")
418+
raise TypeError(
419+
f"type_registry must be an instance of TypeRegistry, not {type(type_registry)}"
420+
)
415421

416422
return tuple.__new__(
417423
cls,

0 commit comments

Comments
 (0)