vsql-python 1.2.2__tar.gz → 1.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {vsql_python-1.2.2 → vsql_python-1.2.3}/PKG-INFO +1 -1
  2. {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql/_convert.py +7 -2
  3. {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql/_libvsql.c +6 -0
  4. {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/PKG-INFO +1 -1
  5. {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/scm_version.json +2 -2
  6. {vsql_python-1.2.2 → vsql_python-1.2.3}/tests/test_vsql.py +1 -0
  7. {vsql_python-1.2.2 → vsql_python-1.2.3}/.github/workflows/release.yml +0 -0
  8. {vsql_python-1.2.2 → vsql_python-1.2.3}/.github/workflows/test.yml +0 -0
  9. {vsql_python-1.2.2 → vsql_python-1.2.3}/.gitignore +0 -0
  10. {vsql_python-1.2.2 → vsql_python-1.2.3}/LICENSE +0 -0
  11. {vsql_python-1.2.2 → vsql_python-1.2.3}/MANIFEST.in +0 -0
  12. {vsql_python-1.2.2 → vsql_python-1.2.3}/README.md +0 -0
  13. {vsql_python-1.2.2 → vsql_python-1.2.3}/example/main.py +0 -0
  14. {vsql_python-1.2.2 → vsql_python-1.2.3}/internal/amalgamation/LICENSE +0 -0
  15. {vsql_python-1.2.2 → vsql_python-1.2.3}/internal/amalgamation/LICENSE-V +0 -0
  16. {vsql_python-1.2.2 → vsql_python-1.2.3}/internal/amalgamation/libvsql.c +0 -0
  17. {vsql_python-1.2.2 → vsql_python-1.2.3}/internal/amalgamation/libvsql.h +0 -0
  18. {vsql_python-1.2.2 → vsql_python-1.2.3}/libvsql_flags.json +0 -0
  19. {vsql_python-1.2.2 → vsql_python-1.2.3}/pyproject.toml +0 -0
  20. {vsql_python-1.2.2 → vsql_python-1.2.3}/scripts/update-amalgamation.sh +0 -0
  21. {vsql_python-1.2.2 → vsql_python-1.2.3}/setup.cfg +0 -0
  22. {vsql_python-1.2.2 → vsql_python-1.2.3}/setup.py +0 -0
  23. {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql/__init__.py +0 -0
  24. {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql/_connection.py +0 -0
  25. {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql/_errors.py +0 -0
  26. {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/SOURCES.txt +0 -0
  27. {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/dependency_links.txt +0 -0
  28. {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/scm_file_list.json +0 -0
  29. {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vsql-python
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: A DB-API 2.0 (PEP 249) driver for vsql, a single file or in-memory SQL database.
5
5
  Author-email: Elliot Chance <elliotchance@gmail.com>
6
6
  License-Expression: MIT
@@ -108,8 +108,13 @@ def to_param(value):
108
108
  return (lib.SQL_DOUBLE, lib.SQL_DOUBLE, 0, 0, value)
109
109
 
110
110
  if isinstance(value, str):
111
- # A CHARACTER VARYING as long as the string (which can't be 0).
112
- return (lib.SQL_CHAR, lib.SQL_VARCHAR, max(len(value), 1), 0, value.encode())
111
+ # A CHARACTER VARYING as long as the string (which can't be 0). A lone
112
+ # surrogate (such as from surrogateescape) can't be UTF-8.
113
+ try:
114
+ encoded = value.encode()
115
+ except UnicodeEncodeError as e:
116
+ raise DataError(f"{value!r} isn't valid Unicode: {e.reason}") from None
117
+ return (lib.SQL_CHAR, lib.SQL_VARCHAR, max(len(value), 1), 0, encoded)
113
118
 
114
119
  if isinstance(value, decimal.Decimal):
115
120
  if not value.is_finite():
@@ -607,6 +607,12 @@ static PyObject *get_string(SQLINTEGER stmt, SQLSMALLINT n) {
607
607
 
608
608
  PyObject *s = PyUnicode_DecodeUTF8(buf, (Py_ssize_t)(length + ind), NULL);
609
609
  PyMem_Free(large);
610
+ // vsql's strings are always UTF-8, but it should still be a DataError
611
+ // rather than a UnicodeDecodeError if one isn't.
612
+ if (s == NULL && PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) {
613
+ PyErr_Clear();
614
+ raise_error("22021", "character not in repertoire: the value isn't UTF-8", -1);
615
+ }
610
616
  return s;
611
617
  }
612
618
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vsql-python
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: A DB-API 2.0 (PEP 249) driver for vsql, a single file or in-memory SQL database.
5
5
  Author-email: Elliot Chance <elliotchance@gmail.com>
6
6
  License-Expression: MIT
@@ -1,7 +1,7 @@
1
1
  {
2
- "tag": "1.2.2",
2
+ "tag": "1.2.3",
3
3
  "distance": 0,
4
- "node": "ga1b26c506cb771dff61db933708f100dac62d6c8",
4
+ "node": "gac273b770adeeaf3e7f3c57890169914c733b65d",
5
5
  "dirty": false,
6
6
  "branch": "HEAD",
7
7
  "node_date": "2026-11-27"
@@ -245,6 +245,7 @@ def test_parameters_in_where(conn):
245
245
  ([vsql.YearMonthInterval(1)], vsql.ProgrammingError, "07006"),
246
246
  ([object()], vsql.ProgrammingError, "unsupported type"),
247
247
  ([decimal.Decimal("NaN")], vsql.DataError, "finite"),
248
+ (["\ud800"], vsql.DataError, "parameter 1: .* isn't valid Unicode"),
248
249
  ([], vsql.ProgrammingError, "dynamic parameter"),
249
250
  ],
250
251
  )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes