Skip to content

Commit 005ebc1

Browse files
committed
Implement hashtable
1 parent 5f64e68 commit 005ebc1

26 files changed

Lines changed: 3851 additions & 2366 deletions

.github/workflows/auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- name: Dependabot metadata
1717
id: metadata
18-
uses: dependabot/fetch-metadata@v2.3.0
18+
uses: dependabot/fetch-metadata@v2.4.0
1919
with:
2020
github-token: "${{ secrets.GITHUB_TOKEN }}"
2121
- name: Enable auto-merge for Dependabot PRs

.github/workflows/ci-cd.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,16 @@ jobs:
123123
os:
124124
- ubuntu
125125
- windows
126+
- windows-11-arm
126127
- macos
127128
tag:
128129
- ''
129130
- 'musllinux'
130131
exclude:
131132
- os: windows
132133
tag: 'musllinux'
134+
- os: windows-11-arm
135+
tag: 'musllinux'
133136
- os: macos
134137
tag: 'musllinux'
135138
- os: ubuntu
@@ -199,7 +202,7 @@ jobs:
199202
debug: ''
200203
fail-fast: false
201204
runs-on: ${{ matrix.os }}-latest
202-
timeout-minutes: 15
205+
timeout-minutes: 20
203206

204207
continue-on-error: >-
205208
${{

.github/workflows/reusable-build-wheel.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ jobs:
4444
build-wheel:
4545
name: >-
4646
Build ${{ inputs.tag }} wheels on ${{ inputs.os }} ${{ inputs.qemu }}
47-
runs-on: ${{ inputs.os }}-latest
47+
runs-on: ${{
48+
inputs.os == 'windows-11-arm' && inputs.os ||
49+
format('{0}-latest', inputs.os)
50+
}}
4851
timeout-minutes: ${{ inputs.qemu && 120 || 15 }}
4952
steps:
5053
- name: Compute GHA artifact name ending
@@ -89,7 +92,7 @@ jobs:
8992
shell: bash
9093

9194
- name: Build wheels
92-
uses: pypa/cibuildwheel@v2.23.2
95+
uses: pypa/cibuildwheel@v2.23.3
9396
env:
9497
CIBW_ARCHS_MACOS: x86_64 arm64 universal2
9598

.github/workflows/reusable-linters.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ jobs:
7474
fail_ci_if_error: true
7575
- name: Install spell checker
7676
run: |
77-
sudo apt install libenchant-2-dev
7877
pip install -r requirements/doc.txt
7978
- name: Run docs spelling
8079
run: |

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ repos:
118118
additional_dependencies:
119119
- types-docutils
120120
- lxml # dep of `--txt-report`, `--cobertura-xml-report` & `--html-report`
121-
- pytest
121+
- pytest >= 8.4.0
122122
- pytest_codspeed
123123
- Sphinx >= 5.3.0
124124
- sphinxcontrib-spelling
@@ -134,7 +134,7 @@ repos:
134134
additional_dependencies:
135135
- types-docutils
136136
- lxml # dep of `--txt-report`, `--cobertura-xml-report` & `--html-report`
137-
- pytest
137+
- pytest >= 8.4.0
138138
- pytest_codspeed
139139
- Sphinx >= 5.3.0
140140
- sphinxcontrib-spelling

CHANGES.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,60 @@ Changelog
1414

1515
.. towncrier release notes start
1616
17+
6.4.4
18+
=====
19+
20+
*(2025-05-19)*
21+
22+
23+
Bug fixes
24+
---------
25+
26+
- Fixed a segmentation fault when calling :py:meth:`multidict.MultiDict.setdefault` with a single argument -- by :user:`bdraco`.
27+
28+
*Related issues and pull requests on GitHub:*
29+
:issue:`1160`.
30+
31+
- Fixed a segmentation fault when attempting to directly instantiate view objects
32+
(``multidict._ItemsView``, ``multidict._KeysView``, ``multidict._ValuesView``) -- by :user:`bdraco`.
33+
34+
View objects now raise a proper :exc:`TypeError` with the message "cannot create '...' instances directly"
35+
when direct instantiation is attempted.
36+
37+
View objects should only be created through the proper methods: :py:meth:`multidict.MultiDict.items`,
38+
:py:meth:`multidict.MultiDict.keys`, and :py:meth:`multidict.MultiDict.values`.
39+
40+
*Related issues and pull requests on GitHub:*
41+
:issue:`1164`.
42+
43+
44+
Miscellaneous internal changes
45+
------------------------------
46+
47+
- :class:`multidict.MultiDictProxy` was refactored to rely only on
48+
:class:`multidict.MultiDict` public interface and don't touch any implementation
49+
details.
50+
51+
*Related issues and pull requests on GitHub:*
52+
:issue:`1150`.
53+
54+
- Multidict views were refactored to rely only on
55+
:class:`multidict.MultiDict` API and don't touch any implementation
56+
details.
57+
58+
*Related issues and pull requests on GitHub:*
59+
:issue:`1152`.
60+
61+
- Dropped internal ``_Impl`` class from pure Python implementation, both pure Python and C
62+
Extension follows the same design internally now.
63+
64+
*Related issues and pull requests on GitHub:*
65+
:issue:`1153`.
66+
67+
68+
----
69+
70+
1771
6.4.3
1872
=====
1973

CHANGES/1128.feature

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Replace internal implementation from an array of items to hash table.
2+
algorithmic complexity for lookups is switched from O(N) to O(1).
3+
4+
The hash table is very similar to :class:`dict` from CPython but it allows keys duplication.
5+
6+
The benchmark shows 25-50% boost for single lookups, x2-x3 for bulk updates, and x20 for
7+
some multidict view operations. The gain is not for free:
8+
:class:`~multidict.MultiDict.add` and :class:`~multidict.MultiDict.extend` are 25-50%
9+
slower now. We consider it as acceptable because the lookup is much more common
10+
operation that addition for the library domain.

CHANGES/1167.contrib.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Builds have been added for arm64 Windows
2+
wheels and the ``reusable-build-wheel.yml``
3+
template has been modified to allow for
4+
an os value (``windows-11-arm``) which
5+
does not end with the ``-latest`` postfix.

multidict/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"getversion",
2323
)
2424

25-
__version__ = "6.4.3"
25+
__version__ = "6.4.5.dev0"
2626

2727

2828
if TYPE_CHECKING or not USE_EXTENSIONS:

0 commit comments

Comments
 (0)