Skip to content

Commit 20e15f8

Browse files
authored
Replace Cython with pure C (#394)
1 parent 8f6926b commit 20e15f8

21 files changed

Lines changed: 1665 additions & 624 deletions

.azure-pipelines/deploy.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ stages:
3838
- template: templates/step-build.yml@templates
3939
parameters:
4040
steps:
41-
- script: |
42-
make cythonize
43-
displayName: 'Cythonize'
4441
- script: |
4542
python setup.py sdist
4643
displayName: 'Make tarball'
@@ -80,7 +77,6 @@ stages:
8077
8178
- script: |
8279
source .build-venv/bin/activate
83-
make cythonize
8480
python setup.py bdist_wheel
8581
displayName: 'Make wheel'
8682
@@ -152,7 +148,6 @@ stages:
152148
architecture: '$(python.architecture)'
153149
steps:
154150
- script: |
155-
make cythonize
156151
python setup.py bdist_wheel
157152
displayName: 'Make wheel'
158153

.azure-pipelines/stage-test.yml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ stages:
66
- job:
77
strategy:
88
matrix:
9-
Py35-Cython-Linux:
9+
Py35-C-Linux:
1010
python.version: '3.5'
1111
no_extensions: ''
1212
image: 'ubuntu-latest'
13-
Py36-Cython-Linux:
13+
Py36-C-Linux:
1414
python.version: '3.6'
1515
no_extensions: ''
1616
image: 'ubuntu-latest'
17-
Py37-Cython-Linux:
17+
Py37-C-Linux:
1818
python.version: '3.7'
1919
no_extensions: ''
2020
image: 'ubuntu-latest'
21-
Py38-Cython-Linux:
21+
Py38-C-Linux:
2222
python.version: '3.8'
2323
no_extensions: ''
2424
image: 'ubuntu-latest'
@@ -42,35 +42,35 @@ stages:
4242
# python.version: 'pypy3'
4343
# no_extensions: 'Y'
4444
# image: 'ubuntu-latest'
45-
Py35-Cython-Win:
45+
Py35-C-Win:
4646
python.version: '3.5'
4747
no_extensions: ''
4848
image: 'vs2017-win2016'
49-
Py36-Cython-Win:
49+
Py36-C-Win:
5050
python.version: '3.6'
5151
no_extensions: ''
5252
image: 'windows-latest'
53-
Py37-Cython-Win:
53+
Py37-C-Win:
5454
python.version: '3.7'
5555
no_extensions: ''
5656
image: 'windows-latest'
57-
Py38-Cython-Win:
57+
Py38-C-Win:
5858
python.version: '3.8'
5959
no_extensions: ''
6060
image: 'windows-latest'
61-
Py35-Cython-Mac:
61+
Py35-C-Mac:
6262
python.version: '3.5'
6363
no_extensions: ''
6464
image: 'macos-latest'
65-
Py36-Cython-Mac:
65+
Py36-C-Mac:
6666
python.version: '3.6'
6767
no_extensions: ''
6868
image: 'macos-latest'
69-
Py37-Cython-Mac:
69+
Py37-C-Mac:
7070
python.version: '3.7'
7171
no_extensions: ''
7272
image: 'macos-latest'
73-
Py38-Cython-Mac:
73+
Py38-C-Mac:
7474
python.version: '3.8'
7575
no_extensions: ''
7676
image: 'macos-latest'
@@ -93,11 +93,6 @@ stages:
9393
python -m pip install --upgrade pip setuptools wheel
9494
displayName: 'Update pip'
9595
96-
- script: |
97-
make cythonize
98-
condition: eq(variables['no_extensions'], '')
99-
displayName: 'Cythonize'
100-
10196
- script: |
10297
python setup.py install
10398
displayName: 'Install itself'

CHANGES/249.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Replace Cython optimization with pure C

Makefile

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,7 @@ SRC = multidict tests setup.py
77

88
all: test
99

10-
.install-cython:
11-
pip install -r requirements/cython.txt
12-
touch .install-cython
13-
14-
multidict/%.c: multidict/%.pyx
15-
cython -3 -o $@ $< -I multidict
16-
17-
cythonize: .install-cython $(PYXS:.pyx=.c)
18-
19-
.install-deps: cythonize $(shell find requirements -type f)
10+
.install-deps: $(shell find requirements -type f)
2011
pip install -r requirements/dev.txt
2112
@touch .install-deps
2213

@@ -116,10 +107,8 @@ clean:
116107
rm -f multidict/_multidict.c
117108
rm -f multidict/_multidict.*.so
118109
rm -f multidict/_multidict.*.pyd
110+
rm -f multidict/_multidict_c.*.so
111+
rm -f multidict/_multidict_c.*.pyd
119112
rm -f multidict/_istr.*.so
120113
rm -f multidict/_istr.*.pyd
121-
rm -f multidict/_pair_list.*.so
122-
rm -f multidict/_pair_list.*.pyd
123-
rm -f multidict/_multidict_iter.*.so
124-
rm -f multidict/_multidict_iter.*.pyd
125114
rm -rf .tox

README.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ insensitive, e.g.::
6464

6565
*Keys* should be ``str`` or ``istr`` instances.
6666

67-
The library has optional Cython_ optimization for sake of speed.
67+
The library has optional C Extensions for sake of speed.
6868

6969

7070
License
@@ -73,10 +73,6 @@ License
7373
Apache 2
7474

7575

76-
.. _aiohttp: https://github.com/KeepSafe/aiohttp
77-
.. _Cython: http://cython.org/
78-
79-
8076
Changelog
8177
---------
8278
See `RTD page <http://multidict.readthedocs.org/en/latest/changes.html>`_.

docs/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ insensitive, e.g.::
4747

4848
*Keys* should be either :class:`str` or :class:`istr` instance.
4949

50-
The library has optional Cython_ optimization for sake of speed.
50+
The library has optional C Extensions for sake of speed.
5151

5252
Library Installation
5353
--------------------
@@ -104,4 +104,3 @@ Indices and tables
104104
* :ref:`search`
105105

106106
.. _GitHub: https://github.com/aio-libs/multidict
107-
.. _Cython: http://cython.org/

multidict/_istr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static PyTypeObject istr_type = {
8484
sizeof(istrobject),
8585
0,
8686
(destructor)istr_dealloc, /* tp_dealloc */
87-
0, /* tp_print */
87+
0, /* tp_vectorcall_offset */
8888
0, /* tp_getattr */
8989
0, /* tp_setattr */
9090
0, /* tp_reserved */

0 commit comments

Comments
 (0)