Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Applying python linting changes
  • Loading branch information
jahnvi480 committed May 7, 2026
commit 5b91325f24c2a88aa00b21cf9e97055dc5aff976
14 changes: 5 additions & 9 deletions mssql_python/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ def __init__(self, connection: "Connection", timeout: int = 0) -> None:
self._has_result_set = False # Track if we have an active result set
# Cache decoding encoding strings — these don't change between fetches,
# so we avoid 2 method calls + 2 dict.get() per fetch call.
self._cached_char_encoding = self._get_decoding_settings(
ddbc_sql_const.SQL_CHAR.value
).get("encoding", "utf-8")
self._cached_char_encoding = self._get_decoding_settings(ddbc_sql_const.SQL_CHAR.value).get(
"encoding", "utf-8"
)
self._cached_wchar_encoding = self._get_decoding_settings(
ddbc_sql_const.SQL_WCHAR.value
).get("encoding", "utf-16le")
Expand Down Expand Up @@ -2569,9 +2569,7 @@ def fetchmany(self, size: Optional[int] = None) -> List[Row]:
uuid_idx = self._uuid_str_indices
# Fast path: build Row objects in C++ — avoids Python loop overhead
if not converter_map and not uuid_idx:
return ddbc_bindings.construct_rows(
rows_data, Row, column_map, self
)
return ddbc_bindings.construct_rows(rows_data, Row, column_map, self)
return [
Row(
row_data,
Expand Down Expand Up @@ -2635,9 +2633,7 @@ def fetchall(self) -> List[Row]:
uuid_idx = self._uuid_str_indices
# Fast path: build Row objects in C++ — avoids Python loop overhead
if not converter_map and not uuid_idx:
return ddbc_bindings.construct_rows(
rows_data, Row, column_map, self
)
return ddbc_bindings.construct_rows(rows_data, Row, column_map, self)
return [
Row(
row_data,
Expand Down
2 changes: 1 addition & 1 deletion mssql_python/row.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Row:

# __slots__ eliminates per-instance __dict__ (~232 bytes/row savings),
# and makes attribute access ~30% faster (array index vs dict lookup).
__slots__ = ('_values', '_column_map', '_cursor')
__slots__ = ("_values", "_column_map", "_cursor")

@staticmethod
def _fast_create(values, column_map, cursor):
Expand Down
Loading