Skip to content

Commit 8d3d31d

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongo-python-driver
2 parents 1d39d87 + 9d5d4fa commit 8d3d31d

13 files changed

+715
-49
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ repos:
66
- id: check-added-large-files
77
- id: check-case-conflict
88
- id: check-toml
9+
- id: check-json
910
- id: check-yaml
1011
exclude: template.yaml
1112
- id: debug-statements

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ the pages will re-render and the browser will automatically refresh.
224224
- Run the tests with `just run-tests`.
225225
- When done, run `just teardown-tests` to clean up.
226226

227+
## Enable Debug Logs
228+
- Use `-o log_cli_level="DEBUG" -o log_cli=1` with `just test` or `pytest`.
229+
- Add `log_cli_level = "DEBUG` and `log_cli = 1` to the `tool.pytest.ini_options` section in `pyproject.toml` for Evergreen patches or to enable debug logs by default on your machine.
230+
227231
## Re-sync Spec Tests
228232

229233
If you would like to re-sync the copy of the specification tests in the

bson/binary.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,10 @@ def from_vector(
450450
raise ValueError(f"padding does not apply to {dtype=}")
451451
elif dtype == BinaryVectorDtype.PACKED_BIT: # pack ints in [0, 255] as unsigned uint8
452452
format_str = "B"
453+
if 0 <= padding > 7:
454+
raise ValueError(f"{padding=}. It must be in [0,1, ..7].")
455+
if padding and not vector:
456+
raise ValueError("Empty vector with non-zero padding.")
453457
elif dtype == BinaryVectorDtype.FLOAT32: # pack floats as float32
454458
format_str = "f"
455459
if padding:

0 commit comments

Comments
 (0)