Codebase list python-msgpack / upstream/1.0.2+git20211116.1.9b84e49
Import upstream version 1.0.2+git20211116.1.9b84e49 Debian Janitor 2 years ago
32 changed file(s) with 17042 addition(s) and 1918 deletion(s). Raw diff Collapse all Expand all
+0
-21
.github/workflows/black.yaml less more
0 name: Black
1
2 on: ["push", "pull_request"]
3
4 jobs:
5 black:
6 runs-on: ubuntu-latest
7 steps:
8 - name: Setup Python
9 uses: actions/setup-python@v1
10 with:
11 python-version: '3.x'
12 architecture: 'x64'
13
14 - name: Checkout
15 uses: actions/checkout@v1
16
17 - name: Black Code Formatter
18 run: |
19 pip install black
20 black --diff --check msgpack/ test/ setup.py
+0
-88
.github/workflows/linux.yml less more
0 name: Build Linux Wheels
1 on:
2 push:
3 pull_request:
4 create:
5
6 jobs:
7 build:
8 runs-on: ubuntu-latest
9 steps:
10 - name: Checkout
11 uses: actions/checkout@v1
12
13 - name: Set up Python 3.8
14 uses: actions/setup-python@v1
15 with:
16 python-version: 3.8
17
18 - name: Cythonize
19 shell: bash
20 run: |
21 pip install -U pip
22 pip -V
23 pip install -r requirements.txt
24 make cython
25 #python setup.py sdist
26
27 - name: Build wheels
28 shell: bash
29 run: |
30 make linux-wheel
31
32 - name: Install qemu-user-static for docker
33 shell: bash
34 run: |
35 docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
36
37 - name: Build arm64 wheels
38 shell: bash
39 run: |
40 make linux-arm64-wheel
41
42 - name: Run test (3.8)
43 run: |
44 pip install pytest
45 pip install -v msgpack --only-binary :all: --no-index -f dist/wheelhouse
46 pytest -v test
47
48
49 - name: Set up Python 3.9
50 uses: actions/setup-python@v1
51 with:
52 python-version: 3.9
53
54 - name: Run test (3.9)
55 run: |
56 pip install pytest
57 pip install -v msgpack --only-binary :all: --no-index -f dist/wheelhouse
58 pytest -v test
59
60 - name: Set up Python 3.7
61 uses: actions/setup-python@v1
62 with:
63 python-version: 3.7
64
65 - name: Run test (3.7)
66 run: |
67 pip install pytest
68 pip install -v msgpack --only-binary :all: --no-index -f dist/wheelhouse
69 pytest -v test
70
71 - name: Set up Python 3.6
72 uses: actions/setup-python@v1
73 with:
74 python-version: 3.6
75
76 - name: Run test (3.6)
77 run: |
78 pip install pytest
79 pip install -v msgpack --only-binary :all: --no-index -f dist/wheelhouse
80 pytest -v test
81
82
83 - name: Upload Wheels
84 uses: actions/upload-artifact@v1
85 with:
86 name: linux-wheels
87 path: ./dist/wheelhouse/
+0
-93
.github/workflows/mac.yml less more
0 name: Build macOS Wheels
1 on:
2 push:
3 pull_request:
4 create:
5
6 jobs:
7 build:
8 runs-on: macos-latest
9
10 steps:
11 - name: Checkout
12 uses: actions/checkout@v1
13
14 - name: Set up Python 3.8
15 uses: actions/setup-python@v1
16 with:
17 python-version: "3.8"
18
19 - name: Cythonize
20 run: |
21 pip install -U pip
22 pip install -r requirements.txt
23 make cython
24
25 - name: Build wheel
26 run: |
27 pip install setuptools wheel
28 python setup.py bdist_wheel
29
30 - name: Run test
31 run: |
32 pip install pytest
33 pip install -v msgpack --only-binary :all: -f dist/ --no-index
34 pytest -v test
35
36
37 - name: Set up Python 3.9
38 uses: actions/setup-python@v1
39 with:
40 python-version: "3.9"
41
42 - name: Build wheel
43 run: |
44 pip install setuptools wheel
45 python setup.py bdist_wheel
46
47 - name: Run test
48 run: |
49 pip install pytest
50 pip install -v msgpack --only-binary :all: -f dist/ --no-index
51 pytest -v test
52
53
54 - name: Set up Python 3.7
55 uses: actions/setup-python@v1
56 with:
57 python-version: "3.7"
58
59 - name: Build wheel
60 run: |
61 pip install setuptools wheel
62 python setup.py bdist_wheel
63
64 - name: Run test
65 run: |
66 pip install pytest
67 pip install -v msgpack --only-binary :all: -f dist/ --no-index
68 pytest -v test
69
70
71 - name: Set up Python 3.6
72 uses: actions/setup-python@v1
73 with:
74 python-version: "3.6"
75
76 - name: Build wheel
77 run: |
78 pip install setuptools wheel
79 python setup.py bdist_wheel
80
81 - name: Run test
82 run: |
83 pip install pytest
84 pip install -v msgpack --only-binary :all: -f dist/ --no-index
85 pytest -v test
86
87
88 - name: Upload Wheels
89 uses: actions/upload-artifact@v1
90 with:
91 name: macos-wheels
92 path: ./dist/
+0
-84
.github/workflows/windows.yaml less more
0 name: Build and test windows wheels
1 on:
2 push:
3 branches:
4 - master
5 - test
6 pull_request:
7 create:
8
9 jobs:
10 build:
11 runs-on: windows-latest
12 steps:
13 - name: Checkout
14 uses: actions/checkout@v1
15
16 - name: Cythonize
17 shell: bash
18 run: |
19 pip install -U Cython
20 make cython
21 #python setup.py sdist
22
23 - name: Python 3.6 (amd64)
24 env:
25 PYTHON: "py -3.6-64"
26 shell: bash
27 run: |
28 ci/runtests.sh
29
30 - name: Python 3.6 (x86)
31 env:
32 PYTHON: "py -3.6-32"
33 shell: bash
34 run: |
35 ci/runtests.sh
36
37 - name: Python 3.7 (amd64)
38 env:
39 PYTHON: "py -3.7-64"
40 shell: bash
41 run: |
42 ci/runtests.sh
43
44 - name: Python 3.7 (x86)
45 env:
46 PYTHON: "py -3.7-32"
47 shell: bash
48 run: |
49 ci/runtests.sh
50
51 - name: Python 3.8 (amd64)
52 env:
53 PYTHON: "py -3.8-64"
54 shell: bash
55 run: |
56 ci/runtests.sh
57
58 - name: Python 3.8 (x86)
59 env:
60 PYTHON: "py -3.8-32"
61 shell: bash
62 run: |
63 ci/runtests.sh
64
65 - name: Python 3.9 (amd64)
66 env:
67 PYTHON: "py -3.9-64"
68 shell: bash
69 run: |
70 ci/runtests.sh
71
72 - name: Python 3.9 (x86)
73 env:
74 PYTHON: "py -3.9-32"
75 shell: bash
76 run: |
77 ci/runtests.sh
78
79 - name: Upload Wheels
80 uses: actions/upload-artifact@v1
81 with:
82 name: win-wheels
83 path: ./dist
+0
-15
.gitignore less more
0 MANIFEST
1 build/*
2 dist/*
3 .tox
4 *.pyc
5 *.pyo
6 *.so
7 *~
8 msgpack/__version__.py
9 msgpack/*.cpp
10 *.egg-info
11 /venv
12 /tags
13 /docs/_build
14 .cache
+0
-89
.travis.yml less more
0 version: ~> 1.0
1 dist: xenial
2 language: python
3 cache: pip
4 arch:
5 - arm64
6
7 python:
8 # Available Python (PyPy) can be listed by:
9 #
10 # $ aws s3 ls s3://travis-python-archives/binaries/ubuntu/16.04/x86_64/
11 - "3.6"
12 - "3.7"
13 - "3.8"
14 - "3.9-dev"
15
16 _pure: &pure
17 install:
18 - pip install -U pip
19 - pip install -U pytest pytest-cov codecov
20 - pip install .
21 script:
22 - pytest --cov=msgpack -v test
23
24 matrix:
25 include:
26 - name: 32bit build
27 arch: amd64
28 language: python
29 services:
30 - docker
31 env:
32 - DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
33 install:
34 - pip install -U pip
35 - pip install -r requirements.txt
36 - make cython
37 - docker pull $DOCKER_IMAGE
38 script:
39 - docker run --rm -v `pwd`:/io -w /io $DOCKER_IMAGE /io/docker/runtests.sh
40
41 - arch: arm64
42 name: arm64 32bit build
43 language: python
44 services:
45 - docker
46 env:
47 - DOCKER_IMAGE=quay.io/pypa/manylinux2014_aarch64
48 install:
49 - pip install -U pip
50 - pip install -r requirements.txt
51 - make cython
52 - docker pull $DOCKER_IMAGE
53 script:
54 - docker run --rm -v `pwd`:/io -w /io $DOCKER_IMAGE /io/docker/runtests.sh
55
56 - name: "Python 2 (fallback)"
57 python: "2.7"
58 <<: *pure
59
60 - name: "pypy2.7"
61 arch: amd64
62 python: "pypy2.7-7.1.1"
63 <<: *pure
64
65 - name: "pypy3"
66 arch: amd64
67 python: "pypy3.6-7.1.1"
68 <<: *pure
69
70 install:
71 - pip install -U pip
72 - pip install -U pytest pytest-cov codecov
73 - pip install -r requirements.txt # Cython
74 - make cython
75 - pip install -e .
76
77 script:
78 - python -c 'import sys; print(hex(sys.maxsize))'
79 - python -c 'from msgpack import _cmsgpack'
80 - pytest --cov=msgpack -v test
81 - MSGPACK_PUREPYTHON=x pytest --cov=msgpack -v test
82
83 after_success:
84 - if [ -f .coverage ]; then
85 codecov;
86 fi
87
88 # vim: sw=2 ts=2
+0
-504
ChangeLog.rst less more
0 1.0.2
1 =====
2
3 * Fix year 2038 problem regression in 1.0.1. (#451)
4
5 1.0.1
6 =====
7
8 * Add Python 3.9 and linux/arm64 wheels. (#439)
9 * Fixed Unpacker.tell() after read_bytes() (#426)
10 * Fixed unpacking datetime before epoch on Windows (#433)
11 * Fixed fallback Packer didn't check DateTime.tzinfo (#434)
12
13 1.0.0
14 =====
15
16 Release Date: 2020-02-17
17
18 * Remove Python 2 support from the ``msgpack/_cmsgpack``.
19 ``msgpack/fallback`` still supports Python 2.
20 * Remove ``encoding`` option from the Packer and Unpacker.
21 * Unpacker: The default value of ``max_buffer_size`` is changed to 100MiB.
22 * Unpacker: ``strict_map_key`` is True by default now.
23 * Unpacker: String map keys are interned.
24 * Drop old buffer protocol support.
25 * Support Timestamp type.
26 * Support serializing and decerializing ``datetime`` object
27 with tzinfo.
28 * Unpacker: ``Fix Unpacker.read_bytes()`` in fallback implementation. (#352)
29
30
31 0.6.2
32 =====
33
34 Release Date: 2019-09-20
35
36 * Support Python 3.8.
37 * Update Cython to 0.29.13 for support Python 3.8.
38 * Some small optimizations.
39
40
41 0.6.1
42 ======
43
44 Release Date: 2019-01-25
45
46 This release is for mitigating pain caused by v0.6.0 reduced max input limits
47 for security reason.
48
49 * ``unpackb(data)`` configures ``max_*_len`` options from ``len(data)``,
50 instead of static default sizes.
51
52 * ``Unpacker(max_buffer_len=N)`` configures ``max_*_len`` options from ``N``,
53 instead of static default sizes.
54
55 * ``max_bin_len``, ``max_str_len``, and ``max_ext_len`` are deprecated.
56 Since this is minor release, it's document only deprecation.
57
58
59 0.6.0
60 ======
61
62 Release Date: 2018-11-30
63
64 This release contains some backward incompatible changes for security reason (DoS).
65
66 Important changes
67 -----------------
68
69 * unpacker: Default value of input limits are smaller than before to avoid DoS attack.
70 If you need to handle large data, you need to specify limits manually. (#319)
71
72 * Unpacker doesn't wrap underlaying ``ValueError`` (including ``UnicodeError``) into
73 ``UnpackValueError``. If you want to catch all exception during unpack, you need
74 to use ``try ... except Exception`` with minimum try code block. (#323, #233)
75
76 * ``PackValueError`` and ``PackOverflowError`` are also removed. You need to catch
77 normal ``ValueError`` and ``OverflowError``. (#323, #233)
78
79 * Unpacker has ``strict_map_key`` option now. When it is true, only bytes and str
80 (unicode in Python 2) are allowed for map keys. It is recommended to avoid
81 hashdos. Default value of this option is False for backward compatibility reason.
82 But it will be changed True in 1.0. (#296, #334)
83
84 Other changes
85 -------------
86
87 * Extension modules are merged. There is ``msgpack._cmsgpack`` instead of
88 ``msgpack._packer`` and ``msgpack._unpacker``. (#314, #328)
89
90 * Add ``Unpacker.getbuffer()`` method. (#320)
91
92 * unpacker: ``msgpack.StackError`` is raised when input data contains too
93 nested data. (#331)
94
95 * unpacker: ``msgpack.FormatError`` is raised when input data is not valid
96 msgpack format. (#331)
97
98
99 0.5.6
100 ======
101
102 * Fix fallback.Unpacker.feed() dropped unused data from buffer (#287)
103 * Resurrect fallback.unpack() and _unpacker.unpack().
104 They were removed at 0.5.5 but it breaks backward compatibility. (#288, #290)
105
106 0.5.5
107 ======
108
109 * Fix memory leak in pure Python Unpacker.feed() (#283)
110 * Fix unpack() didn't support `raw` option (#285)
111
112 0.5.4
113 ======
114
115 * Undeprecate ``unicode_errors`` option. (#278)
116
117 0.5.3
118 ======
119
120 * Fixed regression when passing ``unicode_errors`` to Packer but not ``encoding``. (#277)
121
122 0.5.2
123 ======
124
125 * Add ``raw`` option to Unpacker. It is preferred way than ``encoding`` option.
126
127 * Packer.pack() reset buffer on exception (#274)
128
129
130 0.5.1
131 ======
132
133 * Remove FutureWarning about use_bin_type option (#271)
134
135 0.5.0
136 ======
137
138 There are some deprecations. Please read changes carefully.
139
140 Changes
141 -------
142
143 * Drop Python 2.6 and ~3.4 support. Python 2.7 and 3.5+ are supported.
144
145 * Deprecate useless custom exceptions. Use ValueError instead of PackValueError,
146 Exception instead of PackException and UnpackException, etc...
147 See msgpack/exceptions.py
148
149 * Add *strict_types* option to packer. It can be used to serialize subclass of
150 builtin types. For example, when packing object which type is subclass of dict,
151 ``default()`` is called. ``default()`` is called for tuple too.
152
153 * Pure Python implementation supports packing memoryview object.
154
155 * Support packing bytearray.
156
157 * Add ``Unpacker.tell()``. And ``write_bytes`` option is deprecated.
158
159
160 Bugs fixed
161 ----------
162
163 * Fixed zero length raw can't be decoded when encoding is specified. (#236)
164
165
166 0.4.8
167 =====
168 :release date: 2016-07-29
169
170 Bugs fixed
171 ----------
172
173 * Calling ext_hook with wrong length. (Only on Windows, maybe. #203)
174
175
176 0.4.7
177 =====
178 :release date: 2016-01-25
179
180 Bugs fixed
181 ----------
182
183 * Memory leak when unpack is failed
184
185 Changes
186 -------
187
188 * Reduce compiler warnings while building extension module
189 * unpack() now accepts ext_hook argument like Unpacker and unpackb()
190 * Update Cython version to 0.23.4
191 * default function is called when integer overflow
192
193
194 0.4.6
195 =====
196 :release date: 2015-03-13
197
198 Bugs fixed
199 ----------
200
201 * fallback.Unpacker: Fix Data corruption when OutOfData.
202 This bug only affects "Streaming unpacking."
203
204
205 0.4.5
206 =====
207 :release date: 2015-01-25
208
209 Incompatible Changes
210 --------------------
211
212 Changes
213 -------
214
215 Bugs fixed
216 ----------
217
218 * Fix test failure on pytest 2.3. (by @ktdreyer)
219 * Fix typos in ChangeLog. (Thanks to @dmick)
220 * Improve README.rst (by @msabramo)
221
222
223 0.4.4
224 =====
225 :release date: 2015-01-09
226
227 Incompatible Changes
228 --------------------
229
230 Changes
231 -------
232
233 Bugs fixed
234 ----------
235
236 * Fix compile error.
237
238 0.4.3
239 =====
240 :release date: 2015-01-07
241
242 Incompatible Changes
243 --------------------
244
245 Changes
246 -------
247
248 Bugs fixed
249 ----------
250
251 * Unpacker may unpack wrong uint32 value on 32bit or LLP64 environment. (#101)
252 * Build failed on Windows Python 2.7.
253
254 0.4.2
255 =====
256 :release date: 2014-03-26
257
258 Incompatible Changes
259 --------------------
260
261 Changes
262 -------
263
264 Bugs fixed
265 ----------
266
267 * Unpacker doesn't increment refcount of ExtType hook.
268 * Packer raises no exception for inputs doesn't fit to msgpack format.
269
270 0.4.1
271 =====
272 :release date: 2014-02-17
273
274 Incompatible Changes
275 --------------------
276
277 Changes
278 -------
279
280 * fallback.Unpacker.feed() supports bytearray.
281
282 Bugs fixed
283 ----------
284
285 * Unpacker doesn't increment refcount of hooks. Hooks may be GCed while unpacking.
286 * Unpacker may read unfilled internal buffer.
287
288 0.4.0
289 =====
290 :release date: 2013-10-21
291
292 Incompatible Changes
293 --------------------
294
295 * Raises TypeError instead of ValueError when packer receives unsupported type.
296
297 Changes
298 -------
299
300 * Support New msgpack spec.
301
302
303 0.3.0
304 =====
305
306 Incompatible Changes
307 --------------------
308
309 * Default value of ``use_list`` is ``True`` for now. (It was ``False`` for 0.2.x)
310 You should pass it explicitly for compatibility to 0.2.x.
311 * `Unpacker.unpack()` and some unpack methods now raise `OutOfData` instead of
312 `StopIteration`. `StopIteration` is used for iterator protocol only.
313
314 Changes
315 -------
316 * Pure Python fallback module is added. (thanks to bwesterb)
317 * Add ``.skip()`` method to ``Unpacker`` (thanks to jnothman)
318 * Add capturing feature. You can pass the writable object to
319 ``Unpacker.unpack()`` as a second parameter.
320 * Add ``Packer.pack_array_header`` and ``Packer.pack_map_header``.
321 These methods only pack header of each type.
322 * Add ``autoreset`` option to ``Packer`` (default: True).
323 Packer doesn't return packed bytes and clear internal buffer.
324 * Add ``Packer.pack_map_pairs``. It packs sequence of pair to map type.
325
326
327
328 0.2.4
329 =====
330 :release date: 2012-12-22
331
332 Bugs fixed
333 ----------
334
335 * Fix SEGV when object_hook or object_pairs_hook raise Exception. (#39)
336
337 0.2.3
338 =====
339 :release date: 2012-12-11
340
341 Changes
342 -------
343 * Warn when use_list is not specified. It's default value will be changed in 0.3.
344
345 Bugs fixed
346 ----------
347 * Can't pack subclass of dict.
348
349 0.2.2
350 =====
351 :release date: 2012-09-21
352
353 Changes
354 -------
355 * Add ``use_single_float`` option to ``Packer``. When it is true, packs float
356 object in single precision format.
357
358 Bugs fixed
359 ----------
360 * ``unpack()`` didn't restores gc state when it called with gc disabled.
361 ``unpack()`` doesn't control gc now instead of restoring gc state collectly.
362 User can control gc state when gc cause performance issue.
363
364 * ``Unpacker``'s ``read_size`` option didn't used.
365
366 0.2.1
367 =====
368 :release date: 2012-08-20
369
370 Changes
371 -------
372 * Add ``max_buffer_size`` parameter to Unpacker. It limits internal buffer size
373 and allows unpack data from untrusted source safely.
374
375 * Unpacker's buffer reallocation algorithm is less greedy now. It cause performance
376 decrease in rare case but memory efficient and don't allocate than ``max_buffer_size``.
377
378 Bugs fixed
379 ----------
380 * Fix msgpack didn't work on SPARC Solaris. It was because choosing wrong byteorder
381 on compilation time. Use ``sys.byteorder`` to get correct byte order.
382 Very thanks to Chris Casey for giving test environment to me.
383
384
385 0.2.0
386 =====
387 :release date: 2012-06-27
388
389 Changes
390 -------
391 * Drop supporting Python 2.5 and unify tests for Py2 and Py3.
392 * Use new version of msgpack-c. It packs correctly on big endian platforms.
393 * Remove deprecated packs and unpacks API.
394
395 Bugs fixed
396 ----------
397 * #8 Packing subclass of dict raises TypeError. (Thanks to Steeve Morin.)
398
399
400 0.1.13
401 ======
402 :release date: 2012-04-21
403
404 New
405 ---
406 * Don't accept subtype of list and tuple as msgpack list. (Steeve Morin)
407 It allows customize how it serialized with ``default`` argument.
408
409 Bugs fixed
410 ----------
411 * Fix wrong error message. (David Wolever)
412 * Fix memory leak while unpacking when ``object_hook`` or ``list_hook`` is used.
413 (Steeve Morin)
414
415 Other changes
416 -------------
417 * setup.py works on Python 2.5 (Steffen Siering)
418 * Optimization for serializing dict.
419
420
421 0.1.12
422 ======
423 :release date: 2011-12-27
424
425 Bugs fixed
426 ----------
427
428 * Re-enable packs/unpacks removed at 0.1.11. It will be removed when 0.2 is released.
429
430
431 0.1.11
432 ======
433 :release date: 2011-12-26
434
435 Bugs fixed
436 ----------
437
438 * Include test code for Python3 to sdist. (Johan Bergström)
439 * Fix compilation error on MSVC. (davidgaleano)
440
441
442 0.1.10
443 ======
444 :release date: 2011-08-22
445
446 New feature
447 -----------
448 * Add ``encoding`` and ``unicode_errors`` option to packer and unpacker.
449 When this option is specified, (un)packs unicode object instead of bytes.
450 This enables using msgpack as a replacement of json. (tailhook)
451
452
453 0.1.9
454 =====
455 :release date: 2011-01-29
456
457 New feature
458 -----------
459 * ``use_list`` option is added to unpack(b) like Unpacker.
460 (Use keyword argument because order of parameters are different)
461
462 Bugs fixed
463 ----------
464 * Fix typo.
465 * Add MemoryError check.
466
467 0.1.8
468 =====
469 :release date: 2011-01-10
470
471 New feature
472 -----------
473 * Support ``loads`` and ``dumps`` aliases for API compatibility with
474 simplejson and pickle.
475
476 * Add *object_hook* and *list_hook* option to unpacker. It allows you to
477 hook unpacking mapping type and array type.
478
479 * Add *default* option to packer. It allows you to pack unsupported types.
480
481 * unpacker accepts (old) buffer types.
482
483 Bugs fixed
484 ----------
485 * Fix segv around ``Unpacker.feed`` or ``Unpacker(file)``.
486
487
488 0.1.7
489 =====
490 :release date: 2010-11-02
491
492 New feature
493 -----------
494 * Add *object_hook* and *list_hook* option to unpacker. It allows you to
495 hook unpacking mapping type and array type.
496
497 * Add *default* option to packer. It allows you to pack unsupported types.
498
499 * unpacker accepts (old) buffer types.
500
501 Bugs fixed
502 ----------
503 * Compilation error on win32.
+0
-25
DEVELOP.md less more
0 # Developer's note
1
2 ## Wheels
3
4 Wheels for macOS and Linux are built on Travis and AppVeyr, in
5 [methane/msgpack-wheels](https://github.com/methane/msgpack-wheels) repository.
6
7 Wheels for Windows are built on Github Actions in this repository.
8
9
10 ### Build
11
12 ```
13 $ make cython
14 ```
15
16
17 ### Test
18
19 MessagePack uses `pytest` for testing.
20 Run test with following command:
21
22 ```
23 $ make test
24 ```
+0
-5
MANIFEST.in less more
0 include setup.py
1 include COPYING
2 include README.md
3 recursive-include msgpack *.h *.c *.pyx *.cpp
4 recursive-include test *.py
+0
-44
Makefile less more
0 .PHONY: all
1 all: cython
2 python setup.py build_ext -i -f
3
4 .PHONY: black
5 black:
6 black msgpack/ test/ setup.py
7
8 .PHONY: cython
9 cython:
10 cython --cplus msgpack/_cmsgpack.pyx
11
12 .PHONY: test
13 test: cython
14 pip install -e .
15 pytest -v test
16 MSGPACK_PUREPYTHON=1 pytest -v test
17
18 .PHONY: serve-doc
19 serve-doc: all
20 cd docs && make serve
21
22 .PHONY: clean
23 clean:
24 rm -rf build
25 rm -f msgpack/_cmsgpack.cpp
26 rm -f msgpack/_cmsgpack.*.so
27 rm -f msgpack/_cmsgpack.*.pyd
28 rm -rf msgpack/__pycache__
29 rm -rf test/__pycache__
30
31 .PHONY: update-docker
32 update-docker:
33 docker pull quay.io/pypa/manylinux2010_i686
34 docker pull quay.io/pypa/manylinux2010_x86_64
35
36 .PHONY: linux-wheel
37 linux-wheel:
38 docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux2010_i686 bash docker/buildwheel.sh
39 docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux2010_x86_64 bash docker/buildwheel.sh
40
41 .PHONY: linux-arm64-wheel
42 linux-arm64-wheel:
43 docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux2014_aarch64 bash docker/buildwheel.sh
0 Metadata-Version: 2.1
1 Name: msgpack
2 Version: 1.0.2
3 Summary: MessagePack (de)serializer.
4 Home-page: https://msgpack.org/
5 Author: Inada Naoki
6 Author-email: songofacandy@gmail.com
7 License: Apache 2.0
8 Project-URL: Documentation, https://msgpack-python.readthedocs.io/
9 Project-URL: Source, https://github.com/msgpack/msgpack-python
10 Project-URL: Tracker, https://github.com/msgpack/msgpack-python/issues
11 Platform: UNKNOWN
12 Classifier: Programming Language :: Python :: 2
13 Classifier: Programming Language :: Python :: 2.7
14 Classifier: Programming Language :: Python :: 3
15 Classifier: Programming Language :: Python :: 3.5
16 Classifier: Programming Language :: Python :: 3.6
17 Classifier: Programming Language :: Python :: 3.7
18 Classifier: Programming Language :: Python :: 3.8
19 Classifier: Programming Language :: Python :: 3.9
20 Classifier: Programming Language :: Python :: Implementation :: CPython
21 Classifier: Programming Language :: Python :: Implementation :: PyPy
22 Classifier: Intended Audience :: Developers
23 Classifier: License :: OSI Approved :: Apache Software License
24 Description-Content-Type: text/markdown
25 License-File: COPYING
26
27 # MessagePack for Python
28
29 [![Build Status](https://travis-ci.org/msgpack/msgpack-python.svg?branch=master)](https://travis-ci.org/msgpack/msgpack-python)
30 [![Documentation Status](https://readthedocs.org/projects/msgpack-python/badge/?version=latest)](https://msgpack-python.readthedocs.io/en/latest/?badge=latest)
31
32 ## What's this
33
34 [MessagePack](https://msgpack.org/) is an efficient binary serialization format.
35 It lets you exchange data among multiple languages like JSON.
36 But it's faster and smaller.
37 This package provides CPython bindings for reading and writing MessagePack data.
38
39
40 ## Very important notes for existing users
41
42 ### PyPI package name
43
44 Package name on PyPI was changed from `msgpack-python` to `msgpack` from 0.5.
45
46 When upgrading from msgpack-0.4 or earlier, do `pip uninstall msgpack-python` before
47 `pip install -U msgpack`.
48
49
50 ### Compatibility with the old format
51
52 You can use `use_bin_type=False` option to pack `bytes`
53 object into raw type in the old msgpack spec, instead of bin type in new msgpack spec.
54
55 You can unpack old msgpack format using `raw=True` option.
56 It unpacks str (raw) type in msgpack into Python bytes.
57
58 See note below for detail.
59
60
61 ### Major breaking changes in msgpack 1.0
62
63 * Python 2
64
65 * The extension module does not support Python 2 anymore.
66 The pure Python implementation (`msgpack.fallback`) is used for Python 2.
67
68 * Packer
69
70 * `use_bin_type=True` by default. bytes are encoded in bin type in msgpack.
71 **If you are still using Python 2, you must use unicode for all string types.**
72 You can use `use_bin_type=False` to encode into old msgpack format.
73 * `encoding` option is removed. UTF-8 is used always.
74
75 * Unpacker
76
77 * `raw=False` by default. It assumes str types are valid UTF-8 string
78 and decode them to Python str (unicode) object.
79 * `encoding` option is removed. You can use `raw=True` to support old format.
80 * Default value of `max_buffer_size` is changed from 0 to 100 MiB.
81 * Default value of `strict_map_key` is changed to True to avoid hashdos.
82 You need to pass `strict_map_key=False` if you have data which contain map keys
83 which type is not bytes or str.
84
85
86 ## Install
87
88 ```
89 $ pip install msgpack
90 ```
91
92 ### Pure Python implementation
93
94 The extension module in msgpack (`msgpack._cmsgpack`) does not support
95 Python 2 and PyPy.
96
97 But msgpack provides a pure Python implementation (`msgpack.fallback`)
98 for PyPy and Python 2.
99
100
101
102 ### Windows
103
104 When you can't use a binary distribution, you need to install Visual Studio
105 or Windows SDK on Windows.
106 Without extension, using pure Python implementation on CPython runs slowly.
107
108
109 ## How to use
110
111 NOTE: In examples below, I use `raw=False` and `use_bin_type=True` for users
112 using msgpack < 1.0. These options are default from msgpack 1.0 so you can omit them.
113
114
115 ### One-shot pack & unpack
116
117 Use `packb` for packing and `unpackb` for unpacking.
118 msgpack provides `dumps` and `loads` as an alias for compatibility with
119 `json` and `pickle`.
120
121 `pack` and `dump` packs to a file-like object.
122 `unpack` and `load` unpacks from a file-like object.
123
124 ```pycon
125 >>> import msgpack
126 >>> msgpack.packb([1, 2, 3], use_bin_type=True)
127 '\x93\x01\x02\x03'
128 >>> msgpack.unpackb(_, raw=False)
129 [1, 2, 3]
130 ```
131
132 `unpack` unpacks msgpack's array to Python's list, but can also unpack to tuple:
133
134 ```pycon
135 >>> msgpack.unpackb(b'\x93\x01\x02\x03', use_list=False, raw=False)
136 (1, 2, 3)
137 ```
138
139 You should always specify the `use_list` keyword argument for backward compatibility.
140 See performance issues relating to `use_list option`_ below.
141
142 Read the docstring for other options.
143
144
145 ### Streaming unpacking
146
147 `Unpacker` is a "streaming unpacker". It unpacks multiple objects from one
148 stream (or from bytes provided through its `feed` method).
149
150 ```py
151 import msgpack
152 from io import BytesIO
153
154 buf = BytesIO()
155 for i in range(100):
156 buf.write(msgpack.packb(i, use_bin_type=True))
157
158 buf.seek(0)
159
160 unpacker = msgpack.Unpacker(buf, raw=False)
161 for unpacked in unpacker:
162 print(unpacked)
163 ```
164
165
166 ### Packing/unpacking of custom data type
167
168 It is also possible to pack/unpack custom data types. Here is an example for
169 `datetime.datetime`.
170
171 ```py
172 import datetime
173 import msgpack
174
175 useful_dict = {
176 "id": 1,
177 "created": datetime.datetime.now(),
178 }
179
180 def decode_datetime(obj):
181 if '__datetime__' in obj:
182 obj = datetime.datetime.strptime(obj["as_str"], "%Y%m%dT%H:%M:%S.%f")
183 return obj
184
185 def encode_datetime(obj):
186 if isinstance(obj, datetime.datetime):
187 return {'__datetime__': True, 'as_str': obj.strftime("%Y%m%dT%H:%M:%S.%f")}
188 return obj
189
190
191 packed_dict = msgpack.packb(useful_dict, default=encode_datetime, use_bin_type=True)
192 this_dict_again = msgpack.unpackb(packed_dict, object_hook=decode_datetime, raw=False)
193 ```
194
195 `Unpacker`'s `object_hook` callback receives a dict; the
196 `object_pairs_hook` callback may instead be used to receive a list of
197 key-value pairs.
198
199
200 ### Extended types
201
202 It is also possible to pack/unpack custom data types using the **ext** type.
203
204 ```pycon
205 >>> import msgpack
206 >>> import array
207 >>> def default(obj):
208 ... if isinstance(obj, array.array) and obj.typecode == 'd':
209 ... return msgpack.ExtType(42, obj.tostring())
210 ... raise TypeError("Unknown type: %r" % (obj,))
211 ...
212 >>> def ext_hook(code, data):
213 ... if code == 42:
214 ... a = array.array('d')
215 ... a.fromstring(data)
216 ... return a
217 ... return ExtType(code, data)
218 ...
219 >>> data = array.array('d', [1.2, 3.4])
220 >>> packed = msgpack.packb(data, default=default, use_bin_type=True)
221 >>> unpacked = msgpack.unpackb(packed, ext_hook=ext_hook, raw=False)
222 >>> data == unpacked
223 True
224 ```
225
226
227 ### Advanced unpacking control
228
229 As an alternative to iteration, `Unpacker` objects provide `unpack`,
230 `skip`, `read_array_header` and `read_map_header` methods. The former two
231 read an entire message from the stream, respectively de-serialising and returning
232 the result, or ignoring it. The latter two methods return the number of elements
233 in the upcoming container, so that each element in an array, or key-value pair
234 in a map, can be unpacked or skipped individually.
235
236
237 ## Notes
238
239 ### string and binary type
240
241 Early versions of msgpack didn't distinguish string and binary types.
242 The type for representing both string and binary types was named **raw**.
243
244 You can pack into and unpack from this old spec using `use_bin_type=False`
245 and `raw=True` options.
246
247 ```pycon
248 >>> import msgpack
249 >>> msgpack.unpackb(msgpack.packb([b'spam', u'eggs'], use_bin_type=False), raw=True)
250 [b'spam', b'eggs']
251 >>> msgpack.unpackb(msgpack.packb([b'spam', u'eggs'], use_bin_type=True), raw=False)
252 [b'spam', 'eggs']
253 ```
254
255 ### ext type
256
257 To use the **ext** type, pass `msgpack.ExtType` object to packer.
258
259 ```pycon
260 >>> import msgpack
261 >>> packed = msgpack.packb(msgpack.ExtType(42, b'xyzzy'))
262 >>> msgpack.unpackb(packed)
263 ExtType(code=42, data='xyzzy')
264 ```
265
266 You can use it with `default` and `ext_hook`. See below.
267
268
269 ### Security
270
271 To unpacking data received from unreliable source, msgpack provides
272 two security options.
273
274 `max_buffer_size` (default: `100*1024*1024`) limits the internal buffer size.
275 It is used to limit the preallocated list size too.
276
277 `strict_map_key` (default: `True`) limits the type of map keys to bytes and str.
278 While msgpack spec doesn't limit the types of the map keys,
279 there is a risk of the hashdos.
280 If you need to support other types for map keys, use `strict_map_key=False`.
281
282
283 ### Performance tips
284
285 CPython's GC starts when growing allocated object.
286 This means unpacking may cause useless GC.
287 You can use `gc.disable()` when unpacking large message.
288
289 List is the default sequence type of Python.
290 But tuple is lighter than list.
291 You can use `use_list=False` while unpacking when performance is important.
292
293
7070 But msgpack provides a pure Python implementation (`msgpack.fallback`)
7171 for PyPy and Python 2.
7272
73 Since the [pip](https://pip.pypa.io/) uses the pure Python implementation,
74 Python 2 support will not be dropped in the foreseeable future.
7573
7674
7775 ### Windows
+0
-50
appveyor.yml less more
0 environment:
1 matrix:
2 # For Python versions available on Appveyor, see
3 # http://www.appveyor.com/docs/installed-software#python
4 - PYTHON: "C:\\Python36"
5
6 install:
7 # We need wheel installed to build wheels
8 - "%PYTHON%\\python.exe -m pip install -U pip"
9 - "%PYTHON%\\python.exe -m pip install -U cython"
10 - "%PYTHON%\\Scripts\\cython --cplus msgpack/_cmsgpack.pyx"
11
12 build: off
13
14 test_script:
15 # Put your test command here.
16 # Note that you must use the environment variable %PYTHON% to refer to
17 # the interpreter you're using - Appveyor does not do anything special
18 # to put the Python version you want to use on PATH.
19 - set PYTHON="C:\\Python27"
20 - ci\\runtests.bat
21 - set PYTHON="C:\\Python27-x64"
22 - ci\\runtests.bat
23 - set PYTHON="C:\\Python36"
24 - ci\\runtests.bat
25 - set PYTHON="C:\\Python36-x64"
26 - ci\\runtests.bat
27 - set PYTHON="C:\\Python37"
28 - ci\\runtests.bat
29 - set PYTHON="C:\\Python37-x64"
30 - ci\\runtests.bat
31 - set PYTHON="C:\\Python38"
32 - ci\\runtests.bat
33 - set PYTHON="C:\\Python38-x64"
34 - ci\\runtests.bat
35
36 after_test:
37 # This step builds your wheels.
38 # Again, you need to use %PYTHON% to get the correct interpreter
39
40 artifacts:
41 # bdist_wheel puts your built wheel in the dist directory
42 - path: dist\*.whl
43
44 #on_success:
45 # You can use this step to upload your artifacts to a public website.
46 # See Appveyor's documentation for more details. Or you can simply
47 # access your wheels from the Appveyor "artifacts" tab for your build.
48
49 # vim: set shiftwidth=2
+0
-38
benchmark/benchmark.py less more
0 from msgpack import fallback
1
2 try:
3 from msgpack import _cmsgpack
4
5 has_ext = True
6 except ImportError:
7 has_ext = False
8 import timeit
9
10
11 def profile(name, func):
12 times = timeit.repeat(func, number=1000, repeat=4)
13 times = ", ".join(["%8f" % t for t in times])
14 print("%-30s %40s" % (name, times))
15
16
17 def simple(name, data):
18 if has_ext:
19 packer = _cmsgpack.Packer()
20 profile("packing %s (ext)" % name, lambda: packer.pack(data))
21 packer = fallback.Packer()
22 profile("packing %s (fallback)" % name, lambda: packer.pack(data))
23
24 data = packer.pack(data)
25 if has_ext:
26 profile("unpacking %s (ext)" % name, lambda: _cmsgpack.unpackb(data))
27 profile("unpacking %s (fallback)" % name, lambda: fallback.unpackb(data))
28
29
30 def main():
31 simple("integers", [7] * 10000)
32 simple("bytes", [b"x" * n for n in range(100)] * 10)
33 simple("lists", [[]] * 10000)
34 simple("dicts", [{}] * 10000)
35
36
37 main()
+0
-9
ci/runtests.bat less more
0 %PYTHON%\python.exe -m pip install -U pip wheel pytest
1 %PYTHON%\python.exe setup.py build_ext -i
2 %PYTHON%\python.exe setup.py install
3 %PYTHON%\python.exe -c "import sys; print(hex(sys.maxsize))"
4 %PYTHON%\python.exe -c "from msgpack import _cmsgpack"
5 %PYTHON%\python.exe setup.py bdist_wheel
6 %PYTHON%\python.exe -m pytest -v test
7 SET EL=%ERRORLEVEL%
8 exit /b %EL%
+0
-8
ci/runtests.sh less more
0 #!/bin/bash
1 set -ex
2 ${PYTHON} -VV
3 ${PYTHON} -m pip install setuptools wheel pytest
4 ${PYTHON} setup.py build_ext -if
5 ${PYTHON} -c "from msgpack import _cmsgpack"
6 ${PYTHON} setup.py bdist_wheel
7 ${PYTHON} -m pytest -v test
+0
-20
docker/buildwheel.sh less more
0 #!/bin/bash
1 DOCKER_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2 source "$DOCKER_DIR/shared.env"
3
4 set -e -x
5
6 ARCH=`uname -p`
7 echo "arch=$ARCH"
8
9 for V in "${PYTHON_VERSIONS[@]}"; do
10 PYBIN=/opt/python/$V/bin
11 rm -rf build/ # Avoid lib build by narrow Python is used by wide python
12 $PYBIN/python setup.py bdist_wheel
13 done
14
15 cd dist
16 for whl in *.whl; do
17 auditwheel repair "$whl"
18 rm "$whl"
19 done
+0
-17
docker/runtests.sh less more
0 #!/bin/bash
1 DOCKER_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2 source "$DOCKER_DIR/shared.env"
3
4 set -e -x
5
6 for V in "${PYTHON_VERSIONS[@]}"; do
7 PYBIN=/opt/python/$V/bin
8 $PYBIN/python setup.py install
9 rm -rf build/ # Avoid lib build by narrow Python is used by wide python
10 $PYBIN/pip install pytest
11 pushd test # prevent importing msgpack package in current directory.
12 $PYBIN/python -c 'import sys; print(hex(sys.maxsize))'
13 $PYBIN/python -c 'from msgpack import _cmsgpack' # Ensure extension is available
14 $PYBIN/pytest -v .
15 popd
16 done
+0
-7
docker/shared.env less more
0 PYTHON_VERSIONS=(
1 cp39-cp39
2 cp38-cp38
3 cp37-cp37m
4 cp36-cp36m
5 cp35-cp35m
6 )
+0
-159
docs/Makefile less more
0 # Makefile for Sphinx documentation
1 #
2
3 # You can set these variables from the command line.
4 SPHINXOPTS =
5 SPHINXBUILD = sphinx-build
6 PAPER =
7 BUILDDIR = _build
8
9 # Internal variables.
10 PAPEROPT_a4 = -D latex_paper_size=a4
11 PAPEROPT_letter = -D latex_paper_size=letter
12 ALLSPHINXOPTS = -E -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
13 # the i18n builder cannot share the environment and doctrees with the others
14 I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
15
16 .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
17
18 help:
19 @echo "Please use \`make <target>' where <target> is one of"
20 @echo " html to make standalone HTML files"
21 @echo " dirhtml to make HTML files named index.html in directories"
22 @echo " singlehtml to make a single large HTML file"
23 @echo " pickle to make pickle files"
24 @echo " json to make JSON files"
25 @echo " htmlhelp to make HTML files and a HTML help project"
26 @echo " qthelp to make HTML files and a qthelp project"
27 @echo " devhelp to make HTML files and a Devhelp project"
28 @echo " epub to make an epub"
29 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
30 @echo " latexpdf to make LaTeX files and run them through pdflatex"
31 @echo " text to make text files"
32 @echo " man to make manual pages"
33 @echo " texinfo to make Texinfo files"
34 @echo " info to make Texinfo files and run them through makeinfo"
35 @echo " gettext to make PO message catalogs"
36 @echo " changes to make an overview of all changed/added/deprecated items"
37 @echo " linkcheck to check all external links for integrity"
38 @echo " doctest to run all doctests embedded in the documentation (if enabled)"
39
40 clean:
41 -rm -rf $(BUILDDIR)/*
42
43 html:
44 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
45 @echo
46 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
47
48 dirhtml:
49 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
50 @echo
51 @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
52
53 singlehtml:
54 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
55 @echo
56 @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
57
58 pickle:
59 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
60 @echo
61 @echo "Build finished; now you can process the pickle files."
62
63 json:
64 $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
65 @echo
66 @echo "Build finished; now you can process the JSON files."
67
68 htmlhelp:
69 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
70 @echo
71 @echo "Build finished; now you can run HTML Help Workshop with the" \
72 ".hhp project file in $(BUILDDIR)/htmlhelp."
73
74 qthelp:
75 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
76 @echo
77 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
78 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
79 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/msgpack.qhcp"
80 @echo "To view the help file:"
81 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/msgpack.qhc"
82
83 devhelp:
84 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
85 @echo
86 @echo "Build finished."
87 @echo "To view the help file:"
88 @echo "# mkdir -p $$HOME/.local/share/devhelp/msgpack"
89 @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/msgpack"
90 @echo "# devhelp"
91
92 epub:
93 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
94 @echo
95 @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
96
97 latex:
98 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
99 @echo
100 @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
101 @echo "Run \`make' in that directory to run these through (pdf)latex" \
102 "(use \`make latexpdf' here to do that automatically)."
103
104 latexpdf:
105 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
106 @echo "Running LaTeX files through pdflatex..."
107 $(MAKE) -C $(BUILDDIR)/latex all-pdf
108 @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
109
110 text:
111 $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
112 @echo
113 @echo "Build finished. The text files are in $(BUILDDIR)/text."
114
115 man:
116 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
117 @echo
118 @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
119
120 texinfo:
121 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
122 @echo
123 @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
124 @echo "Run \`make' in that directory to run these through makeinfo" \
125 "(use \`make info' here to do that automatically)."
126
127 info:
128 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
129 @echo "Running Texinfo files through makeinfo..."
130 make -C $(BUILDDIR)/texinfo info
131 @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
132
133 gettext:
134 $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
135 @echo
136 @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
137
138 changes:
139 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
140 @echo
141 @echo "The overview file is in $(BUILDDIR)/changes."
142
143 linkcheck:
144 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
145 @echo
146 @echo "Link check complete; look for any errors in the above output " \
147 "or in $(BUILDDIR)/linkcheck/output.txt."
148
149 doctest:
150 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
151 @echo "Testing of doctests in the sources finished, look at the " \
152 "results in $(BUILDDIR)/doctest/output.txt."
153
154 serve: html
155 python3 -m http.server -d _build/html
156
157 zip: html
158 cd _build/html && zip -r ../../../msgpack-doc.zip .
+0
-32
docs/advanced.rst less more
0 Advanced usage
1 ===============
2
3 Packer
4 ------
5
6 autoreset
7 ~~~~~~~~~
8
9 When you used ``autoreset=False`` option of :class:`~msgpack.Packer`,
10 ``pack()`` method doesn't return packed ``bytes``.
11
12 You can use :meth:`~msgpack.Packer.bytes` or :meth:`~msgpack.Packer.getbuffer` to
13 get packed data.
14
15 ``bytes()`` returns ``bytes`` object. ``getbuffer()`` returns some bytes-like
16 object. It's concrete type is implement detail and it will be changed in future
17 versions.
18
19 You can reduce temporary bytes object by using ``Unpacker.getbuffer()``.
20
21 .. code-block:: python
22
23 packer = Packer(use_bin_type=True, autoreset=False)
24
25 packer.pack([1, 2])
26 packer.pack([3, 4])
27
28 with open('data.bin', 'wb') as f:
29 f.write(packer.getbuffer())
30
31 packer.reset() # reset internal buffer
+0
-43
docs/api.rst less more
0 API reference
1 =============
2
3 .. module:: msgpack
4
5 .. autofunction:: pack
6
7 :func:`dump` is alias for :func:`pack`
8
9 .. autofunction:: packb
10
11 :func:`dumps` is alias for :func:`packb`
12
13 .. autofunction:: unpack
14
15 :func:`load` is alias for :func:`unpack`
16
17 .. autofunction:: unpackb
18
19 :func:`loads` is alias for :func:`unpackb`
20
21 .. autoclass:: Packer
22 :members:
23
24 .. autoclass:: Unpacker
25 :members:
26
27 .. autoclass:: ExtType
28
29 .. autoclass:: Timestamp
30 :members:
31 :special-members: __init__
32
33 exceptions
34 ----------
35
36 These exceptions are accessible via `msgpack` package.
37 (For example, `msgpack.OutOfData` is shortcut for `msgpack.exceptions.OutOfData`)
38
39 .. automodule:: msgpack.exceptions
40 :members:
41 :undoc-members:
42 :show-inheritance:
+0
-285
docs/conf.py less more
0 # -*- coding: utf-8 -*-
1 #
2 # msgpack documentation build configuration file, created by
3 # sphinx-quickstart on Sun Feb 24 14:20:50 2013.
4 #
5 # This file is execfile()d with the current directory set to its containing dir.
6 #
7 # Note that not all possible configuration values are present in this
8 # autogenerated file.
9 #
10 # All configuration values have a default; values that are commented out
11 # serve to show the default.
12
13 import sys, os
14
15 # If extensions (or modules to document with autodoc) are in another directory,
16 # add these directories to sys.path here. If the directory is relative to the
17 # documentation root, use os.path.abspath to make it absolute, like shown here.
18 # sys.path.insert(0, os.path.abspath('.'))
19
20 # -- General configuration -----------------------------------------------------
21
22 # If your documentation needs a minimal Sphinx version, state it here.
23 # needs_sphinx = '1.0'
24
25 # Add any Sphinx extension module names here, as strings. They can be extensions
26 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
27 extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
28
29 # Add any paths that contain templates here, relative to this directory.
30 templates_path = ["_templates"]
31
32 # The suffix of source filenames.
33 source_suffix = ".rst"
34
35 # The encoding of source files.
36 # source_encoding = 'utf-8-sig'
37
38 # The master toctree document.
39 master_doc = "index"
40
41 # General information about the project.
42 project = u"msgpack"
43 copyright = u"Inada Naoki"
44
45 # The version info for the project you're documenting, acts as replacement for
46 # |version| and |release|, also used in various other places throughout the
47 # built documents.
48 #
49 # The short X.Y version.
50 # The full version, including alpha/beta/rc tags.
51 version = release = "1.0"
52
53 # The language for content autogenerated by Sphinx. Refer to documentation
54 # for a list of supported languages.
55 # language = None
56
57 # There are two options for replacing |today|: either, you set today to some
58 # non-false value, then it is used:
59 # today = ''
60 # Else, today_fmt is used as the format for a strftime call.
61 # today_fmt = '%B %d, %Y'
62 today_fmt = "%Y-%m-%d"
63
64 # List of patterns, relative to source directory, that match files and
65 # directories to ignore when looking for source files.
66 exclude_patterns = ["_build"]
67
68 # The reST default role (used for this markup: `text`) to use for all documents.
69 # default_role = None
70
71 # If true, '()' will be appended to :func: etc. cross-reference text.
72 # add_function_parentheses = True
73
74 # If true, the current module name will be prepended to all description
75 # unit titles (such as .. function::).
76 # add_module_names = True
77
78 # If true, sectionauthor and moduleauthor directives will be shown in the
79 # output. They are ignored by default.
80 # show_authors = False
81
82 # The name of the Pygments (syntax highlighting) style to use.
83 pygments_style = "sphinx"
84
85 # A list of ignored prefixes for module index sorting.
86 # modindex_common_prefix = []
87
88
89 # -- Options for HTML output ---------------------------------------------------
90
91 # The theme to use for HTML and HTML Help pages. See the documentation for
92 # a list of builtin themes.
93 html_theme = "sphinxdoc"
94
95 # Theme options are theme-specific and customize the look and feel of a theme
96 # further. For a list of options available for each theme, see the
97 # documentation.
98 # html_theme_options = {}
99
100 # Add any paths that contain custom themes here, relative to this directory.
101 # html_theme_path = []
102
103 # The name for this set of Sphinx documents. If None, it defaults to
104 # "<project> v<release> documentation".
105 # html_title = None
106
107 # A shorter title for the navigation bar. Default is the same as html_title.
108 # html_short_title = None
109
110 # The name of an image file (relative to this directory) to place at the top
111 # of the sidebar.
112 # html_logo = None
113
114 # The name of an image file (within the static path) to use as favicon of the
115 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
116 # pixels large.
117 # html_favicon = None
118
119 # Add any paths that contain custom static files (such as style sheets) here,
120 # relative to this directory. They are copied after the builtin static files,
121 # so a file named "default.css" will overwrite the builtin "default.css".
122 html_static_path = ["_static"]
123
124 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
125 # using the given strftime format.
126 # html_last_updated_fmt = '%b %d, %Y'
127
128 # If true, SmartyPants will be used to convert quotes and dashes to
129 # typographically correct entities.
130 # html_use_smartypants = True
131
132 # Custom sidebar templates, maps document names to template names.
133 # html_sidebars = {}
134
135 # Additional templates that should be rendered to pages, maps page names to
136 # template names.
137 # html_additional_pages = {}
138
139 # If false, no module index is generated.
140 # html_domain_indices = True
141
142 # If false, no index is generated.
143 # html_use_index = True
144
145 # If true, the index is split into individual pages for each letter.
146 # html_split_index = False
147
148 # If true, links to the reST sources are added to the pages.
149 # html_show_sourcelink = True
150
151 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
152 # html_show_sphinx = True
153
154 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
155 # html_show_copyright = True
156
157 # If true, an OpenSearch description file will be output, and all pages will
158 # contain a <link> tag referring to it. The value of this option must be the
159 # base URL from which the finished HTML is served.
160 # html_use_opensearch = ''
161
162 # This is the file name suffix for HTML files (e.g. ".xhtml").
163 # html_file_suffix = None
164
165 # Output file base name for HTML help builder.
166 htmlhelp_basename = "msgpackdoc"
167
168
169 # -- Options for LaTeX output --------------------------------------------------
170
171 latex_elements = {
172 # The paper size ('letterpaper' or 'a4paper').
173 #'papersize': 'letterpaper',
174 # The font size ('10pt', '11pt' or '12pt').
175 #'pointsize': '10pt',
176 # Additional stuff for the LaTeX preamble.
177 #'preamble': '',
178 }
179
180 # Grouping the document tree into LaTeX files. List of tuples
181 # (source start file, target name, title, author, documentclass [howto/manual]).
182 latex_documents = [
183 ("index", "msgpack.tex", u"msgpack Documentation", u"Author", "manual"),
184 ]
185
186 # The name of an image file (relative to this directory) to place at the top of
187 # the title page.
188 # latex_logo = None
189
190 # For "manual" documents, if this is true, then toplevel headings are parts,
191 # not chapters.
192 # latex_use_parts = False
193
194 # If true, show page references after internal links.
195 # latex_show_pagerefs = False
196
197 # If true, show URL addresses after external links.
198 # latex_show_urls = False
199
200 # Documents to append as an appendix to all manuals.
201 # latex_appendices = []
202
203 # If false, no module index is generated.
204 # latex_domain_indices = True
205
206
207 # -- Options for manual page output --------------------------------------------
208
209 # One entry per manual page. List of tuples
210 # (source start file, name, description, authors, manual section).
211 man_pages = [("index", "msgpack", u"msgpack Documentation", [u"Author"], 1)]
212
213 # If true, show URL addresses after external links.
214 # man_show_urls = False
215
216
217 # -- Options for Texinfo output ------------------------------------------------
218
219 # Grouping the document tree into Texinfo files. List of tuples
220 # (source start file, target name, title, author,
221 # dir menu entry, description, category)
222 texinfo_documents = [
223 (
224 "index",
225 "msgpack",
226 u"msgpack Documentation",
227 u"Author",
228 "msgpack",
229 "One line description of project.",
230 "Miscellaneous",
231 ),
232 ]
233
234 # Documents to append as an appendix to all manuals.
235 # texinfo_appendices = []
236
237 # If false, no module index is generated.
238 # texinfo_domain_indices = True
239
240 # How to display URL addresses: 'footnote', 'no', or 'inline'.
241 # texinfo_show_urls = 'footnote'
242
243
244 # -- Options for Epub output ---------------------------------------------------
245
246 # Bibliographic Dublin Core info.
247 epub_title = u"msgpack"
248 epub_author = u"Author"
249 epub_publisher = u"Author"
250 epub_copyright = u"2013, Author"
251
252 # The language of the text. It defaults to the language option
253 # or en if the language is not set.
254 # epub_language = ''
255
256 # The scheme of the identifier. Typical schemes are ISBN or URL.
257 # epub_scheme = ''
258
259 # The unique identifier of the text. This can be a ISBN number
260 # or the project homepage.
261 # epub_identifier = ''
262
263 # A unique identification for the text.
264 # epub_uid = ''
265
266 # A tuple containing the cover image and cover page html template filenames.
267 # epub_cover = ()
268
269 # HTML files that should be inserted before the pages created by sphinx.
270 # The format is a list of tuples containing the path and title.
271 # epub_pre_files = []
272
273 # HTML files shat should be inserted after the pages created by sphinx.
274 # The format is a list of tuples containing the path and title.
275 # epub_post_files = []
276
277 # A list of files that should not be packed into the epub file.
278 # epub_exclude_files = []
279
280 # The depth of the table of contents in toc.ncx.
281 # epub_tocdepth = 3
282
283 # Allow duplicate toc entries.
284 # epub_tocdup = True
+0
-11
docs/index.rst less more
0 msgpack document
1 ================
2
3 `MessagePack <http://msgpack.org>`_ is a efficient format for inter
4 language data exchange.
5
6 .. toctree::
7 :maxdepth: 1
8
9 api
10 advanced
0 /* Generated by Cython 0.29.24 */
1
2 #ifndef PY_SSIZE_T_CLEAN
3 #define PY_SSIZE_T_CLEAN
4 #endif /* PY_SSIZE_T_CLEAN */
5 #include "Python.h"
6 #ifndef Py_PYTHON_H
7 #error Python headers needed to compile C extensions, please install development version of Python.
8 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
9 #error Cython requires Python 2.6+ or Python 3.3+.
10 #else
11 #define CYTHON_ABI "0_29_24"
12 #define CYTHON_HEX_VERSION 0x001D18F0
13 #define CYTHON_FUTURE_DIVISION 1
14 #include <stddef.h>
15 #ifndef offsetof
16 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
17 #endif
18 #if !defined(WIN32) && !defined(MS_WINDOWS)
19 #ifndef __stdcall
20 #define __stdcall
21 #endif
22 #ifndef __cdecl
23 #define __cdecl
24 #endif
25 #ifndef __fastcall
26 #define __fastcall
27 #endif
28 #endif
29 #ifndef DL_IMPORT
30 #define DL_IMPORT(t) t
31 #endif
32 #ifndef DL_EXPORT
33 #define DL_EXPORT(t) t
34 #endif
35 #define __PYX_COMMA ,
36 #ifndef HAVE_LONG_LONG
37 #if PY_VERSION_HEX >= 0x02070000
38 #define HAVE_LONG_LONG
39 #endif
40 #endif
41 #ifndef PY_LONG_LONG
42 #define PY_LONG_LONG LONG_LONG
43 #endif
44 #ifndef Py_HUGE_VAL
45 #define Py_HUGE_VAL HUGE_VAL
46 #endif
47 #ifdef PYPY_VERSION
48 #define CYTHON_COMPILING_IN_PYPY 1
49 #define CYTHON_COMPILING_IN_PYSTON 0
50 #define CYTHON_COMPILING_IN_CPYTHON 0
51 #undef CYTHON_USE_TYPE_SLOTS
52 #define CYTHON_USE_TYPE_SLOTS 0
53 #undef CYTHON_USE_PYTYPE_LOOKUP
54 #define CYTHON_USE_PYTYPE_LOOKUP 0
55 #if PY_VERSION_HEX < 0x03050000
56 #undef CYTHON_USE_ASYNC_SLOTS
57 #define CYTHON_USE_ASYNC_SLOTS 0
58 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
59 #define CYTHON_USE_ASYNC_SLOTS 1
60 #endif
61 #undef CYTHON_USE_PYLIST_INTERNALS
62 #define CYTHON_USE_PYLIST_INTERNALS 0
63 #undef CYTHON_USE_UNICODE_INTERNALS
64 #define CYTHON_USE_UNICODE_INTERNALS 0
65 #undef CYTHON_USE_UNICODE_WRITER
66 #define CYTHON_USE_UNICODE_WRITER 0
67 #undef CYTHON_USE_PYLONG_INTERNALS
68 #define CYTHON_USE_PYLONG_INTERNALS 0
69 #undef CYTHON_AVOID_BORROWED_REFS
70 #define CYTHON_AVOID_BORROWED_REFS 1
71 #undef CYTHON_ASSUME_SAFE_MACROS
72 #define CYTHON_ASSUME_SAFE_MACROS 0
73 #undef CYTHON_UNPACK_METHODS
74 #define CYTHON_UNPACK_METHODS 0
75 #undef CYTHON_FAST_THREAD_STATE
76 #define CYTHON_FAST_THREAD_STATE 0
77 #undef CYTHON_FAST_PYCALL
78 #define CYTHON_FAST_PYCALL 0
79 #undef CYTHON_PEP489_MULTI_PHASE_INIT
80 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
81 #undef CYTHON_USE_TP_FINALIZE
82 #define CYTHON_USE_TP_FINALIZE 0
83 #undef CYTHON_USE_DICT_VERSIONS
84 #define CYTHON_USE_DICT_VERSIONS 0
85 #undef CYTHON_USE_EXC_INFO_STACK
86 #define CYTHON_USE_EXC_INFO_STACK 0
87 #elif defined(PYSTON_VERSION)
88 #define CYTHON_COMPILING_IN_PYPY 0
89 #define CYTHON_COMPILING_IN_PYSTON 1
90 #define CYTHON_COMPILING_IN_CPYTHON 0
91 #ifndef CYTHON_USE_TYPE_SLOTS
92 #define CYTHON_USE_TYPE_SLOTS 1
93 #endif
94 #undef CYTHON_USE_PYTYPE_LOOKUP
95 #define CYTHON_USE_PYTYPE_LOOKUP 0
96 #undef CYTHON_USE_ASYNC_SLOTS
97 #define CYTHON_USE_ASYNC_SLOTS 0
98 #undef CYTHON_USE_PYLIST_INTERNALS
99 #define CYTHON_USE_PYLIST_INTERNALS 0
100 #ifndef CYTHON_USE_UNICODE_INTERNALS
101 #define CYTHON_USE_UNICODE_INTERNALS 1
102 #endif
103 #undef CYTHON_USE_UNICODE_WRITER
104 #define CYTHON_USE_UNICODE_WRITER 0
105 #undef CYTHON_USE_PYLONG_INTERNALS
106 #define CYTHON_USE_PYLONG_INTERNALS 0
107 #ifndef CYTHON_AVOID_BORROWED_REFS
108 #define CYTHON_AVOID_BORROWED_REFS 0
109 #endif
110 #ifndef CYTHON_ASSUME_SAFE_MACROS
111 #define CYTHON_ASSUME_SAFE_MACROS 1
112 #endif
113 #ifndef CYTHON_UNPACK_METHODS
114 #define CYTHON_UNPACK_METHODS 1
115 #endif
116 #undef CYTHON_FAST_THREAD_STATE
117 #define CYTHON_FAST_THREAD_STATE 0
118 #undef CYTHON_FAST_PYCALL
119 #define CYTHON_FAST_PYCALL 0
120 #undef CYTHON_PEP489_MULTI_PHASE_INIT
121 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
122 #undef CYTHON_USE_TP_FINALIZE
123 #define CYTHON_USE_TP_FINALIZE 0
124 #undef CYTHON_USE_DICT_VERSIONS
125 #define CYTHON_USE_DICT_VERSIONS 0
126 #undef CYTHON_USE_EXC_INFO_STACK
127 #define CYTHON_USE_EXC_INFO_STACK 0
128 #else
129 #define CYTHON_COMPILING_IN_PYPY 0
130 #define CYTHON_COMPILING_IN_PYSTON 0
131 #define CYTHON_COMPILING_IN_CPYTHON 1
132 #ifndef CYTHON_USE_TYPE_SLOTS
133 #define CYTHON_USE_TYPE_SLOTS 1
134 #endif
135 #if PY_VERSION_HEX < 0x02070000
136 #undef CYTHON_USE_PYTYPE_LOOKUP
137 #define CYTHON_USE_PYTYPE_LOOKUP 0
138 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
139 #define CYTHON_USE_PYTYPE_LOOKUP 1
140 #endif
141 #if PY_MAJOR_VERSION < 3
142 #undef CYTHON_USE_ASYNC_SLOTS
143 #define CYTHON_USE_ASYNC_SLOTS 0
144 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
145 #define CYTHON_USE_ASYNC_SLOTS 1
146 #endif
147 #if PY_VERSION_HEX < 0x02070000
148 #undef CYTHON_USE_PYLONG_INTERNALS
149 #define CYTHON_USE_PYLONG_INTERNALS 0
150 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
151 #define CYTHON_USE_PYLONG_INTERNALS 1
152 #endif
153 #ifndef CYTHON_USE_PYLIST_INTERNALS
154 #define CYTHON_USE_PYLIST_INTERNALS 1
155 #endif
156 #ifndef CYTHON_USE_UNICODE_INTERNALS
157 #define CYTHON_USE_UNICODE_INTERNALS 1
158 #endif
159 #if PY_VERSION_HEX < 0x030300F0
160 #undef CYTHON_USE_UNICODE_WRITER
161 #define CYTHON_USE_UNICODE_WRITER 0
162 #elif !defined(CYTHON_USE_UNICODE_WRITER)
163 #define CYTHON_USE_UNICODE_WRITER 1
164 #endif
165 #ifndef CYTHON_AVOID_BORROWED_REFS
166 #define CYTHON_AVOID_BORROWED_REFS 0
167 #endif
168 #ifndef CYTHON_ASSUME_SAFE_MACROS
169 #define CYTHON_ASSUME_SAFE_MACROS 1
170 #endif
171 #ifndef CYTHON_UNPACK_METHODS
172 #define CYTHON_UNPACK_METHODS 1
173 #endif
174 #ifndef CYTHON_FAST_THREAD_STATE
175 #define CYTHON_FAST_THREAD_STATE 1
176 #endif
177 #ifndef CYTHON_FAST_PYCALL
178 #define CYTHON_FAST_PYCALL 1
179 #endif
180 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
181 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
182 #endif
183 #ifndef CYTHON_USE_TP_FINALIZE
184 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
185 #endif
186 #ifndef CYTHON_USE_DICT_VERSIONS
187 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
188 #endif
189 #ifndef CYTHON_USE_EXC_INFO_STACK
190 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
191 #endif
192 #endif
193 #if !defined(CYTHON_FAST_PYCCALL)
194 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
195 #endif
196 #if CYTHON_USE_PYLONG_INTERNALS
197 #include "longintrepr.h"
198 #undef SHIFT
199 #undef BASE
200 #undef MASK
201 #ifdef SIZEOF_VOID_P
202 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
203 #endif
204 #endif
205 #ifndef __has_attribute
206 #define __has_attribute(x) 0
207 #endif
208 #ifndef __has_cpp_attribute
209 #define __has_cpp_attribute(x) 0
210 #endif
211 #ifndef CYTHON_RESTRICT
212 #if defined(__GNUC__)
213 #define CYTHON_RESTRICT __restrict__
214 #elif defined(_MSC_VER) && _MSC_VER >= 1400
215 #define CYTHON_RESTRICT __restrict
216 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
217 #define CYTHON_RESTRICT restrict
218 #else
219 #define CYTHON_RESTRICT
220 #endif
221 #endif
222 #ifndef CYTHON_UNUSED
223 # if defined(__GNUC__)
224 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
225 # define CYTHON_UNUSED __attribute__ ((__unused__))
226 # else
227 # define CYTHON_UNUSED
228 # endif
229 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
230 # define CYTHON_UNUSED __attribute__ ((__unused__))
231 # else
232 # define CYTHON_UNUSED
233 # endif
234 #endif
235 #ifndef CYTHON_MAYBE_UNUSED_VAR
236 # if defined(__cplusplus)
237 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
238 # else
239 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
240 # endif
241 #endif
242 #ifndef CYTHON_NCP_UNUSED
243 # if CYTHON_COMPILING_IN_CPYTHON
244 # define CYTHON_NCP_UNUSED
245 # else
246 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
247 # endif
248 #endif
249 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
250 #ifdef _MSC_VER
251 #ifndef _MSC_STDINT_H_
252 #if _MSC_VER < 1300
253 typedef unsigned char uint8_t;
254 typedef unsigned int uint32_t;
255 #else
256 typedef unsigned __int8 uint8_t;
257 typedef unsigned __int32 uint32_t;
258 #endif
259 #endif
260 #else
261 #include <stdint.h>
262 #endif
263 #ifndef CYTHON_FALLTHROUGH
264 #if defined(__cplusplus) && __cplusplus >= 201103L
265 #if __has_cpp_attribute(fallthrough)
266 #define CYTHON_FALLTHROUGH [[fallthrough]]
267 #elif __has_cpp_attribute(clang::fallthrough)
268 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
269 #elif __has_cpp_attribute(gnu::fallthrough)
270 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
271 #endif
272 #endif
273 #ifndef CYTHON_FALLTHROUGH
274 #if __has_attribute(fallthrough)
275 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
276 #else
277 #define CYTHON_FALLTHROUGH
278 #endif
279 #endif
280 #if defined(__clang__ ) && defined(__apple_build_version__)
281 #if __apple_build_version__ < 7000000
282 #undef CYTHON_FALLTHROUGH
283 #define CYTHON_FALLTHROUGH
284 #endif
285 #endif
286 #endif
287
288 #ifndef __cplusplus
289 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
290 #endif
291 #ifndef CYTHON_INLINE
292 #if defined(__clang__)
293 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
294 #else
295 #define CYTHON_INLINE inline
296 #endif
297 #endif
298 template<typename T>
299 void __Pyx_call_destructor(T& x) {
300 x.~T();
301 }
302 template<typename T>
303 class __Pyx_FakeReference {
304 public:
305 __Pyx_FakeReference() : ptr(NULL) { }
306 __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
307 T *operator->() { return ptr; }
308 T *operator&() { return ptr; }
309 operator T&() { return *ptr; }
310 template<typename U> bool operator ==(U other) { return *ptr == other; }
311 template<typename U> bool operator !=(U other) { return *ptr != other; }
312 private:
313 T *ptr;
314 };
315
316 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
317 #define Py_OptimizeFlag 0
318 #endif
319 #define __PYX_BUILD_PY_SSIZE_T "n"
320 #define CYTHON_FORMAT_SSIZE_T "z"
321 #if PY_MAJOR_VERSION < 3
322 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
323 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
324 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
325 #define __Pyx_DefaultClassType PyClass_Type
326 #else
327 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
328 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
329 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
330 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
331 #else
332 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
333 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
334 #endif
335 #define __Pyx_DefaultClassType PyType_Type
336 #endif
337 #ifndef Py_TPFLAGS_CHECKTYPES
338 #define Py_TPFLAGS_CHECKTYPES 0
339 #endif
340 #ifndef Py_TPFLAGS_HAVE_INDEX
341 #define Py_TPFLAGS_HAVE_INDEX 0
342 #endif
343 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
344 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
345 #endif
346 #ifndef Py_TPFLAGS_HAVE_FINALIZE
347 #define Py_TPFLAGS_HAVE_FINALIZE 0
348 #endif
349 #ifndef METH_STACKLESS
350 #define METH_STACKLESS 0
351 #endif
352 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
353 #ifndef METH_FASTCALL
354 #define METH_FASTCALL 0x80
355 #endif
356 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
357 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
358 Py_ssize_t nargs, PyObject *kwnames);
359 #else
360 #define __Pyx_PyCFunctionFast _PyCFunctionFast
361 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
362 #endif
363 #if CYTHON_FAST_PYCCALL
364 #define __Pyx_PyFastCFunction_Check(func)\
365 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
366 #else
367 #define __Pyx_PyFastCFunction_Check(func) 0
368 #endif
369 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
370 #define PyObject_Malloc(s) PyMem_Malloc(s)
371 #define PyObject_Free(p) PyMem_Free(p)
372 #define PyObject_Realloc(p) PyMem_Realloc(p)
373 #endif
374 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
375 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
376 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
377 #define PyMem_RawFree(p) PyMem_Free(p)
378 #endif
379 #if CYTHON_COMPILING_IN_PYSTON
380 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
381 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
382 #else
383 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
384 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
385 #endif
386 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
387 #define __Pyx_PyThreadState_Current PyThreadState_GET()
388 #elif PY_VERSION_HEX >= 0x03060000
389 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
390 #elif PY_VERSION_HEX >= 0x03000000
391 #define __Pyx_PyThreadState_Current PyThreadState_GET()
392 #else
393 #define __Pyx_PyThreadState_Current _PyThreadState_Current
394 #endif
395 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
396 #include "pythread.h"
397 #define Py_tss_NEEDS_INIT 0
398 typedef int Py_tss_t;
399 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
400 *key = PyThread_create_key();
401 return 0;
402 }
403 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
404 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
405 *key = Py_tss_NEEDS_INIT;
406 return key;
407 }
408 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
409 PyObject_Free(key);
410 }
411 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
412 return *key != Py_tss_NEEDS_INIT;
413 }
414 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
415 PyThread_delete_key(*key);
416 *key = Py_tss_NEEDS_INIT;
417 }
418 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
419 return PyThread_set_key_value(*key, value);
420 }
421 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
422 return PyThread_get_key_value(*key);
423 }
424 #endif
425 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
426 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
427 #else
428 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
429 #endif
430 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
431 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
432 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
433 #else
434 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
435 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
436 #endif
437 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
438 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
439 #else
440 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
441 #endif
442 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
443 #define CYTHON_PEP393_ENABLED 1
444 #if defined(PyUnicode_IS_READY)
445 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
446 0 : _PyUnicode_Ready((PyObject *)(op)))
447 #else
448 #define __Pyx_PyUnicode_READY(op) (0)
449 #endif
450 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
451 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
452 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
453 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
454 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
455 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
456 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
457 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
458 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
459 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
460 #else
461 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
462 #endif
463 #else
464 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
465 #endif
466 #else
467 #define CYTHON_PEP393_ENABLED 0
468 #define PyUnicode_1BYTE_KIND 1
469 #define PyUnicode_2BYTE_KIND 2
470 #define PyUnicode_4BYTE_KIND 4
471 #define __Pyx_PyUnicode_READY(op) (0)
472 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
473 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
474 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
475 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
476 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
477 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
478 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
479 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
480 #endif
481 #if CYTHON_COMPILING_IN_PYPY
482 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
483 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
484 #else
485 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
486 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
487 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
488 #endif
489 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
490 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
491 #endif
492 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
493 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
494 #endif
495 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
496 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
497 #endif
498 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
499 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
500 #if PY_MAJOR_VERSION >= 3
501 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
502 #else
503 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
504 #endif
505 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
506 #define PyObject_ASCII(o) PyObject_Repr(o)
507 #endif
508 #if PY_MAJOR_VERSION >= 3
509 #define PyBaseString_Type PyUnicode_Type
510 #define PyStringObject PyUnicodeObject
511 #define PyString_Type PyUnicode_Type
512 #define PyString_Check PyUnicode_Check
513 #define PyString_CheckExact PyUnicode_CheckExact
514 #ifndef PyObject_Unicode
515 #define PyObject_Unicode PyObject_Str
516 #endif
517 #endif
518 #if PY_MAJOR_VERSION >= 3
519 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
520 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
521 #else
522 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
523 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
524 #endif
525 #ifndef PySet_CheckExact
526 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
527 #endif
528 #if PY_VERSION_HEX >= 0x030900A4
529 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
530 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
531 #else
532 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
533 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
534 #endif
535 #if CYTHON_ASSUME_SAFE_MACROS
536 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
537 #else
538 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
539 #endif
540 #if PY_MAJOR_VERSION >= 3
541 #define PyIntObject PyLongObject
542 #define PyInt_Type PyLong_Type
543 #define PyInt_Check(op) PyLong_Check(op)
544 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
545 #define PyInt_FromString PyLong_FromString
546 #define PyInt_FromUnicode PyLong_FromUnicode
547 #define PyInt_FromLong PyLong_FromLong
548 #define PyInt_FromSize_t PyLong_FromSize_t
549 #define PyInt_FromSsize_t PyLong_FromSsize_t
550 #define PyInt_AsLong PyLong_AsLong
551 #define PyInt_AS_LONG PyLong_AS_LONG
552 #define PyInt_AsSsize_t PyLong_AsSsize_t
553 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
554 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
555 #define PyNumber_Int PyNumber_Long
556 #endif
557 #if PY_MAJOR_VERSION >= 3
558 #define PyBoolObject PyLongObject
559 #endif
560 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
561 #ifndef PyUnicode_InternFromString
562 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
563 #endif
564 #endif
565 #if PY_VERSION_HEX < 0x030200A4
566 typedef long Py_hash_t;
567 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
568 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
569 #else
570 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
571 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
572 #endif
573 #if PY_MAJOR_VERSION >= 3
574 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
575 #else
576 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
577 #endif
578 #if CYTHON_USE_ASYNC_SLOTS
579 #if PY_VERSION_HEX >= 0x030500B1
580 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
581 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
582 #else
583 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
584 #endif
585 #else
586 #define __Pyx_PyType_AsAsync(obj) NULL
587 #endif
588 #ifndef __Pyx_PyAsyncMethodsStruct
589 typedef struct {
590 unaryfunc am_await;
591 unaryfunc am_aiter;
592 unaryfunc am_anext;
593 } __Pyx_PyAsyncMethodsStruct;
594 #endif
595
596 #if defined(WIN32) || defined(MS_WINDOWS)
597 #define _USE_MATH_DEFINES
598 #endif
599 #include <math.h>
600 #ifdef NAN
601 #define __PYX_NAN() ((float) NAN)
602 #else
603 static CYTHON_INLINE float __PYX_NAN() {
604 float value;
605 memset(&value, 0xFF, sizeof(value));
606 return value;
607 }
608 #endif
609 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
610 #define __Pyx_truncl trunc
611 #else
612 #define __Pyx_truncl truncl
613 #endif
614
615 #define __PYX_MARK_ERR_POS(f_index, lineno) \
616 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
617 #define __PYX_ERR(f_index, lineno, Ln_error) \
618 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
619
620 #ifndef __PYX_EXTERN_C
621 #ifdef __cplusplus
622 #define __PYX_EXTERN_C extern "C"
623 #else
624 #define __PYX_EXTERN_C extern
625 #endif
626 #endif
627
628 #define __PYX_HAVE__msgpack___cmsgpack
629 #define __PYX_HAVE_API__msgpack___cmsgpack
630 /* Early includes */
631 #include <string.h>
632 #include <stdio.h>
633 #include "datetime.h"
634 #include "pythread.h"
635 #include "pack.h"
636 #include "buff_converter.h"
637 #include <stdlib.h>
638 #include <limits.h>
639 #include <stdint.h>
640 #include "unpack.h"
641 #ifdef _OPENMP
642 #include <omp.h>
643 #endif /* _OPENMP */
644
645 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
646 #define CYTHON_WITHOUT_ASSERTIONS
647 #endif
648
649 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
650 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
651
652 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 1
653 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
654 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
655 #define __PYX_DEFAULT_STRING_ENCODING "ascii"
656 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
657 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
658 #define __Pyx_uchar_cast(c) ((unsigned char)c)
659 #define __Pyx_long_cast(x) ((long)x)
660 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
661 (sizeof(type) < sizeof(Py_ssize_t)) ||\
662 (sizeof(type) > sizeof(Py_ssize_t) &&\
663 likely(v < (type)PY_SSIZE_T_MAX ||\
664 v == (type)PY_SSIZE_T_MAX) &&\
665 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
666 v == (type)PY_SSIZE_T_MIN))) ||\
667 (sizeof(type) == sizeof(Py_ssize_t) &&\
668 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
669 v == (type)PY_SSIZE_T_MAX))) )
670 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
671 return (size_t) i < (size_t) limit;
672 }
673 #if defined (__cplusplus) && __cplusplus >= 201103L
674 #include <cstdlib>
675 #define __Pyx_sst_abs(value) std::abs(value)
676 #elif SIZEOF_INT >= SIZEOF_SIZE_T
677 #define __Pyx_sst_abs(value) abs(value)
678 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
679 #define __Pyx_sst_abs(value) labs(value)
680 #elif defined (_MSC_VER)
681 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
682 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
683 #define __Pyx_sst_abs(value) llabs(value)
684 #elif defined (__GNUC__)
685 #define __Pyx_sst_abs(value) __builtin_llabs(value)
686 #else
687 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
688 #endif
689 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
690 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
691 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
692 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
693 #define __Pyx_PyBytes_FromString PyBytes_FromString
694 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
695 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
696 #if PY_MAJOR_VERSION < 3
697 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
698 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
699 #else
700 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
701 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
702 #endif
703 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
704 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
705 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
706 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
707 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
708 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
709 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
710 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
711 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
712 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
713 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
714 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
715 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
716 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
717 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
718 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
719 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
720 const Py_UNICODE *u_end = u;
721 while (*u_end++) ;
722 return (size_t)(u_end - u - 1);
723 }
724 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
725 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
726 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
727 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
728 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
729 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
730 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
731 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
732 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
733 #define __Pyx_PySequence_Tuple(obj)\
734 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
735 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
736 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
737 #if CYTHON_ASSUME_SAFE_MACROS
738 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
739 #else
740 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
741 #endif
742 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
743 #if PY_MAJOR_VERSION >= 3
744 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
745 #else
746 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
747 #endif
748 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
749 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
750 static int __Pyx_sys_getdefaultencoding_not_ascii;
751 static int __Pyx_init_sys_getdefaultencoding_params(void) {
752 PyObject* sys;
753 PyObject* default_encoding = NULL;
754 PyObject* ascii_chars_u = NULL;
755 PyObject* ascii_chars_b = NULL;
756 const char* default_encoding_c;
757 sys = PyImport_ImportModule("sys");
758 if (!sys) goto bad;
759 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
760 Py_DECREF(sys);
761 if (!default_encoding) goto bad;
762 default_encoding_c = PyBytes_AsString(default_encoding);
763 if (!default_encoding_c) goto bad;
764 if (strcmp(default_encoding_c, "ascii") == 0) {
765 __Pyx_sys_getdefaultencoding_not_ascii = 0;
766 } else {
767 char ascii_chars[128];
768 int c;
769 for (c = 0; c < 128; c++) {
770 ascii_chars[c] = c;
771 }
772 __Pyx_sys_getdefaultencoding_not_ascii = 1;
773 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
774 if (!ascii_chars_u) goto bad;
775 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
776 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
777 PyErr_Format(
778 PyExc_ValueError,
779 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
780 default_encoding_c);
781 goto bad;
782 }
783 Py_DECREF(ascii_chars_u);
784 Py_DECREF(ascii_chars_b);
785 }
786 Py_DECREF(default_encoding);
787 return 0;
788 bad:
789 Py_XDECREF(default_encoding);
790 Py_XDECREF(ascii_chars_u);
791 Py_XDECREF(ascii_chars_b);
792 return -1;
793 }
794 #endif
795 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
796 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
797 #else
798 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
799 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
800 static char* __PYX_DEFAULT_STRING_ENCODING;
801 static int __Pyx_init_sys_getdefaultencoding_params(void) {
802 PyObject* sys;
803 PyObject* default_encoding = NULL;
804 char* default_encoding_c;
805 sys = PyImport_ImportModule("sys");
806 if (!sys) goto bad;
807 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
808 Py_DECREF(sys);
809 if (!default_encoding) goto bad;
810 default_encoding_c = PyBytes_AsString(default_encoding);
811 if (!default_encoding_c) goto bad;
812 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
813 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
814 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
815 Py_DECREF(default_encoding);
816 return 0;
817 bad:
818 Py_XDECREF(default_encoding);
819 return -1;
820 }
821 #endif
822 #endif
823
824
825 /* Test for GCC > 2.95 */
826 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
827 #define likely(x) __builtin_expect(!!(x), 1)
828 #define unlikely(x) __builtin_expect(!!(x), 0)
829 #else /* !__GNUC__ or GCC < 2.95 */
830 #define likely(x) (x)
831 #define unlikely(x) (x)
832 #endif /* __GNUC__ */
833 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
834
835 static PyObject *__pyx_m = NULL;
836 static PyObject *__pyx_d;
837 static PyObject *__pyx_b;
838 static PyObject *__pyx_cython_runtime = NULL;
839 static PyObject *__pyx_empty_tuple;
840 static PyObject *__pyx_empty_bytes;
841 static PyObject *__pyx_empty_unicode;
842 static int __pyx_lineno;
843 static int __pyx_clineno = 0;
844 static const char * __pyx_cfilenm= __FILE__;
845 static const char *__pyx_filename;
846
847
848 static const char *__pyx_f[] = {
849 "msgpack/_packer.pyx",
850 "msgpack/_unpacker.pyx",
851 "stringsource",
852 "datetime.pxd",
853 "msgpack/_cmsgpack.pyx",
854 "type.pxd",
855 "bool.pxd",
856 "complex.pxd",
857 };
858
859 /*--- Type declarations ---*/
860 struct __pyx_obj_7msgpack_9_cmsgpack_Packer;
861 struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker;
862 struct __pyx_opt_args_7msgpack_9_cmsgpack_6Packer__pack;
863 struct __pyx_opt_args_7msgpack_9_cmsgpack_8Unpacker__unpack;
864
865 /* "msgpack/_packer.pyx":147
866 * self.pk.buf = NULL
867 *
868 * cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1: # <<<<<<<<<<<<<<
869 * cdef long long llval
870 * cdef unsigned long long ullval
871 */
872 struct __pyx_opt_args_7msgpack_9_cmsgpack_6Packer__pack {
873 int __pyx_n;
874 int nest_limit;
875 };
876
877 /* "msgpack/_unpacker.pyx":453
878 * self.file_like = None
879 *
880 * cdef object _unpack(self, execute_fn execute, bint iter=0): # <<<<<<<<<<<<<<
881 * cdef int ret
882 * cdef object obj
883 */
884 struct __pyx_opt_args_7msgpack_9_cmsgpack_8Unpacker__unpack {
885 int __pyx_n;
886 int iter;
887 };
888
889 /* "msgpack/_packer.pyx":62
890 *
891 *
892 * cdef class Packer(object): # <<<<<<<<<<<<<<
893 * """
894 * MessagePack Packer
895 */
896 struct __pyx_obj_7msgpack_9_cmsgpack_Packer {
897 PyObject_HEAD
898 struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer *__pyx_vtab;
899 struct msgpack_packer pk;
900 PyObject *_default;
901 PyObject *_berrors;
902 char const *unicode_errors;
903 int strict_types;
904 int use_float;
905 int autoreset;
906 int datetime;
907 };
908
909
910 /* "msgpack/_unpacker.pyx":213
911 *
912 *
913 * cdef class Unpacker(object): # <<<<<<<<<<<<<<
914 * """Streaming unpacker.
915 *
916 */
917 struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker {
918 PyObject_HEAD
919 struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker *__pyx_vtab;
920 unpack_context ctx;
921 char *buf;
922 Py_ssize_t buf_size;
923 Py_ssize_t buf_head;
924 Py_ssize_t buf_tail;
925 PyObject *file_like;
926 PyObject *file_like_read;
927 Py_ssize_t read_size;
928 PyObject *object_hook;
929 PyObject *object_pairs_hook;
930 PyObject *list_hook;
931 PyObject *ext_hook;
932 PyObject *unicode_errors;
933 Py_ssize_t max_buffer_size;
934 uint64_t stream_offset;
935 };
936
937
938
939 /* "msgpack/_packer.pyx":62
940 *
941 *
942 * cdef class Packer(object): # <<<<<<<<<<<<<<
943 * """
944 * MessagePack Packer
945 */
946
947 struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer {
948 int (*_pack)(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *, PyObject *, struct __pyx_opt_args_7msgpack_9_cmsgpack_6Packer__pack *__pyx_optional_args);
949 PyObject *(*pack)(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *, PyObject *, int __pyx_skip_dispatch);
950 };
951 static struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer *__pyx_vtabptr_7msgpack_9_cmsgpack_Packer;
952
953
954 /* "msgpack/_unpacker.pyx":213
955 *
956 *
957 * cdef class Unpacker(object): # <<<<<<<<<<<<<<
958 * """Streaming unpacker.
959 *
960 */
961
962 struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker {
963 PyObject *(*append_buffer)(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *, void *, Py_ssize_t);
964 PyObject *(*read_from_file)(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *);
965 PyObject *(*_unpack)(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *, execute_fn, struct __pyx_opt_args_7msgpack_9_cmsgpack_8Unpacker__unpack *__pyx_optional_args);
966 };
967 static struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker *__pyx_vtabptr_7msgpack_9_cmsgpack_Unpacker;
968
969 /* --- Runtime support code (head) --- */
970 /* Refnanny.proto */
971 #ifndef CYTHON_REFNANNY
972 #define CYTHON_REFNANNY 0
973 #endif
974 #if CYTHON_REFNANNY
975 typedef struct {
976 void (*INCREF)(void*, PyObject*, int);
977 void (*DECREF)(void*, PyObject*, int);
978 void (*GOTREF)(void*, PyObject*, int);
979 void (*GIVEREF)(void*, PyObject*, int);
980 void* (*SetupContext)(const char*, int, const char*);
981 void (*FinishContext)(void**);
982 } __Pyx_RefNannyAPIStruct;
983 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
984 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
985 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
986 #ifdef WITH_THREAD
987 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
988 if (acquire_gil) {\
989 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
990 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
991 PyGILState_Release(__pyx_gilstate_save);\
992 } else {\
993 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
994 }
995 #else
996 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
997 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
998 #endif
999 #define __Pyx_RefNannyFinishContext()\
1000 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1001 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1002 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1003 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1004 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1005 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1006 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1007 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1008 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1009 #else
1010 #define __Pyx_RefNannyDeclarations
1011 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1012 #define __Pyx_RefNannyFinishContext()
1013 #define __Pyx_INCREF(r) Py_INCREF(r)
1014 #define __Pyx_DECREF(r) Py_DECREF(r)
1015 #define __Pyx_GOTREF(r)
1016 #define __Pyx_GIVEREF(r)
1017 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1018 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1019 #define __Pyx_XGOTREF(r)
1020 #define __Pyx_XGIVEREF(r)
1021 #endif
1022 #define __Pyx_XDECREF_SET(r, v) do {\
1023 PyObject *tmp = (PyObject *) r;\
1024 r = v; __Pyx_XDECREF(tmp);\
1025 } while (0)
1026 #define __Pyx_DECREF_SET(r, v) do {\
1027 PyObject *tmp = (PyObject *) r;\
1028 r = v; __Pyx_DECREF(tmp);\
1029 } while (0)
1030 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1031 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1032
1033 /* PyObjectGetAttrStr.proto */
1034 #if CYTHON_USE_TYPE_SLOTS
1035 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1036 #else
1037 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1038 #endif
1039
1040 /* GetBuiltinName.proto */
1041 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1042
1043 /* RaiseArgTupleInvalid.proto */
1044 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1045 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1046
1047 /* KeywordStringCheck.proto */
1048 static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
1049
1050 /* PyObjectCall.proto */
1051 #if CYTHON_COMPILING_IN_CPYTHON
1052 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1053 #else
1054 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1055 #endif
1056
1057 /* PyThreadStateGet.proto */
1058 #if CYTHON_FAST_THREAD_STATE
1059 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1060 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1061 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1062 #else
1063 #define __Pyx_PyThreadState_declare
1064 #define __Pyx_PyThreadState_assign
1065 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1066 #endif
1067
1068 /* PyErrFetchRestore.proto */
1069 #if CYTHON_FAST_THREAD_STATE
1070 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1071 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1072 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1073 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1074 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1075 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1076 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1077 #if CYTHON_COMPILING_IN_CPYTHON
1078 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1079 #else
1080 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1081 #endif
1082 #else
1083 #define __Pyx_PyErr_Clear() PyErr_Clear()
1084 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1085 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1086 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1087 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1088 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1089 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1090 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1091 #endif
1092
1093 /* RaiseException.proto */
1094 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1095
1096 /* RaiseDoubleKeywords.proto */
1097 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1098
1099 /* ParseKeywords.proto */
1100 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1101 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1102 const char* function_name);
1103
1104 /* GetTopmostException.proto */
1105 #if CYTHON_USE_EXC_INFO_STACK
1106 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1107 #endif
1108
1109 /* SaveResetException.proto */
1110 #if CYTHON_FAST_THREAD_STATE
1111 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1112 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1113 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1114 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1115 #else
1116 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1117 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1118 #endif
1119
1120 /* PyErrExceptionMatches.proto */
1121 #if CYTHON_FAST_THREAD_STATE
1122 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1123 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1124 #else
1125 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1126 #endif
1127
1128 /* GetException.proto */
1129 #if CYTHON_FAST_THREAD_STATE
1130 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1131 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1132 #else
1133 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1134 #endif
1135
1136 /* PyCFunctionFastCall.proto */
1137 #if CYTHON_FAST_PYCCALL
1138 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1139 #else
1140 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1141 #endif
1142
1143 /* PyFunctionFastCall.proto */
1144 #if CYTHON_FAST_PYCALL
1145 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1146 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1147 #if 1 || PY_VERSION_HEX < 0x030600B1
1148 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1149 #else
1150 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1151 #endif
1152 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1153 (sizeof(char [1 - 2*!(cond)]) - 1)
1154 #ifndef Py_MEMBER_SIZE
1155 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1156 #endif
1157 static size_t __pyx_pyframe_localsplus_offset = 0;
1158 #include "frameobject.h"
1159 #define __Pxy_PyFrame_Initialize_Offsets()\
1160 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1161 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1162 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1163 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1164 #endif
1165
1166 /* PyObjectCall2Args.proto */
1167 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1168
1169 /* PyObjectCallMethO.proto */
1170 #if CYTHON_COMPILING_IN_CPYTHON
1171 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1172 #endif
1173
1174 /* PyObjectCallOneArg.proto */
1175 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1176
1177 /* SwapException.proto */
1178 #if CYTHON_FAST_THREAD_STATE
1179 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1180 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1181 #else
1182 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1183 #endif
1184
1185 /* IterFinish.proto */
1186 static CYTHON_INLINE int __Pyx_IterFinish(void);
1187
1188 /* PyObjectCallNoArg.proto */
1189 #if CYTHON_COMPILING_IN_CPYTHON
1190 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1191 #else
1192 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1193 #endif
1194
1195 /* PyObjectGetMethod.proto */
1196 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1197
1198 /* PyObjectCallMethod0.proto */
1199 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1200
1201 /* RaiseNeedMoreValuesToUnpack.proto */
1202 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1203
1204 /* RaiseTooManyValuesToUnpack.proto */
1205 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1206
1207 /* UnpackItemEndCheck.proto */
1208 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1209
1210 /* RaiseNoneIterError.proto */
1211 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1212
1213 /* UnpackTupleError.proto */
1214 static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);
1215
1216 /* UnpackTuple2.proto */
1217 #define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
1218 (likely(is_tuple || PyTuple_Check(tuple)) ?\
1219 (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
1220 __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
1221 (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
1222 __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
1223 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
1224 PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
1225 static int __Pyx_unpack_tuple2_generic(
1226 PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);
1227
1228 /* dict_iter.proto */
1229 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
1230 Py_ssize_t* p_orig_length, int* p_is_dict);
1231 static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
1232 PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
1233
1234 /* PyDictVersioning.proto */
1235 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1236 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1237 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1238 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1239 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1240 (cache_var) = (value);
1241 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1242 static PY_UINT64_T __pyx_dict_version = 0;\
1243 static PyObject *__pyx_dict_cached_value = NULL;\
1244 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1245 (VAR) = __pyx_dict_cached_value;\
1246 } else {\
1247 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1248 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1249 }\
1250 }
1251 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1252 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1253 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1254 #else
1255 #define __PYX_GET_DICT_VERSION(dict) (0)
1256 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1257 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1258 #endif
1259
1260 /* ReRaiseException.proto */
1261 static CYTHON_INLINE void __Pyx_ReraiseException(void);
1262
1263 /* None.proto */
1264 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1265
1266 /* GetModuleGlobalName.proto */
1267 #if CYTHON_USE_DICT_VERSIONS
1268 #define __Pyx_GetModuleGlobalName(var, name) {\
1269 static PY_UINT64_T __pyx_dict_version = 0;\
1270 static PyObject *__pyx_dict_cached_value = NULL;\
1271 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1272 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1273 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1274 }
1275 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1276 PY_UINT64_T __pyx_dict_version;\
1277 PyObject *__pyx_dict_cached_value;\
1278 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1279 }
1280 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1281 #else
1282 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1283 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1284 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1285 #endif
1286
1287 /* GCCDiagnostics.proto */
1288 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1289 #define __Pyx_HAS_GCC_DIAGNOSTIC
1290 #endif
1291
1292 /* BuildPyUnicode.proto */
1293 static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength,
1294 int prepend_sign, char padding_char);
1295
1296 /* CIntToPyUnicode.proto */
1297 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char);
1298
1299 /* PyObject_GenericGetAttrNoDict.proto */
1300 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1301 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1302 #else
1303 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1304 #endif
1305
1306 /* PyObject_GenericGetAttr.proto */
1307 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1308 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1309 #else
1310 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1311 #endif
1312
1313 /* SetVTable.proto */
1314 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1315
1316 /* PyObjectGetAttrStrNoError.proto */
1317 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1318
1319 /* SetupReduce.proto */
1320 static int __Pyx_setup_reduce(PyObject* type_obj);
1321
1322 /* TypeImport.proto */
1323 #ifndef __PYX_HAVE_RT_ImportType_proto
1324 #define __PYX_HAVE_RT_ImportType_proto
1325 enum __Pyx_ImportType_CheckSize {
1326 __Pyx_ImportType_CheckSize_Error = 0,
1327 __Pyx_ImportType_CheckSize_Warn = 1,
1328 __Pyx_ImportType_CheckSize_Ignore = 2
1329 };
1330 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1331 #endif
1332
1333 /* Import.proto */
1334 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1335
1336 /* ImportFrom.proto */
1337 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1338
1339 /* CLineInTraceback.proto */
1340 #ifdef CYTHON_CLINE_IN_TRACEBACK
1341 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1342 #else
1343 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1344 #endif
1345
1346 /* CodeObjectCache.proto */
1347 typedef struct {
1348 PyCodeObject* code_object;
1349 int code_line;
1350 } __Pyx_CodeObjectCacheEntry;
1351 struct __Pyx_CodeObjectCache {
1352 int count;
1353 int max_count;
1354 __Pyx_CodeObjectCacheEntry* entries;
1355 };
1356 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1357 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1358 static PyCodeObject *__pyx_find_code_object(int code_line);
1359 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1360
1361 /* AddTraceback.proto */
1362 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1363 int py_line, const char *filename);
1364
1365 /* CIntFromPy.proto */
1366 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *);
1367
1368 /* CIntFromPy.proto */
1369 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1370
1371 /* CIntFromPy.proto */
1372 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *);
1373
1374 /* CIntFromPy.proto */
1375 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1376
1377 /* CIntFromPy.proto */
1378 static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *);
1379
1380 /* CIntFromPy.proto */
1381 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
1382
1383 /* CIntToPy.proto */
1384 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value);
1385
1386 /* CIntToPy.proto */
1387 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1388
1389 /* FastTypeChecks.proto */
1390 #if CYTHON_COMPILING_IN_CPYTHON
1391 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1392 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1393 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1394 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1395 #else
1396 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1397 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1398 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1399 #endif
1400 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1401
1402 /* CheckBinaryVersion.proto */
1403 static int __Pyx_check_binary_version(void);
1404
1405 /* InitStrings.proto */
1406 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1407
1408 static int __pyx_f_7msgpack_9_cmsgpack_6Packer__pack(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_o, struct __pyx_opt_args_7msgpack_9_cmsgpack_6Packer__pack *__pyx_optional_args); /* proto*/
1409 static PyObject *__pyx_f_7msgpack_9_cmsgpack_6Packer_pack(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_skip_dispatch); /* proto*/
1410 static PyObject *__pyx_f_7msgpack_9_cmsgpack_8Unpacker_append_buffer(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, void *__pyx_v__buf, Py_ssize_t __pyx_v__buf_len); /* proto*/
1411 static PyObject *__pyx_f_7msgpack_9_cmsgpack_8Unpacker_read_from_file(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self); /* proto*/
1412 static PyObject *__pyx_f_7msgpack_9_cmsgpack_8Unpacker__unpack(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, execute_fn __pyx_v_execute, struct __pyx_opt_args_7msgpack_9_cmsgpack_8Unpacker__unpack *__pyx_optional_args); /* proto*/
1413
1414 /* Module declarations from 'libc.string' */
1415
1416 /* Module declarations from 'libc.stdio' */
1417
1418 /* Module declarations from '__builtin__' */
1419
1420 /* Module declarations from 'cpython.type' */
1421 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1422
1423 /* Module declarations from 'cpython.version' */
1424
1425 /* Module declarations from 'cpython.ref' */
1426
1427 /* Module declarations from 'cpython.exc' */
1428
1429 /* Module declarations from 'cpython.module' */
1430
1431 /* Module declarations from 'cpython.mem' */
1432
1433 /* Module declarations from 'cpython.tuple' */
1434
1435 /* Module declarations from 'cpython.list' */
1436
1437 /* Module declarations from 'cpython.sequence' */
1438
1439 /* Module declarations from 'cpython.mapping' */
1440
1441 /* Module declarations from 'cpython.iterator' */
1442
1443 /* Module declarations from 'cpython.number' */
1444
1445 /* Module declarations from 'cpython.int' */
1446
1447 /* Module declarations from '__builtin__' */
1448
1449 /* Module declarations from 'cpython.bool' */
1450 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
1451
1452 /* Module declarations from 'cpython.long' */
1453
1454 /* Module declarations from 'cpython.float' */
1455
1456 /* Module declarations from '__builtin__' */
1457
1458 /* Module declarations from 'cpython.complex' */
1459 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
1460
1461 /* Module declarations from 'cpython.string' */
1462
1463 /* Module declarations from 'cpython.unicode' */
1464
1465 /* Module declarations from 'cpython.dict' */
1466
1467 /* Module declarations from 'cpython.instance' */
1468
1469 /* Module declarations from 'cpython.function' */
1470
1471 /* Module declarations from 'cpython.method' */
1472
1473 /* Module declarations from 'cpython.weakref' */
1474
1475 /* Module declarations from 'cpython.getargs' */
1476
1477 /* Module declarations from 'cpython.pythread' */
1478
1479 /* Module declarations from 'cpython.pystate' */
1480
1481 /* Module declarations from 'cpython.cobject' */
1482
1483 /* Module declarations from 'cpython.oldbuffer' */
1484
1485 /* Module declarations from 'cpython.set' */
1486
1487 /* Module declarations from 'cpython.buffer' */
1488
1489 /* Module declarations from 'cpython.bytes' */
1490
1491 /* Module declarations from 'cpython.pycapsule' */
1492
1493 /* Module declarations from 'cpython' */
1494
1495 /* Module declarations from 'cpython.object' */
1496
1497 /* Module declarations from 'datetime' */
1498
1499 /* Module declarations from 'cpython.datetime' */
1500 static PyTypeObject *__pyx_ptype_7cpython_8datetime_date = 0;
1501 static PyTypeObject *__pyx_ptype_7cpython_8datetime_time = 0;
1502 static PyTypeObject *__pyx_ptype_7cpython_8datetime_datetime = 0;
1503 static PyTypeObject *__pyx_ptype_7cpython_8datetime_timedelta = 0;
1504 static PyTypeObject *__pyx_ptype_7cpython_8datetime_tzinfo = 0;
1505 static CYTHON_INLINE void __pyx_f_7cpython_8datetime_import_datetime(void); /*proto*/
1506 static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_datetime_new(int, int, int, int, int, int, int, PyObject *); /*proto*/
1507 static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_datetime_tzinfo(PyObject *); /*proto*/
1508 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_days(PyObject *); /*proto*/
1509 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_seconds(PyObject *); /*proto*/
1510 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_microseconds(PyObject *); /*proto*/
1511
1512 /* Module declarations from 'cpython.bytearray' */
1513
1514 /* Module declarations from 'libc.stdlib' */
1515
1516 /* Module declarations from 'libc.limits' */
1517
1518 /* Module declarations from 'libc.stdint' */
1519
1520 /* Module declarations from 'msgpack._cmsgpack' */
1521 static PyTypeObject *__pyx_ptype_7msgpack_9_cmsgpack_Packer = 0;
1522 static PyTypeObject *__pyx_ptype_7msgpack_9_cmsgpack_Unpacker = 0;
1523 static PyObject *__pyx_v_7msgpack_9_cmsgpack_utc = 0;
1524 static PyObject *__pyx_v_7msgpack_9_cmsgpack_epoch = 0;
1525 static PyObject *__pyx_v_7msgpack_9_cmsgpack_ExtType = 0;
1526 static PyObject *__pyx_v_7msgpack_9_cmsgpack_Timestamp = 0;
1527 static int __pyx_v_7msgpack_9_cmsgpack_DEFAULT_RECURSE_LIMIT;
1528 static PY_LONG_LONG __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT;
1529 static PyObject *__pyx_v_7msgpack_9_cmsgpack_giga = 0;
1530 static CYTHON_INLINE int __pyx_f_7msgpack_9_cmsgpack_PyBytesLike_Check(PyObject *); /*proto*/
1531 static CYTHON_INLINE int __pyx_f_7msgpack_9_cmsgpack_PyBytesLike_CheckExact(PyObject *); /*proto*/
1532 static CYTHON_INLINE PyObject *__pyx_f_7msgpack_9_cmsgpack_init_ctx(unpack_context *, PyObject *, PyObject *, PyObject *, PyObject *, int, int, int, int, char const *, Py_ssize_t, Py_ssize_t, Py_ssize_t, Py_ssize_t, Py_ssize_t); /*proto*/
1533 static CYTHON_INLINE int __pyx_f_7msgpack_9_cmsgpack_get_data_from_buffer(PyObject *, Py_buffer *, char **, Py_ssize_t *); /*proto*/
1534 #define __Pyx_MODULE_NAME "msgpack._cmsgpack"
1535 extern int __pyx_module_is_main_msgpack___cmsgpack;
1536 int __pyx_module_is_main_msgpack___cmsgpack = 0;
1537
1538 /* Implementation of 'msgpack._cmsgpack' */
1539 static PyObject *__pyx_builtin_MemoryError;
1540 static PyObject *__pyx_builtin_TypeError;
1541 static PyObject *__pyx_builtin_ValueError;
1542 static PyObject *__pyx_builtin_OverflowError;
1543 static PyObject *__pyx_builtin_RuntimeError;
1544 static PyObject *__pyx_builtin_NotImplementedError;
1545 static PyObject *__pyx_builtin_BufferError;
1546 static PyObject *__pyx_builtin_AssertionError;
1547 static PyObject *__pyx_builtin_StopIteration;
1548 static const char __pyx_k_d[] = "d";
1549 static const char __pyx_k_buf[] = "buf";
1550 static const char __pyx_k_ctx[] = "ctx";
1551 static const char __pyx_k_ext[] = "ext";
1552 static const char __pyx_k_obj[] = "obj";
1553 static const char __pyx_k_off[] = "off";
1554 static const char __pyx_k_raw[] = "raw";
1555 static const char __pyx_k_ret[] = "ret";
1556 static const char __pyx_k_utc[] = "utc";
1557 static const char __pyx_k_cerr[] = "cerr";
1558 static const char __pyx_k_code[] = "code";
1559 static const char __pyx_k_data[] = "data";
1560 static const char __pyx_k_main[] = "__main__";
1561 static const char __pyx_k_name[] = "__name__";
1562 static const char __pyx_k_pack[] = "pack";
1563 static const char __pyx_k_read[] = "read";
1564 static const char __pyx_k_test[] = "__test__";
1565 static const char __pyx_k_view[] = "view";
1566 static const char __pyx_k_items[] = "items";
1567 static const char __pyx_k_Packer[] = "Packer";
1568 static const char __pyx_k_import[] = "__import__";
1569 static const char __pyx_k_packed[] = "packed";
1570 static const char __pyx_k_reduce[] = "__reduce__";
1571 static const char __pyx_k_ExtType[] = "ExtType";
1572 static const char __pyx_k_buf_len[] = "buf_len";
1573 static const char __pyx_k_default[] = "default";
1574 static const char __pyx_k_seconds[] = "seconds";
1575 static const char __pyx_k_unpackb[] = "unpackb";
1576 static const char __pyx_k_Unpacker[] = "Unpacker";
1577 static const char __pyx_k_datetime[] = "datetime";
1578 static const char __pyx_k_ext_hook[] = "ext_hook";
1579 static const char __pyx_k_getstate[] = "__getstate__";
1580 static const char __pyx_k_setstate[] = "__setstate__";
1581 static const char __pyx_k_timezone[] = "timezone";
1582 static const char __pyx_k_typecode[] = "typecode";
1583 static const char __pyx_k_use_list[] = "use_list";
1584 static const char __pyx_k_ExtraData[] = "ExtraData";
1585 static const char __pyx_k_OutOfData[] = "OutOfData";
1586 static const char __pyx_k_Timestamp[] = "Timestamp";
1587 static const char __pyx_k_TypeError[] = "TypeError";
1588 static const char __pyx_k_autoreset[] = "autoreset";
1589 static const char __pyx_k_file_like[] = "file_like";
1590 static const char __pyx_k_list_hook[] = "list_hook";
1591 static const char __pyx_k_read_size[] = "read_size";
1592 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1593 static const char __pyx_k_timestamp[] = "timestamp";
1594 static const char __pyx_k_BufferFull[] = "BufferFull";
1595 static const char __pyx_k_StackError[] = "StackError";
1596 static const char __pyx_k_ValueError[] = "ValueError";
1597 static const char __pyx_k_exceptions[] = "exceptions";
1598 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1599 static const char __pyx_k_BufferError[] = "BufferError";
1600 static const char __pyx_k_FormatError[] = "FormatError";
1601 static const char __pyx_k_MemoryError[] = "MemoryError";
1602 static const char __pyx_k_max_bin_len[] = "max_bin_len";
1603 static const char __pyx_k_max_ext_len[] = "max_ext_len";
1604 static const char __pyx_k_max_map_len[] = "max_map_len";
1605 static const char __pyx_k_max_str_len[] = "max_str_len";
1606 static const char __pyx_k_nanoseconds[] = "nanoseconds";
1607 static const char __pyx_k_object_hook[] = "object_hook";
1608 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1609 static const char __pyx_k_strict_types[] = "strict_types";
1610 static const char __pyx_k_use_bin_type[] = "use_bin_type";
1611 static const char __pyx_k_OverflowError[] = "OverflowError";
1612 static const char __pyx_k_StopIteration[] = "StopIteration";
1613 static const char __pyx_k_max_array_len[] = "max_array_len";
1614 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1615 static const char __pyx_k_AssertionError[] = "AssertionError";
1616 static const char __pyx_k_internal_error[] = "internal error";
1617 static const char __pyx_k_strict_map_key[] = "strict_map_key";
1618 static const char __pyx_k_unicode_errors[] = "unicode_errors";
1619 static const char __pyx_k_max_buffer_size[] = "max_buffer_size";
1620 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1621 static const char __pyx_k_use_single_float[] = "use_single_float";
1622 static const char __pyx_k_dict_is_too_large[] = "dict is too large";
1623 static const char __pyx_k_list_is_too_large[] = "list is too large";
1624 static const char __pyx_k_msgpack__cmsgpack[] = "msgpack._cmsgpack";
1625 static const char __pyx_k_object_pairs_hook[] = "object_pairs_hook";
1626 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1627 static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
1628 static const char __pyx_k_Unpack_failed_error[] = "Unpack failed: error = ";
1629 static const char __pyx_k_EXT_data_is_too_large[] = "EXT data is too large";
1630 static const char __pyx_k_msgpack__unpacker_pyx[] = "msgpack/_unpacker.pyx";
1631 static const char __pyx_k_timestamp_must_be_0_3[] = "timestamp must be 0..3";
1632 static const char __pyx_k_No_more_data_to_unpack[] = "No more data to unpack.";
1633 static const char __pyx_k_memoryview_is_too_large[] = "memoryview is too large";
1634 static const char __pyx_k_recursion_limit_exceeded[] = "recursion limit exceeded.";
1635 static const char __pyx_k_failed_to_calculate_delta[] = "failed to calculate delta";
1636 static const char __pyx_k_Integer_value_out_of_range[] = "Integer value out of range";
1637 static const char __pyx_k_default_must_be_a_callable[] = "default must be a callable.";
1638 static const char __pyx_k_default_read_extended_type[] = "default_read_extended_type";
1639 static const char __pyx_k_ext_hook_must_be_a_callable[] = "ext_hook must be a callable.";
1640 static const char __pyx_k_unicode_string_is_too_large[] = "unicode string is too large";
1641 static const char __pyx_k_list_hook_must_be_a_callable[] = "list_hook must be a callable.";
1642 static const char __pyx_k_Unpack_failed_incomplete_input[] = "Unpack failed: incomplete input";
1643 static const char __pyx_k_object_hook_must_be_a_callable[] = "object_hook must be a callable.";
1644 static const char __pyx_k_file_like_read_must_be_a_callab[] = "`file_like.read` must be a callable.";
1645 static const char __pyx_k_unpacker_feed_is_not_be_able_to[] = "unpacker.feed() is not be able to use with `file_like`.";
1646 static const char __pyx_k_Cannot_decode_extended_type_with[] = "Cannot decode extended type with typecode=%d";
1647 static const char __pyx_k_Unable_to_allocate_internal_buff[] = "Unable to allocate internal buffer.";
1648 static const char __pyx_k_Unable_to_enlarge_internal_buffe[] = "Unable to enlarge internal buffer.";
1649 static const char __pyx_k_cannot_unpack_from_multi_byte_ob[] = "cannot unpack from multi-byte object";
1650 static const char __pyx_k_could_not_get_buffer_for_memoryv[] = "could not get buffer for memoryview";
1651 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
1652 static const char __pyx_k_object_pairs_hook_and_object_hoo[] = "object_pairs_hook and object_hook are mutually exclusive.";
1653 static const char __pyx_k_object_pairs_hook_must_be_a_call[] = "object_pairs_hook must be a callable.";
1654 static const char __pyx_k_read_size_should_be_less_or_equa[] = "read_size should be less or equal to max_buffer_size";
1655 static PyObject *__pyx_n_s_AssertionError;
1656 static PyObject *__pyx_n_s_BufferError;
1657 static PyObject *__pyx_n_s_BufferFull;
1658 static PyObject *__pyx_kp_u_Cannot_decode_extended_type_with;
1659 static PyObject *__pyx_kp_u_EXT_data_is_too_large;
1660 static PyObject *__pyx_n_s_ExtType;
1661 static PyObject *__pyx_n_s_ExtraData;
1662 static PyObject *__pyx_n_s_FormatError;
1663 static PyObject *__pyx_kp_u_Integer_value_out_of_range;
1664 static PyObject *__pyx_n_s_MemoryError;
1665 static PyObject *__pyx_kp_u_No_more_data_to_unpack;
1666 static PyObject *__pyx_n_s_NotImplementedError;
1667 static PyObject *__pyx_n_s_OutOfData;
1668 static PyObject *__pyx_n_s_OverflowError;
1669 static PyObject *__pyx_n_s_Packer;
1670 static PyObject *__pyx_n_s_RuntimeError;
1671 static PyObject *__pyx_n_s_StackError;
1672 static PyObject *__pyx_n_s_StopIteration;
1673 static PyObject *__pyx_n_s_Timestamp;
1674 static PyObject *__pyx_n_s_TypeError;
1675 static PyObject *__pyx_kp_u_Unable_to_allocate_internal_buff;
1676 static PyObject *__pyx_kp_u_Unable_to_enlarge_internal_buffe;
1677 static PyObject *__pyx_kp_u_Unpack_failed_error;
1678 static PyObject *__pyx_kp_u_Unpack_failed_incomplete_input;
1679 static PyObject *__pyx_n_s_Unpacker;
1680 static PyObject *__pyx_n_s_ValueError;
1681 static PyObject *__pyx_n_s_autoreset;
1682 static PyObject *__pyx_n_s_buf;
1683 static PyObject *__pyx_n_s_buf_len;
1684 static PyObject *__pyx_kp_u_cannot_unpack_from_multi_byte_ob;
1685 static PyObject *__pyx_n_s_cerr;
1686 static PyObject *__pyx_n_s_cline_in_traceback;
1687 static PyObject *__pyx_n_s_code;
1688 static PyObject *__pyx_kp_u_could_not_get_buffer_for_memoryv;
1689 static PyObject *__pyx_n_s_ctx;
1690 static PyObject *__pyx_n_u_d;
1691 static PyObject *__pyx_n_s_data;
1692 static PyObject *__pyx_n_s_datetime;
1693 static PyObject *__pyx_n_s_default;
1694 static PyObject *__pyx_kp_u_default_must_be_a_callable;
1695 static PyObject *__pyx_n_s_default_read_extended_type;
1696 static PyObject *__pyx_kp_u_dict_is_too_large;
1697 static PyObject *__pyx_n_s_exceptions;
1698 static PyObject *__pyx_n_s_ext;
1699 static PyObject *__pyx_n_s_ext_hook;
1700 static PyObject *__pyx_kp_u_ext_hook_must_be_a_callable;
1701 static PyObject *__pyx_kp_u_failed_to_calculate_delta;
1702 static PyObject *__pyx_n_s_file_like;
1703 static PyObject *__pyx_kp_u_file_like_read_must_be_a_callab;
1704 static PyObject *__pyx_n_s_getstate;
1705 static PyObject *__pyx_n_s_import;
1706 static PyObject *__pyx_kp_u_internal_error;
1707 static PyObject *__pyx_n_s_items;
1708 static PyObject *__pyx_n_s_list_hook;
1709 static PyObject *__pyx_kp_u_list_hook_must_be_a_callable;
1710 static PyObject *__pyx_kp_u_list_is_too_large;
1711 static PyObject *__pyx_n_s_main;
1712 static PyObject *__pyx_n_s_max_array_len;
1713 static PyObject *__pyx_n_s_max_bin_len;
1714 static PyObject *__pyx_n_s_max_buffer_size;
1715 static PyObject *__pyx_n_s_max_ext_len;
1716 static PyObject *__pyx_n_s_max_map_len;
1717 static PyObject *__pyx_n_s_max_str_len;
1718 static PyObject *__pyx_kp_u_memoryview_is_too_large;
1719 static PyObject *__pyx_n_s_msgpack__cmsgpack;
1720 static PyObject *__pyx_kp_s_msgpack__unpacker_pyx;
1721 static PyObject *__pyx_n_s_name;
1722 static PyObject *__pyx_n_s_nanoseconds;
1723 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
1724 static PyObject *__pyx_n_s_obj;
1725 static PyObject *__pyx_n_s_object_hook;
1726 static PyObject *__pyx_kp_u_object_hook_must_be_a_callable;
1727 static PyObject *__pyx_n_s_object_pairs_hook;
1728 static PyObject *__pyx_kp_u_object_pairs_hook_and_object_hoo;
1729 static PyObject *__pyx_kp_u_object_pairs_hook_must_be_a_call;
1730 static PyObject *__pyx_n_s_off;
1731 static PyObject *__pyx_n_s_pack;
1732 static PyObject *__pyx_n_s_packed;
1733 static PyObject *__pyx_n_s_pyx_vtable;
1734 static PyObject *__pyx_n_s_raw;
1735 static PyObject *__pyx_n_s_read;
1736 static PyObject *__pyx_n_s_read_size;
1737 static PyObject *__pyx_kp_u_read_size_should_be_less_or_equa;
1738 static PyObject *__pyx_kp_u_recursion_limit_exceeded;
1739 static PyObject *__pyx_n_s_reduce;
1740 static PyObject *__pyx_n_s_reduce_cython;
1741 static PyObject *__pyx_n_s_reduce_ex;
1742 static PyObject *__pyx_n_s_ret;
1743 static PyObject *__pyx_n_s_seconds;
1744 static PyObject *__pyx_n_s_setstate;
1745 static PyObject *__pyx_n_s_setstate_cython;
1746 static PyObject *__pyx_n_s_strict_map_key;
1747 static PyObject *__pyx_n_s_strict_types;
1748 static PyObject *__pyx_n_s_test;
1749 static PyObject *__pyx_n_s_timestamp;
1750 static PyObject *__pyx_kp_u_timestamp_must_be_0_3;
1751 static PyObject *__pyx_n_s_timezone;
1752 static PyObject *__pyx_n_s_typecode;
1753 static PyObject *__pyx_n_s_unicode_errors;
1754 static PyObject *__pyx_kp_u_unicode_string_is_too_large;
1755 static PyObject *__pyx_n_s_unpackb;
1756 static PyObject *__pyx_kp_u_unpacker_feed_is_not_be_able_to;
1757 static PyObject *__pyx_n_s_use_bin_type;
1758 static PyObject *__pyx_n_s_use_list;
1759 static PyObject *__pyx_n_s_use_single_float;
1760 static PyObject *__pyx_n_s_utc;
1761 static PyObject *__pyx_n_s_view;
1762 static int __pyx_pf_7msgpack_9_cmsgpack_6Packer___cinit__(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self); /* proto */
1763 static int __pyx_pf_7msgpack_9_cmsgpack_6Packer_2__init__(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_default, int __pyx_v_use_single_float, int __pyx_v_autoreset, int __pyx_v_use_bin_type, int __pyx_v_strict_types, int __pyx_v_datetime, PyObject *__pyx_v_unicode_errors); /* proto */
1764 static void __pyx_pf_7msgpack_9_cmsgpack_6Packer_4__dealloc__(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self); /* proto */
1765 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_6pack(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_obj); /* proto */
1766 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_8pack_ext_type(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_typecode, PyObject *__pyx_v_data); /* proto */
1767 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_10pack_array_header(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PY_LONG_LONG __pyx_v_size); /* proto */
1768 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_12pack_map_header(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PY_LONG_LONG __pyx_v_size); /* proto */
1769 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_14pack_map_pairs(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_pairs); /* proto */
1770 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_16reset(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self); /* proto */
1771 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_18bytes(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self); /* proto */
1772 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_20getbuffer(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self); /* proto */
1773 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self); /* proto */
1774 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1775 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_default_read_extended_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_typecode, CYTHON_UNUSED PyObject *__pyx_v_data); /* proto */
1776 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_2unpackb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_packed, PyObject *__pyx_v_object_hook, PyObject *__pyx_v_list_hook, int __pyx_v_use_list, int __pyx_v_raw, int __pyx_v_timestamp, int __pyx_v_strict_map_key, PyObject *__pyx_v_unicode_errors, PyObject *__pyx_v_object_pairs_hook, PyObject *__pyx_v_ext_hook, Py_ssize_t __pyx_v_max_str_len, Py_ssize_t __pyx_v_max_bin_len, Py_ssize_t __pyx_v_max_array_len, Py_ssize_t __pyx_v_max_map_len, Py_ssize_t __pyx_v_max_ext_len); /* proto */
1777 static int __pyx_pf_7msgpack_9_cmsgpack_8Unpacker___cinit__(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self); /* proto */
1778 static void __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_2__dealloc__(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self); /* proto */
1779 static int __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_4__init__(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, PyObject *__pyx_v_file_like, Py_ssize_t __pyx_v_read_size, int __pyx_v_use_list, int __pyx_v_raw, int __pyx_v_timestamp, int __pyx_v_strict_map_key, PyObject *__pyx_v_object_hook, PyObject *__pyx_v_object_pairs_hook, PyObject *__pyx_v_list_hook, PyObject *__pyx_v_unicode_errors, Py_ssize_t __pyx_v_max_buffer_size, PyObject *__pyx_v_ext_hook, Py_ssize_t __pyx_v_max_str_len, Py_ssize_t __pyx_v_max_bin_len, Py_ssize_t __pyx_v_max_array_len, Py_ssize_t __pyx_v_max_map_len, Py_ssize_t __pyx_v_max_ext_len); /* proto */
1780 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_6feed(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, PyObject *__pyx_v_next_bytes); /* proto */
1781 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_8read_bytes(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, Py_ssize_t __pyx_v_nbytes); /* proto */
1782 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_10unpack(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self); /* proto */
1783 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_12skip(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self); /* proto */
1784 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_14read_array_header(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self); /* proto */
1785 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_16read_map_header(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self); /* proto */
1786 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_18tell(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self); /* proto */
1787 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_20__iter__(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self); /* proto */
1788 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_22__next__(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self); /* proto */
1789 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_24__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self); /* proto */
1790 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_26__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1791 static PyObject *__pyx_tp_new_7msgpack_9_cmsgpack_Packer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1792 static PyObject *__pyx_tp_new_7msgpack_9_cmsgpack_Unpacker(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1793 static PyObject *__pyx_int_0;
1794 static PyObject *__pyx_int_1000000000;
1795 static int __pyx_k__3;
1796 static PyObject *__pyx_k__23;
1797 static PyObject *__pyx_k__25;
1798 static PyObject *__pyx_tuple_;
1799 static PyObject *__pyx_tuple__2;
1800 static PyObject *__pyx_tuple__4;
1801 static PyObject *__pyx_tuple__5;
1802 static PyObject *__pyx_tuple__6;
1803 static PyObject *__pyx_tuple__7;
1804 static PyObject *__pyx_tuple__8;
1805 static PyObject *__pyx_tuple__9;
1806 static PyObject *__pyx_tuple__10;
1807 static PyObject *__pyx_tuple__11;
1808 static PyObject *__pyx_tuple__12;
1809 static PyObject *__pyx_tuple__13;
1810 static PyObject *__pyx_tuple__14;
1811 static PyObject *__pyx_tuple__15;
1812 static PyObject *__pyx_tuple__16;
1813 static PyObject *__pyx_tuple__17;
1814 static PyObject *__pyx_tuple__18;
1815 static PyObject *__pyx_tuple__19;
1816 static PyObject *__pyx_tuple__20;
1817 static PyObject *__pyx_tuple__21;
1818 static PyObject *__pyx_tuple__22;
1819 static PyObject *__pyx_tuple__24;
1820 static PyObject *__pyx_tuple__26;
1821 static PyObject *__pyx_tuple__27;
1822 static PyObject *__pyx_tuple__28;
1823 static PyObject *__pyx_tuple__29;
1824 static PyObject *__pyx_tuple__30;
1825 static PyObject *__pyx_tuple__31;
1826 static PyObject *__pyx_tuple__32;
1827 static PyObject *__pyx_tuple__33;
1828 static PyObject *__pyx_tuple__35;
1829 static PyObject *__pyx_codeobj__34;
1830 static PyObject *__pyx_codeobj__36;
1831 /* Late includes */
1832
1833 /* "msgpack/_packer.pyx":54
1834 *
1835 *
1836 * cdef inline int PyBytesLike_Check(object o): # <<<<<<<<<<<<<<
1837 * return PyBytes_Check(o) or PyByteArray_Check(o)
1838 *
1839 */
1840
1841 static CYTHON_INLINE int __pyx_f_7msgpack_9_cmsgpack_PyBytesLike_Check(PyObject *__pyx_v_o) {
1842 int __pyx_r;
1843 __Pyx_RefNannyDeclarations
1844 int __pyx_t_1;
1845 int __pyx_t_2;
1846 __Pyx_RefNannySetupContext("PyBytesLike_Check", 0);
1847
1848 /* "msgpack/_packer.pyx":55
1849 *
1850 * cdef inline int PyBytesLike_Check(object o):
1851 * return PyBytes_Check(o) or PyByteArray_Check(o) # <<<<<<<<<<<<<<
1852 *
1853 *
1854 */
1855 __pyx_t_2 = PyBytes_Check(__pyx_v_o);
1856 if (!__pyx_t_2) {
1857 } else {
1858 __pyx_t_1 = __pyx_t_2;
1859 goto __pyx_L3_bool_binop_done;
1860 }
1861 __pyx_t_2 = PyByteArray_Check(__pyx_v_o);
1862 __pyx_t_1 = __pyx_t_2;
1863 __pyx_L3_bool_binop_done:;
1864 __pyx_r = __pyx_t_1;
1865 goto __pyx_L0;
1866
1867 /* "msgpack/_packer.pyx":54
1868 *
1869 *
1870 * cdef inline int PyBytesLike_Check(object o): # <<<<<<<<<<<<<<
1871 * return PyBytes_Check(o) or PyByteArray_Check(o)
1872 *
1873 */
1874
1875 /* function exit code */
1876 __pyx_L0:;
1877 __Pyx_RefNannyFinishContext();
1878 return __pyx_r;
1879 }
1880
1881 /* "msgpack/_packer.pyx":58
1882 *
1883 *
1884 * cdef inline int PyBytesLike_CheckExact(object o): # <<<<<<<<<<<<<<
1885 * return PyBytes_CheckExact(o) or PyByteArray_CheckExact(o)
1886 *
1887 */
1888
1889 static CYTHON_INLINE int __pyx_f_7msgpack_9_cmsgpack_PyBytesLike_CheckExact(PyObject *__pyx_v_o) {
1890 int __pyx_r;
1891 __Pyx_RefNannyDeclarations
1892 int __pyx_t_1;
1893 int __pyx_t_2;
1894 __Pyx_RefNannySetupContext("PyBytesLike_CheckExact", 0);
1895
1896 /* "msgpack/_packer.pyx":59
1897 *
1898 * cdef inline int PyBytesLike_CheckExact(object o):
1899 * return PyBytes_CheckExact(o) or PyByteArray_CheckExact(o) # <<<<<<<<<<<<<<
1900 *
1901 *
1902 */
1903 __pyx_t_2 = PyBytes_CheckExact(__pyx_v_o);
1904 if (!__pyx_t_2) {
1905 } else {
1906 __pyx_t_1 = __pyx_t_2;
1907 goto __pyx_L3_bool_binop_done;
1908 }
1909 __pyx_t_2 = PyByteArray_CheckExact(__pyx_v_o);
1910 __pyx_t_1 = __pyx_t_2;
1911 __pyx_L3_bool_binop_done:;
1912 __pyx_r = __pyx_t_1;
1913 goto __pyx_L0;
1914
1915 /* "msgpack/_packer.pyx":58
1916 *
1917 *
1918 * cdef inline int PyBytesLike_CheckExact(object o): # <<<<<<<<<<<<<<
1919 * return PyBytes_CheckExact(o) or PyByteArray_CheckExact(o)
1920 *
1921 */
1922
1923 /* function exit code */
1924 __pyx_L0:;
1925 __Pyx_RefNannyFinishContext();
1926 return __pyx_r;
1927 }
1928
1929 /* "msgpack/_packer.pyx":116
1930 * cdef bint datetime
1931 *
1932 * def __cinit__(self): # <<<<<<<<<<<<<<
1933 * cdef int buf_size = 1024*1024
1934 * self.pk.buf = <char*> PyMem_Malloc(buf_size)
1935 */
1936
1937 /* Python wrapper */
1938 static int __pyx_pw_7msgpack_9_cmsgpack_6Packer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1939 static int __pyx_pw_7msgpack_9_cmsgpack_6Packer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1940 int __pyx_r;
1941 __Pyx_RefNannyDeclarations
1942 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
1943 if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
1944 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
1945 if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
1946 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer___cinit__(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self));
1947
1948 /* function exit code */
1949 __Pyx_RefNannyFinishContext();
1950 return __pyx_r;
1951 }
1952
1953 static int __pyx_pf_7msgpack_9_cmsgpack_6Packer___cinit__(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self) {
1954 int __pyx_v_buf_size;
1955 int __pyx_r;
1956 __Pyx_RefNannyDeclarations
1957 int __pyx_t_1;
1958 PyObject *__pyx_t_2 = NULL;
1959 int __pyx_lineno = 0;
1960 const char *__pyx_filename = NULL;
1961 int __pyx_clineno = 0;
1962 __Pyx_RefNannySetupContext("__cinit__", 0);
1963
1964 /* "msgpack/_packer.pyx":117
1965 *
1966 * def __cinit__(self):
1967 * cdef int buf_size = 1024*1024 # <<<<<<<<<<<<<<
1968 * self.pk.buf = <char*> PyMem_Malloc(buf_size)
1969 * if self.pk.buf == NULL:
1970 */
1971 __pyx_v_buf_size = 0x100000;
1972
1973 /* "msgpack/_packer.pyx":118
1974 * def __cinit__(self):
1975 * cdef int buf_size = 1024*1024
1976 * self.pk.buf = <char*> PyMem_Malloc(buf_size) # <<<<<<<<<<<<<<
1977 * if self.pk.buf == NULL:
1978 * raise MemoryError("Unable to allocate internal buffer.")
1979 */
1980 __pyx_v_self->pk.buf = ((char *)PyMem_Malloc(__pyx_v_buf_size));
1981
1982 /* "msgpack/_packer.pyx":119
1983 * cdef int buf_size = 1024*1024
1984 * self.pk.buf = <char*> PyMem_Malloc(buf_size)
1985 * if self.pk.buf == NULL: # <<<<<<<<<<<<<<
1986 * raise MemoryError("Unable to allocate internal buffer.")
1987 * self.pk.buf_size = buf_size
1988 */
1989 __pyx_t_1 = ((__pyx_v_self->pk.buf == NULL) != 0);
1990 if (unlikely(__pyx_t_1)) {
1991
1992 /* "msgpack/_packer.pyx":120
1993 * self.pk.buf = <char*> PyMem_Malloc(buf_size)
1994 * if self.pk.buf == NULL:
1995 * raise MemoryError("Unable to allocate internal buffer.") # <<<<<<<<<<<<<<
1996 * self.pk.buf_size = buf_size
1997 * self.pk.length = 0
1998 */
1999 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error)
2000 __Pyx_GOTREF(__pyx_t_2);
2001 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
2002 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2003 __PYX_ERR(0, 120, __pyx_L1_error)
2004
2005 /* "msgpack/_packer.pyx":119
2006 * cdef int buf_size = 1024*1024
2007 * self.pk.buf = <char*> PyMem_Malloc(buf_size)
2008 * if self.pk.buf == NULL: # <<<<<<<<<<<<<<
2009 * raise MemoryError("Unable to allocate internal buffer.")
2010 * self.pk.buf_size = buf_size
2011 */
2012 }
2013
2014 /* "msgpack/_packer.pyx":121
2015 * if self.pk.buf == NULL:
2016 * raise MemoryError("Unable to allocate internal buffer.")
2017 * self.pk.buf_size = buf_size # <<<<<<<<<<<<<<
2018 * self.pk.length = 0
2019 *
2020 */
2021 __pyx_v_self->pk.buf_size = __pyx_v_buf_size;
2022
2023 /* "msgpack/_packer.pyx":122
2024 * raise MemoryError("Unable to allocate internal buffer.")
2025 * self.pk.buf_size = buf_size
2026 * self.pk.length = 0 # <<<<<<<<<<<<<<
2027 *
2028 * def __init__(self, *, default=None,
2029 */
2030 __pyx_v_self->pk.length = 0;
2031
2032 /* "msgpack/_packer.pyx":116
2033 * cdef bint datetime
2034 *
2035 * def __cinit__(self): # <<<<<<<<<<<<<<
2036 * cdef int buf_size = 1024*1024
2037 * self.pk.buf = <char*> PyMem_Malloc(buf_size)
2038 */
2039
2040 /* function exit code */
2041 __pyx_r = 0;
2042 goto __pyx_L0;
2043 __pyx_L1_error:;
2044 __Pyx_XDECREF(__pyx_t_2);
2045 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2046 __pyx_r = -1;
2047 __pyx_L0:;
2048 __Pyx_RefNannyFinishContext();
2049 return __pyx_r;
2050 }
2051
2052 /* "msgpack/_packer.pyx":124
2053 * self.pk.length = 0
2054 *
2055 * def __init__(self, *, default=None, # <<<<<<<<<<<<<<
2056 * bint use_single_float=False, bint autoreset=True, bint use_bin_type=True,
2057 * bint strict_types=False, bint datetime=False, unicode_errors=None):
2058 */
2059
2060 /* Python wrapper */
2061 static int __pyx_pw_7msgpack_9_cmsgpack_6Packer_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2062 static int __pyx_pw_7msgpack_9_cmsgpack_6Packer_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2063 PyObject *__pyx_v_default = 0;
2064 int __pyx_v_use_single_float;
2065 int __pyx_v_autoreset;
2066 int __pyx_v_use_bin_type;
2067 int __pyx_v_strict_types;
2068 int __pyx_v_datetime;
2069 PyObject *__pyx_v_unicode_errors = 0;
2070 int __pyx_lineno = 0;
2071 const char *__pyx_filename = NULL;
2072 int __pyx_clineno = 0;
2073 int __pyx_r;
2074 __Pyx_RefNannyDeclarations
2075 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2076 {
2077 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_default,&__pyx_n_s_use_single_float,&__pyx_n_s_autoreset,&__pyx_n_s_use_bin_type,&__pyx_n_s_strict_types,&__pyx_n_s_datetime,&__pyx_n_s_unicode_errors,0};
2078 PyObject* values[7] = {0,0,0,0,0,0,0};
2079 values[0] = ((PyObject *)Py_None);
2080
2081 /* "msgpack/_packer.pyx":126
2082 * def __init__(self, *, default=None,
2083 * bint use_single_float=False, bint autoreset=True, bint use_bin_type=True,
2084 * bint strict_types=False, bint datetime=False, unicode_errors=None): # <<<<<<<<<<<<<<
2085 * self.use_float = use_single_float
2086 * self.strict_types = strict_types
2087 */
2088 values[6] = ((PyObject *)Py_None);
2089 if (unlikely(__pyx_kwds)) {
2090 Py_ssize_t kw_args;
2091 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2092 switch (pos_args) {
2093 case 0: break;
2094 default: goto __pyx_L5_argtuple_error;
2095 }
2096 kw_args = PyDict_Size(__pyx_kwds);
2097 if (kw_args > 0 && likely(kw_args <= 7)) {
2098 Py_ssize_t index;
2099 for (index = 0; index < 7 && kw_args > 0; index++) {
2100 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]);
2101 if (value) { values[index] = value; kw_args--; }
2102 }
2103 }
2104 if (unlikely(kw_args > 0)) {
2105 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) __PYX_ERR(0, 124, __pyx_L3_error)
2106 }
2107 } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
2108 goto __pyx_L5_argtuple_error;
2109 } else {
2110 }
2111 __pyx_v_default = values[0];
2112 if (values[1]) {
2113 __pyx_v_use_single_float = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_use_single_float == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error)
2114 } else {
2115
2116 /* "msgpack/_packer.pyx":125
2117 *
2118 * def __init__(self, *, default=None,
2119 * bint use_single_float=False, bint autoreset=True, bint use_bin_type=True, # <<<<<<<<<<<<<<
2120 * bint strict_types=False, bint datetime=False, unicode_errors=None):
2121 * self.use_float = use_single_float
2122 */
2123 __pyx_v_use_single_float = ((int)0);
2124 }
2125 if (values[2]) {
2126 __pyx_v_autoreset = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_autoreset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error)
2127 } else {
2128 __pyx_v_autoreset = ((int)1);
2129 }
2130 if (values[3]) {
2131 __pyx_v_use_bin_type = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_use_bin_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error)
2132 } else {
2133 __pyx_v_use_bin_type = ((int)1);
2134 }
2135 if (values[4]) {
2136 __pyx_v_strict_types = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_strict_types == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error)
2137 } else {
2138
2139 /* "msgpack/_packer.pyx":126
2140 * def __init__(self, *, default=None,
2141 * bint use_single_float=False, bint autoreset=True, bint use_bin_type=True,
2142 * bint strict_types=False, bint datetime=False, unicode_errors=None): # <<<<<<<<<<<<<<
2143 * self.use_float = use_single_float
2144 * self.strict_types = strict_types
2145 */
2146 __pyx_v_strict_types = ((int)0);
2147 }
2148 if (values[5]) {
2149 __pyx_v_datetime = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_datetime == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error)
2150 } else {
2151 __pyx_v_datetime = ((int)0);
2152 }
2153 __pyx_v_unicode_errors = values[6];
2154 }
2155 goto __pyx_L4_argument_unpacking_done;
2156 __pyx_L5_argtuple_error:;
2157 __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 124, __pyx_L3_error)
2158 __pyx_L3_error:;
2159 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2160 __Pyx_RefNannyFinishContext();
2161 return -1;
2162 __pyx_L4_argument_unpacking_done:;
2163 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer_2__init__(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self), __pyx_v_default, __pyx_v_use_single_float, __pyx_v_autoreset, __pyx_v_use_bin_type, __pyx_v_strict_types, __pyx_v_datetime, __pyx_v_unicode_errors);
2164
2165 /* "msgpack/_packer.pyx":124
2166 * self.pk.length = 0
2167 *
2168 * def __init__(self, *, default=None, # <<<<<<<<<<<<<<
2169 * bint use_single_float=False, bint autoreset=True, bint use_bin_type=True,
2170 * bint strict_types=False, bint datetime=False, unicode_errors=None):
2171 */
2172
2173 /* function exit code */
2174 __Pyx_RefNannyFinishContext();
2175 return __pyx_r;
2176 }
2177
2178 static int __pyx_pf_7msgpack_9_cmsgpack_6Packer_2__init__(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_default, int __pyx_v_use_single_float, int __pyx_v_autoreset, int __pyx_v_use_bin_type, int __pyx_v_strict_types, int __pyx_v_datetime, PyObject *__pyx_v_unicode_errors) {
2179 int __pyx_r;
2180 __Pyx_RefNannyDeclarations
2181 int __pyx_t_1;
2182 int __pyx_t_2;
2183 PyObject *__pyx_t_3 = NULL;
2184 char const *__pyx_t_4;
2185 int __pyx_lineno = 0;
2186 const char *__pyx_filename = NULL;
2187 int __pyx_clineno = 0;
2188 __Pyx_RefNannySetupContext("__init__", 0);
2189
2190 /* "msgpack/_packer.pyx":127
2191 * bint use_single_float=False, bint autoreset=True, bint use_bin_type=True,
2192 * bint strict_types=False, bint datetime=False, unicode_errors=None):
2193 * self.use_float = use_single_float # <<<<<<<<<<<<<<
2194 * self.strict_types = strict_types
2195 * self.autoreset = autoreset
2196 */
2197 __pyx_v_self->use_float = __pyx_v_use_single_float;
2198
2199 /* "msgpack/_packer.pyx":128
2200 * bint strict_types=False, bint datetime=False, unicode_errors=None):
2201 * self.use_float = use_single_float
2202 * self.strict_types = strict_types # <<<<<<<<<<<<<<
2203 * self.autoreset = autoreset
2204 * self.datetime = datetime
2205 */
2206 __pyx_v_self->strict_types = __pyx_v_strict_types;
2207
2208 /* "msgpack/_packer.pyx":129
2209 * self.use_float = use_single_float
2210 * self.strict_types = strict_types
2211 * self.autoreset = autoreset # <<<<<<<<<<<<<<
2212 * self.datetime = datetime
2213 * self.pk.use_bin_type = use_bin_type
2214 */
2215 __pyx_v_self->autoreset = __pyx_v_autoreset;
2216
2217 /* "msgpack/_packer.pyx":130
2218 * self.strict_types = strict_types
2219 * self.autoreset = autoreset
2220 * self.datetime = datetime # <<<<<<<<<<<<<<
2221 * self.pk.use_bin_type = use_bin_type
2222 * if default is not None:
2223 */
2224 __pyx_v_self->datetime = __pyx_v_datetime;
2225
2226 /* "msgpack/_packer.pyx":131
2227 * self.autoreset = autoreset
2228 * self.datetime = datetime
2229 * self.pk.use_bin_type = use_bin_type # <<<<<<<<<<<<<<
2230 * if default is not None:
2231 * if not PyCallable_Check(default):
2232 */
2233 __pyx_v_self->pk.use_bin_type = __pyx_v_use_bin_type;
2234
2235 /* "msgpack/_packer.pyx":132
2236 * self.datetime = datetime
2237 * self.pk.use_bin_type = use_bin_type
2238 * if default is not None: # <<<<<<<<<<<<<<
2239 * if not PyCallable_Check(default):
2240 * raise TypeError("default must be a callable.")
2241 */
2242 __pyx_t_1 = (__pyx_v_default != Py_None);
2243 __pyx_t_2 = (__pyx_t_1 != 0);
2244 if (__pyx_t_2) {
2245
2246 /* "msgpack/_packer.pyx":133
2247 * self.pk.use_bin_type = use_bin_type
2248 * if default is not None:
2249 * if not PyCallable_Check(default): # <<<<<<<<<<<<<<
2250 * raise TypeError("default must be a callable.")
2251 * self._default = default
2252 */
2253 __pyx_t_2 = ((!(PyCallable_Check(__pyx_v_default) != 0)) != 0);
2254 if (unlikely(__pyx_t_2)) {
2255
2256 /* "msgpack/_packer.pyx":134
2257 * if default is not None:
2258 * if not PyCallable_Check(default):
2259 * raise TypeError("default must be a callable.") # <<<<<<<<<<<<<<
2260 * self._default = default
2261 *
2262 */
2263 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error)
2264 __Pyx_GOTREF(__pyx_t_3);
2265 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
2266 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2267 __PYX_ERR(0, 134, __pyx_L1_error)
2268
2269 /* "msgpack/_packer.pyx":133
2270 * self.pk.use_bin_type = use_bin_type
2271 * if default is not None:
2272 * if not PyCallable_Check(default): # <<<<<<<<<<<<<<
2273 * raise TypeError("default must be a callable.")
2274 * self._default = default
2275 */
2276 }
2277
2278 /* "msgpack/_packer.pyx":132
2279 * self.datetime = datetime
2280 * self.pk.use_bin_type = use_bin_type
2281 * if default is not None: # <<<<<<<<<<<<<<
2282 * if not PyCallable_Check(default):
2283 * raise TypeError("default must be a callable.")
2284 */
2285 }
2286
2287 /* "msgpack/_packer.pyx":135
2288 * if not PyCallable_Check(default):
2289 * raise TypeError("default must be a callable.")
2290 * self._default = default # <<<<<<<<<<<<<<
2291 *
2292 * self._berrors = unicode_errors
2293 */
2294 __Pyx_INCREF(__pyx_v_default);
2295 __Pyx_GIVEREF(__pyx_v_default);
2296 __Pyx_GOTREF(__pyx_v_self->_default);
2297 __Pyx_DECREF(__pyx_v_self->_default);
2298 __pyx_v_self->_default = __pyx_v_default;
2299
2300 /* "msgpack/_packer.pyx":137
2301 * self._default = default
2302 *
2303 * self._berrors = unicode_errors # <<<<<<<<<<<<<<
2304 * if unicode_errors is None:
2305 * self.unicode_errors = NULL
2306 */
2307 __Pyx_INCREF(__pyx_v_unicode_errors);
2308 __Pyx_GIVEREF(__pyx_v_unicode_errors);
2309 __Pyx_GOTREF(__pyx_v_self->_berrors);
2310 __Pyx_DECREF(__pyx_v_self->_berrors);
2311 __pyx_v_self->_berrors = __pyx_v_unicode_errors;
2312
2313 /* "msgpack/_packer.pyx":138
2314 *
2315 * self._berrors = unicode_errors
2316 * if unicode_errors is None: # <<<<<<<<<<<<<<
2317 * self.unicode_errors = NULL
2318 * else:
2319 */
2320 __pyx_t_2 = (__pyx_v_unicode_errors == Py_None);
2321 __pyx_t_1 = (__pyx_t_2 != 0);
2322 if (__pyx_t_1) {
2323
2324 /* "msgpack/_packer.pyx":139
2325 * self._berrors = unicode_errors
2326 * if unicode_errors is None:
2327 * self.unicode_errors = NULL # <<<<<<<<<<<<<<
2328 * else:
2329 * self.unicode_errors = self._berrors
2330 */
2331 __pyx_v_self->unicode_errors = NULL;
2332
2333 /* "msgpack/_packer.pyx":138
2334 *
2335 * self._berrors = unicode_errors
2336 * if unicode_errors is None: # <<<<<<<<<<<<<<
2337 * self.unicode_errors = NULL
2338 * else:
2339 */
2340 goto __pyx_L5;
2341 }
2342
2343 /* "msgpack/_packer.pyx":141
2344 * self.unicode_errors = NULL
2345 * else:
2346 * self.unicode_errors = self._berrors # <<<<<<<<<<<<<<
2347 *
2348 * def __dealloc__(self):
2349 */
2350 /*else*/ {
2351 __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_self->_berrors); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
2352 __pyx_v_self->unicode_errors = __pyx_t_4;
2353 }
2354 __pyx_L5:;
2355
2356 /* "msgpack/_packer.pyx":124
2357 * self.pk.length = 0
2358 *
2359 * def __init__(self, *, default=None, # <<<<<<<<<<<<<<
2360 * bint use_single_float=False, bint autoreset=True, bint use_bin_type=True,
2361 * bint strict_types=False, bint datetime=False, unicode_errors=None):
2362 */
2363
2364 /* function exit code */
2365 __pyx_r = 0;
2366 goto __pyx_L0;
2367 __pyx_L1_error:;
2368 __Pyx_XDECREF(__pyx_t_3);
2369 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2370 __pyx_r = -1;
2371 __pyx_L0:;
2372 __Pyx_RefNannyFinishContext();
2373 return __pyx_r;
2374 }
2375
2376 /* "msgpack/_packer.pyx":143
2377 * self.unicode_errors = self._berrors
2378 *
2379 * def __dealloc__(self): # <<<<<<<<<<<<<<
2380 * PyMem_Free(self.pk.buf)
2381 * self.pk.buf = NULL
2382 */
2383
2384 /* Python wrapper */
2385 static void __pyx_pw_7msgpack_9_cmsgpack_6Packer_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
2386 static void __pyx_pw_7msgpack_9_cmsgpack_6Packer_5__dealloc__(PyObject *__pyx_v_self) {
2387 __Pyx_RefNannyDeclarations
2388 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
2389 __pyx_pf_7msgpack_9_cmsgpack_6Packer_4__dealloc__(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self));
2390
2391 /* function exit code */
2392 __Pyx_RefNannyFinishContext();
2393 }
2394
2395 static void __pyx_pf_7msgpack_9_cmsgpack_6Packer_4__dealloc__(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self) {
2396 __Pyx_RefNannyDeclarations
2397 __Pyx_RefNannySetupContext("__dealloc__", 0);
2398
2399 /* "msgpack/_packer.pyx":144
2400 *
2401 * def __dealloc__(self):
2402 * PyMem_Free(self.pk.buf) # <<<<<<<<<<<<<<
2403 * self.pk.buf = NULL
2404 *
2405 */
2406 PyMem_Free(__pyx_v_self->pk.buf);
2407
2408 /* "msgpack/_packer.pyx":145
2409 * def __dealloc__(self):
2410 * PyMem_Free(self.pk.buf)
2411 * self.pk.buf = NULL # <<<<<<<<<<<<<<
2412 *
2413 * cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1:
2414 */
2415 __pyx_v_self->pk.buf = NULL;
2416
2417 /* "msgpack/_packer.pyx":143
2418 * self.unicode_errors = self._berrors
2419 *
2420 * def __dealloc__(self): # <<<<<<<<<<<<<<
2421 * PyMem_Free(self.pk.buf)
2422 * self.pk.buf = NULL
2423 */
2424
2425 /* function exit code */
2426 __Pyx_RefNannyFinishContext();
2427 }
2428
2429 /* "msgpack/_packer.pyx":147
2430 * self.pk.buf = NULL
2431 *
2432 * cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1: # <<<<<<<<<<<<<<
2433 * cdef long long llval
2434 * cdef unsigned long long ullval
2435 */
2436
2437 static int __pyx_f_7msgpack_9_cmsgpack_6Packer__pack(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_o, struct __pyx_opt_args_7msgpack_9_cmsgpack_6Packer__pack *__pyx_optional_args) {
2438 int __pyx_v_nest_limit = __pyx_k__3;
2439 PY_LONG_LONG __pyx_v_llval;
2440 unsigned PY_LONG_LONG __pyx_v_ullval;
2441 unsigned long __pyx_v_ulval;
2442 long __pyx_v_longval;
2443 float __pyx_v_fval;
2444 double __pyx_v_dval;
2445 char *__pyx_v_rawval;
2446 int __pyx_v_ret;
2447 PyObject *__pyx_v_d = 0;
2448 Py_ssize_t __pyx_v_L;
2449 int __pyx_v_default_used;
2450 int __pyx_v_strict_types;
2451 Py_buffer __pyx_v_view;
2452 CYTHON_UNUSED PyObject *__pyx_v_oe = NULL;
2453 PyObject *__pyx_v_k = NULL;
2454 PyObject *__pyx_v_v = NULL;
2455 PyObject *__pyx_v_delta = NULL;
2456 int __pyx_r;
2457 __Pyx_RefNannyDeclarations
2458 int __pyx_t_1;
2459 PyObject *__pyx_t_2 = NULL;
2460 int __pyx_t_3;
2461 PyObject *__pyx_t_4 = NULL;
2462 PyObject *__pyx_t_5 = NULL;
2463 PyObject *__pyx_t_6 = NULL;
2464 unsigned PY_LONG_LONG __pyx_t_7;
2465 PY_LONG_LONG __pyx_t_8;
2466 int __pyx_t_9;
2467 PyObject *__pyx_t_10 = NULL;
2468 PyObject *__pyx_t_11 = NULL;
2469 int __pyx_t_12;
2470 PyObject *__pyx_t_13 = NULL;
2471 PyObject *__pyx_t_14 = NULL;
2472 PyObject *__pyx_t_15 = NULL;
2473 int __pyx_t_16;
2474 char const *__pyx_t_17;
2475 PyObject *__pyx_t_18 = NULL;
2476 PyObject *__pyx_t_19 = NULL;
2477 PyObject *__pyx_t_20 = NULL;
2478 PyObject *__pyx_t_21 = NULL;
2479 PyObject *__pyx_t_22 = NULL;
2480 PyObject *__pyx_t_23 = NULL;
2481 long __pyx_t_24;
2482 float __pyx_t_25;
2483 double __pyx_t_26;
2484 PyObject *__pyx_t_27;
2485 char *__pyx_t_28;
2486 Py_ssize_t __pyx_t_29;
2487 Py_ssize_t __pyx_t_30;
2488 struct __pyx_opt_args_7msgpack_9_cmsgpack_6Packer__pack __pyx_t_31;
2489 unsigned long __pyx_t_32;
2490 PyObject *(*__pyx_t_33)(PyObject *);
2491 int __pyx_lineno = 0;
2492 const char *__pyx_filename = NULL;
2493 int __pyx_clineno = 0;
2494 __Pyx_RefNannySetupContext("_pack", 0);
2495 if (__pyx_optional_args) {
2496 if (__pyx_optional_args->__pyx_n > 0) {
2497 __pyx_v_nest_limit = __pyx_optional_args->nest_limit;
2498 }
2499 }
2500 __Pyx_INCREF(__pyx_v_o);
2501
2502 /* "msgpack/_packer.pyx":158
2503 * cdef dict d
2504 * cdef Py_ssize_t L
2505 * cdef int default_used = 0 # <<<<<<<<<<<<<<
2506 * cdef bint strict_types = self.strict_types
2507 * cdef Py_buffer view
2508 */
2509 __pyx_v_default_used = 0;
2510
2511 /* "msgpack/_packer.pyx":159
2512 * cdef Py_ssize_t L
2513 * cdef int default_used = 0
2514 * cdef bint strict_types = self.strict_types # <<<<<<<<<<<<<<
2515 * cdef Py_buffer view
2516 *
2517 */
2518 __pyx_t_1 = __pyx_v_self->strict_types;
2519 __pyx_v_strict_types = __pyx_t_1;
2520
2521 /* "msgpack/_packer.pyx":162
2522 * cdef Py_buffer view
2523 *
2524 * if nest_limit < 0: # <<<<<<<<<<<<<<
2525 * raise ValueError("recursion limit exceeded.")
2526 *
2527 */
2528 __pyx_t_1 = ((__pyx_v_nest_limit < 0) != 0);
2529 if (unlikely(__pyx_t_1)) {
2530
2531 /* "msgpack/_packer.pyx":163
2532 *
2533 * if nest_limit < 0:
2534 * raise ValueError("recursion limit exceeded.") # <<<<<<<<<<<<<<
2535 *
2536 * while True:
2537 */
2538 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
2539 __Pyx_GOTREF(__pyx_t_2);
2540 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
2541 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2542 __PYX_ERR(0, 163, __pyx_L1_error)
2543
2544 /* "msgpack/_packer.pyx":162
2545 * cdef Py_buffer view
2546 *
2547 * if nest_limit < 0: # <<<<<<<<<<<<<<
2548 * raise ValueError("recursion limit exceeded.")
2549 *
2550 */
2551 }
2552
2553 /* "msgpack/_packer.pyx":165
2554 * raise ValueError("recursion limit exceeded.")
2555 *
2556 * while True: # <<<<<<<<<<<<<<
2557 * if o is None:
2558 * ret = msgpack_pack_nil(&self.pk)
2559 */
2560 while (1) {
2561
2562 /* "msgpack/_packer.pyx":166
2563 *
2564 * while True:
2565 * if o is None: # <<<<<<<<<<<<<<
2566 * ret = msgpack_pack_nil(&self.pk)
2567 * elif o is True:
2568 */
2569 __pyx_t_1 = (__pyx_v_o == Py_None);
2570 __pyx_t_3 = (__pyx_t_1 != 0);
2571 if (__pyx_t_3) {
2572
2573 /* "msgpack/_packer.pyx":167
2574 * while True:
2575 * if o is None:
2576 * ret = msgpack_pack_nil(&self.pk) # <<<<<<<<<<<<<<
2577 * elif o is True:
2578 * ret = msgpack_pack_true(&self.pk)
2579 */
2580 __pyx_v_ret = msgpack_pack_nil((&__pyx_v_self->pk));
2581
2582 /* "msgpack/_packer.pyx":166
2583 *
2584 * while True:
2585 * if o is None: # <<<<<<<<<<<<<<
2586 * ret = msgpack_pack_nil(&self.pk)
2587 * elif o is True:
2588 */
2589 goto __pyx_L6;
2590 }
2591
2592 /* "msgpack/_packer.pyx":168
2593 * if o is None:
2594 * ret = msgpack_pack_nil(&self.pk)
2595 * elif o is True: # <<<<<<<<<<<<<<
2596 * ret = msgpack_pack_true(&self.pk)
2597 * elif o is False:
2598 */
2599 __pyx_t_3 = (__pyx_v_o == Py_True);
2600 __pyx_t_1 = (__pyx_t_3 != 0);
2601 if (__pyx_t_1) {
2602
2603 /* "msgpack/_packer.pyx":169
2604 * ret = msgpack_pack_nil(&self.pk)
2605 * elif o is True:
2606 * ret = msgpack_pack_true(&self.pk) # <<<<<<<<<<<<<<
2607 * elif o is False:
2608 * ret = msgpack_pack_false(&self.pk)
2609 */
2610 __pyx_v_ret = msgpack_pack_true((&__pyx_v_self->pk));
2611
2612 /* "msgpack/_packer.pyx":168
2613 * if o is None:
2614 * ret = msgpack_pack_nil(&self.pk)
2615 * elif o is True: # <<<<<<<<<<<<<<
2616 * ret = msgpack_pack_true(&self.pk)
2617 * elif o is False:
2618 */
2619 goto __pyx_L6;
2620 }
2621
2622 /* "msgpack/_packer.pyx":170
2623 * elif o is True:
2624 * ret = msgpack_pack_true(&self.pk)
2625 * elif o is False: # <<<<<<<<<<<<<<
2626 * ret = msgpack_pack_false(&self.pk)
2627 * elif PyLong_CheckExact(o) if strict_types else PyLong_Check(o):
2628 */
2629 __pyx_t_1 = (__pyx_v_o == Py_False);
2630 __pyx_t_3 = (__pyx_t_1 != 0);
2631 if (__pyx_t_3) {
2632
2633 /* "msgpack/_packer.pyx":171
2634 * ret = msgpack_pack_true(&self.pk)
2635 * elif o is False:
2636 * ret = msgpack_pack_false(&self.pk) # <<<<<<<<<<<<<<
2637 * elif PyLong_CheckExact(o) if strict_types else PyLong_Check(o):
2638 * # PyInt_Check(long) is True for Python 3.
2639 */
2640 __pyx_v_ret = msgpack_pack_false((&__pyx_v_self->pk));
2641
2642 /* "msgpack/_packer.pyx":170
2643 * elif o is True:
2644 * ret = msgpack_pack_true(&self.pk)
2645 * elif o is False: # <<<<<<<<<<<<<<
2646 * ret = msgpack_pack_false(&self.pk)
2647 * elif PyLong_CheckExact(o) if strict_types else PyLong_Check(o):
2648 */
2649 goto __pyx_L6;
2650 }
2651
2652 /* "msgpack/_packer.pyx":172
2653 * elif o is False:
2654 * ret = msgpack_pack_false(&self.pk)
2655 * elif PyLong_CheckExact(o) if strict_types else PyLong_Check(o): # <<<<<<<<<<<<<<
2656 * # PyInt_Check(long) is True for Python 3.
2657 * # So we should test long before int.
2658 */
2659 if ((__pyx_v_strict_types != 0)) {
2660 __pyx_t_3 = PyLong_CheckExact(__pyx_v_o);
2661 } else {
2662 __pyx_t_3 = PyLong_Check(__pyx_v_o);
2663 }
2664 __pyx_t_1 = (__pyx_t_3 != 0);
2665 if (__pyx_t_1) {
2666
2667 /* "msgpack/_packer.pyx":175
2668 * # PyInt_Check(long) is True for Python 3.
2669 * # So we should test long before int.
2670 * try: # <<<<<<<<<<<<<<
2671 * if o > 0:
2672 * ullval = o
2673 */
2674 {
2675 __Pyx_PyThreadState_declare
2676 __Pyx_PyThreadState_assign
2677 __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
2678 __Pyx_XGOTREF(__pyx_t_4);
2679 __Pyx_XGOTREF(__pyx_t_5);
2680 __Pyx_XGOTREF(__pyx_t_6);
2681 /*try:*/ {
2682
2683 /* "msgpack/_packer.pyx":176
2684 * # So we should test long before int.
2685 * try:
2686 * if o > 0: # <<<<<<<<<<<<<<
2687 * ullval = o
2688 * ret = msgpack_pack_unsigned_long_long(&self.pk, ullval)
2689 */
2690 __pyx_t_2 = PyObject_RichCompare(__pyx_v_o, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L7_error)
2691 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 176, __pyx_L7_error)
2692 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2693 if (__pyx_t_1) {
2694
2695 /* "msgpack/_packer.pyx":177
2696 * try:
2697 * if o > 0:
2698 * ullval = o # <<<<<<<<<<<<<<
2699 * ret = msgpack_pack_unsigned_long_long(&self.pk, ullval)
2700 * else:
2701 */
2702 __pyx_t_7 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_v_o); if (unlikely((__pyx_t_7 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L7_error)
2703 __pyx_v_ullval = __pyx_t_7;
2704
2705 /* "msgpack/_packer.pyx":178
2706 * if o > 0:
2707 * ullval = o
2708 * ret = msgpack_pack_unsigned_long_long(&self.pk, ullval) # <<<<<<<<<<<<<<
2709 * else:
2710 * llval = o
2711 */
2712 __pyx_v_ret = msgpack_pack_unsigned_long_long((&__pyx_v_self->pk), __pyx_v_ullval);
2713
2714 /* "msgpack/_packer.pyx":176
2715 * # So we should test long before int.
2716 * try:
2717 * if o > 0: # <<<<<<<<<<<<<<
2718 * ullval = o
2719 * ret = msgpack_pack_unsigned_long_long(&self.pk, ullval)
2720 */
2721 goto __pyx_L15;
2722 }
2723
2724 /* "msgpack/_packer.pyx":180
2725 * ret = msgpack_pack_unsigned_long_long(&self.pk, ullval)
2726 * else:
2727 * llval = o # <<<<<<<<<<<<<<
2728 * ret = msgpack_pack_long_long(&self.pk, llval)
2729 * except OverflowError as oe:
2730 */
2731 /*else*/ {
2732 __pyx_t_8 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_o); if (unlikely((__pyx_t_8 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L7_error)
2733 __pyx_v_llval = __pyx_t_8;
2734
2735 /* "msgpack/_packer.pyx":181
2736 * else:
2737 * llval = o
2738 * ret = msgpack_pack_long_long(&self.pk, llval) # <<<<<<<<<<<<<<
2739 * except OverflowError as oe:
2740 * if not default_used and self._default is not None:
2741 */
2742 __pyx_v_ret = msgpack_pack_long_long((&__pyx_v_self->pk), __pyx_v_llval);
2743 }
2744 __pyx_L15:;
2745
2746 /* "msgpack/_packer.pyx":175
2747 * # PyInt_Check(long) is True for Python 3.
2748 * # So we should test long before int.
2749 * try: # <<<<<<<<<<<<<<
2750 * if o > 0:
2751 * ullval = o
2752 */
2753 }
2754 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2755 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2756 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2757 goto __pyx_L14_try_end;
2758 __pyx_L7_error:;
2759 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2760
2761 /* "msgpack/_packer.pyx":182
2762 * llval = o
2763 * ret = msgpack_pack_long_long(&self.pk, llval)
2764 * except OverflowError as oe: # <<<<<<<<<<<<<<
2765 * if not default_used and self._default is not None:
2766 * o = self._default(o)
2767 */
2768 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
2769 if (__pyx_t_9) {
2770 __Pyx_AddTraceback("msgpack._cmsgpack.Packer._pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
2771 if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_10, &__pyx_t_11) < 0) __PYX_ERR(0, 182, __pyx_L9_except_error)
2772 __Pyx_GOTREF(__pyx_t_2);
2773 __Pyx_GOTREF(__pyx_t_10);
2774 __Pyx_GOTREF(__pyx_t_11);
2775 __Pyx_INCREF(__pyx_t_10);
2776 __pyx_v_oe = __pyx_t_10;
2777 /*try:*/ {
2778
2779 /* "msgpack/_packer.pyx":183
2780 * ret = msgpack_pack_long_long(&self.pk, llval)
2781 * except OverflowError as oe:
2782 * if not default_used and self._default is not None: # <<<<<<<<<<<<<<
2783 * o = self._default(o)
2784 * default_used = True
2785 */
2786 __pyx_t_3 = ((!(__pyx_v_default_used != 0)) != 0);
2787 if (__pyx_t_3) {
2788 } else {
2789 __pyx_t_1 = __pyx_t_3;
2790 goto __pyx_L24_bool_binop_done;
2791 }
2792 __pyx_t_3 = (__pyx_v_self->_default != Py_None);
2793 __pyx_t_12 = (__pyx_t_3 != 0);
2794 __pyx_t_1 = __pyx_t_12;
2795 __pyx_L24_bool_binop_done:;
2796 if (likely(__pyx_t_1)) {
2797
2798 /* "msgpack/_packer.pyx":184
2799 * except OverflowError as oe:
2800 * if not default_used and self._default is not None:
2801 * o = self._default(o) # <<<<<<<<<<<<<<
2802 * default_used = True
2803 * continue
2804 */
2805 __Pyx_INCREF(__pyx_v_self->_default);
2806 __pyx_t_14 = __pyx_v_self->_default; __pyx_t_15 = NULL;
2807 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
2808 __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
2809 if (likely(__pyx_t_15)) {
2810 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
2811 __Pyx_INCREF(__pyx_t_15);
2812 __Pyx_INCREF(function);
2813 __Pyx_DECREF_SET(__pyx_t_14, function);
2814 }
2815 }
2816 __pyx_t_13 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_v_o) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_o);
2817 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
2818 if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 184, __pyx_L21_error)
2819 __Pyx_GOTREF(__pyx_t_13);
2820 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
2821 __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_13);
2822 __pyx_t_13 = 0;
2823
2824 /* "msgpack/_packer.pyx":185
2825 * if not default_used and self._default is not None:
2826 * o = self._default(o)
2827 * default_used = True # <<<<<<<<<<<<<<
2828 * continue
2829 * else:
2830 */
2831 __pyx_v_default_used = 1;
2832
2833 /* "msgpack/_packer.pyx":186
2834 * o = self._default(o)
2835 * default_used = True
2836 * continue # <<<<<<<<<<<<<<
2837 * else:
2838 * raise OverflowError("Integer value out of range")
2839 */
2840 goto __pyx_L18_continue;
2841
2842 /* "msgpack/_packer.pyx":183
2843 * ret = msgpack_pack_long_long(&self.pk, llval)
2844 * except OverflowError as oe:
2845 * if not default_used and self._default is not None: # <<<<<<<<<<<<<<
2846 * o = self._default(o)
2847 * default_used = True
2848 */
2849 }
2850
2851 /* "msgpack/_packer.pyx":188
2852 * continue
2853 * else:
2854 * raise OverflowError("Integer value out of range") # <<<<<<<<<<<<<<
2855 * elif PyInt_CheckExact(o) if strict_types else PyInt_Check(o):
2856 * longval = o
2857 */
2858 /*else*/ {
2859 __pyx_t_13 = __Pyx_PyObject_Call(__pyx_builtin_OverflowError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 188, __pyx_L21_error)
2860 __Pyx_GOTREF(__pyx_t_13);
2861 __Pyx_Raise(__pyx_t_13, 0, 0, 0);
2862 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
2863 __PYX_ERR(0, 188, __pyx_L21_error)
2864 }
2865 }
2866
2867 /* "msgpack/_packer.pyx":182
2868 * llval = o
2869 * ret = msgpack_pack_long_long(&self.pk, llval)
2870 * except OverflowError as oe: # <<<<<<<<<<<<<<
2871 * if not default_used and self._default is not None:
2872 * o = self._default(o)
2873 */
2874 /*finally:*/ {
2875 __pyx_L21_error:;
2876 /*exception exit:*/{
2877 __Pyx_PyThreadState_declare
2878 __Pyx_PyThreadState_assign
2879 __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
2880 __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
2881 __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
2882 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
2883 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
2884 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
2885 __Pyx_XGOTREF(__pyx_t_18);
2886 __Pyx_XGOTREF(__pyx_t_19);
2887 __Pyx_XGOTREF(__pyx_t_20);
2888 __Pyx_XGOTREF(__pyx_t_21);
2889 __Pyx_XGOTREF(__pyx_t_22);
2890 __Pyx_XGOTREF(__pyx_t_23);
2891 __pyx_t_9 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
2892 {
2893 __Pyx_DECREF(__pyx_v_oe);
2894 __pyx_v_oe = NULL;
2895 }
2896 if (PY_MAJOR_VERSION >= 3) {
2897 __Pyx_XGIVEREF(__pyx_t_21);
2898 __Pyx_XGIVEREF(__pyx_t_22);
2899 __Pyx_XGIVEREF(__pyx_t_23);
2900 __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
2901 }
2902 __Pyx_XGIVEREF(__pyx_t_18);
2903 __Pyx_XGIVEREF(__pyx_t_19);
2904 __Pyx_XGIVEREF(__pyx_t_20);
2905 __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
2906 __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
2907 __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17;
2908 goto __pyx_L9_except_error;
2909 }
2910 __pyx_L18_continue: {
2911 __Pyx_DECREF(__pyx_v_oe);
2912 __pyx_v_oe = NULL;
2913 goto __pyx_L17_except_continue;
2914 }
2915 }
2916 __pyx_L17_except_continue:;
2917 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2918 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2919 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
2920 goto __pyx_L13_try_continue;
2921 }
2922 goto __pyx_L9_except_error;
2923 __pyx_L9_except_error:;
2924
2925 /* "msgpack/_packer.pyx":175
2926 * # PyInt_Check(long) is True for Python 3.
2927 * # So we should test long before int.
2928 * try: # <<<<<<<<<<<<<<
2929 * if o > 0:
2930 * ullval = o
2931 */
2932 __Pyx_XGIVEREF(__pyx_t_4);
2933 __Pyx_XGIVEREF(__pyx_t_5);
2934 __Pyx_XGIVEREF(__pyx_t_6);
2935 __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
2936 goto __pyx_L1_error;
2937 __pyx_L13_try_continue:;
2938 __Pyx_XGIVEREF(__pyx_t_4);
2939 __Pyx_XGIVEREF(__pyx_t_5);
2940 __Pyx_XGIVEREF(__pyx_t_6);
2941 __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
2942 goto __pyx_L4_continue;
2943 __pyx_L14_try_end:;
2944 }
2945
2946 /* "msgpack/_packer.pyx":172
2947 * elif o is False:
2948 * ret = msgpack_pack_false(&self.pk)
2949 * elif PyLong_CheckExact(o) if strict_types else PyLong_Check(o): # <<<<<<<<<<<<<<
2950 * # PyInt_Check(long) is True for Python 3.
2951 * # So we should test long before int.
2952 */
2953 goto __pyx_L6;
2954 }
2955
2956 /* "msgpack/_packer.pyx":189
2957 * else:
2958 * raise OverflowError("Integer value out of range")
2959 * elif PyInt_CheckExact(o) if strict_types else PyInt_Check(o): # <<<<<<<<<<<<<<
2960 * longval = o
2961 * ret = msgpack_pack_long(&self.pk, longval)
2962 */
2963 if ((__pyx_v_strict_types != 0)) {
2964 __pyx_t_1 = PyInt_CheckExact(__pyx_v_o);
2965 } else {
2966 __pyx_t_1 = PyInt_Check(__pyx_v_o);
2967 }
2968 __pyx_t_12 = (__pyx_t_1 != 0);
2969 if (__pyx_t_12) {
2970
2971 /* "msgpack/_packer.pyx":190
2972 * raise OverflowError("Integer value out of range")
2973 * elif PyInt_CheckExact(o) if strict_types else PyInt_Check(o):
2974 * longval = o # <<<<<<<<<<<<<<
2975 * ret = msgpack_pack_long(&self.pk, longval)
2976 * elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):
2977 */
2978 __pyx_t_24 = __Pyx_PyInt_As_long(__pyx_v_o); if (unlikely((__pyx_t_24 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 190, __pyx_L1_error)
2979 __pyx_v_longval = __pyx_t_24;
2980
2981 /* "msgpack/_packer.pyx":191
2982 * elif PyInt_CheckExact(o) if strict_types else PyInt_Check(o):
2983 * longval = o
2984 * ret = msgpack_pack_long(&self.pk, longval) # <<<<<<<<<<<<<<
2985 * elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):
2986 * if self.use_float:
2987 */
2988 __pyx_v_ret = msgpack_pack_long((&__pyx_v_self->pk), __pyx_v_longval);
2989
2990 /* "msgpack/_packer.pyx":189
2991 * else:
2992 * raise OverflowError("Integer value out of range")
2993 * elif PyInt_CheckExact(o) if strict_types else PyInt_Check(o): # <<<<<<<<<<<<<<
2994 * longval = o
2995 * ret = msgpack_pack_long(&self.pk, longval)
2996 */
2997 goto __pyx_L6;
2998 }
2999
3000 /* "msgpack/_packer.pyx":192
3001 * longval = o
3002 * ret = msgpack_pack_long(&self.pk, longval)
3003 * elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o): # <<<<<<<<<<<<<<
3004 * if self.use_float:
3005 * fval = o
3006 */
3007 if ((__pyx_v_strict_types != 0)) {
3008 __pyx_t_12 = PyFloat_CheckExact(__pyx_v_o);
3009 } else {
3010 __pyx_t_12 = PyFloat_Check(__pyx_v_o);
3011 }
3012 __pyx_t_1 = (__pyx_t_12 != 0);
3013 if (__pyx_t_1) {
3014
3015 /* "msgpack/_packer.pyx":193
3016 * ret = msgpack_pack_long(&self.pk, longval)
3017 * elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):
3018 * if self.use_float: # <<<<<<<<<<<<<<
3019 * fval = o
3020 * ret = msgpack_pack_float(&self.pk, fval)
3021 */
3022 __pyx_t_1 = (__pyx_v_self->use_float != 0);
3023 if (__pyx_t_1) {
3024
3025 /* "msgpack/_packer.pyx":194
3026 * elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):
3027 * if self.use_float:
3028 * fval = o # <<<<<<<<<<<<<<
3029 * ret = msgpack_pack_float(&self.pk, fval)
3030 * else:
3031 */
3032 __pyx_t_25 = __pyx_PyFloat_AsFloat(__pyx_v_o); if (unlikely((__pyx_t_25 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error)
3033 __pyx_v_fval = __pyx_t_25;
3034
3035 /* "msgpack/_packer.pyx":195
3036 * if self.use_float:
3037 * fval = o
3038 * ret = msgpack_pack_float(&self.pk, fval) # <<<<<<<<<<<<<<
3039 * else:
3040 * dval = o
3041 */
3042 __pyx_v_ret = msgpack_pack_float((&__pyx_v_self->pk), __pyx_v_fval);
3043
3044 /* "msgpack/_packer.pyx":193
3045 * ret = msgpack_pack_long(&self.pk, longval)
3046 * elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):
3047 * if self.use_float: # <<<<<<<<<<<<<<
3048 * fval = o
3049 * ret = msgpack_pack_float(&self.pk, fval)
3050 */
3051 goto __pyx_L30;
3052 }
3053
3054 /* "msgpack/_packer.pyx":197
3055 * ret = msgpack_pack_float(&self.pk, fval)
3056 * else:
3057 * dval = o # <<<<<<<<<<<<<<
3058 * ret = msgpack_pack_double(&self.pk, dval)
3059 * elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
3060 */
3061 /*else*/ {
3062 __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_o); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error)
3063 __pyx_v_dval = __pyx_t_26;
3064
3065 /* "msgpack/_packer.pyx":198
3066 * else:
3067 * dval = o
3068 * ret = msgpack_pack_double(&self.pk, dval) # <<<<<<<<<<<<<<
3069 * elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
3070 * L = Py_SIZE(o)
3071 */
3072 __pyx_v_ret = msgpack_pack_double((&__pyx_v_self->pk), __pyx_v_dval);
3073 }
3074 __pyx_L30:;
3075
3076 /* "msgpack/_packer.pyx":192
3077 * longval = o
3078 * ret = msgpack_pack_long(&self.pk, longval)
3079 * elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o): # <<<<<<<<<<<<<<
3080 * if self.use_float:
3081 * fval = o
3082 */
3083 goto __pyx_L6;
3084 }
3085
3086 /* "msgpack/_packer.pyx":199
3087 * dval = o
3088 * ret = msgpack_pack_double(&self.pk, dval)
3089 * elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o): # <<<<<<<<<<<<<<
3090 * L = Py_SIZE(o)
3091 * if L > ITEM_LIMIT:
3092 */
3093 if ((__pyx_v_strict_types != 0)) {
3094 __pyx_t_16 = __pyx_f_7msgpack_9_cmsgpack_PyBytesLike_CheckExact(__pyx_v_o);
3095 } else {
3096 __pyx_t_16 = __pyx_f_7msgpack_9_cmsgpack_PyBytesLike_Check(__pyx_v_o);
3097 }
3098 __pyx_t_1 = (__pyx_t_16 != 0);
3099 if (__pyx_t_1) {
3100
3101 /* "msgpack/_packer.pyx":200
3102 * ret = msgpack_pack_double(&self.pk, dval)
3103 * elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
3104 * L = Py_SIZE(o) # <<<<<<<<<<<<<<
3105 * if L > ITEM_LIMIT:
3106 * PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(o).tp_name)
3107 */
3108 __pyx_v_L = Py_SIZE(__pyx_v_o);
3109
3110 /* "msgpack/_packer.pyx":201
3111 * elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
3112 * L = Py_SIZE(o)
3113 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3114 * PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(o).tp_name)
3115 * rawval = o
3116 */
3117 __pyx_t_1 = ((__pyx_v_L > __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT) != 0);
3118 if (__pyx_t_1) {
3119
3120 /* "msgpack/_packer.pyx":202
3121 * L = Py_SIZE(o)
3122 * if L > ITEM_LIMIT:
3123 * PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(o).tp_name) # <<<<<<<<<<<<<<
3124 * rawval = o
3125 * ret = msgpack_pack_bin(&self.pk, L)
3126 */
3127 __pyx_t_27 = PyErr_Format(__pyx_builtin_ValueError, ((char *)"%.200s object is too large"), Py_TYPE(__pyx_v_o)->tp_name); if (unlikely(__pyx_t_27 == ((PyObject *)NULL))) __PYX_ERR(0, 202, __pyx_L1_error)
3128
3129 /* "msgpack/_packer.pyx":201
3130 * elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
3131 * L = Py_SIZE(o)
3132 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3133 * PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(o).tp_name)
3134 * rawval = o
3135 */
3136 }
3137
3138 /* "msgpack/_packer.pyx":203
3139 * if L > ITEM_LIMIT:
3140 * PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(o).tp_name)
3141 * rawval = o # <<<<<<<<<<<<<<
3142 * ret = msgpack_pack_bin(&self.pk, L)
3143 * if ret == 0:
3144 */
3145 __pyx_t_28 = __Pyx_PyObject_AsWritableString(__pyx_v_o); if (unlikely((!__pyx_t_28) && PyErr_Occurred())) __PYX_ERR(0, 203, __pyx_L1_error)
3146 __pyx_v_rawval = __pyx_t_28;
3147
3148 /* "msgpack/_packer.pyx":204
3149 * PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(o).tp_name)
3150 * rawval = o
3151 * ret = msgpack_pack_bin(&self.pk, L) # <<<<<<<<<<<<<<
3152 * if ret == 0:
3153 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3154 */
3155 __pyx_v_ret = msgpack_pack_bin((&__pyx_v_self->pk), __pyx_v_L);
3156
3157 /* "msgpack/_packer.pyx":205
3158 * rawval = o
3159 * ret = msgpack_pack_bin(&self.pk, L)
3160 * if ret == 0: # <<<<<<<<<<<<<<
3161 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3162 * elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3163 */
3164 __pyx_t_1 = ((__pyx_v_ret == 0) != 0);
3165 if (__pyx_t_1) {
3166
3167 /* "msgpack/_packer.pyx":206
3168 * ret = msgpack_pack_bin(&self.pk, L)
3169 * if ret == 0:
3170 * ret = msgpack_pack_raw_body(&self.pk, rawval, L) # <<<<<<<<<<<<<<
3171 * elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3172 * if self.unicode_errors == NULL:
3173 */
3174 __pyx_v_ret = msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_v_rawval, __pyx_v_L);
3175
3176 /* "msgpack/_packer.pyx":205
3177 * rawval = o
3178 * ret = msgpack_pack_bin(&self.pk, L)
3179 * if ret == 0: # <<<<<<<<<<<<<<
3180 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3181 * elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3182 */
3183 }
3184
3185 /* "msgpack/_packer.pyx":199
3186 * dval = o
3187 * ret = msgpack_pack_double(&self.pk, dval)
3188 * elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o): # <<<<<<<<<<<<<<
3189 * L = Py_SIZE(o)
3190 * if L > ITEM_LIMIT:
3191 */
3192 goto __pyx_L6;
3193 }
3194
3195 /* "msgpack/_packer.pyx":207
3196 * if ret == 0:
3197 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3198 * elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o): # <<<<<<<<<<<<<<
3199 * if self.unicode_errors == NULL:
3200 * ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3201 */
3202 if ((__pyx_v_strict_types != 0)) {
3203 __pyx_t_1 = PyUnicode_CheckExact(__pyx_v_o);
3204 } else {
3205 __pyx_t_1 = PyUnicode_Check(__pyx_v_o);
3206 }
3207 __pyx_t_12 = (__pyx_t_1 != 0);
3208 if (__pyx_t_12) {
3209
3210 /* "msgpack/_packer.pyx":208
3211 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3212 * elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3213 * if self.unicode_errors == NULL: # <<<<<<<<<<<<<<
3214 * ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3215 * if ret == -2:
3216 */
3217 __pyx_t_12 = ((__pyx_v_self->unicode_errors == NULL) != 0);
3218 if (__pyx_t_12) {
3219
3220 /* "msgpack/_packer.pyx":209
3221 * elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3222 * if self.unicode_errors == NULL:
3223 * ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT); # <<<<<<<<<<<<<<
3224 * if ret == -2:
3225 * raise ValueError("unicode string is too large")
3226 */
3227 __pyx_v_ret = msgpack_pack_unicode((&__pyx_v_self->pk), __pyx_v_o, __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT);
3228
3229 /* "msgpack/_packer.pyx":210
3230 * if self.unicode_errors == NULL:
3231 * ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3232 * if ret == -2: # <<<<<<<<<<<<<<
3233 * raise ValueError("unicode string is too large")
3234 * else:
3235 */
3236 __pyx_t_12 = ((__pyx_v_ret == -2L) != 0);
3237 if (unlikely(__pyx_t_12)) {
3238
3239 /* "msgpack/_packer.pyx":211
3240 * ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3241 * if ret == -2:
3242 * raise ValueError("unicode string is too large") # <<<<<<<<<<<<<<
3243 * else:
3244 * o = PyUnicode_AsEncodedString(o, NULL, self.unicode_errors)
3245 */
3246 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 211, __pyx_L1_error)
3247 __Pyx_GOTREF(__pyx_t_11);
3248 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
3249 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3250 __PYX_ERR(0, 211, __pyx_L1_error)
3251
3252 /* "msgpack/_packer.pyx":210
3253 * if self.unicode_errors == NULL:
3254 * ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3255 * if ret == -2: # <<<<<<<<<<<<<<
3256 * raise ValueError("unicode string is too large")
3257 * else:
3258 */
3259 }
3260
3261 /* "msgpack/_packer.pyx":208
3262 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3263 * elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3264 * if self.unicode_errors == NULL: # <<<<<<<<<<<<<<
3265 * ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3266 * if ret == -2:
3267 */
3268 goto __pyx_L33;
3269 }
3270
3271 /* "msgpack/_packer.pyx":213
3272 * raise ValueError("unicode string is too large")
3273 * else:
3274 * o = PyUnicode_AsEncodedString(o, NULL, self.unicode_errors) # <<<<<<<<<<<<<<
3275 * L = Py_SIZE(o)
3276 * if L > ITEM_LIMIT:
3277 */
3278 /*else*/ {
3279 __pyx_t_11 = PyUnicode_AsEncodedString(__pyx_v_o, NULL, __pyx_v_self->unicode_errors); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 213, __pyx_L1_error)
3280 __Pyx_GOTREF(__pyx_t_11);
3281 __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_11);
3282 __pyx_t_11 = 0;
3283
3284 /* "msgpack/_packer.pyx":214
3285 * else:
3286 * o = PyUnicode_AsEncodedString(o, NULL, self.unicode_errors)
3287 * L = Py_SIZE(o) # <<<<<<<<<<<<<<
3288 * if L > ITEM_LIMIT:
3289 * raise ValueError("unicode string is too large")
3290 */
3291 __pyx_v_L = Py_SIZE(__pyx_v_o);
3292
3293 /* "msgpack/_packer.pyx":215
3294 * o = PyUnicode_AsEncodedString(o, NULL, self.unicode_errors)
3295 * L = Py_SIZE(o)
3296 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3297 * raise ValueError("unicode string is too large")
3298 * ret = msgpack_pack_raw(&self.pk, L)
3299 */
3300 __pyx_t_12 = ((__pyx_v_L > __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT) != 0);
3301 if (unlikely(__pyx_t_12)) {
3302
3303 /* "msgpack/_packer.pyx":216
3304 * L = Py_SIZE(o)
3305 * if L > ITEM_LIMIT:
3306 * raise ValueError("unicode string is too large") # <<<<<<<<<<<<<<
3307 * ret = msgpack_pack_raw(&self.pk, L)
3308 * if ret == 0:
3309 */
3310 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 216, __pyx_L1_error)
3311 __Pyx_GOTREF(__pyx_t_11);
3312 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
3313 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3314 __PYX_ERR(0, 216, __pyx_L1_error)
3315
3316 /* "msgpack/_packer.pyx":215
3317 * o = PyUnicode_AsEncodedString(o, NULL, self.unicode_errors)
3318 * L = Py_SIZE(o)
3319 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3320 * raise ValueError("unicode string is too large")
3321 * ret = msgpack_pack_raw(&self.pk, L)
3322 */
3323 }
3324
3325 /* "msgpack/_packer.pyx":217
3326 * if L > ITEM_LIMIT:
3327 * raise ValueError("unicode string is too large")
3328 * ret = msgpack_pack_raw(&self.pk, L) # <<<<<<<<<<<<<<
3329 * if ret == 0:
3330 * rawval = o
3331 */
3332 __pyx_v_ret = msgpack_pack_raw((&__pyx_v_self->pk), __pyx_v_L);
3333
3334 /* "msgpack/_packer.pyx":218
3335 * raise ValueError("unicode string is too large")
3336 * ret = msgpack_pack_raw(&self.pk, L)
3337 * if ret == 0: # <<<<<<<<<<<<<<
3338 * rawval = o
3339 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3340 */
3341 __pyx_t_12 = ((__pyx_v_ret == 0) != 0);
3342 if (__pyx_t_12) {
3343
3344 /* "msgpack/_packer.pyx":219
3345 * ret = msgpack_pack_raw(&self.pk, L)
3346 * if ret == 0:
3347 * rawval = o # <<<<<<<<<<<<<<
3348 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3349 * elif PyDict_CheckExact(o):
3350 */
3351 __pyx_t_28 = __Pyx_PyObject_AsWritableString(__pyx_v_o); if (unlikely((!__pyx_t_28) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error)
3352 __pyx_v_rawval = __pyx_t_28;
3353
3354 /* "msgpack/_packer.pyx":220
3355 * if ret == 0:
3356 * rawval = o
3357 * ret = msgpack_pack_raw_body(&self.pk, rawval, L) # <<<<<<<<<<<<<<
3358 * elif PyDict_CheckExact(o):
3359 * d = <dict>o
3360 */
3361 __pyx_v_ret = msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_v_rawval, __pyx_v_L);
3362
3363 /* "msgpack/_packer.pyx":218
3364 * raise ValueError("unicode string is too large")
3365 * ret = msgpack_pack_raw(&self.pk, L)
3366 * if ret == 0: # <<<<<<<<<<<<<<
3367 * rawval = o
3368 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3369 */
3370 }
3371 }
3372 __pyx_L33:;
3373
3374 /* "msgpack/_packer.pyx":207
3375 * if ret == 0:
3376 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3377 * elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o): # <<<<<<<<<<<<<<
3378 * if self.unicode_errors == NULL:
3379 * ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3380 */
3381 goto __pyx_L6;
3382 }
3383
3384 /* "msgpack/_packer.pyx":221
3385 * rawval = o
3386 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3387 * elif PyDict_CheckExact(o): # <<<<<<<<<<<<<<
3388 * d = <dict>o
3389 * L = len(d)
3390 */
3391 __pyx_t_12 = (PyDict_CheckExact(__pyx_v_o) != 0);
3392 if (__pyx_t_12) {
3393
3394 /* "msgpack/_packer.pyx":222
3395 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3396 * elif PyDict_CheckExact(o):
3397 * d = <dict>o # <<<<<<<<<<<<<<
3398 * L = len(d)
3399 * if L > ITEM_LIMIT:
3400 */
3401 __pyx_t_11 = __pyx_v_o;
3402 __Pyx_INCREF(__pyx_t_11);
3403 __pyx_v_d = ((PyObject*)__pyx_t_11);
3404 __pyx_t_11 = 0;
3405
3406 /* "msgpack/_packer.pyx":223
3407 * elif PyDict_CheckExact(o):
3408 * d = <dict>o
3409 * L = len(d) # <<<<<<<<<<<<<<
3410 * if L > ITEM_LIMIT:
3411 * raise ValueError("dict is too large")
3412 */
3413 if (unlikely(__pyx_v_d == Py_None)) {
3414 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
3415 __PYX_ERR(0, 223, __pyx_L1_error)
3416 }
3417 __pyx_t_29 = PyDict_Size(__pyx_v_d); if (unlikely(__pyx_t_29 == ((Py_ssize_t)-1))) __PYX_ERR(0, 223, __pyx_L1_error)
3418 __pyx_v_L = __pyx_t_29;
3419
3420 /* "msgpack/_packer.pyx":224
3421 * d = <dict>o
3422 * L = len(d)
3423 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3424 * raise ValueError("dict is too large")
3425 * ret = msgpack_pack_map(&self.pk, L)
3426 */
3427 __pyx_t_12 = ((__pyx_v_L > __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT) != 0);
3428 if (unlikely(__pyx_t_12)) {
3429
3430 /* "msgpack/_packer.pyx":225
3431 * L = len(d)
3432 * if L > ITEM_LIMIT:
3433 * raise ValueError("dict is too large") # <<<<<<<<<<<<<<
3434 * ret = msgpack_pack_map(&self.pk, L)
3435 * if ret == 0:
3436 */
3437 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 225, __pyx_L1_error)
3438 __Pyx_GOTREF(__pyx_t_11);
3439 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
3440 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3441 __PYX_ERR(0, 225, __pyx_L1_error)
3442
3443 /* "msgpack/_packer.pyx":224
3444 * d = <dict>o
3445 * L = len(d)
3446 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3447 * raise ValueError("dict is too large")
3448 * ret = msgpack_pack_map(&self.pk, L)
3449 */
3450 }
3451
3452 /* "msgpack/_packer.pyx":226
3453 * if L > ITEM_LIMIT:
3454 * raise ValueError("dict is too large")
3455 * ret = msgpack_pack_map(&self.pk, L) # <<<<<<<<<<<<<<
3456 * if ret == 0:
3457 * for k, v in d.items():
3458 */
3459 __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->pk), __pyx_v_L);
3460
3461 /* "msgpack/_packer.pyx":227
3462 * raise ValueError("dict is too large")
3463 * ret = msgpack_pack_map(&self.pk, L)
3464 * if ret == 0: # <<<<<<<<<<<<<<
3465 * for k, v in d.items():
3466 * ret = self._pack(k, nest_limit-1)
3467 */
3468 __pyx_t_12 = ((__pyx_v_ret == 0) != 0);
3469 if (__pyx_t_12) {
3470
3471 /* "msgpack/_packer.pyx":228
3472 * ret = msgpack_pack_map(&self.pk, L)
3473 * if ret == 0:
3474 * for k, v in d.items(): # <<<<<<<<<<<<<<
3475 * ret = self._pack(k, nest_limit-1)
3476 * if ret != 0: break
3477 */
3478 __pyx_t_29 = 0;
3479 if (unlikely(__pyx_v_d == Py_None)) {
3480 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
3481 __PYX_ERR(0, 228, __pyx_L1_error)
3482 }
3483 __pyx_t_10 = __Pyx_dict_iterator(__pyx_v_d, 1, __pyx_n_s_items, (&__pyx_t_30), (&__pyx_t_16)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 228, __pyx_L1_error)
3484 __Pyx_GOTREF(__pyx_t_10);
3485 __Pyx_XDECREF(__pyx_t_11);
3486 __pyx_t_11 = __pyx_t_10;
3487 __pyx_t_10 = 0;
3488 while (1) {
3489 __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_11, __pyx_t_30, &__pyx_t_29, &__pyx_t_10, &__pyx_t_2, NULL, __pyx_t_16);
3490 if (unlikely(__pyx_t_9 == 0)) break;
3491 if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 228, __pyx_L1_error)
3492 __Pyx_GOTREF(__pyx_t_10);
3493 __Pyx_GOTREF(__pyx_t_2);
3494 __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_10);
3495 __pyx_t_10 = 0;
3496 __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_2);
3497 __pyx_t_2 = 0;
3498
3499 /* "msgpack/_packer.pyx":229
3500 * if ret == 0:
3501 * for k, v in d.items():
3502 * ret = self._pack(k, nest_limit-1) # <<<<<<<<<<<<<<
3503 * if ret != 0: break
3504 * ret = self._pack(v, nest_limit-1)
3505 */
3506 __pyx_t_31.__pyx_n = 1;
3507 __pyx_t_31.nest_limit = (__pyx_v_nest_limit - 1);
3508 __pyx_t_9 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_k, &__pyx_t_31); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 229, __pyx_L1_error)
3509 __pyx_v_ret = __pyx_t_9;
3510
3511 /* "msgpack/_packer.pyx":230
3512 * for k, v in d.items():
3513 * ret = self._pack(k, nest_limit-1)
3514 * if ret != 0: break # <<<<<<<<<<<<<<
3515 * ret = self._pack(v, nest_limit-1)
3516 * if ret != 0: break
3517 */
3518 __pyx_t_12 = ((__pyx_v_ret != 0) != 0);
3519 if (__pyx_t_12) {
3520 goto __pyx_L40_break;
3521 }
3522
3523 /* "msgpack/_packer.pyx":231
3524 * ret = self._pack(k, nest_limit-1)
3525 * if ret != 0: break
3526 * ret = self._pack(v, nest_limit-1) # <<<<<<<<<<<<<<
3527 * if ret != 0: break
3528 * elif not strict_types and PyDict_Check(o):
3529 */
3530 __pyx_t_31.__pyx_n = 1;
3531 __pyx_t_31.nest_limit = (__pyx_v_nest_limit - 1);
3532 __pyx_t_9 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_v, &__pyx_t_31); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 231, __pyx_L1_error)
3533 __pyx_v_ret = __pyx_t_9;
3534
3535 /* "msgpack/_packer.pyx":232
3536 * if ret != 0: break
3537 * ret = self._pack(v, nest_limit-1)
3538 * if ret != 0: break # <<<<<<<<<<<<<<
3539 * elif not strict_types and PyDict_Check(o):
3540 * L = len(o)
3541 */
3542 __pyx_t_12 = ((__pyx_v_ret != 0) != 0);
3543 if (__pyx_t_12) {
3544 goto __pyx_L40_break;
3545 }
3546 }
3547 __pyx_L40_break:;
3548 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3549
3550 /* "msgpack/_packer.pyx":227
3551 * raise ValueError("dict is too large")
3552 * ret = msgpack_pack_map(&self.pk, L)
3553 * if ret == 0: # <<<<<<<<<<<<<<
3554 * for k, v in d.items():
3555 * ret = self._pack(k, nest_limit-1)
3556 */
3557 }
3558
3559 /* "msgpack/_packer.pyx":221
3560 * rawval = o
3561 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3562 * elif PyDict_CheckExact(o): # <<<<<<<<<<<<<<
3563 * d = <dict>o
3564 * L = len(d)
3565 */
3566 goto __pyx_L6;
3567 }
3568
3569 /* "msgpack/_packer.pyx":233
3570 * ret = self._pack(v, nest_limit-1)
3571 * if ret != 0: break
3572 * elif not strict_types and PyDict_Check(o): # <<<<<<<<<<<<<<
3573 * L = len(o)
3574 * if L > ITEM_LIMIT:
3575 */
3576 __pyx_t_1 = ((!(__pyx_v_strict_types != 0)) != 0);
3577 if (__pyx_t_1) {
3578 } else {
3579 __pyx_t_12 = __pyx_t_1;
3580 goto __pyx_L43_bool_binop_done;
3581 }
3582 __pyx_t_1 = (PyDict_Check(__pyx_v_o) != 0);
3583 __pyx_t_12 = __pyx_t_1;
3584 __pyx_L43_bool_binop_done:;
3585 if (__pyx_t_12) {
3586
3587 /* "msgpack/_packer.pyx":234
3588 * if ret != 0: break
3589 * elif not strict_types and PyDict_Check(o):
3590 * L = len(o) # <<<<<<<<<<<<<<
3591 * if L > ITEM_LIMIT:
3592 * raise ValueError("dict is too large")
3593 */
3594 __pyx_t_30 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_30 == ((Py_ssize_t)-1))) __PYX_ERR(0, 234, __pyx_L1_error)
3595 __pyx_v_L = __pyx_t_30;
3596
3597 /* "msgpack/_packer.pyx":235
3598 * elif not strict_types and PyDict_Check(o):
3599 * L = len(o)
3600 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3601 * raise ValueError("dict is too large")
3602 * ret = msgpack_pack_map(&self.pk, L)
3603 */
3604 __pyx_t_12 = ((__pyx_v_L > __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT) != 0);
3605 if (unlikely(__pyx_t_12)) {
3606
3607 /* "msgpack/_packer.pyx":236
3608 * L = len(o)
3609 * if L > ITEM_LIMIT:
3610 * raise ValueError("dict is too large") # <<<<<<<<<<<<<<
3611 * ret = msgpack_pack_map(&self.pk, L)
3612 * if ret == 0:
3613 */
3614 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 236, __pyx_L1_error)
3615 __Pyx_GOTREF(__pyx_t_11);
3616 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
3617 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3618 __PYX_ERR(0, 236, __pyx_L1_error)
3619
3620 /* "msgpack/_packer.pyx":235
3621 * elif not strict_types and PyDict_Check(o):
3622 * L = len(o)
3623 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3624 * raise ValueError("dict is too large")
3625 * ret = msgpack_pack_map(&self.pk, L)
3626 */
3627 }
3628
3629 /* "msgpack/_packer.pyx":237
3630 * if L > ITEM_LIMIT:
3631 * raise ValueError("dict is too large")
3632 * ret = msgpack_pack_map(&self.pk, L) # <<<<<<<<<<<<<<
3633 * if ret == 0:
3634 * for k, v in o.items():
3635 */
3636 __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->pk), __pyx_v_L);
3637
3638 /* "msgpack/_packer.pyx":238
3639 * raise ValueError("dict is too large")
3640 * ret = msgpack_pack_map(&self.pk, L)
3641 * if ret == 0: # <<<<<<<<<<<<<<
3642 * for k, v in o.items():
3643 * ret = self._pack(k, nest_limit-1)
3644 */
3645 __pyx_t_12 = ((__pyx_v_ret == 0) != 0);
3646 if (__pyx_t_12) {
3647
3648 /* "msgpack/_packer.pyx":239
3649 * ret = msgpack_pack_map(&self.pk, L)
3650 * if ret == 0:
3651 * for k, v in o.items(): # <<<<<<<<<<<<<<
3652 * ret = self._pack(k, nest_limit-1)
3653 * if ret != 0: break
3654 */
3655 __pyx_t_30 = 0;
3656 if (unlikely(__pyx_v_o == Py_None)) {
3657 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
3658 __PYX_ERR(0, 239, __pyx_L1_error)
3659 }
3660 __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_o, 0, __pyx_n_s_items, (&__pyx_t_29), (&__pyx_t_16)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
3661 __Pyx_GOTREF(__pyx_t_2);
3662 __Pyx_XDECREF(__pyx_t_11);
3663 __pyx_t_11 = __pyx_t_2;
3664 __pyx_t_2 = 0;
3665 while (1) {
3666 __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_11, __pyx_t_29, &__pyx_t_30, &__pyx_t_2, &__pyx_t_10, NULL, __pyx_t_16);
3667 if (unlikely(__pyx_t_9 == 0)) break;
3668 if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 239, __pyx_L1_error)
3669 __Pyx_GOTREF(__pyx_t_2);
3670 __Pyx_GOTREF(__pyx_t_10);
3671 __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_2);
3672 __pyx_t_2 = 0;
3673 __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_10);
3674 __pyx_t_10 = 0;
3675
3676 /* "msgpack/_packer.pyx":240
3677 * if ret == 0:
3678 * for k, v in o.items():
3679 * ret = self._pack(k, nest_limit-1) # <<<<<<<<<<<<<<
3680 * if ret != 0: break
3681 * ret = self._pack(v, nest_limit-1)
3682 */
3683 __pyx_t_31.__pyx_n = 1;
3684 __pyx_t_31.nest_limit = (__pyx_v_nest_limit - 1);
3685 __pyx_t_9 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_k, &__pyx_t_31); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 240, __pyx_L1_error)
3686 __pyx_v_ret = __pyx_t_9;
3687
3688 /* "msgpack/_packer.pyx":241
3689 * for k, v in o.items():
3690 * ret = self._pack(k, nest_limit-1)
3691 * if ret != 0: break # <<<<<<<<<<<<<<
3692 * ret = self._pack(v, nest_limit-1)
3693 * if ret != 0: break
3694 */
3695 __pyx_t_12 = ((__pyx_v_ret != 0) != 0);
3696 if (__pyx_t_12) {
3697 goto __pyx_L48_break;
3698 }
3699
3700 /* "msgpack/_packer.pyx":242
3701 * ret = self._pack(k, nest_limit-1)
3702 * if ret != 0: break
3703 * ret = self._pack(v, nest_limit-1) # <<<<<<<<<<<<<<
3704 * if ret != 0: break
3705 * elif type(o) is ExtType if strict_types else isinstance(o, ExtType):
3706 */
3707 __pyx_t_31.__pyx_n = 1;
3708 __pyx_t_31.nest_limit = (__pyx_v_nest_limit - 1);
3709 __pyx_t_9 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_v, &__pyx_t_31); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 242, __pyx_L1_error)
3710 __pyx_v_ret = __pyx_t_9;
3711
3712 /* "msgpack/_packer.pyx":243
3713 * if ret != 0: break
3714 * ret = self._pack(v, nest_limit-1)
3715 * if ret != 0: break # <<<<<<<<<<<<<<
3716 * elif type(o) is ExtType if strict_types else isinstance(o, ExtType):
3717 * # This should be before Tuple because ExtType is namedtuple.
3718 */
3719 __pyx_t_12 = ((__pyx_v_ret != 0) != 0);
3720 if (__pyx_t_12) {
3721 goto __pyx_L48_break;
3722 }
3723 }
3724 __pyx_L48_break:;
3725 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3726
3727 /* "msgpack/_packer.pyx":238
3728 * raise ValueError("dict is too large")
3729 * ret = msgpack_pack_map(&self.pk, L)
3730 * if ret == 0: # <<<<<<<<<<<<<<
3731 * for k, v in o.items():
3732 * ret = self._pack(k, nest_limit-1)
3733 */
3734 }
3735
3736 /* "msgpack/_packer.pyx":233
3737 * ret = self._pack(v, nest_limit-1)
3738 * if ret != 0: break
3739 * elif not strict_types and PyDict_Check(o): # <<<<<<<<<<<<<<
3740 * L = len(o)
3741 * if L > ITEM_LIMIT:
3742 */
3743 goto __pyx_L6;
3744 }
3745
3746 /* "msgpack/_packer.pyx":244
3747 * ret = self._pack(v, nest_limit-1)
3748 * if ret != 0: break
3749 * elif type(o) is ExtType if strict_types else isinstance(o, ExtType): # <<<<<<<<<<<<<<
3750 * # This should be before Tuple because ExtType is namedtuple.
3751 * longval = o.code
3752 */
3753 if ((__pyx_v_strict_types != 0)) {
3754 __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), __pyx_v_o); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 244, __pyx_L1_error)
3755 __Pyx_GOTREF(__pyx_t_11);
3756 __pyx_t_1 = (__pyx_t_11 == __pyx_v_7msgpack_9_cmsgpack_ExtType);
3757 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3758 __pyx_t_12 = __pyx_t_1;
3759 } else {
3760 __pyx_t_11 = __pyx_v_7msgpack_9_cmsgpack_ExtType;
3761 __Pyx_INCREF(__pyx_t_11);
3762 __pyx_t_1 = PyObject_IsInstance(__pyx_v_o, __pyx_t_11); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 244, __pyx_L1_error)
3763 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3764 __pyx_t_12 = __pyx_t_1;
3765 }
3766 __pyx_t_1 = (__pyx_t_12 != 0);
3767 if (__pyx_t_1) {
3768
3769 /* "msgpack/_packer.pyx":246
3770 * elif type(o) is ExtType if strict_types else isinstance(o, ExtType):
3771 * # This should be before Tuple because ExtType is namedtuple.
3772 * longval = o.code # <<<<<<<<<<<<<<
3773 * rawval = o.data
3774 * L = len(o.data)
3775 */
3776 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_code); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 246, __pyx_L1_error)
3777 __Pyx_GOTREF(__pyx_t_11);
3778 __pyx_t_24 = __Pyx_PyInt_As_long(__pyx_t_11); if (unlikely((__pyx_t_24 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 246, __pyx_L1_error)
3779 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3780 __pyx_v_longval = __pyx_t_24;
3781
3782 /* "msgpack/_packer.pyx":247
3783 * # This should be before Tuple because ExtType is namedtuple.
3784 * longval = o.code
3785 * rawval = o.data # <<<<<<<<<<<<<<
3786 * L = len(o.data)
3787 * if L > ITEM_LIMIT:
3788 */
3789 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_data); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 247, __pyx_L1_error)
3790 __Pyx_GOTREF(__pyx_t_11);
3791 __pyx_t_28 = __Pyx_PyObject_AsWritableString(__pyx_t_11); if (unlikely((!__pyx_t_28) && PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error)
3792 __pyx_v_rawval = __pyx_t_28;
3793 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3794
3795 /* "msgpack/_packer.pyx":248
3796 * longval = o.code
3797 * rawval = o.data
3798 * L = len(o.data) # <<<<<<<<<<<<<<
3799 * if L > ITEM_LIMIT:
3800 * raise ValueError("EXT data is too large")
3801 */
3802 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_data); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 248, __pyx_L1_error)
3803 __Pyx_GOTREF(__pyx_t_11);
3804 __pyx_t_29 = PyObject_Length(__pyx_t_11); if (unlikely(__pyx_t_29 == ((Py_ssize_t)-1))) __PYX_ERR(0, 248, __pyx_L1_error)
3805 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3806 __pyx_v_L = __pyx_t_29;
3807
3808 /* "msgpack/_packer.pyx":249
3809 * rawval = o.data
3810 * L = len(o.data)
3811 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3812 * raise ValueError("EXT data is too large")
3813 * ret = msgpack_pack_ext(&self.pk, longval, L)
3814 */
3815 __pyx_t_1 = ((__pyx_v_L > __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT) != 0);
3816 if (unlikely(__pyx_t_1)) {
3817
3818 /* "msgpack/_packer.pyx":250
3819 * L = len(o.data)
3820 * if L > ITEM_LIMIT:
3821 * raise ValueError("EXT data is too large") # <<<<<<<<<<<<<<
3822 * ret = msgpack_pack_ext(&self.pk, longval, L)
3823 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3824 */
3825 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 250, __pyx_L1_error)
3826 __Pyx_GOTREF(__pyx_t_11);
3827 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
3828 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3829 __PYX_ERR(0, 250, __pyx_L1_error)
3830
3831 /* "msgpack/_packer.pyx":249
3832 * rawval = o.data
3833 * L = len(o.data)
3834 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3835 * raise ValueError("EXT data is too large")
3836 * ret = msgpack_pack_ext(&self.pk, longval, L)
3837 */
3838 }
3839
3840 /* "msgpack/_packer.pyx":251
3841 * if L > ITEM_LIMIT:
3842 * raise ValueError("EXT data is too large")
3843 * ret = msgpack_pack_ext(&self.pk, longval, L) # <<<<<<<<<<<<<<
3844 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3845 * elif type(o) is Timestamp:
3846 */
3847 __pyx_v_ret = msgpack_pack_ext((&__pyx_v_self->pk), __pyx_v_longval, __pyx_v_L);
3848
3849 /* "msgpack/_packer.pyx":252
3850 * raise ValueError("EXT data is too large")
3851 * ret = msgpack_pack_ext(&self.pk, longval, L)
3852 * ret = msgpack_pack_raw_body(&self.pk, rawval, L) # <<<<<<<<<<<<<<
3853 * elif type(o) is Timestamp:
3854 * llval = o.seconds
3855 */
3856 __pyx_v_ret = msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_v_rawval, __pyx_v_L);
3857
3858 /* "msgpack/_packer.pyx":244
3859 * ret = self._pack(v, nest_limit-1)
3860 * if ret != 0: break
3861 * elif type(o) is ExtType if strict_types else isinstance(o, ExtType): # <<<<<<<<<<<<<<
3862 * # This should be before Tuple because ExtType is namedtuple.
3863 * longval = o.code
3864 */
3865 goto __pyx_L6;
3866 }
3867
3868 /* "msgpack/_packer.pyx":253
3869 * ret = msgpack_pack_ext(&self.pk, longval, L)
3870 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3871 * elif type(o) is Timestamp: # <<<<<<<<<<<<<<
3872 * llval = o.seconds
3873 * ulval = o.nanoseconds
3874 */
3875 __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), __pyx_v_o); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 253, __pyx_L1_error)
3876 __Pyx_GOTREF(__pyx_t_11);
3877 __pyx_t_1 = (__pyx_t_11 == __pyx_v_7msgpack_9_cmsgpack_Timestamp);
3878 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3879 __pyx_t_12 = (__pyx_t_1 != 0);
3880 if (__pyx_t_12) {
3881
3882 /* "msgpack/_packer.pyx":254
3883 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3884 * elif type(o) is Timestamp:
3885 * llval = o.seconds # <<<<<<<<<<<<<<
3886 * ulval = o.nanoseconds
3887 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval)
3888 */
3889 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_seconds); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 254, __pyx_L1_error)
3890 __Pyx_GOTREF(__pyx_t_11);
3891 __pyx_t_8 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_11); if (unlikely((__pyx_t_8 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 254, __pyx_L1_error)
3892 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3893 __pyx_v_llval = __pyx_t_8;
3894
3895 /* "msgpack/_packer.pyx":255
3896 * elif type(o) is Timestamp:
3897 * llval = o.seconds
3898 * ulval = o.nanoseconds # <<<<<<<<<<<<<<
3899 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval)
3900 * elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
3901 */
3902 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_nanoseconds); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 255, __pyx_L1_error)
3903 __Pyx_GOTREF(__pyx_t_11);
3904 __pyx_t_32 = __Pyx_PyInt_As_unsigned_long(__pyx_t_11); if (unlikely((__pyx_t_32 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L1_error)
3905 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3906 __pyx_v_ulval = __pyx_t_32;
3907
3908 /* "msgpack/_packer.pyx":256
3909 * llval = o.seconds
3910 * ulval = o.nanoseconds
3911 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval) # <<<<<<<<<<<<<<
3912 * elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
3913 * L = Py_SIZE(o)
3914 */
3915 __pyx_v_ret = msgpack_pack_timestamp((&__pyx_v_self->pk), __pyx_v_llval, __pyx_v_ulval);
3916
3917 /* "msgpack/_packer.pyx":253
3918 * ret = msgpack_pack_ext(&self.pk, longval, L)
3919 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3920 * elif type(o) is Timestamp: # <<<<<<<<<<<<<<
3921 * llval = o.seconds
3922 * ulval = o.nanoseconds
3923 */
3924 goto __pyx_L6;
3925 }
3926
3927 /* "msgpack/_packer.pyx":257
3928 * ulval = o.nanoseconds
3929 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval)
3930 * elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)): # <<<<<<<<<<<<<<
3931 * L = Py_SIZE(o)
3932 * if L > ITEM_LIMIT:
3933 */
3934 if ((__pyx_v_strict_types != 0)) {
3935 __pyx_t_12 = PyList_CheckExact(__pyx_v_o);
3936 } else {
3937 __pyx_t_3 = PyTuple_Check(__pyx_v_o);
3938 if (!__pyx_t_3) {
3939 } else {
3940 __pyx_t_1 = __pyx_t_3;
3941 goto __pyx_L52_bool_binop_done;
3942 }
3943 __pyx_t_3 = PyList_Check(__pyx_v_o);
3944 __pyx_t_1 = __pyx_t_3;
3945 __pyx_L52_bool_binop_done:;
3946 __pyx_t_12 = __pyx_t_1;
3947 }
3948 __pyx_t_1 = (__pyx_t_12 != 0);
3949 if (__pyx_t_1) {
3950
3951 /* "msgpack/_packer.pyx":258
3952 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval)
3953 * elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
3954 * L = Py_SIZE(o) # <<<<<<<<<<<<<<
3955 * if L > ITEM_LIMIT:
3956 * raise ValueError("list is too large")
3957 */
3958 __pyx_v_L = Py_SIZE(__pyx_v_o);
3959
3960 /* "msgpack/_packer.pyx":259
3961 * elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
3962 * L = Py_SIZE(o)
3963 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3964 * raise ValueError("list is too large")
3965 * ret = msgpack_pack_array(&self.pk, L)
3966 */
3967 __pyx_t_1 = ((__pyx_v_L > __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT) != 0);
3968 if (unlikely(__pyx_t_1)) {
3969
3970 /* "msgpack/_packer.pyx":260
3971 * L = Py_SIZE(o)
3972 * if L > ITEM_LIMIT:
3973 * raise ValueError("list is too large") # <<<<<<<<<<<<<<
3974 * ret = msgpack_pack_array(&self.pk, L)
3975 * if ret == 0:
3976 */
3977 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 260, __pyx_L1_error)
3978 __Pyx_GOTREF(__pyx_t_11);
3979 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
3980 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3981 __PYX_ERR(0, 260, __pyx_L1_error)
3982
3983 /* "msgpack/_packer.pyx":259
3984 * elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
3985 * L = Py_SIZE(o)
3986 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
3987 * raise ValueError("list is too large")
3988 * ret = msgpack_pack_array(&self.pk, L)
3989 */
3990 }
3991
3992 /* "msgpack/_packer.pyx":261
3993 * if L > ITEM_LIMIT:
3994 * raise ValueError("list is too large")
3995 * ret = msgpack_pack_array(&self.pk, L) # <<<<<<<<<<<<<<
3996 * if ret == 0:
3997 * for v in o:
3998 */
3999 __pyx_v_ret = msgpack_pack_array((&__pyx_v_self->pk), __pyx_v_L);
4000
4001 /* "msgpack/_packer.pyx":262
4002 * raise ValueError("list is too large")
4003 * ret = msgpack_pack_array(&self.pk, L)
4004 * if ret == 0: # <<<<<<<<<<<<<<
4005 * for v in o:
4006 * ret = self._pack(v, nest_limit-1)
4007 */
4008 __pyx_t_1 = ((__pyx_v_ret == 0) != 0);
4009 if (__pyx_t_1) {
4010
4011 /* "msgpack/_packer.pyx":263
4012 * ret = msgpack_pack_array(&self.pk, L)
4013 * if ret == 0:
4014 * for v in o: # <<<<<<<<<<<<<<
4015 * ret = self._pack(v, nest_limit-1)
4016 * if ret != 0: break
4017 */
4018 if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
4019 __pyx_t_11 = __pyx_v_o; __Pyx_INCREF(__pyx_t_11); __pyx_t_29 = 0;
4020 __pyx_t_33 = NULL;
4021 } else {
4022 __pyx_t_29 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 263, __pyx_L1_error)
4023 __Pyx_GOTREF(__pyx_t_11);
4024 __pyx_t_33 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 263, __pyx_L1_error)
4025 }
4026 for (;;) {
4027 if (likely(!__pyx_t_33)) {
4028 if (likely(PyList_CheckExact(__pyx_t_11))) {
4029 if (__pyx_t_29 >= PyList_GET_SIZE(__pyx_t_11)) break;
4030 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4031 __pyx_t_10 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_29); __Pyx_INCREF(__pyx_t_10); __pyx_t_29++; if (unlikely(0 < 0)) __PYX_ERR(0, 263, __pyx_L1_error)
4032 #else
4033 __pyx_t_10 = PySequence_ITEM(__pyx_t_11, __pyx_t_29); __pyx_t_29++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 263, __pyx_L1_error)
4034 __Pyx_GOTREF(__pyx_t_10);
4035 #endif
4036 } else {
4037 if (__pyx_t_29 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
4038 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4039 __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_29); __Pyx_INCREF(__pyx_t_10); __pyx_t_29++; if (unlikely(0 < 0)) __PYX_ERR(0, 263, __pyx_L1_error)
4040 #else
4041 __pyx_t_10 = PySequence_ITEM(__pyx_t_11, __pyx_t_29); __pyx_t_29++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 263, __pyx_L1_error)
4042 __Pyx_GOTREF(__pyx_t_10);
4043 #endif
4044 }
4045 } else {
4046 __pyx_t_10 = __pyx_t_33(__pyx_t_11);
4047 if (unlikely(!__pyx_t_10)) {
4048 PyObject* exc_type = PyErr_Occurred();
4049 if (exc_type) {
4050 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4051 else __PYX_ERR(0, 263, __pyx_L1_error)
4052 }
4053 break;
4054 }
4055 __Pyx_GOTREF(__pyx_t_10);
4056 }
4057 __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_10);
4058 __pyx_t_10 = 0;
4059
4060 /* "msgpack/_packer.pyx":264
4061 * if ret == 0:
4062 * for v in o:
4063 * ret = self._pack(v, nest_limit-1) # <<<<<<<<<<<<<<
4064 * if ret != 0: break
4065 * elif PyMemoryView_Check(o):
4066 */
4067 __pyx_t_31.__pyx_n = 1;
4068 __pyx_t_31.nest_limit = (__pyx_v_nest_limit - 1);
4069 __pyx_t_16 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_v, &__pyx_t_31); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 264, __pyx_L1_error)
4070 __pyx_v_ret = __pyx_t_16;
4071
4072 /* "msgpack/_packer.pyx":265
4073 * for v in o:
4074 * ret = self._pack(v, nest_limit-1)
4075 * if ret != 0: break # <<<<<<<<<<<<<<
4076 * elif PyMemoryView_Check(o):
4077 * if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:
4078 */
4079 __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
4080 if (__pyx_t_1) {
4081 goto __pyx_L57_break;
4082 }
4083
4084 /* "msgpack/_packer.pyx":263
4085 * ret = msgpack_pack_array(&self.pk, L)
4086 * if ret == 0:
4087 * for v in o: # <<<<<<<<<<<<<<
4088 * ret = self._pack(v, nest_limit-1)
4089 * if ret != 0: break
4090 */
4091 }
4092 __pyx_L57_break:;
4093 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4094
4095 /* "msgpack/_packer.pyx":262
4096 * raise ValueError("list is too large")
4097 * ret = msgpack_pack_array(&self.pk, L)
4098 * if ret == 0: # <<<<<<<<<<<<<<
4099 * for v in o:
4100 * ret = self._pack(v, nest_limit-1)
4101 */
4102 }
4103
4104 /* "msgpack/_packer.pyx":257
4105 * ulval = o.nanoseconds
4106 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval)
4107 * elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)): # <<<<<<<<<<<<<<
4108 * L = Py_SIZE(o)
4109 * if L > ITEM_LIMIT:
4110 */
4111 goto __pyx_L6;
4112 }
4113
4114 /* "msgpack/_packer.pyx":266
4115 * ret = self._pack(v, nest_limit-1)
4116 * if ret != 0: break
4117 * elif PyMemoryView_Check(o): # <<<<<<<<<<<<<<
4118 * if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:
4119 * raise ValueError("could not get buffer for memoryview")
4120 */
4121 __pyx_t_1 = (PyMemoryView_Check(__pyx_v_o) != 0);
4122 if (__pyx_t_1) {
4123
4124 /* "msgpack/_packer.pyx":267
4125 * if ret != 0: break
4126 * elif PyMemoryView_Check(o):
4127 * if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0: # <<<<<<<<<<<<<<
4128 * raise ValueError("could not get buffer for memoryview")
4129 * L = view.len
4130 */
4131 __pyx_t_16 = PyObject_GetBuffer(__pyx_v_o, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 267, __pyx_L1_error)
4132 __pyx_t_1 = ((__pyx_t_16 != 0) != 0);
4133 if (unlikely(__pyx_t_1)) {
4134
4135 /* "msgpack/_packer.pyx":268
4136 * elif PyMemoryView_Check(o):
4137 * if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:
4138 * raise ValueError("could not get buffer for memoryview") # <<<<<<<<<<<<<<
4139 * L = view.len
4140 * if L > ITEM_LIMIT:
4141 */
4142 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 268, __pyx_L1_error)
4143 __Pyx_GOTREF(__pyx_t_11);
4144 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
4145 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4146 __PYX_ERR(0, 268, __pyx_L1_error)
4147
4148 /* "msgpack/_packer.pyx":267
4149 * if ret != 0: break
4150 * elif PyMemoryView_Check(o):
4151 * if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0: # <<<<<<<<<<<<<<
4152 * raise ValueError("could not get buffer for memoryview")
4153 * L = view.len
4154 */
4155 }
4156
4157 /* "msgpack/_packer.pyx":269
4158 * if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:
4159 * raise ValueError("could not get buffer for memoryview")
4160 * L = view.len # <<<<<<<<<<<<<<
4161 * if L > ITEM_LIMIT:
4162 * PyBuffer_Release(&view);
4163 */
4164 __pyx_t_29 = __pyx_v_view.len;
4165 __pyx_v_L = __pyx_t_29;
4166
4167 /* "msgpack/_packer.pyx":270
4168 * raise ValueError("could not get buffer for memoryview")
4169 * L = view.len
4170 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
4171 * PyBuffer_Release(&view);
4172 * raise ValueError("memoryview is too large")
4173 */
4174 __pyx_t_1 = ((__pyx_v_L > __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT) != 0);
4175 if (unlikely(__pyx_t_1)) {
4176
4177 /* "msgpack/_packer.pyx":271
4178 * L = view.len
4179 * if L > ITEM_LIMIT:
4180 * PyBuffer_Release(&view); # <<<<<<<<<<<<<<
4181 * raise ValueError("memoryview is too large")
4182 * ret = msgpack_pack_bin(&self.pk, L)
4183 */
4184 PyBuffer_Release((&__pyx_v_view));
4185
4186 /* "msgpack/_packer.pyx":272
4187 * if L > ITEM_LIMIT:
4188 * PyBuffer_Release(&view);
4189 * raise ValueError("memoryview is too large") # <<<<<<<<<<<<<<
4190 * ret = msgpack_pack_bin(&self.pk, L)
4191 * if ret == 0:
4192 */
4193 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 272, __pyx_L1_error)
4194 __Pyx_GOTREF(__pyx_t_11);
4195 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
4196 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4197 __PYX_ERR(0, 272, __pyx_L1_error)
4198
4199 /* "msgpack/_packer.pyx":270
4200 * raise ValueError("could not get buffer for memoryview")
4201 * L = view.len
4202 * if L > ITEM_LIMIT: # <<<<<<<<<<<<<<
4203 * PyBuffer_Release(&view);
4204 * raise ValueError("memoryview is too large")
4205 */
4206 }
4207
4208 /* "msgpack/_packer.pyx":273
4209 * PyBuffer_Release(&view);
4210 * raise ValueError("memoryview is too large")
4211 * ret = msgpack_pack_bin(&self.pk, L) # <<<<<<<<<<<<<<
4212 * if ret == 0:
4213 * ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4214 */
4215 __pyx_v_ret = msgpack_pack_bin((&__pyx_v_self->pk), __pyx_v_L);
4216
4217 /* "msgpack/_packer.pyx":274
4218 * raise ValueError("memoryview is too large")
4219 * ret = msgpack_pack_bin(&self.pk, L)
4220 * if ret == 0: # <<<<<<<<<<<<<<
4221 * ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4222 * PyBuffer_Release(&view);
4223 */
4224 __pyx_t_1 = ((__pyx_v_ret == 0) != 0);
4225 if (__pyx_t_1) {
4226
4227 /* "msgpack/_packer.pyx":275
4228 * ret = msgpack_pack_bin(&self.pk, L)
4229 * if ret == 0:
4230 * ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L) # <<<<<<<<<<<<<<
4231 * PyBuffer_Release(&view);
4232 * elif self.datetime and PyDateTime_CheckExact(o) and datetime_tzinfo(o) is not None:
4233 */
4234 __pyx_v_ret = msgpack_pack_raw_body((&__pyx_v_self->pk), ((char *)__pyx_v_view.buf), __pyx_v_L);
4235
4236 /* "msgpack/_packer.pyx":274
4237 * raise ValueError("memoryview is too large")
4238 * ret = msgpack_pack_bin(&self.pk, L)
4239 * if ret == 0: # <<<<<<<<<<<<<<
4240 * ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4241 * PyBuffer_Release(&view);
4242 */
4243 }
4244
4245 /* "msgpack/_packer.pyx":276
4246 * if ret == 0:
4247 * ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4248 * PyBuffer_Release(&view); # <<<<<<<<<<<<<<
4249 * elif self.datetime and PyDateTime_CheckExact(o) and datetime_tzinfo(o) is not None:
4250 * delta = o - epoch
4251 */
4252 PyBuffer_Release((&__pyx_v_view));
4253
4254 /* "msgpack/_packer.pyx":266
4255 * ret = self._pack(v, nest_limit-1)
4256 * if ret != 0: break
4257 * elif PyMemoryView_Check(o): # <<<<<<<<<<<<<<
4258 * if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:
4259 * raise ValueError("could not get buffer for memoryview")
4260 */
4261 goto __pyx_L6;
4262 }
4263
4264 /* "msgpack/_packer.pyx":277
4265 * ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4266 * PyBuffer_Release(&view);
4267 * elif self.datetime and PyDateTime_CheckExact(o) and datetime_tzinfo(o) is not None: # <<<<<<<<<<<<<<
4268 * delta = o - epoch
4269 * if not PyDelta_CheckExact(delta):
4270 */
4271 __pyx_t_12 = (__pyx_v_self->datetime != 0);
4272 if (__pyx_t_12) {
4273 } else {
4274 __pyx_t_1 = __pyx_t_12;
4275 goto __pyx_L62_bool_binop_done;
4276 }
4277 __pyx_t_12 = (PyDateTime_CheckExact(__pyx_v_o) != 0);
4278 if (__pyx_t_12) {
4279 } else {
4280 __pyx_t_1 = __pyx_t_12;
4281 goto __pyx_L62_bool_binop_done;
4282 }
4283 __pyx_t_11 = __pyx_f_7cpython_8datetime_datetime_tzinfo(__pyx_v_o); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 277, __pyx_L1_error)
4284 __Pyx_GOTREF(__pyx_t_11);
4285 __pyx_t_12 = (__pyx_t_11 != Py_None);
4286 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4287 __pyx_t_3 = (__pyx_t_12 != 0);
4288 __pyx_t_1 = __pyx_t_3;
4289 __pyx_L62_bool_binop_done:;
4290 if (__pyx_t_1) {
4291
4292 /* "msgpack/_packer.pyx":278
4293 * PyBuffer_Release(&view);
4294 * elif self.datetime and PyDateTime_CheckExact(o) and datetime_tzinfo(o) is not None:
4295 * delta = o - epoch # <<<<<<<<<<<<<<
4296 * if not PyDelta_CheckExact(delta):
4297 * raise ValueError("failed to calculate delta")
4298 */
4299 __pyx_t_11 = PyNumber_Subtract(__pyx_v_o, __pyx_v_7msgpack_9_cmsgpack_epoch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 278, __pyx_L1_error)
4300 __Pyx_GOTREF(__pyx_t_11);
4301 __pyx_v_delta = __pyx_t_11;
4302 __pyx_t_11 = 0;
4303
4304 /* "msgpack/_packer.pyx":279
4305 * elif self.datetime and PyDateTime_CheckExact(o) and datetime_tzinfo(o) is not None:
4306 * delta = o - epoch
4307 * if not PyDelta_CheckExact(delta): # <<<<<<<<<<<<<<
4308 * raise ValueError("failed to calculate delta")
4309 * llval = timedelta_days(delta) * <long long>(24*60*60) + timedelta_seconds(delta)
4310 */
4311 __pyx_t_1 = ((!(PyDelta_CheckExact(__pyx_v_delta) != 0)) != 0);
4312 if (unlikely(__pyx_t_1)) {
4313
4314 /* "msgpack/_packer.pyx":280
4315 * delta = o - epoch
4316 * if not PyDelta_CheckExact(delta):
4317 * raise ValueError("failed to calculate delta") # <<<<<<<<<<<<<<
4318 * llval = timedelta_days(delta) * <long long>(24*60*60) + timedelta_seconds(delta)
4319 * ulval = timedelta_microseconds(delta) * 1000
4320 */
4321 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 280, __pyx_L1_error)
4322 __Pyx_GOTREF(__pyx_t_11);
4323 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
4324 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4325 __PYX_ERR(0, 280, __pyx_L1_error)
4326
4327 /* "msgpack/_packer.pyx":279
4328 * elif self.datetime and PyDateTime_CheckExact(o) and datetime_tzinfo(o) is not None:
4329 * delta = o - epoch
4330 * if not PyDelta_CheckExact(delta): # <<<<<<<<<<<<<<
4331 * raise ValueError("failed to calculate delta")
4332 * llval = timedelta_days(delta) * <long long>(24*60*60) + timedelta_seconds(delta)
4333 */
4334 }
4335
4336 /* "msgpack/_packer.pyx":281
4337 * if not PyDelta_CheckExact(delta):
4338 * raise ValueError("failed to calculate delta")
4339 * llval = timedelta_days(delta) * <long long>(24*60*60) + timedelta_seconds(delta) # <<<<<<<<<<<<<<
4340 * ulval = timedelta_microseconds(delta) * 1000
4341 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval)
4342 */
4343 __pyx_v_llval = ((__pyx_f_7cpython_8datetime_timedelta_days(__pyx_v_delta) * ((PY_LONG_LONG)0x15180)) + __pyx_f_7cpython_8datetime_timedelta_seconds(__pyx_v_delta));
4344
4345 /* "msgpack/_packer.pyx":282
4346 * raise ValueError("failed to calculate delta")
4347 * llval = timedelta_days(delta) * <long long>(24*60*60) + timedelta_seconds(delta)
4348 * ulval = timedelta_microseconds(delta) * 1000 # <<<<<<<<<<<<<<
4349 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval)
4350 * elif not default_used and self._default:
4351 */
4352 __pyx_v_ulval = (__pyx_f_7cpython_8datetime_timedelta_microseconds(__pyx_v_delta) * 0x3E8);
4353
4354 /* "msgpack/_packer.pyx":283
4355 * llval = timedelta_days(delta) * <long long>(24*60*60) + timedelta_seconds(delta)
4356 * ulval = timedelta_microseconds(delta) * 1000
4357 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval) # <<<<<<<<<<<<<<
4358 * elif not default_used and self._default:
4359 * o = self._default(o)
4360 */
4361 __pyx_v_ret = msgpack_pack_timestamp((&__pyx_v_self->pk), __pyx_v_llval, __pyx_v_ulval);
4362
4363 /* "msgpack/_packer.pyx":277
4364 * ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4365 * PyBuffer_Release(&view);
4366 * elif self.datetime and PyDateTime_CheckExact(o) and datetime_tzinfo(o) is not None: # <<<<<<<<<<<<<<
4367 * delta = o - epoch
4368 * if not PyDelta_CheckExact(delta):
4369 */
4370 goto __pyx_L6;
4371 }
4372
4373 /* "msgpack/_packer.pyx":284
4374 * ulval = timedelta_microseconds(delta) * 1000
4375 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval)
4376 * elif not default_used and self._default: # <<<<<<<<<<<<<<
4377 * o = self._default(o)
4378 * default_used = 1
4379 */
4380 __pyx_t_3 = ((!(__pyx_v_default_used != 0)) != 0);
4381 if (__pyx_t_3) {
4382 } else {
4383 __pyx_t_1 = __pyx_t_3;
4384 goto __pyx_L66_bool_binop_done;
4385 }
4386 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_self->_default); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 284, __pyx_L1_error)
4387 __pyx_t_1 = __pyx_t_3;
4388 __pyx_L66_bool_binop_done:;
4389 if (__pyx_t_1) {
4390
4391 /* "msgpack/_packer.pyx":285
4392 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval)
4393 * elif not default_used and self._default:
4394 * o = self._default(o) # <<<<<<<<<<<<<<
4395 * default_used = 1
4396 * continue
4397 */
4398 __Pyx_INCREF(__pyx_v_self->_default);
4399 __pyx_t_10 = __pyx_v_self->_default; __pyx_t_2 = NULL;
4400 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
4401 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
4402 if (likely(__pyx_t_2)) {
4403 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
4404 __Pyx_INCREF(__pyx_t_2);
4405 __Pyx_INCREF(function);
4406 __Pyx_DECREF_SET(__pyx_t_10, function);
4407 }
4408 }
4409 __pyx_t_11 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_2, __pyx_v_o) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_o);
4410 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4411 if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 285, __pyx_L1_error)
4412 __Pyx_GOTREF(__pyx_t_11);
4413 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4414 __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_11);
4415 __pyx_t_11 = 0;
4416
4417 /* "msgpack/_packer.pyx":286
4418 * elif not default_used and self._default:
4419 * o = self._default(o)
4420 * default_used = 1 # <<<<<<<<<<<<<<
4421 * continue
4422 * else:
4423 */
4424 __pyx_v_default_used = 1;
4425
4426 /* "msgpack/_packer.pyx":287
4427 * o = self._default(o)
4428 * default_used = 1
4429 * continue # <<<<<<<<<<<<<<
4430 * else:
4431 * PyErr_Format(TypeError, b"can not serialize '%.200s' object", Py_TYPE(o).tp_name)
4432 */
4433 goto __pyx_L4_continue;
4434
4435 /* "msgpack/_packer.pyx":284
4436 * ulval = timedelta_microseconds(delta) * 1000
4437 * ret = msgpack_pack_timestamp(&self.pk, llval, ulval)
4438 * elif not default_used and self._default: # <<<<<<<<<<<<<<
4439 * o = self._default(o)
4440 * default_used = 1
4441 */
4442 }
4443
4444 /* "msgpack/_packer.pyx":289
4445 * continue
4446 * else:
4447 * PyErr_Format(TypeError, b"can not serialize '%.200s' object", Py_TYPE(o).tp_name) # <<<<<<<<<<<<<<
4448 * return ret
4449 *
4450 */
4451 /*else*/ {
4452 __pyx_t_27 = PyErr_Format(__pyx_builtin_TypeError, ((char *)"can not serialize '%.200s' object"), Py_TYPE(__pyx_v_o)->tp_name); if (unlikely(__pyx_t_27 == ((PyObject *)NULL))) __PYX_ERR(0, 289, __pyx_L1_error)
4453 }
4454 __pyx_L6:;
4455
4456 /* "msgpack/_packer.pyx":290
4457 * else:
4458 * PyErr_Format(TypeError, b"can not serialize '%.200s' object", Py_TYPE(o).tp_name)
4459 * return ret # <<<<<<<<<<<<<<
4460 *
4461 * cpdef pack(self, object obj):
4462 */
4463 __pyx_r = __pyx_v_ret;
4464 goto __pyx_L0;
4465 __pyx_L4_continue:;
4466 }
4467
4468 /* "msgpack/_packer.pyx":147
4469 * self.pk.buf = NULL
4470 *
4471 * cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1: # <<<<<<<<<<<<<<
4472 * cdef long long llval
4473 * cdef unsigned long long ullval
4474 */
4475
4476 /* function exit code */
4477 __pyx_r = 0;
4478 goto __pyx_L0;
4479 __pyx_L1_error:;
4480 __Pyx_XDECREF(__pyx_t_2);
4481 __Pyx_XDECREF(__pyx_t_10);
4482 __Pyx_XDECREF(__pyx_t_11);
4483 __Pyx_XDECREF(__pyx_t_13);
4484 __Pyx_XDECREF(__pyx_t_14);
4485 __Pyx_XDECREF(__pyx_t_15);
4486 __Pyx_AddTraceback("msgpack._cmsgpack.Packer._pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
4487 __pyx_r = -1;
4488 __pyx_L0:;
4489 __Pyx_XDECREF(__pyx_v_d);
4490 __Pyx_XDECREF(__pyx_v_oe);
4491 __Pyx_XDECREF(__pyx_v_k);
4492 __Pyx_XDECREF(__pyx_v_v);
4493 __Pyx_XDECREF(__pyx_v_delta);
4494 __Pyx_XDECREF(__pyx_v_o);
4495 __Pyx_RefNannyFinishContext();
4496 return __pyx_r;
4497 }
4498
4499 /* "msgpack/_packer.pyx":292
4500 * return ret
4501 *
4502 * cpdef pack(self, object obj): # <<<<<<<<<<<<<<
4503 * cdef int ret
4504 * try:
4505 */
4506
4507 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_7pack(PyObject *__pyx_v_self, PyObject *__pyx_v_obj); /*proto*/
4508 static PyObject *__pyx_f_7msgpack_9_cmsgpack_6Packer_pack(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_skip_dispatch) {
4509 int __pyx_v_ret;
4510 PyObject *__pyx_v_buf = NULL;
4511 PyObject *__pyx_r = NULL;
4512 __Pyx_RefNannyDeclarations
4513 PyObject *__pyx_t_1 = NULL;
4514 PyObject *__pyx_t_2 = NULL;
4515 PyObject *__pyx_t_3 = NULL;
4516 PyObject *__pyx_t_4 = NULL;
4517 PyObject *__pyx_t_5 = NULL;
4518 PyObject *__pyx_t_6 = NULL;
4519 PyObject *__pyx_t_7 = NULL;
4520 int __pyx_t_8;
4521 struct __pyx_opt_args_7msgpack_9_cmsgpack_6Packer__pack __pyx_t_9;
4522 int __pyx_t_10;
4523 int __pyx_lineno = 0;
4524 const char *__pyx_filename = NULL;
4525 int __pyx_clineno = 0;
4526 __Pyx_RefNannySetupContext("pack", 0);
4527 /* Check if called by wrapper */
4528 if (unlikely(__pyx_skip_dispatch)) ;
4529 /* Check if overridden in Python */
4530 else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
4531 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
4532 static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
4533 if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
4534 PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
4535 #endif
4536 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
4537 __Pyx_GOTREF(__pyx_t_1);
4538 if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7msgpack_9_cmsgpack_6Packer_7pack)) {
4539 __Pyx_XDECREF(__pyx_r);
4540 __Pyx_INCREF(__pyx_t_1);
4541 __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
4542 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4543 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
4544 if (likely(__pyx_t_4)) {
4545 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4546 __Pyx_INCREF(__pyx_t_4);
4547 __Pyx_INCREF(function);
4548 __Pyx_DECREF_SET(__pyx_t_3, function);
4549 }
4550 }
4551 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_obj) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_obj);
4552 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4553 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error)
4554 __Pyx_GOTREF(__pyx_t_2);
4555 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4556 __pyx_r = __pyx_t_2;
4557 __pyx_t_2 = 0;
4558 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4559 goto __pyx_L0;
4560 }
4561 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
4562 __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
4563 __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
4564 if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
4565 __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
4566 }
4567 #endif
4568 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4569 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
4570 }
4571 #endif
4572 }
4573
4574 /* "msgpack/_packer.pyx":294
4575 * cpdef pack(self, object obj):
4576 * cdef int ret
4577 * try: # <<<<<<<<<<<<<<
4578 * ret = self._pack(obj, DEFAULT_RECURSE_LIMIT)
4579 * except:
4580 */
4581 {
4582 __Pyx_PyThreadState_declare
4583 __Pyx_PyThreadState_assign
4584 __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
4585 __Pyx_XGOTREF(__pyx_t_5);
4586 __Pyx_XGOTREF(__pyx_t_6);
4587 __Pyx_XGOTREF(__pyx_t_7);
4588 /*try:*/ {
4589
4590 /* "msgpack/_packer.pyx":295
4591 * cdef int ret
4592 * try:
4593 * ret = self._pack(obj, DEFAULT_RECURSE_LIMIT) # <<<<<<<<<<<<<<
4594 * except:
4595 * self.pk.length = 0
4596 */
4597 __pyx_t_9.__pyx_n = 1;
4598 __pyx_t_9.nest_limit = __pyx_v_7msgpack_9_cmsgpack_DEFAULT_RECURSE_LIMIT;
4599 __pyx_t_8 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_obj, &__pyx_t_9); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 295, __pyx_L3_error)
4600 __pyx_v_ret = __pyx_t_8;
4601
4602 /* "msgpack/_packer.pyx":294
4603 * cpdef pack(self, object obj):
4604 * cdef int ret
4605 * try: # <<<<<<<<<<<<<<
4606 * ret = self._pack(obj, DEFAULT_RECURSE_LIMIT)
4607 * except:
4608 */
4609 }
4610 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4611 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4612 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4613 goto __pyx_L8_try_end;
4614 __pyx_L3_error:;
4615 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4616 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4617 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4618 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4619
4620 /* "msgpack/_packer.pyx":296
4621 * try:
4622 * ret = self._pack(obj, DEFAULT_RECURSE_LIMIT)
4623 * except: # <<<<<<<<<<<<<<
4624 * self.pk.length = 0
4625 * raise
4626 */
4627 /*except:*/ {
4628 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
4629 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 296, __pyx_L5_except_error)
4630 __Pyx_GOTREF(__pyx_t_1);
4631 __Pyx_GOTREF(__pyx_t_2);
4632 __Pyx_GOTREF(__pyx_t_3);
4633
4634 /* "msgpack/_packer.pyx":297
4635 * ret = self._pack(obj, DEFAULT_RECURSE_LIMIT)
4636 * except:
4637 * self.pk.length = 0 # <<<<<<<<<<<<<<
4638 * raise
4639 * if ret: # should not happen.
4640 */
4641 __pyx_v_self->pk.length = 0;
4642
4643 /* "msgpack/_packer.pyx":298
4644 * except:
4645 * self.pk.length = 0
4646 * raise # <<<<<<<<<<<<<<
4647 * if ret: # should not happen.
4648 * raise RuntimeError("internal error")
4649 */
4650 __Pyx_GIVEREF(__pyx_t_1);
4651 __Pyx_GIVEREF(__pyx_t_2);
4652 __Pyx_XGIVEREF(__pyx_t_3);
4653 __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4654 __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
4655 __PYX_ERR(0, 298, __pyx_L5_except_error)
4656 }
4657 __pyx_L5_except_error:;
4658
4659 /* "msgpack/_packer.pyx":294
4660 * cpdef pack(self, object obj):
4661 * cdef int ret
4662 * try: # <<<<<<<<<<<<<<
4663 * ret = self._pack(obj, DEFAULT_RECURSE_LIMIT)
4664 * except:
4665 */
4666 __Pyx_XGIVEREF(__pyx_t_5);
4667 __Pyx_XGIVEREF(__pyx_t_6);
4668 __Pyx_XGIVEREF(__pyx_t_7);
4669 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
4670 goto __pyx_L1_error;
4671 __pyx_L8_try_end:;
4672 }
4673
4674 /* "msgpack/_packer.pyx":299
4675 * self.pk.length = 0
4676 * raise
4677 * if ret: # should not happen. # <<<<<<<<<<<<<<
4678 * raise RuntimeError("internal error")
4679 * if self.autoreset:
4680 */
4681 __pyx_t_10 = (__pyx_v_ret != 0);
4682 if (unlikely(__pyx_t_10)) {
4683
4684 /* "msgpack/_packer.pyx":300
4685 * raise
4686 * if ret: # should not happen.
4687 * raise RuntimeError("internal error") # <<<<<<<<<<<<<<
4688 * if self.autoreset:
4689 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
4690 */
4691 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error)
4692 __Pyx_GOTREF(__pyx_t_3);
4693 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4694 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4695 __PYX_ERR(0, 300, __pyx_L1_error)
4696
4697 /* "msgpack/_packer.pyx":299
4698 * self.pk.length = 0
4699 * raise
4700 * if ret: # should not happen. # <<<<<<<<<<<<<<
4701 * raise RuntimeError("internal error")
4702 * if self.autoreset:
4703 */
4704 }
4705
4706 /* "msgpack/_packer.pyx":301
4707 * if ret: # should not happen.
4708 * raise RuntimeError("internal error")
4709 * if self.autoreset: # <<<<<<<<<<<<<<
4710 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
4711 * self.pk.length = 0
4712 */
4713 __pyx_t_10 = (__pyx_v_self->autoreset != 0);
4714 if (__pyx_t_10) {
4715
4716 /* "msgpack/_packer.pyx":302
4717 * raise RuntimeError("internal error")
4718 * if self.autoreset:
4719 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) # <<<<<<<<<<<<<<
4720 * self.pk.length = 0
4721 * return buf
4722 */
4723 __pyx_t_3 = PyBytes_FromStringAndSize(__pyx_v_self->pk.buf, __pyx_v_self->pk.length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
4724 __Pyx_GOTREF(__pyx_t_3);
4725 __pyx_v_buf = ((PyObject*)__pyx_t_3);
4726 __pyx_t_3 = 0;
4727
4728 /* "msgpack/_packer.pyx":303
4729 * if self.autoreset:
4730 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
4731 * self.pk.length = 0 # <<<<<<<<<<<<<<
4732 * return buf
4733 *
4734 */
4735 __pyx_v_self->pk.length = 0;
4736
4737 /* "msgpack/_packer.pyx":304
4738 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
4739 * self.pk.length = 0
4740 * return buf # <<<<<<<<<<<<<<
4741 *
4742 * def pack_ext_type(self, typecode, data):
4743 */
4744 __Pyx_XDECREF(__pyx_r);
4745 __Pyx_INCREF(__pyx_v_buf);
4746 __pyx_r = __pyx_v_buf;
4747 goto __pyx_L0;
4748
4749 /* "msgpack/_packer.pyx":301
4750 * if ret: # should not happen.
4751 * raise RuntimeError("internal error")
4752 * if self.autoreset: # <<<<<<<<<<<<<<
4753 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
4754 * self.pk.length = 0
4755 */
4756 }
4757
4758 /* "msgpack/_packer.pyx":292
4759 * return ret
4760 *
4761 * cpdef pack(self, object obj): # <<<<<<<<<<<<<<
4762 * cdef int ret
4763 * try:
4764 */
4765
4766 /* function exit code */
4767 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4768 goto __pyx_L0;
4769 __pyx_L1_error:;
4770 __Pyx_XDECREF(__pyx_t_1);
4771 __Pyx_XDECREF(__pyx_t_2);
4772 __Pyx_XDECREF(__pyx_t_3);
4773 __Pyx_XDECREF(__pyx_t_4);
4774 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
4775 __pyx_r = 0;
4776 __pyx_L0:;
4777 __Pyx_XDECREF(__pyx_v_buf);
4778 __Pyx_XGIVEREF(__pyx_r);
4779 __Pyx_RefNannyFinishContext();
4780 return __pyx_r;
4781 }
4782
4783 /* Python wrapper */
4784 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_7pack(PyObject *__pyx_v_self, PyObject *__pyx_v_obj); /*proto*/
4785 static char __pyx_doc_7msgpack_9_cmsgpack_6Packer_6pack[] = "Packer.pack(self, obj)";
4786 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_7pack(PyObject *__pyx_v_self, PyObject *__pyx_v_obj) {
4787 PyObject *__pyx_r = 0;
4788 __Pyx_RefNannyDeclarations
4789 __Pyx_RefNannySetupContext("pack (wrapper)", 0);
4790 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer_6pack(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self), ((PyObject *)__pyx_v_obj));
4791
4792 /* function exit code */
4793 __Pyx_RefNannyFinishContext();
4794 return __pyx_r;
4795 }
4796
4797 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_6pack(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_obj) {
4798 PyObject *__pyx_r = NULL;
4799 __Pyx_RefNannyDeclarations
4800 PyObject *__pyx_t_1 = NULL;
4801 int __pyx_lineno = 0;
4802 const char *__pyx_filename = NULL;
4803 int __pyx_clineno = 0;
4804 __Pyx_RefNannySetupContext("pack", 0);
4805 __Pyx_XDECREF(__pyx_r);
4806 __pyx_t_1 = __pyx_f_7msgpack_9_cmsgpack_6Packer_pack(__pyx_v_self, __pyx_v_obj, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
4807 __Pyx_GOTREF(__pyx_t_1);
4808 __pyx_r = __pyx_t_1;
4809 __pyx_t_1 = 0;
4810 goto __pyx_L0;
4811
4812 /* function exit code */
4813 __pyx_L1_error:;
4814 __Pyx_XDECREF(__pyx_t_1);
4815 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
4816 __pyx_r = NULL;
4817 __pyx_L0:;
4818 __Pyx_XGIVEREF(__pyx_r);
4819 __Pyx_RefNannyFinishContext();
4820 return __pyx_r;
4821 }
4822
4823 /* "msgpack/_packer.pyx":306
4824 * return buf
4825 *
4826 * def pack_ext_type(self, typecode, data): # <<<<<<<<<<<<<<
4827 * msgpack_pack_ext(&self.pk, typecode, len(data))
4828 * msgpack_pack_raw_body(&self.pk, data, len(data))
4829 */
4830
4831 /* Python wrapper */
4832 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_9pack_ext_type(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4833 static char __pyx_doc_7msgpack_9_cmsgpack_6Packer_8pack_ext_type[] = "Packer.pack_ext_type(self, typecode, data)";
4834 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_9pack_ext_type(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4835 PyObject *__pyx_v_typecode = 0;
4836 PyObject *__pyx_v_data = 0;
4837 int __pyx_lineno = 0;
4838 const char *__pyx_filename = NULL;
4839 int __pyx_clineno = 0;
4840 PyObject *__pyx_r = 0;
4841 __Pyx_RefNannyDeclarations
4842 __Pyx_RefNannySetupContext("pack_ext_type (wrapper)", 0);
4843 {
4844 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_typecode,&__pyx_n_s_data,0};
4845 PyObject* values[2] = {0,0};
4846 if (unlikely(__pyx_kwds)) {
4847 Py_ssize_t kw_args;
4848 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4849 switch (pos_args) {
4850 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4851 CYTHON_FALLTHROUGH;
4852 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4853 CYTHON_FALLTHROUGH;
4854 case 0: break;
4855 default: goto __pyx_L5_argtuple_error;
4856 }
4857 kw_args = PyDict_Size(__pyx_kwds);
4858 switch (pos_args) {
4859 case 0:
4860 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typecode)) != 0)) kw_args--;
4861 else goto __pyx_L5_argtuple_error;
4862 CYTHON_FALLTHROUGH;
4863 case 1:
4864 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
4865 else {
4866 __Pyx_RaiseArgtupleInvalid("pack_ext_type", 1, 2, 2, 1); __PYX_ERR(0, 306, __pyx_L3_error)
4867 }
4868 }
4869 if (unlikely(kw_args > 0)) {
4870 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pack_ext_type") < 0)) __PYX_ERR(0, 306, __pyx_L3_error)
4871 }
4872 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4873 goto __pyx_L5_argtuple_error;
4874 } else {
4875 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4876 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4877 }
4878 __pyx_v_typecode = values[0];
4879 __pyx_v_data = values[1];
4880 }
4881 goto __pyx_L4_argument_unpacking_done;
4882 __pyx_L5_argtuple_error:;
4883 __Pyx_RaiseArgtupleInvalid("pack_ext_type", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 306, __pyx_L3_error)
4884 __pyx_L3_error:;
4885 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.pack_ext_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
4886 __Pyx_RefNannyFinishContext();
4887 return NULL;
4888 __pyx_L4_argument_unpacking_done:;
4889 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer_8pack_ext_type(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self), __pyx_v_typecode, __pyx_v_data);
4890
4891 /* function exit code */
4892 __Pyx_RefNannyFinishContext();
4893 return __pyx_r;
4894 }
4895
4896 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_8pack_ext_type(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_typecode, PyObject *__pyx_v_data) {
4897 PyObject *__pyx_r = NULL;
4898 __Pyx_RefNannyDeclarations
4899 char __pyx_t_1;
4900 Py_ssize_t __pyx_t_2;
4901 char *__pyx_t_3;
4902 int __pyx_lineno = 0;
4903 const char *__pyx_filename = NULL;
4904 int __pyx_clineno = 0;
4905 __Pyx_RefNannySetupContext("pack_ext_type", 0);
4906
4907 /* "msgpack/_packer.pyx":307
4908 *
4909 * def pack_ext_type(self, typecode, data):
4910 * msgpack_pack_ext(&self.pk, typecode, len(data)) # <<<<<<<<<<<<<<
4911 * msgpack_pack_raw_body(&self.pk, data, len(data))
4912 *
4913 */
4914 __pyx_t_1 = __Pyx_PyInt_As_char(__pyx_v_typecode); if (unlikely((__pyx_t_1 == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L1_error)
4915 __pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 307, __pyx_L1_error)
4916 (void)(msgpack_pack_ext((&__pyx_v_self->pk), __pyx_t_1, __pyx_t_2));
4917
4918 /* "msgpack/_packer.pyx":308
4919 * def pack_ext_type(self, typecode, data):
4920 * msgpack_pack_ext(&self.pk, typecode, len(data))
4921 * msgpack_pack_raw_body(&self.pk, data, len(data)) # <<<<<<<<<<<<<<
4922 *
4923 * def pack_array_header(self, long long size):
4924 */
4925 __pyx_t_3 = __Pyx_PyObject_AsWritableString(__pyx_v_data); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L1_error)
4926 __pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 308, __pyx_L1_error)
4927 (void)(msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_t_3, __pyx_t_2));
4928
4929 /* "msgpack/_packer.pyx":306
4930 * return buf
4931 *
4932 * def pack_ext_type(self, typecode, data): # <<<<<<<<<<<<<<
4933 * msgpack_pack_ext(&self.pk, typecode, len(data))
4934 * msgpack_pack_raw_body(&self.pk, data, len(data))
4935 */
4936
4937 /* function exit code */
4938 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4939 goto __pyx_L0;
4940 __pyx_L1_error:;
4941 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.pack_ext_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
4942 __pyx_r = NULL;
4943 __pyx_L0:;
4944 __Pyx_XGIVEREF(__pyx_r);
4945 __Pyx_RefNannyFinishContext();
4946 return __pyx_r;
4947 }
4948
4949 /* "msgpack/_packer.pyx":310
4950 * msgpack_pack_raw_body(&self.pk, data, len(data))
4951 *
4952 * def pack_array_header(self, long long size): # <<<<<<<<<<<<<<
4953 * if size > ITEM_LIMIT:
4954 * raise ValueError
4955 */
4956
4957 /* Python wrapper */
4958 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_11pack_array_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
4959 static char __pyx_doc_7msgpack_9_cmsgpack_6Packer_10pack_array_header[] = "Packer.pack_array_header(self, long long size)";
4960 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_11pack_array_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
4961 PY_LONG_LONG __pyx_v_size;
4962 int __pyx_lineno = 0;
4963 const char *__pyx_filename = NULL;
4964 int __pyx_clineno = 0;
4965 PyObject *__pyx_r = 0;
4966 __Pyx_RefNannyDeclarations
4967 __Pyx_RefNannySetupContext("pack_array_header (wrapper)", 0);
4968 assert(__pyx_arg_size); {
4969 __pyx_v_size = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_arg_size); if (unlikely((__pyx_v_size == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 310, __pyx_L3_error)
4970 }
4971 goto __pyx_L4_argument_unpacking_done;
4972 __pyx_L3_error:;
4973 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.pack_array_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
4974 __Pyx_RefNannyFinishContext();
4975 return NULL;
4976 __pyx_L4_argument_unpacking_done:;
4977 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer_10pack_array_header(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self), ((PY_LONG_LONG)__pyx_v_size));
4978
4979 /* function exit code */
4980 __Pyx_RefNannyFinishContext();
4981 return __pyx_r;
4982 }
4983
4984 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_10pack_array_header(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PY_LONG_LONG __pyx_v_size) {
4985 int __pyx_v_ret;
4986 PyObject *__pyx_v_buf = NULL;
4987 PyObject *__pyx_r = NULL;
4988 __Pyx_RefNannyDeclarations
4989 int __pyx_t_1;
4990 PyObject *__pyx_t_2 = NULL;
4991 int __pyx_lineno = 0;
4992 const char *__pyx_filename = NULL;
4993 int __pyx_clineno = 0;
4994 __Pyx_RefNannySetupContext("pack_array_header", 0);
4995
4996 /* "msgpack/_packer.pyx":311
4997 *
4998 * def pack_array_header(self, long long size):
4999 * if size > ITEM_LIMIT: # <<<<<<<<<<<<<<
5000 * raise ValueError
5001 * cdef int ret = msgpack_pack_array(&self.pk, size)
5002 */
5003 __pyx_t_1 = ((__pyx_v_size > __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT) != 0);
5004 if (unlikely(__pyx_t_1)) {
5005
5006 /* "msgpack/_packer.pyx":312
5007 * def pack_array_header(self, long long size):
5008 * if size > ITEM_LIMIT:
5009 * raise ValueError # <<<<<<<<<<<<<<
5010 * cdef int ret = msgpack_pack_array(&self.pk, size)
5011 * if ret == -1:
5012 */
5013 __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
5014 __PYX_ERR(0, 312, __pyx_L1_error)
5015
5016 /* "msgpack/_packer.pyx":311
5017 *
5018 * def pack_array_header(self, long long size):
5019 * if size > ITEM_LIMIT: # <<<<<<<<<<<<<<
5020 * raise ValueError
5021 * cdef int ret = msgpack_pack_array(&self.pk, size)
5022 */
5023 }
5024
5025 /* "msgpack/_packer.pyx":313
5026 * if size > ITEM_LIMIT:
5027 * raise ValueError
5028 * cdef int ret = msgpack_pack_array(&self.pk, size) # <<<<<<<<<<<<<<
5029 * if ret == -1:
5030 * raise MemoryError
5031 */
5032 __pyx_v_ret = msgpack_pack_array((&__pyx_v_self->pk), __pyx_v_size);
5033
5034 /* "msgpack/_packer.pyx":314
5035 * raise ValueError
5036 * cdef int ret = msgpack_pack_array(&self.pk, size)
5037 * if ret == -1: # <<<<<<<<<<<<<<
5038 * raise MemoryError
5039 * elif ret: # should not happen
5040 */
5041 __pyx_t_1 = ((__pyx_v_ret == -1L) != 0);
5042 if (unlikely(__pyx_t_1)) {
5043
5044 /* "msgpack/_packer.pyx":315
5045 * cdef int ret = msgpack_pack_array(&self.pk, size)
5046 * if ret == -1:
5047 * raise MemoryError # <<<<<<<<<<<<<<
5048 * elif ret: # should not happen
5049 * raise TypeError
5050 */
5051 PyErr_NoMemory(); __PYX_ERR(0, 315, __pyx_L1_error)
5052
5053 /* "msgpack/_packer.pyx":314
5054 * raise ValueError
5055 * cdef int ret = msgpack_pack_array(&self.pk, size)
5056 * if ret == -1: # <<<<<<<<<<<<<<
5057 * raise MemoryError
5058 * elif ret: # should not happen
5059 */
5060 }
5061
5062 /* "msgpack/_packer.pyx":316
5063 * if ret == -1:
5064 * raise MemoryError
5065 * elif ret: # should not happen # <<<<<<<<<<<<<<
5066 * raise TypeError
5067 * if self.autoreset:
5068 */
5069 __pyx_t_1 = (__pyx_v_ret != 0);
5070 if (unlikely(__pyx_t_1)) {
5071
5072 /* "msgpack/_packer.pyx":317
5073 * raise MemoryError
5074 * elif ret: # should not happen
5075 * raise TypeError # <<<<<<<<<<<<<<
5076 * if self.autoreset:
5077 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5078 */
5079 __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
5080 __PYX_ERR(0, 317, __pyx_L1_error)
5081
5082 /* "msgpack/_packer.pyx":316
5083 * if ret == -1:
5084 * raise MemoryError
5085 * elif ret: # should not happen # <<<<<<<<<<<<<<
5086 * raise TypeError
5087 * if self.autoreset:
5088 */
5089 }
5090
5091 /* "msgpack/_packer.pyx":318
5092 * elif ret: # should not happen
5093 * raise TypeError
5094 * if self.autoreset: # <<<<<<<<<<<<<<
5095 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5096 * self.pk.length = 0
5097 */
5098 __pyx_t_1 = (__pyx_v_self->autoreset != 0);
5099 if (__pyx_t_1) {
5100
5101 /* "msgpack/_packer.pyx":319
5102 * raise TypeError
5103 * if self.autoreset:
5104 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) # <<<<<<<<<<<<<<
5105 * self.pk.length = 0
5106 * return buf
5107 */
5108 __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_self->pk.buf, __pyx_v_self->pk.length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error)
5109 __Pyx_GOTREF(__pyx_t_2);
5110 __pyx_v_buf = ((PyObject*)__pyx_t_2);
5111 __pyx_t_2 = 0;
5112
5113 /* "msgpack/_packer.pyx":320
5114 * if self.autoreset:
5115 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5116 * self.pk.length = 0 # <<<<<<<<<<<<<<
5117 * return buf
5118 *
5119 */
5120 __pyx_v_self->pk.length = 0;
5121
5122 /* "msgpack/_packer.pyx":321
5123 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5124 * self.pk.length = 0
5125 * return buf # <<<<<<<<<<<<<<
5126 *
5127 * def pack_map_header(self, long long size):
5128 */
5129 __Pyx_XDECREF(__pyx_r);
5130 __Pyx_INCREF(__pyx_v_buf);
5131 __pyx_r = __pyx_v_buf;
5132 goto __pyx_L0;
5133
5134 /* "msgpack/_packer.pyx":318
5135 * elif ret: # should not happen
5136 * raise TypeError
5137 * if self.autoreset: # <<<<<<<<<<<<<<
5138 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5139 * self.pk.length = 0
5140 */
5141 }
5142
5143 /* "msgpack/_packer.pyx":310
5144 * msgpack_pack_raw_body(&self.pk, data, len(data))
5145 *
5146 * def pack_array_header(self, long long size): # <<<<<<<<<<<<<<
5147 * if size > ITEM_LIMIT:
5148 * raise ValueError
5149 */
5150
5151 /* function exit code */
5152 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5153 goto __pyx_L0;
5154 __pyx_L1_error:;
5155 __Pyx_XDECREF(__pyx_t_2);
5156 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.pack_array_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
5157 __pyx_r = NULL;
5158 __pyx_L0:;
5159 __Pyx_XDECREF(__pyx_v_buf);
5160 __Pyx_XGIVEREF(__pyx_r);
5161 __Pyx_RefNannyFinishContext();
5162 return __pyx_r;
5163 }
5164
5165 /* "msgpack/_packer.pyx":323
5166 * return buf
5167 *
5168 * def pack_map_header(self, long long size): # <<<<<<<<<<<<<<
5169 * if size > ITEM_LIMIT:
5170 * raise ValueError
5171 */
5172
5173 /* Python wrapper */
5174 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_13pack_map_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
5175 static char __pyx_doc_7msgpack_9_cmsgpack_6Packer_12pack_map_header[] = "Packer.pack_map_header(self, long long size)";
5176 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_13pack_map_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
5177 PY_LONG_LONG __pyx_v_size;
5178 int __pyx_lineno = 0;
5179 const char *__pyx_filename = NULL;
5180 int __pyx_clineno = 0;
5181 PyObject *__pyx_r = 0;
5182 __Pyx_RefNannyDeclarations
5183 __Pyx_RefNannySetupContext("pack_map_header (wrapper)", 0);
5184 assert(__pyx_arg_size); {
5185 __pyx_v_size = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_arg_size); if (unlikely((__pyx_v_size == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 323, __pyx_L3_error)
5186 }
5187 goto __pyx_L4_argument_unpacking_done;
5188 __pyx_L3_error:;
5189 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.pack_map_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
5190 __Pyx_RefNannyFinishContext();
5191 return NULL;
5192 __pyx_L4_argument_unpacking_done:;
5193 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer_12pack_map_header(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self), ((PY_LONG_LONG)__pyx_v_size));
5194
5195 /* function exit code */
5196 __Pyx_RefNannyFinishContext();
5197 return __pyx_r;
5198 }
5199
5200 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_12pack_map_header(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PY_LONG_LONG __pyx_v_size) {
5201 int __pyx_v_ret;
5202 PyObject *__pyx_v_buf = NULL;
5203 PyObject *__pyx_r = NULL;
5204 __Pyx_RefNannyDeclarations
5205 int __pyx_t_1;
5206 PyObject *__pyx_t_2 = NULL;
5207 int __pyx_lineno = 0;
5208 const char *__pyx_filename = NULL;
5209 int __pyx_clineno = 0;
5210 __Pyx_RefNannySetupContext("pack_map_header", 0);
5211
5212 /* "msgpack/_packer.pyx":324
5213 *
5214 * def pack_map_header(self, long long size):
5215 * if size > ITEM_LIMIT: # <<<<<<<<<<<<<<
5216 * raise ValueError
5217 * cdef int ret = msgpack_pack_map(&self.pk, size)
5218 */
5219 __pyx_t_1 = ((__pyx_v_size > __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT) != 0);
5220 if (unlikely(__pyx_t_1)) {
5221
5222 /* "msgpack/_packer.pyx":325
5223 * def pack_map_header(self, long long size):
5224 * if size > ITEM_LIMIT:
5225 * raise ValueError # <<<<<<<<<<<<<<
5226 * cdef int ret = msgpack_pack_map(&self.pk, size)
5227 * if ret == -1:
5228 */
5229 __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
5230 __PYX_ERR(0, 325, __pyx_L1_error)
5231
5232 /* "msgpack/_packer.pyx":324
5233 *
5234 * def pack_map_header(self, long long size):
5235 * if size > ITEM_LIMIT: # <<<<<<<<<<<<<<
5236 * raise ValueError
5237 * cdef int ret = msgpack_pack_map(&self.pk, size)
5238 */
5239 }
5240
5241 /* "msgpack/_packer.pyx":326
5242 * if size > ITEM_LIMIT:
5243 * raise ValueError
5244 * cdef int ret = msgpack_pack_map(&self.pk, size) # <<<<<<<<<<<<<<
5245 * if ret == -1:
5246 * raise MemoryError
5247 */
5248 __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->pk), __pyx_v_size);
5249
5250 /* "msgpack/_packer.pyx":327
5251 * raise ValueError
5252 * cdef int ret = msgpack_pack_map(&self.pk, size)
5253 * if ret == -1: # <<<<<<<<<<<<<<
5254 * raise MemoryError
5255 * elif ret: # should not happen
5256 */
5257 __pyx_t_1 = ((__pyx_v_ret == -1L) != 0);
5258 if (unlikely(__pyx_t_1)) {
5259
5260 /* "msgpack/_packer.pyx":328
5261 * cdef int ret = msgpack_pack_map(&self.pk, size)
5262 * if ret == -1:
5263 * raise MemoryError # <<<<<<<<<<<<<<
5264 * elif ret: # should not happen
5265 * raise TypeError
5266 */
5267 PyErr_NoMemory(); __PYX_ERR(0, 328, __pyx_L1_error)
5268
5269 /* "msgpack/_packer.pyx":327
5270 * raise ValueError
5271 * cdef int ret = msgpack_pack_map(&self.pk, size)
5272 * if ret == -1: # <<<<<<<<<<<<<<
5273 * raise MemoryError
5274 * elif ret: # should not happen
5275 */
5276 }
5277
5278 /* "msgpack/_packer.pyx":329
5279 * if ret == -1:
5280 * raise MemoryError
5281 * elif ret: # should not happen # <<<<<<<<<<<<<<
5282 * raise TypeError
5283 * if self.autoreset:
5284 */
5285 __pyx_t_1 = (__pyx_v_ret != 0);
5286 if (unlikely(__pyx_t_1)) {
5287
5288 /* "msgpack/_packer.pyx":330
5289 * raise MemoryError
5290 * elif ret: # should not happen
5291 * raise TypeError # <<<<<<<<<<<<<<
5292 * if self.autoreset:
5293 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5294 */
5295 __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
5296 __PYX_ERR(0, 330, __pyx_L1_error)
5297
5298 /* "msgpack/_packer.pyx":329
5299 * if ret == -1:
5300 * raise MemoryError
5301 * elif ret: # should not happen # <<<<<<<<<<<<<<
5302 * raise TypeError
5303 * if self.autoreset:
5304 */
5305 }
5306
5307 /* "msgpack/_packer.pyx":331
5308 * elif ret: # should not happen
5309 * raise TypeError
5310 * if self.autoreset: # <<<<<<<<<<<<<<
5311 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5312 * self.pk.length = 0
5313 */
5314 __pyx_t_1 = (__pyx_v_self->autoreset != 0);
5315 if (__pyx_t_1) {
5316
5317 /* "msgpack/_packer.pyx":332
5318 * raise TypeError
5319 * if self.autoreset:
5320 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) # <<<<<<<<<<<<<<
5321 * self.pk.length = 0
5322 * return buf
5323 */
5324 __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_self->pk.buf, __pyx_v_self->pk.length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error)
5325 __Pyx_GOTREF(__pyx_t_2);
5326 __pyx_v_buf = ((PyObject*)__pyx_t_2);
5327 __pyx_t_2 = 0;
5328
5329 /* "msgpack/_packer.pyx":333
5330 * if self.autoreset:
5331 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5332 * self.pk.length = 0 # <<<<<<<<<<<<<<
5333 * return buf
5334 *
5335 */
5336 __pyx_v_self->pk.length = 0;
5337
5338 /* "msgpack/_packer.pyx":334
5339 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5340 * self.pk.length = 0
5341 * return buf # <<<<<<<<<<<<<<
5342 *
5343 * def pack_map_pairs(self, object pairs):
5344 */
5345 __Pyx_XDECREF(__pyx_r);
5346 __Pyx_INCREF(__pyx_v_buf);
5347 __pyx_r = __pyx_v_buf;
5348 goto __pyx_L0;
5349
5350 /* "msgpack/_packer.pyx":331
5351 * elif ret: # should not happen
5352 * raise TypeError
5353 * if self.autoreset: # <<<<<<<<<<<<<<
5354 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5355 * self.pk.length = 0
5356 */
5357 }
5358
5359 /* "msgpack/_packer.pyx":323
5360 * return buf
5361 *
5362 * def pack_map_header(self, long long size): # <<<<<<<<<<<<<<
5363 * if size > ITEM_LIMIT:
5364 * raise ValueError
5365 */
5366
5367 /* function exit code */
5368 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5369 goto __pyx_L0;
5370 __pyx_L1_error:;
5371 __Pyx_XDECREF(__pyx_t_2);
5372 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.pack_map_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
5373 __pyx_r = NULL;
5374 __pyx_L0:;
5375 __Pyx_XDECREF(__pyx_v_buf);
5376 __Pyx_XGIVEREF(__pyx_r);
5377 __Pyx_RefNannyFinishContext();
5378 return __pyx_r;
5379 }
5380
5381 /* "msgpack/_packer.pyx":336
5382 * return buf
5383 *
5384 * def pack_map_pairs(self, object pairs): # <<<<<<<<<<<<<<
5385 * """
5386 * Pack *pairs* as msgpack map type.
5387 */
5388
5389 /* Python wrapper */
5390 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_15pack_map_pairs(PyObject *__pyx_v_self, PyObject *__pyx_v_pairs); /*proto*/
5391 static char __pyx_doc_7msgpack_9_cmsgpack_6Packer_14pack_map_pairs[] = "Packer.pack_map_pairs(self, pairs)\n\n Pack *pairs* as msgpack map type.\n\n *pairs* should be a sequence of pairs.\n (`len(pairs)` and `for k, v in pairs:` should be supported.)\n ";
5392 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_15pack_map_pairs(PyObject *__pyx_v_self, PyObject *__pyx_v_pairs) {
5393 PyObject *__pyx_r = 0;
5394 __Pyx_RefNannyDeclarations
5395 __Pyx_RefNannySetupContext("pack_map_pairs (wrapper)", 0);
5396 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer_14pack_map_pairs(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self), ((PyObject *)__pyx_v_pairs));
5397
5398 /* function exit code */
5399 __Pyx_RefNannyFinishContext();
5400 return __pyx_r;
5401 }
5402
5403 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_14pack_map_pairs(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, PyObject *__pyx_v_pairs) {
5404 int __pyx_v_ret;
5405 PyObject *__pyx_v_k = NULL;
5406 PyObject *__pyx_v_v = NULL;
5407 PyObject *__pyx_v_buf = NULL;
5408 PyObject *__pyx_r = NULL;
5409 __Pyx_RefNannyDeclarations
5410 Py_ssize_t __pyx_t_1;
5411 int __pyx_t_2;
5412 PyObject *__pyx_t_3 = NULL;
5413 PyObject *(*__pyx_t_4)(PyObject *);
5414 PyObject *__pyx_t_5 = NULL;
5415 PyObject *__pyx_t_6 = NULL;
5416 PyObject *__pyx_t_7 = NULL;
5417 PyObject *__pyx_t_8 = NULL;
5418 PyObject *(*__pyx_t_9)(PyObject *);
5419 int __pyx_t_10;
5420 int __pyx_lineno = 0;
5421 const char *__pyx_filename = NULL;
5422 int __pyx_clineno = 0;
5423 __Pyx_RefNannySetupContext("pack_map_pairs", 0);
5424
5425 /* "msgpack/_packer.pyx":343
5426 * (`len(pairs)` and `for k, v in pairs:` should be supported.)
5427 * """
5428 * cdef int ret = msgpack_pack_map(&self.pk, len(pairs)) # <<<<<<<<<<<<<<
5429 * if ret == 0:
5430 * for k, v in pairs:
5431 */
5432 __pyx_t_1 = PyObject_Length(__pyx_v_pairs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 343, __pyx_L1_error)
5433 __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->pk), __pyx_t_1);
5434
5435 /* "msgpack/_packer.pyx":344
5436 * """
5437 * cdef int ret = msgpack_pack_map(&self.pk, len(pairs))
5438 * if ret == 0: # <<<<<<<<<<<<<<
5439 * for k, v in pairs:
5440 * ret = self._pack(k)
5441 */
5442 __pyx_t_2 = ((__pyx_v_ret == 0) != 0);
5443 if (__pyx_t_2) {
5444
5445 /* "msgpack/_packer.pyx":345
5446 * cdef int ret = msgpack_pack_map(&self.pk, len(pairs))
5447 * if ret == 0:
5448 * for k, v in pairs: # <<<<<<<<<<<<<<
5449 * ret = self._pack(k)
5450 * if ret != 0: break
5451 */
5452 if (likely(PyList_CheckExact(__pyx_v_pairs)) || PyTuple_CheckExact(__pyx_v_pairs)) {
5453 __pyx_t_3 = __pyx_v_pairs; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
5454 __pyx_t_4 = NULL;
5455 } else {
5456 __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_pairs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error)
5457 __Pyx_GOTREF(__pyx_t_3);
5458 __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 345, __pyx_L1_error)
5459 }
5460 for (;;) {
5461 if (likely(!__pyx_t_4)) {
5462 if (likely(PyList_CheckExact(__pyx_t_3))) {
5463 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
5464 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5465 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 345, __pyx_L1_error)
5466 #else
5467 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 345, __pyx_L1_error)
5468 __Pyx_GOTREF(__pyx_t_5);
5469 #endif
5470 } else {
5471 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
5472 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5473 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 345, __pyx_L1_error)
5474 #else
5475 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 345, __pyx_L1_error)
5476 __Pyx_GOTREF(__pyx_t_5);
5477 #endif
5478 }
5479 } else {
5480 __pyx_t_5 = __pyx_t_4(__pyx_t_3);
5481 if (unlikely(!__pyx_t_5)) {
5482 PyObject* exc_type = PyErr_Occurred();
5483 if (exc_type) {
5484 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5485 else __PYX_ERR(0, 345, __pyx_L1_error)
5486 }
5487 break;
5488 }
5489 __Pyx_GOTREF(__pyx_t_5);
5490 }
5491 if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
5492 PyObject* sequence = __pyx_t_5;
5493 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
5494 if (unlikely(size != 2)) {
5495 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
5496 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
5497 __PYX_ERR(0, 345, __pyx_L1_error)
5498 }
5499 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5500 if (likely(PyTuple_CheckExact(sequence))) {
5501 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
5502 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
5503 } else {
5504 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
5505 __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
5506 }
5507 __Pyx_INCREF(__pyx_t_6);
5508 __Pyx_INCREF(__pyx_t_7);
5509 #else
5510 __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 345, __pyx_L1_error)
5511 __Pyx_GOTREF(__pyx_t_6);
5512 __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error)
5513 __Pyx_GOTREF(__pyx_t_7);
5514 #endif
5515 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5516 } else {
5517 Py_ssize_t index = -1;
5518 __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 345, __pyx_L1_error)
5519 __Pyx_GOTREF(__pyx_t_8);
5520 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5521 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
5522 index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
5523 __Pyx_GOTREF(__pyx_t_6);
5524 index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
5525 __Pyx_GOTREF(__pyx_t_7);
5526 if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 345, __pyx_L1_error)
5527 __pyx_t_9 = NULL;
5528 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5529 goto __pyx_L7_unpacking_done;
5530 __pyx_L6_unpacking_failed:;
5531 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5532 __pyx_t_9 = NULL;
5533 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
5534 __PYX_ERR(0, 345, __pyx_L1_error)
5535 __pyx_L7_unpacking_done:;
5536 }
5537 __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
5538 __pyx_t_6 = 0;
5539 __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_7);
5540 __pyx_t_7 = 0;
5541
5542 /* "msgpack/_packer.pyx":346
5543 * if ret == 0:
5544 * for k, v in pairs:
5545 * ret = self._pack(k) # <<<<<<<<<<<<<<
5546 * if ret != 0: break
5547 * ret = self._pack(v)
5548 */
5549 __pyx_t_10 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_k, NULL); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 346, __pyx_L1_error)
5550 __pyx_v_ret = __pyx_t_10;
5551
5552 /* "msgpack/_packer.pyx":347
5553 * for k, v in pairs:
5554 * ret = self._pack(k)
5555 * if ret != 0: break # <<<<<<<<<<<<<<
5556 * ret = self._pack(v)
5557 * if ret != 0: break
5558 */
5559 __pyx_t_2 = ((__pyx_v_ret != 0) != 0);
5560 if (__pyx_t_2) {
5561 goto __pyx_L5_break;
5562 }
5563
5564 /* "msgpack/_packer.pyx":348
5565 * ret = self._pack(k)
5566 * if ret != 0: break
5567 * ret = self._pack(v) # <<<<<<<<<<<<<<
5568 * if ret != 0: break
5569 * if ret == -1:
5570 */
5571 __pyx_t_10 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_v, NULL); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 348, __pyx_L1_error)
5572 __pyx_v_ret = __pyx_t_10;
5573
5574 /* "msgpack/_packer.pyx":349
5575 * if ret != 0: break
5576 * ret = self._pack(v)
5577 * if ret != 0: break # <<<<<<<<<<<<<<
5578 * if ret == -1:
5579 * raise MemoryError
5580 */
5581 __pyx_t_2 = ((__pyx_v_ret != 0) != 0);
5582 if (__pyx_t_2) {
5583 goto __pyx_L5_break;
5584 }
5585
5586 /* "msgpack/_packer.pyx":345
5587 * cdef int ret = msgpack_pack_map(&self.pk, len(pairs))
5588 * if ret == 0:
5589 * for k, v in pairs: # <<<<<<<<<<<<<<
5590 * ret = self._pack(k)
5591 * if ret != 0: break
5592 */
5593 }
5594 __pyx_L5_break:;
5595 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5596
5597 /* "msgpack/_packer.pyx":344
5598 * """
5599 * cdef int ret = msgpack_pack_map(&self.pk, len(pairs))
5600 * if ret == 0: # <<<<<<<<<<<<<<
5601 * for k, v in pairs:
5602 * ret = self._pack(k)
5603 */
5604 }
5605
5606 /* "msgpack/_packer.pyx":350
5607 * ret = self._pack(v)
5608 * if ret != 0: break
5609 * if ret == -1: # <<<<<<<<<<<<<<
5610 * raise MemoryError
5611 * elif ret: # should not happen
5612 */
5613 __pyx_t_2 = ((__pyx_v_ret == -1L) != 0);
5614 if (unlikely(__pyx_t_2)) {
5615
5616 /* "msgpack/_packer.pyx":351
5617 * if ret != 0: break
5618 * if ret == -1:
5619 * raise MemoryError # <<<<<<<<<<<<<<
5620 * elif ret: # should not happen
5621 * raise TypeError
5622 */
5623 PyErr_NoMemory(); __PYX_ERR(0, 351, __pyx_L1_error)
5624
5625 /* "msgpack/_packer.pyx":350
5626 * ret = self._pack(v)
5627 * if ret != 0: break
5628 * if ret == -1: # <<<<<<<<<<<<<<
5629 * raise MemoryError
5630 * elif ret: # should not happen
5631 */
5632 }
5633
5634 /* "msgpack/_packer.pyx":352
5635 * if ret == -1:
5636 * raise MemoryError
5637 * elif ret: # should not happen # <<<<<<<<<<<<<<
5638 * raise TypeError
5639 * if self.autoreset:
5640 */
5641 __pyx_t_2 = (__pyx_v_ret != 0);
5642 if (unlikely(__pyx_t_2)) {
5643
5644 /* "msgpack/_packer.pyx":353
5645 * raise MemoryError
5646 * elif ret: # should not happen
5647 * raise TypeError # <<<<<<<<<<<<<<
5648 * if self.autoreset:
5649 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5650 */
5651 __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
5652 __PYX_ERR(0, 353, __pyx_L1_error)
5653
5654 /* "msgpack/_packer.pyx":352
5655 * if ret == -1:
5656 * raise MemoryError
5657 * elif ret: # should not happen # <<<<<<<<<<<<<<
5658 * raise TypeError
5659 * if self.autoreset:
5660 */
5661 }
5662
5663 /* "msgpack/_packer.pyx":354
5664 * elif ret: # should not happen
5665 * raise TypeError
5666 * if self.autoreset: # <<<<<<<<<<<<<<
5667 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5668 * self.pk.length = 0
5669 */
5670 __pyx_t_2 = (__pyx_v_self->autoreset != 0);
5671 if (__pyx_t_2) {
5672
5673 /* "msgpack/_packer.pyx":355
5674 * raise TypeError
5675 * if self.autoreset:
5676 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) # <<<<<<<<<<<<<<
5677 * self.pk.length = 0
5678 * return buf
5679 */
5680 __pyx_t_3 = PyBytes_FromStringAndSize(__pyx_v_self->pk.buf, __pyx_v_self->pk.length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 355, __pyx_L1_error)
5681 __Pyx_GOTREF(__pyx_t_3);
5682 __pyx_v_buf = ((PyObject*)__pyx_t_3);
5683 __pyx_t_3 = 0;
5684
5685 /* "msgpack/_packer.pyx":356
5686 * if self.autoreset:
5687 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5688 * self.pk.length = 0 # <<<<<<<<<<<<<<
5689 * return buf
5690 *
5691 */
5692 __pyx_v_self->pk.length = 0;
5693
5694 /* "msgpack/_packer.pyx":357
5695 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5696 * self.pk.length = 0
5697 * return buf # <<<<<<<<<<<<<<
5698 *
5699 * def reset(self):
5700 */
5701 __Pyx_XDECREF(__pyx_r);
5702 __Pyx_INCREF(__pyx_v_buf);
5703 __pyx_r = __pyx_v_buf;
5704 goto __pyx_L0;
5705
5706 /* "msgpack/_packer.pyx":354
5707 * elif ret: # should not happen
5708 * raise TypeError
5709 * if self.autoreset: # <<<<<<<<<<<<<<
5710 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5711 * self.pk.length = 0
5712 */
5713 }
5714
5715 /* "msgpack/_packer.pyx":336
5716 * return buf
5717 *
5718 * def pack_map_pairs(self, object pairs): # <<<<<<<<<<<<<<
5719 * """
5720 * Pack *pairs* as msgpack map type.
5721 */
5722
5723 /* function exit code */
5724 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5725 goto __pyx_L0;
5726 __pyx_L1_error:;
5727 __Pyx_XDECREF(__pyx_t_3);
5728 __Pyx_XDECREF(__pyx_t_5);
5729 __Pyx_XDECREF(__pyx_t_6);
5730 __Pyx_XDECREF(__pyx_t_7);
5731 __Pyx_XDECREF(__pyx_t_8);
5732 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.pack_map_pairs", __pyx_clineno, __pyx_lineno, __pyx_filename);
5733 __pyx_r = NULL;
5734 __pyx_L0:;
5735 __Pyx_XDECREF(__pyx_v_k);
5736 __Pyx_XDECREF(__pyx_v_v);
5737 __Pyx_XDECREF(__pyx_v_buf);
5738 __Pyx_XGIVEREF(__pyx_r);
5739 __Pyx_RefNannyFinishContext();
5740 return __pyx_r;
5741 }
5742
5743 /* "msgpack/_packer.pyx":359
5744 * return buf
5745 *
5746 * def reset(self): # <<<<<<<<<<<<<<
5747 * """Reset internal buffer.
5748 *
5749 */
5750
5751 /* Python wrapper */
5752 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_17reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5753 static char __pyx_doc_7msgpack_9_cmsgpack_6Packer_16reset[] = "Packer.reset(self)\nReset internal buffer.\n\n This method is useful only when autoreset=False.\n ";
5754 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_17reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5755 PyObject *__pyx_r = 0;
5756 __Pyx_RefNannyDeclarations
5757 __Pyx_RefNannySetupContext("reset (wrapper)", 0);
5758 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer_16reset(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self));
5759
5760 /* function exit code */
5761 __Pyx_RefNannyFinishContext();
5762 return __pyx_r;
5763 }
5764
5765 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_16reset(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self) {
5766 PyObject *__pyx_r = NULL;
5767 __Pyx_RefNannyDeclarations
5768 __Pyx_RefNannySetupContext("reset", 0);
5769
5770 /* "msgpack/_packer.pyx":364
5771 * This method is useful only when autoreset=False.
5772 * """
5773 * self.pk.length = 0 # <<<<<<<<<<<<<<
5774 *
5775 * def bytes(self):
5776 */
5777 __pyx_v_self->pk.length = 0;
5778
5779 /* "msgpack/_packer.pyx":359
5780 * return buf
5781 *
5782 * def reset(self): # <<<<<<<<<<<<<<
5783 * """Reset internal buffer.
5784 *
5785 */
5786
5787 /* function exit code */
5788 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5789 __Pyx_XGIVEREF(__pyx_r);
5790 __Pyx_RefNannyFinishContext();
5791 return __pyx_r;
5792 }
5793
5794 /* "msgpack/_packer.pyx":366
5795 * self.pk.length = 0
5796 *
5797 * def bytes(self): # <<<<<<<<<<<<<<
5798 * """Return internal buffer contents as bytes object"""
5799 * return PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5800 */
5801
5802 /* Python wrapper */
5803 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_19bytes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5804 static char __pyx_doc_7msgpack_9_cmsgpack_6Packer_18bytes[] = "Packer.bytes(self)\nReturn internal buffer contents as bytes object";
5805 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_19bytes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5806 PyObject *__pyx_r = 0;
5807 __Pyx_RefNannyDeclarations
5808 __Pyx_RefNannySetupContext("bytes (wrapper)", 0);
5809 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer_18bytes(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self));
5810
5811 /* function exit code */
5812 __Pyx_RefNannyFinishContext();
5813 return __pyx_r;
5814 }
5815
5816 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_18bytes(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self) {
5817 PyObject *__pyx_r = NULL;
5818 __Pyx_RefNannyDeclarations
5819 PyObject *__pyx_t_1 = NULL;
5820 int __pyx_lineno = 0;
5821 const char *__pyx_filename = NULL;
5822 int __pyx_clineno = 0;
5823 __Pyx_RefNannySetupContext("bytes", 0);
5824
5825 /* "msgpack/_packer.pyx":368
5826 * def bytes(self):
5827 * """Return internal buffer contents as bytes object"""
5828 * return PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) # <<<<<<<<<<<<<<
5829 *
5830 * def getbuffer(self):
5831 */
5832 __Pyx_XDECREF(__pyx_r);
5833 __pyx_t_1 = PyBytes_FromStringAndSize(__pyx_v_self->pk.buf, __pyx_v_self->pk.length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error)
5834 __Pyx_GOTREF(__pyx_t_1);
5835 __pyx_r = __pyx_t_1;
5836 __pyx_t_1 = 0;
5837 goto __pyx_L0;
5838
5839 /* "msgpack/_packer.pyx":366
5840 * self.pk.length = 0
5841 *
5842 * def bytes(self): # <<<<<<<<<<<<<<
5843 * """Return internal buffer contents as bytes object"""
5844 * return PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5845 */
5846
5847 /* function exit code */
5848 __pyx_L1_error:;
5849 __Pyx_XDECREF(__pyx_t_1);
5850 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
5851 __pyx_r = NULL;
5852 __pyx_L0:;
5853 __Pyx_XGIVEREF(__pyx_r);
5854 __Pyx_RefNannyFinishContext();
5855 return __pyx_r;
5856 }
5857
5858 /* "msgpack/_packer.pyx":370
5859 * return PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5860 *
5861 * def getbuffer(self): # <<<<<<<<<<<<<<
5862 * """Return view of internal buffer."""
5863 * return buff_to_buff(self.pk.buf, self.pk.length)
5864 */
5865
5866 /* Python wrapper */
5867 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_21getbuffer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5868 static char __pyx_doc_7msgpack_9_cmsgpack_6Packer_20getbuffer[] = "Packer.getbuffer(self)\nReturn view of internal buffer.";
5869 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_21getbuffer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5870 PyObject *__pyx_r = 0;
5871 __Pyx_RefNannyDeclarations
5872 __Pyx_RefNannySetupContext("getbuffer (wrapper)", 0);
5873 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer_20getbuffer(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self));
5874
5875 /* function exit code */
5876 __Pyx_RefNannyFinishContext();
5877 return __pyx_r;
5878 }
5879
5880 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_20getbuffer(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self) {
5881 PyObject *__pyx_r = NULL;
5882 __Pyx_RefNannyDeclarations
5883 PyObject *__pyx_t_1 = NULL;
5884 int __pyx_lineno = 0;
5885 const char *__pyx_filename = NULL;
5886 int __pyx_clineno = 0;
5887 __Pyx_RefNannySetupContext("getbuffer", 0);
5888
5889 /* "msgpack/_packer.pyx":372
5890 * def getbuffer(self):
5891 * """Return view of internal buffer."""
5892 * return buff_to_buff(self.pk.buf, self.pk.length) # <<<<<<<<<<<<<<
5893 */
5894 __Pyx_XDECREF(__pyx_r);
5895 __pyx_t_1 = buff_to_buff(__pyx_v_self->pk.buf, __pyx_v_self->pk.length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
5896 __Pyx_GOTREF(__pyx_t_1);
5897 __pyx_r = __pyx_t_1;
5898 __pyx_t_1 = 0;
5899 goto __pyx_L0;
5900
5901 /* "msgpack/_packer.pyx":370
5902 * return PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5903 *
5904 * def getbuffer(self): # <<<<<<<<<<<<<<
5905 * """Return view of internal buffer."""
5906 * return buff_to_buff(self.pk.buf, self.pk.length)
5907 */
5908
5909 /* function exit code */
5910 __pyx_L1_error:;
5911 __Pyx_XDECREF(__pyx_t_1);
5912 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.getbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
5913 __pyx_r = NULL;
5914 __pyx_L0:;
5915 __Pyx_XGIVEREF(__pyx_r);
5916 __Pyx_RefNannyFinishContext();
5917 return __pyx_r;
5918 }
5919
5920 /* "(tree fragment)":1
5921 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
5922 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5923 * def __setstate_cython__(self, __pyx_state):
5924 */
5925
5926 /* Python wrapper */
5927 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5928 static char __pyx_doc_7msgpack_9_cmsgpack_6Packer_22__reduce_cython__[] = "Packer.__reduce_cython__(self)";
5929 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5930 PyObject *__pyx_r = 0;
5931 __Pyx_RefNannyDeclarations
5932 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
5933 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer_22__reduce_cython__(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self));
5934
5935 /* function exit code */
5936 __Pyx_RefNannyFinishContext();
5937 return __pyx_r;
5938 }
5939
5940 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self) {
5941 PyObject *__pyx_r = NULL;
5942 __Pyx_RefNannyDeclarations
5943 PyObject *__pyx_t_1 = NULL;
5944 int __pyx_lineno = 0;
5945 const char *__pyx_filename = NULL;
5946 int __pyx_clineno = 0;
5947 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
5948
5949 /* "(tree fragment)":2
5950 * def __reduce_cython__(self):
5951 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
5952 * def __setstate_cython__(self, __pyx_state):
5953 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5954 */
5955 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
5956 __Pyx_GOTREF(__pyx_t_1);
5957 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5958 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5959 __PYX_ERR(2, 2, __pyx_L1_error)
5960
5961 /* "(tree fragment)":1
5962 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
5963 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5964 * def __setstate_cython__(self, __pyx_state):
5965 */
5966
5967 /* function exit code */
5968 __pyx_L1_error:;
5969 __Pyx_XDECREF(__pyx_t_1);
5970 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5971 __pyx_r = NULL;
5972 __Pyx_XGIVEREF(__pyx_r);
5973 __Pyx_RefNannyFinishContext();
5974 return __pyx_r;
5975 }
5976
5977 /* "(tree fragment)":3
5978 * def __reduce_cython__(self):
5979 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5980 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
5981 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5982 */
5983
5984 /* Python wrapper */
5985 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
5986 static char __pyx_doc_7msgpack_9_cmsgpack_6Packer_24__setstate_cython__[] = "Packer.__setstate_cython__(self, __pyx_state)";
5987 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_6Packer_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5988 PyObject *__pyx_r = 0;
5989 __Pyx_RefNannyDeclarations
5990 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
5991 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_6Packer_24__setstate_cython__(((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
5992
5993 /* function exit code */
5994 __Pyx_RefNannyFinishContext();
5995 return __pyx_r;
5996 }
5997
5998 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_6Packer_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7msgpack_9_cmsgpack_Packer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
5999 PyObject *__pyx_r = NULL;
6000 __Pyx_RefNannyDeclarations
6001 PyObject *__pyx_t_1 = NULL;
6002 int __pyx_lineno = 0;
6003 const char *__pyx_filename = NULL;
6004 int __pyx_clineno = 0;
6005 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
6006
6007 /* "(tree fragment)":4
6008 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6009 * def __setstate_cython__(self, __pyx_state):
6010 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
6011 */
6012 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
6013 __Pyx_GOTREF(__pyx_t_1);
6014 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6015 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6016 __PYX_ERR(2, 4, __pyx_L1_error)
6017
6018 /* "(tree fragment)":3
6019 * def __reduce_cython__(self):
6020 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6021 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
6022 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6023 */
6024
6025 /* function exit code */
6026 __pyx_L1_error:;
6027 __Pyx_XDECREF(__pyx_t_1);
6028 __Pyx_AddTraceback("msgpack._cmsgpack.Packer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6029 __pyx_r = NULL;
6030 __Pyx_XGIVEREF(__pyx_r);
6031 __Pyx_RefNannyFinishContext();
6032 return __pyx_r;
6033 }
6034
6035 /* "msgpack/_unpacker.pyx":60
6036 * void unpack_clear(unpack_context* ctx)
6037 *
6038 * cdef inline init_ctx(unpack_context *ctx, # <<<<<<<<<<<<<<
6039 * object object_hook, object object_pairs_hook,
6040 * object list_hook, object ext_hook,
6041 */
6042
6043 static CYTHON_INLINE PyObject *__pyx_f_7msgpack_9_cmsgpack_init_ctx(unpack_context *__pyx_v_ctx, PyObject *__pyx_v_object_hook, PyObject *__pyx_v_object_pairs_hook, PyObject *__pyx_v_list_hook, PyObject *__pyx_v_ext_hook, int __pyx_v_use_list, int __pyx_v_raw, int __pyx_v_timestamp, int __pyx_v_strict_map_key, char const *__pyx_v_unicode_errors, Py_ssize_t __pyx_v_max_str_len, Py_ssize_t __pyx_v_max_bin_len, Py_ssize_t __pyx_v_max_array_len, Py_ssize_t __pyx_v_max_map_len, Py_ssize_t __pyx_v_max_ext_len) {
6044 PyObject *__pyx_r = NULL;
6045 __Pyx_RefNannyDeclarations
6046 int __pyx_t_1;
6047 int __pyx_t_2;
6048 int __pyx_t_3;
6049 PyObject *__pyx_t_4 = NULL;
6050 int __pyx_lineno = 0;
6051 const char *__pyx_filename = NULL;
6052 int __pyx_clineno = 0;
6053 __Pyx_RefNannySetupContext("init_ctx", 0);
6054
6055 /* "msgpack/_unpacker.pyx":69
6056 * Py_ssize_t max_array_len, Py_ssize_t max_map_len,
6057 * Py_ssize_t max_ext_len):
6058 * unpack_init(ctx) # <<<<<<<<<<<<<<
6059 * ctx.user.use_list = use_list
6060 * ctx.user.raw = raw
6061 */
6062 unpack_init(__pyx_v_ctx);
6063
6064 /* "msgpack/_unpacker.pyx":70
6065 * Py_ssize_t max_ext_len):
6066 * unpack_init(ctx)
6067 * ctx.user.use_list = use_list # <<<<<<<<<<<<<<
6068 * ctx.user.raw = raw
6069 * ctx.user.strict_map_key = strict_map_key
6070 */
6071 __pyx_v_ctx->user.use_list = __pyx_v_use_list;
6072
6073 /* "msgpack/_unpacker.pyx":71
6074 * unpack_init(ctx)
6075 * ctx.user.use_list = use_list
6076 * ctx.user.raw = raw # <<<<<<<<<<<<<<
6077 * ctx.user.strict_map_key = strict_map_key
6078 * ctx.user.object_hook = ctx.user.list_hook = <PyObject*>NULL
6079 */
6080 __pyx_v_ctx->user.raw = __pyx_v_raw;
6081
6082 /* "msgpack/_unpacker.pyx":72
6083 * ctx.user.use_list = use_list
6084 * ctx.user.raw = raw
6085 * ctx.user.strict_map_key = strict_map_key # <<<<<<<<<<<<<<
6086 * ctx.user.object_hook = ctx.user.list_hook = <PyObject*>NULL
6087 * ctx.user.max_str_len = max_str_len
6088 */
6089 __pyx_v_ctx->user.strict_map_key = __pyx_v_strict_map_key;
6090
6091 /* "msgpack/_unpacker.pyx":73
6092 * ctx.user.raw = raw
6093 * ctx.user.strict_map_key = strict_map_key
6094 * ctx.user.object_hook = ctx.user.list_hook = <PyObject*>NULL # <<<<<<<<<<<<<<
6095 * ctx.user.max_str_len = max_str_len
6096 * ctx.user.max_bin_len = max_bin_len
6097 */
6098 __pyx_v_ctx->user.object_hook = ((PyObject *)NULL);
6099 __pyx_v_ctx->user.list_hook = ((PyObject *)NULL);
6100
6101 /* "msgpack/_unpacker.pyx":74
6102 * ctx.user.strict_map_key = strict_map_key
6103 * ctx.user.object_hook = ctx.user.list_hook = <PyObject*>NULL
6104 * ctx.user.max_str_len = max_str_len # <<<<<<<<<<<<<<
6105 * ctx.user.max_bin_len = max_bin_len
6106 * ctx.user.max_array_len = max_array_len
6107 */
6108 __pyx_v_ctx->user.max_str_len = __pyx_v_max_str_len;
6109
6110 /* "msgpack/_unpacker.pyx":75
6111 * ctx.user.object_hook = ctx.user.list_hook = <PyObject*>NULL
6112 * ctx.user.max_str_len = max_str_len
6113 * ctx.user.max_bin_len = max_bin_len # <<<<<<<<<<<<<<
6114 * ctx.user.max_array_len = max_array_len
6115 * ctx.user.max_map_len = max_map_len
6116 */
6117 __pyx_v_ctx->user.max_bin_len = __pyx_v_max_bin_len;
6118
6119 /* "msgpack/_unpacker.pyx":76
6120 * ctx.user.max_str_len = max_str_len
6121 * ctx.user.max_bin_len = max_bin_len
6122 * ctx.user.max_array_len = max_array_len # <<<<<<<<<<<<<<
6123 * ctx.user.max_map_len = max_map_len
6124 * ctx.user.max_ext_len = max_ext_len
6125 */
6126 __pyx_v_ctx->user.max_array_len = __pyx_v_max_array_len;
6127
6128 /* "msgpack/_unpacker.pyx":77
6129 * ctx.user.max_bin_len = max_bin_len
6130 * ctx.user.max_array_len = max_array_len
6131 * ctx.user.max_map_len = max_map_len # <<<<<<<<<<<<<<
6132 * ctx.user.max_ext_len = max_ext_len
6133 *
6134 */
6135 __pyx_v_ctx->user.max_map_len = __pyx_v_max_map_len;
6136
6137 /* "msgpack/_unpacker.pyx":78
6138 * ctx.user.max_array_len = max_array_len
6139 * ctx.user.max_map_len = max_map_len
6140 * ctx.user.max_ext_len = max_ext_len # <<<<<<<<<<<<<<
6141 *
6142 * if object_hook is not None and object_pairs_hook is not None:
6143 */
6144 __pyx_v_ctx->user.max_ext_len = __pyx_v_max_ext_len;
6145
6146 /* "msgpack/_unpacker.pyx":80
6147 * ctx.user.max_ext_len = max_ext_len
6148 *
6149 * if object_hook is not None and object_pairs_hook is not None: # <<<<<<<<<<<<<<
6150 * raise TypeError("object_pairs_hook and object_hook are mutually exclusive.")
6151 *
6152 */
6153 __pyx_t_2 = (__pyx_v_object_hook != Py_None);
6154 __pyx_t_3 = (__pyx_t_2 != 0);
6155 if (__pyx_t_3) {
6156 } else {
6157 __pyx_t_1 = __pyx_t_3;
6158 goto __pyx_L4_bool_binop_done;
6159 }
6160 __pyx_t_3 = (__pyx_v_object_pairs_hook != Py_None);
6161 __pyx_t_2 = (__pyx_t_3 != 0);
6162 __pyx_t_1 = __pyx_t_2;
6163 __pyx_L4_bool_binop_done:;
6164 if (unlikely(__pyx_t_1)) {
6165
6166 /* "msgpack/_unpacker.pyx":81
6167 *
6168 * if object_hook is not None and object_pairs_hook is not None:
6169 * raise TypeError("object_pairs_hook and object_hook are mutually exclusive.") # <<<<<<<<<<<<<<
6170 *
6171 * if object_hook is not None:
6172 */
6173 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 81, __pyx_L1_error)
6174 __Pyx_GOTREF(__pyx_t_4);
6175 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6176 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6177 __PYX_ERR(1, 81, __pyx_L1_error)
6178
6179 /* "msgpack/_unpacker.pyx":80
6180 * ctx.user.max_ext_len = max_ext_len
6181 *
6182 * if object_hook is not None and object_pairs_hook is not None: # <<<<<<<<<<<<<<
6183 * raise TypeError("object_pairs_hook and object_hook are mutually exclusive.")
6184 *
6185 */
6186 }
6187
6188 /* "msgpack/_unpacker.pyx":83
6189 * raise TypeError("object_pairs_hook and object_hook are mutually exclusive.")
6190 *
6191 * if object_hook is not None: # <<<<<<<<<<<<<<
6192 * if not PyCallable_Check(object_hook):
6193 * raise TypeError("object_hook must be a callable.")
6194 */
6195 __pyx_t_1 = (__pyx_v_object_hook != Py_None);
6196 __pyx_t_2 = (__pyx_t_1 != 0);
6197 if (__pyx_t_2) {
6198
6199 /* "msgpack/_unpacker.pyx":84
6200 *
6201 * if object_hook is not None:
6202 * if not PyCallable_Check(object_hook): # <<<<<<<<<<<<<<
6203 * raise TypeError("object_hook must be a callable.")
6204 * ctx.user.object_hook = <PyObject*>object_hook
6205 */
6206 __pyx_t_2 = ((!(PyCallable_Check(__pyx_v_object_hook) != 0)) != 0);
6207 if (unlikely(__pyx_t_2)) {
6208
6209 /* "msgpack/_unpacker.pyx":85
6210 * if object_hook is not None:
6211 * if not PyCallable_Check(object_hook):
6212 * raise TypeError("object_hook must be a callable.") # <<<<<<<<<<<<<<
6213 * ctx.user.object_hook = <PyObject*>object_hook
6214 *
6215 */
6216 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 85, __pyx_L1_error)
6217 __Pyx_GOTREF(__pyx_t_4);
6218 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6219 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6220 __PYX_ERR(1, 85, __pyx_L1_error)
6221
6222 /* "msgpack/_unpacker.pyx":84
6223 *
6224 * if object_hook is not None:
6225 * if not PyCallable_Check(object_hook): # <<<<<<<<<<<<<<
6226 * raise TypeError("object_hook must be a callable.")
6227 * ctx.user.object_hook = <PyObject*>object_hook
6228 */
6229 }
6230
6231 /* "msgpack/_unpacker.pyx":86
6232 * if not PyCallable_Check(object_hook):
6233 * raise TypeError("object_hook must be a callable.")
6234 * ctx.user.object_hook = <PyObject*>object_hook # <<<<<<<<<<<<<<
6235 *
6236 * if object_pairs_hook is None:
6237 */
6238 __pyx_v_ctx->user.object_hook = ((PyObject *)__pyx_v_object_hook);
6239
6240 /* "msgpack/_unpacker.pyx":83
6241 * raise TypeError("object_pairs_hook and object_hook are mutually exclusive.")
6242 *
6243 * if object_hook is not None: # <<<<<<<<<<<<<<
6244 * if not PyCallable_Check(object_hook):
6245 * raise TypeError("object_hook must be a callable.")
6246 */
6247 }
6248
6249 /* "msgpack/_unpacker.pyx":88
6250 * ctx.user.object_hook = <PyObject*>object_hook
6251 *
6252 * if object_pairs_hook is None: # <<<<<<<<<<<<<<
6253 * ctx.user.has_pairs_hook = False
6254 * else:
6255 */
6256 __pyx_t_2 = (__pyx_v_object_pairs_hook == Py_None);
6257 __pyx_t_1 = (__pyx_t_2 != 0);
6258 if (__pyx_t_1) {
6259
6260 /* "msgpack/_unpacker.pyx":89
6261 *
6262 * if object_pairs_hook is None:
6263 * ctx.user.has_pairs_hook = False # <<<<<<<<<<<<<<
6264 * else:
6265 * if not PyCallable_Check(object_pairs_hook):
6266 */
6267 __pyx_v_ctx->user.has_pairs_hook = 0;
6268
6269 /* "msgpack/_unpacker.pyx":88
6270 * ctx.user.object_hook = <PyObject*>object_hook
6271 *
6272 * if object_pairs_hook is None: # <<<<<<<<<<<<<<
6273 * ctx.user.has_pairs_hook = False
6274 * else:
6275 */
6276 goto __pyx_L8;
6277 }
6278
6279 /* "msgpack/_unpacker.pyx":91
6280 * ctx.user.has_pairs_hook = False
6281 * else:
6282 * if not PyCallable_Check(object_pairs_hook): # <<<<<<<<<<<<<<
6283 * raise TypeError("object_pairs_hook must be a callable.")
6284 * ctx.user.object_hook = <PyObject*>object_pairs_hook
6285 */
6286 /*else*/ {
6287 __pyx_t_1 = ((!(PyCallable_Check(__pyx_v_object_pairs_hook) != 0)) != 0);
6288 if (unlikely(__pyx_t_1)) {
6289
6290 /* "msgpack/_unpacker.pyx":92
6291 * else:
6292 * if not PyCallable_Check(object_pairs_hook):
6293 * raise TypeError("object_pairs_hook must be a callable.") # <<<<<<<<<<<<<<
6294 * ctx.user.object_hook = <PyObject*>object_pairs_hook
6295 * ctx.user.has_pairs_hook = True
6296 */
6297 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 92, __pyx_L1_error)
6298 __Pyx_GOTREF(__pyx_t_4);
6299 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6300 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6301 __PYX_ERR(1, 92, __pyx_L1_error)
6302
6303 /* "msgpack/_unpacker.pyx":91
6304 * ctx.user.has_pairs_hook = False
6305 * else:
6306 * if not PyCallable_Check(object_pairs_hook): # <<<<<<<<<<<<<<
6307 * raise TypeError("object_pairs_hook must be a callable.")
6308 * ctx.user.object_hook = <PyObject*>object_pairs_hook
6309 */
6310 }
6311
6312 /* "msgpack/_unpacker.pyx":93
6313 * if not PyCallable_Check(object_pairs_hook):
6314 * raise TypeError("object_pairs_hook must be a callable.")
6315 * ctx.user.object_hook = <PyObject*>object_pairs_hook # <<<<<<<<<<<<<<
6316 * ctx.user.has_pairs_hook = True
6317 *
6318 */
6319 __pyx_v_ctx->user.object_hook = ((PyObject *)__pyx_v_object_pairs_hook);
6320
6321 /* "msgpack/_unpacker.pyx":94
6322 * raise TypeError("object_pairs_hook must be a callable.")
6323 * ctx.user.object_hook = <PyObject*>object_pairs_hook
6324 * ctx.user.has_pairs_hook = True # <<<<<<<<<<<<<<
6325 *
6326 * if list_hook is not None:
6327 */
6328 __pyx_v_ctx->user.has_pairs_hook = 1;
6329 }
6330 __pyx_L8:;
6331
6332 /* "msgpack/_unpacker.pyx":96
6333 * ctx.user.has_pairs_hook = True
6334 *
6335 * if list_hook is not None: # <<<<<<<<<<<<<<
6336 * if not PyCallable_Check(list_hook):
6337 * raise TypeError("list_hook must be a callable.")
6338 */
6339 __pyx_t_1 = (__pyx_v_list_hook != Py_None);
6340 __pyx_t_2 = (__pyx_t_1 != 0);
6341 if (__pyx_t_2) {
6342
6343 /* "msgpack/_unpacker.pyx":97
6344 *
6345 * if list_hook is not None:
6346 * if not PyCallable_Check(list_hook): # <<<<<<<<<<<<<<
6347 * raise TypeError("list_hook must be a callable.")
6348 * ctx.user.list_hook = <PyObject*>list_hook
6349 */
6350 __pyx_t_2 = ((!(PyCallable_Check(__pyx_v_list_hook) != 0)) != 0);
6351 if (unlikely(__pyx_t_2)) {
6352
6353 /* "msgpack/_unpacker.pyx":98
6354 * if list_hook is not None:
6355 * if not PyCallable_Check(list_hook):
6356 * raise TypeError("list_hook must be a callable.") # <<<<<<<<<<<<<<
6357 * ctx.user.list_hook = <PyObject*>list_hook
6358 *
6359 */
6360 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 98, __pyx_L1_error)
6361 __Pyx_GOTREF(__pyx_t_4);
6362 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6363 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6364 __PYX_ERR(1, 98, __pyx_L1_error)
6365
6366 /* "msgpack/_unpacker.pyx":97
6367 *
6368 * if list_hook is not None:
6369 * if not PyCallable_Check(list_hook): # <<<<<<<<<<<<<<
6370 * raise TypeError("list_hook must be a callable.")
6371 * ctx.user.list_hook = <PyObject*>list_hook
6372 */
6373 }
6374
6375 /* "msgpack/_unpacker.pyx":99
6376 * if not PyCallable_Check(list_hook):
6377 * raise TypeError("list_hook must be a callable.")
6378 * ctx.user.list_hook = <PyObject*>list_hook # <<<<<<<<<<<<<<
6379 *
6380 * if ext_hook is not None:
6381 */
6382 __pyx_v_ctx->user.list_hook = ((PyObject *)__pyx_v_list_hook);
6383
6384 /* "msgpack/_unpacker.pyx":96
6385 * ctx.user.has_pairs_hook = True
6386 *
6387 * if list_hook is not None: # <<<<<<<<<<<<<<
6388 * if not PyCallable_Check(list_hook):
6389 * raise TypeError("list_hook must be a callable.")
6390 */
6391 }
6392
6393 /* "msgpack/_unpacker.pyx":101
6394 * ctx.user.list_hook = <PyObject*>list_hook
6395 *
6396 * if ext_hook is not None: # <<<<<<<<<<<<<<
6397 * if not PyCallable_Check(ext_hook):
6398 * raise TypeError("ext_hook must be a callable.")
6399 */
6400 __pyx_t_2 = (__pyx_v_ext_hook != Py_None);
6401 __pyx_t_1 = (__pyx_t_2 != 0);
6402 if (__pyx_t_1) {
6403
6404 /* "msgpack/_unpacker.pyx":102
6405 *
6406 * if ext_hook is not None:
6407 * if not PyCallable_Check(ext_hook): # <<<<<<<<<<<<<<
6408 * raise TypeError("ext_hook must be a callable.")
6409 * ctx.user.ext_hook = <PyObject*>ext_hook
6410 */
6411 __pyx_t_1 = ((!(PyCallable_Check(__pyx_v_ext_hook) != 0)) != 0);
6412 if (unlikely(__pyx_t_1)) {
6413
6414 /* "msgpack/_unpacker.pyx":103
6415 * if ext_hook is not None:
6416 * if not PyCallable_Check(ext_hook):
6417 * raise TypeError("ext_hook must be a callable.") # <<<<<<<<<<<<<<
6418 * ctx.user.ext_hook = <PyObject*>ext_hook
6419 *
6420 */
6421 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L1_error)
6422 __Pyx_GOTREF(__pyx_t_4);
6423 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6424 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6425 __PYX_ERR(1, 103, __pyx_L1_error)
6426
6427 /* "msgpack/_unpacker.pyx":102
6428 *
6429 * if ext_hook is not None:
6430 * if not PyCallable_Check(ext_hook): # <<<<<<<<<<<<<<
6431 * raise TypeError("ext_hook must be a callable.")
6432 * ctx.user.ext_hook = <PyObject*>ext_hook
6433 */
6434 }
6435
6436 /* "msgpack/_unpacker.pyx":104
6437 * if not PyCallable_Check(ext_hook):
6438 * raise TypeError("ext_hook must be a callable.")
6439 * ctx.user.ext_hook = <PyObject*>ext_hook # <<<<<<<<<<<<<<
6440 *
6441 * if timestamp < 0 or 3 < timestamp:
6442 */
6443 __pyx_v_ctx->user.ext_hook = ((PyObject *)__pyx_v_ext_hook);
6444
6445 /* "msgpack/_unpacker.pyx":101
6446 * ctx.user.list_hook = <PyObject*>list_hook
6447 *
6448 * if ext_hook is not None: # <<<<<<<<<<<<<<
6449 * if not PyCallable_Check(ext_hook):
6450 * raise TypeError("ext_hook must be a callable.")
6451 */
6452 }
6453
6454 /* "msgpack/_unpacker.pyx":106
6455 * ctx.user.ext_hook = <PyObject*>ext_hook
6456 *
6457 * if timestamp < 0 or 3 < timestamp: # <<<<<<<<<<<<<<
6458 * raise ValueError("timestamp must be 0..3")
6459 *
6460 */
6461 __pyx_t_2 = ((__pyx_v_timestamp < 0) != 0);
6462 if (!__pyx_t_2) {
6463 } else {
6464 __pyx_t_1 = __pyx_t_2;
6465 goto __pyx_L15_bool_binop_done;
6466 }
6467 __pyx_t_2 = ((3 < __pyx_v_timestamp) != 0);
6468 __pyx_t_1 = __pyx_t_2;
6469 __pyx_L15_bool_binop_done:;
6470 if (unlikely(__pyx_t_1)) {
6471
6472 /* "msgpack/_unpacker.pyx":107
6473 *
6474 * if timestamp < 0 or 3 < timestamp:
6475 * raise ValueError("timestamp must be 0..3") # <<<<<<<<<<<<<<
6476 *
6477 * # Add Timestamp type to the user object so it may be used in unpack.h
6478 */
6479 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 107, __pyx_L1_error)
6480 __Pyx_GOTREF(__pyx_t_4);
6481 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6482 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6483 __PYX_ERR(1, 107, __pyx_L1_error)
6484
6485 /* "msgpack/_unpacker.pyx":106
6486 * ctx.user.ext_hook = <PyObject*>ext_hook
6487 *
6488 * if timestamp < 0 or 3 < timestamp: # <<<<<<<<<<<<<<
6489 * raise ValueError("timestamp must be 0..3")
6490 *
6491 */
6492 }
6493
6494 /* "msgpack/_unpacker.pyx":110
6495 *
6496 * # Add Timestamp type to the user object so it may be used in unpack.h
6497 * ctx.user.timestamp = timestamp # <<<<<<<<<<<<<<
6498 * ctx.user.timestamp_t = <PyObject*>Timestamp
6499 * ctx.user.giga = <PyObject*>giga
6500 */
6501 __pyx_v_ctx->user.timestamp = __pyx_v_timestamp;
6502
6503 /* "msgpack/_unpacker.pyx":111
6504 * # Add Timestamp type to the user object so it may be used in unpack.h
6505 * ctx.user.timestamp = timestamp
6506 * ctx.user.timestamp_t = <PyObject*>Timestamp # <<<<<<<<<<<<<<
6507 * ctx.user.giga = <PyObject*>giga
6508 * ctx.user.utc = <PyObject*>utc
6509 */
6510 __pyx_v_ctx->user.timestamp_t = ((PyObject *)__pyx_v_7msgpack_9_cmsgpack_Timestamp);
6511
6512 /* "msgpack/_unpacker.pyx":112
6513 * ctx.user.timestamp = timestamp
6514 * ctx.user.timestamp_t = <PyObject*>Timestamp
6515 * ctx.user.giga = <PyObject*>giga # <<<<<<<<<<<<<<
6516 * ctx.user.utc = <PyObject*>utc
6517 * ctx.user.unicode_errors = unicode_errors
6518 */
6519 __pyx_v_ctx->user.giga = ((PyObject *)__pyx_v_7msgpack_9_cmsgpack_giga);
6520
6521 /* "msgpack/_unpacker.pyx":113
6522 * ctx.user.timestamp_t = <PyObject*>Timestamp
6523 * ctx.user.giga = <PyObject*>giga
6524 * ctx.user.utc = <PyObject*>utc # <<<<<<<<<<<<<<
6525 * ctx.user.unicode_errors = unicode_errors
6526 *
6527 */
6528 __pyx_v_ctx->user.utc = ((PyObject *)__pyx_v_7msgpack_9_cmsgpack_utc);
6529
6530 /* "msgpack/_unpacker.pyx":114
6531 * ctx.user.giga = <PyObject*>giga
6532 * ctx.user.utc = <PyObject*>utc
6533 * ctx.user.unicode_errors = unicode_errors # <<<<<<<<<<<<<<
6534 *
6535 * def default_read_extended_type(typecode, data):
6536 */
6537 __pyx_v_ctx->user.unicode_errors = __pyx_v_unicode_errors;
6538
6539 /* "msgpack/_unpacker.pyx":60
6540 * void unpack_clear(unpack_context* ctx)
6541 *
6542 * cdef inline init_ctx(unpack_context *ctx, # <<<<<<<<<<<<<<
6543 * object object_hook, object object_pairs_hook,
6544 * object list_hook, object ext_hook,
6545 */
6546
6547 /* function exit code */
6548 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6549 goto __pyx_L0;
6550 __pyx_L1_error:;
6551 __Pyx_XDECREF(__pyx_t_4);
6552 __Pyx_AddTraceback("msgpack._cmsgpack.init_ctx", __pyx_clineno, __pyx_lineno, __pyx_filename);
6553 __pyx_r = 0;
6554 __pyx_L0:;
6555 __Pyx_XGIVEREF(__pyx_r);
6556 __Pyx_RefNannyFinishContext();
6557 return __pyx_r;
6558 }
6559
6560 /* "msgpack/_unpacker.pyx":116
6561 * ctx.user.unicode_errors = unicode_errors
6562 *
6563 * def default_read_extended_type(typecode, data): # <<<<<<<<<<<<<<
6564 * raise NotImplementedError("Cannot decode extended type with typecode=%d" % typecode)
6565 *
6566 */
6567
6568 /* Python wrapper */
6569 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_1default_read_extended_type(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6570 static char __pyx_doc_7msgpack_9_cmsgpack_default_read_extended_type[] = "default_read_extended_type(typecode, data)";
6571 static PyMethodDef __pyx_mdef_7msgpack_9_cmsgpack_1default_read_extended_type = {"default_read_extended_type", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7msgpack_9_cmsgpack_1default_read_extended_type, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7msgpack_9_cmsgpack_default_read_extended_type};
6572 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_1default_read_extended_type(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6573 PyObject *__pyx_v_typecode = 0;
6574 CYTHON_UNUSED PyObject *__pyx_v_data = 0;
6575 int __pyx_lineno = 0;
6576 const char *__pyx_filename = NULL;
6577 int __pyx_clineno = 0;
6578 PyObject *__pyx_r = 0;
6579 __Pyx_RefNannyDeclarations
6580 __Pyx_RefNannySetupContext("default_read_extended_type (wrapper)", 0);
6581 {
6582 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_typecode,&__pyx_n_s_data,0};
6583 PyObject* values[2] = {0,0};
6584 if (unlikely(__pyx_kwds)) {
6585 Py_ssize_t kw_args;
6586 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6587 switch (pos_args) {
6588 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6589 CYTHON_FALLTHROUGH;
6590 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6591 CYTHON_FALLTHROUGH;
6592 case 0: break;
6593 default: goto __pyx_L5_argtuple_error;
6594 }
6595 kw_args = PyDict_Size(__pyx_kwds);
6596 switch (pos_args) {
6597 case 0:
6598 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typecode)) != 0)) kw_args--;
6599 else goto __pyx_L5_argtuple_error;
6600 CYTHON_FALLTHROUGH;
6601 case 1:
6602 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
6603 else {
6604 __Pyx_RaiseArgtupleInvalid("default_read_extended_type", 1, 2, 2, 1); __PYX_ERR(1, 116, __pyx_L3_error)
6605 }
6606 }
6607 if (unlikely(kw_args > 0)) {
6608 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_read_extended_type") < 0)) __PYX_ERR(1, 116, __pyx_L3_error)
6609 }
6610 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
6611 goto __pyx_L5_argtuple_error;
6612 } else {
6613 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6614 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6615 }
6616 __pyx_v_typecode = values[0];
6617 __pyx_v_data = values[1];
6618 }
6619 goto __pyx_L4_argument_unpacking_done;
6620 __pyx_L5_argtuple_error:;
6621 __Pyx_RaiseArgtupleInvalid("default_read_extended_type", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 116, __pyx_L3_error)
6622 __pyx_L3_error:;
6623 __Pyx_AddTraceback("msgpack._cmsgpack.default_read_extended_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
6624 __Pyx_RefNannyFinishContext();
6625 return NULL;
6626 __pyx_L4_argument_unpacking_done:;
6627 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_default_read_extended_type(__pyx_self, __pyx_v_typecode, __pyx_v_data);
6628
6629 /* function exit code */
6630 __Pyx_RefNannyFinishContext();
6631 return __pyx_r;
6632 }
6633
6634 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_default_read_extended_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_typecode, CYTHON_UNUSED PyObject *__pyx_v_data) {
6635 PyObject *__pyx_r = NULL;
6636 __Pyx_RefNannyDeclarations
6637 PyObject *__pyx_t_1 = NULL;
6638 PyObject *__pyx_t_2 = NULL;
6639 int __pyx_lineno = 0;
6640 const char *__pyx_filename = NULL;
6641 int __pyx_clineno = 0;
6642 __Pyx_RefNannySetupContext("default_read_extended_type", 0);
6643
6644 /* "msgpack/_unpacker.pyx":117
6645 *
6646 * def default_read_extended_type(typecode, data):
6647 * raise NotImplementedError("Cannot decode extended type with typecode=%d" % typecode) # <<<<<<<<<<<<<<
6648 *
6649 * cdef inline int get_data_from_buffer(object obj,
6650 */
6651 __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_Cannot_decode_extended_type_with, __pyx_v_typecode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 117, __pyx_L1_error)
6652 __Pyx_GOTREF(__pyx_t_1);
6653 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_NotImplementedError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 117, __pyx_L1_error)
6654 __Pyx_GOTREF(__pyx_t_2);
6655 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6656 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
6657 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6658 __PYX_ERR(1, 117, __pyx_L1_error)
6659
6660 /* "msgpack/_unpacker.pyx":116
6661 * ctx.user.unicode_errors = unicode_errors
6662 *
6663 * def default_read_extended_type(typecode, data): # <<<<<<<<<<<<<<
6664 * raise NotImplementedError("Cannot decode extended type with typecode=%d" % typecode)
6665 *
6666 */
6667
6668 /* function exit code */
6669 __pyx_L1_error:;
6670 __Pyx_XDECREF(__pyx_t_1);
6671 __Pyx_XDECREF(__pyx_t_2);
6672 __Pyx_AddTraceback("msgpack._cmsgpack.default_read_extended_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
6673 __pyx_r = NULL;
6674 __Pyx_XGIVEREF(__pyx_r);
6675 __Pyx_RefNannyFinishContext();
6676 return __pyx_r;
6677 }
6678
6679 /* "msgpack/_unpacker.pyx":119
6680 * raise NotImplementedError("Cannot decode extended type with typecode=%d" % typecode)
6681 *
6682 * cdef inline int get_data_from_buffer(object obj, # <<<<<<<<<<<<<<
6683 * Py_buffer *view,
6684 * char **buf,
6685 */
6686
6687 static CYTHON_INLINE int __pyx_f_7msgpack_9_cmsgpack_get_data_from_buffer(PyObject *__pyx_v_obj, Py_buffer *__pyx_v_view, char **__pyx_v_buf, Py_ssize_t *__pyx_v_buffer_len) {
6688 PyObject *__pyx_v_contiguous = 0;
6689 int __pyx_r;
6690 __Pyx_RefNannyDeclarations
6691 int __pyx_t_1;
6692 int __pyx_t_2;
6693 PyObject *__pyx_t_3 = NULL;
6694 Py_ssize_t __pyx_t_4;
6695 int __pyx_lineno = 0;
6696 const char *__pyx_filename = NULL;
6697 int __pyx_clineno = 0;
6698 __Pyx_RefNannySetupContext("get_data_from_buffer", 0);
6699
6700 /* "msgpack/_unpacker.pyx":125
6701 * cdef object contiguous
6702 * cdef Py_buffer tmp
6703 * if PyObject_GetBuffer(obj, view, PyBUF_FULL_RO) == -1: # <<<<<<<<<<<<<<
6704 * raise
6705 * if view.itemsize != 1:
6706 */
6707 __pyx_t_1 = PyObject_GetBuffer(__pyx_v_obj, __pyx_v_view, PyBUF_FULL_RO); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 125, __pyx_L1_error)
6708 __pyx_t_2 = ((__pyx_t_1 == -1L) != 0);
6709 if (unlikely(__pyx_t_2)) {
6710
6711 /* "msgpack/_unpacker.pyx":126
6712 * cdef Py_buffer tmp
6713 * if PyObject_GetBuffer(obj, view, PyBUF_FULL_RO) == -1:
6714 * raise # <<<<<<<<<<<<<<
6715 * if view.itemsize != 1:
6716 * PyBuffer_Release(view)
6717 */
6718 __Pyx_ReraiseException(); __PYX_ERR(1, 126, __pyx_L1_error)
6719
6720 /* "msgpack/_unpacker.pyx":125
6721 * cdef object contiguous
6722 * cdef Py_buffer tmp
6723 * if PyObject_GetBuffer(obj, view, PyBUF_FULL_RO) == -1: # <<<<<<<<<<<<<<
6724 * raise
6725 * if view.itemsize != 1:
6726 */
6727 }
6728
6729 /* "msgpack/_unpacker.pyx":127
6730 * if PyObject_GetBuffer(obj, view, PyBUF_FULL_RO) == -1:
6731 * raise
6732 * if view.itemsize != 1: # <<<<<<<<<<<<<<
6733 * PyBuffer_Release(view)
6734 * raise BufferError("cannot unpack from multi-byte object")
6735 */
6736 __pyx_t_2 = ((__pyx_v_view->itemsize != 1) != 0);
6737 if (unlikely(__pyx_t_2)) {
6738
6739 /* "msgpack/_unpacker.pyx":128
6740 * raise
6741 * if view.itemsize != 1:
6742 * PyBuffer_Release(view) # <<<<<<<<<<<<<<
6743 * raise BufferError("cannot unpack from multi-byte object")
6744 * if PyBuffer_IsContiguous(view, b'A') == 0:
6745 */
6746 PyBuffer_Release(__pyx_v_view);
6747
6748 /* "msgpack/_unpacker.pyx":129
6749 * if view.itemsize != 1:
6750 * PyBuffer_Release(view)
6751 * raise BufferError("cannot unpack from multi-byte object") # <<<<<<<<<<<<<<
6752 * if PyBuffer_IsContiguous(view, b'A') == 0:
6753 * PyBuffer_Release(view)
6754 */
6755 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_BufferError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 129, __pyx_L1_error)
6756 __Pyx_GOTREF(__pyx_t_3);
6757 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6758 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6759 __PYX_ERR(1, 129, __pyx_L1_error)
6760
6761 /* "msgpack/_unpacker.pyx":127
6762 * if PyObject_GetBuffer(obj, view, PyBUF_FULL_RO) == -1:
6763 * raise
6764 * if view.itemsize != 1: # <<<<<<<<<<<<<<
6765 * PyBuffer_Release(view)
6766 * raise BufferError("cannot unpack from multi-byte object")
6767 */
6768 }
6769
6770 /* "msgpack/_unpacker.pyx":130
6771 * PyBuffer_Release(view)
6772 * raise BufferError("cannot unpack from multi-byte object")
6773 * if PyBuffer_IsContiguous(view, b'A') == 0: # <<<<<<<<<<<<<<
6774 * PyBuffer_Release(view)
6775 * # create a contiguous copy and get buffer
6776 */
6777 __pyx_t_2 = ((PyBuffer_IsContiguous(__pyx_v_view, 'A') == 0) != 0);
6778 if (__pyx_t_2) {
6779
6780 /* "msgpack/_unpacker.pyx":131
6781 * raise BufferError("cannot unpack from multi-byte object")
6782 * if PyBuffer_IsContiguous(view, b'A') == 0:
6783 * PyBuffer_Release(view) # <<<<<<<<<<<<<<
6784 * # create a contiguous copy and get buffer
6785 * contiguous = PyMemoryView_GetContiguous(obj, PyBUF_READ, b'C')
6786 */
6787 PyBuffer_Release(__pyx_v_view);
6788
6789 /* "msgpack/_unpacker.pyx":133
6790 * PyBuffer_Release(view)
6791 * # create a contiguous copy and get buffer
6792 * contiguous = PyMemoryView_GetContiguous(obj, PyBUF_READ, b'C') # <<<<<<<<<<<<<<
6793 * PyObject_GetBuffer(contiguous, view, PyBUF_SIMPLE)
6794 * # view must hold the only reference to contiguous,
6795 */
6796 __pyx_t_3 = PyMemoryView_GetContiguous(__pyx_v_obj, PyBUF_READ, 'C'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
6797 __Pyx_GOTREF(__pyx_t_3);
6798 __pyx_v_contiguous = __pyx_t_3;
6799 __pyx_t_3 = 0;
6800
6801 /* "msgpack/_unpacker.pyx":134
6802 * # create a contiguous copy and get buffer
6803 * contiguous = PyMemoryView_GetContiguous(obj, PyBUF_READ, b'C')
6804 * PyObject_GetBuffer(contiguous, view, PyBUF_SIMPLE) # <<<<<<<<<<<<<<
6805 * # view must hold the only reference to contiguous,
6806 * # so memory is freed when view is released
6807 */
6808 __pyx_t_1 = PyObject_GetBuffer(__pyx_v_contiguous, __pyx_v_view, PyBUF_SIMPLE); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 134, __pyx_L1_error)
6809
6810 /* "msgpack/_unpacker.pyx":137
6811 * # view must hold the only reference to contiguous,
6812 * # so memory is freed when view is released
6813 * Py_DECREF(contiguous) # <<<<<<<<<<<<<<
6814 * buffer_len[0] = view.len
6815 * buf[0] = <char*> view.buf
6816 */
6817 Py_DECREF(__pyx_v_contiguous);
6818
6819 /* "msgpack/_unpacker.pyx":130
6820 * PyBuffer_Release(view)
6821 * raise BufferError("cannot unpack from multi-byte object")
6822 * if PyBuffer_IsContiguous(view, b'A') == 0: # <<<<<<<<<<<<<<
6823 * PyBuffer_Release(view)
6824 * # create a contiguous copy and get buffer
6825 */
6826 }
6827
6828 /* "msgpack/_unpacker.pyx":138
6829 * # so memory is freed when view is released
6830 * Py_DECREF(contiguous)
6831 * buffer_len[0] = view.len # <<<<<<<<<<<<<<
6832 * buf[0] = <char*> view.buf
6833 * return 1
6834 */
6835 __pyx_t_4 = __pyx_v_view->len;
6836 (__pyx_v_buffer_len[0]) = __pyx_t_4;
6837
6838 /* "msgpack/_unpacker.pyx":139
6839 * Py_DECREF(contiguous)
6840 * buffer_len[0] = view.len
6841 * buf[0] = <char*> view.buf # <<<<<<<<<<<<<<
6842 * return 1
6843 *
6844 */
6845 (__pyx_v_buf[0]) = ((char *)__pyx_v_view->buf);
6846
6847 /* "msgpack/_unpacker.pyx":140
6848 * buffer_len[0] = view.len
6849 * buf[0] = <char*> view.buf
6850 * return 1 # <<<<<<<<<<<<<<
6851 *
6852 *
6853 */
6854 __pyx_r = 1;
6855 goto __pyx_L0;
6856
6857 /* "msgpack/_unpacker.pyx":119
6858 * raise NotImplementedError("Cannot decode extended type with typecode=%d" % typecode)
6859 *
6860 * cdef inline int get_data_from_buffer(object obj, # <<<<<<<<<<<<<<
6861 * Py_buffer *view,
6862 * char **buf,
6863 */
6864
6865 /* function exit code */
6866 __pyx_L1_error:;
6867 __Pyx_XDECREF(__pyx_t_3);
6868 __Pyx_AddTraceback("msgpack._cmsgpack.get_data_from_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
6869 __pyx_r = 0;
6870 __pyx_L0:;
6871 __Pyx_XDECREF(__pyx_v_contiguous);
6872 __Pyx_RefNannyFinishContext();
6873 return __pyx_r;
6874 }
6875
6876 /* "msgpack/_unpacker.pyx":143
6877 *
6878 *
6879 * def unpackb(object packed, *, object object_hook=None, object list_hook=None, # <<<<<<<<<<<<<<
6880 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
6881 * unicode_errors=None,
6882 */
6883
6884 /* Python wrapper */
6885 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_3unpackb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6886 static char __pyx_doc_7msgpack_9_cmsgpack_2unpackb[] = "unpackb(packed, *, object_hook=None, list_hook=None, bool use_list=True, bool raw=False, int timestamp=0, bool strict_map_key=True, unicode_errors=None, object_pairs_hook=None, ext_hook=ExtType, Py_ssize_t max_str_len=-1, Py_ssize_t max_bin_len=-1, Py_ssize_t max_array_len=-1, Py_ssize_t max_map_len=-1, Py_ssize_t max_ext_len=-1)\n\n Unpack packed_bytes to object. Returns an unpacked object.\n\n Raises ``ExtraData`` when *packed* contains extra bytes.\n Raises ``ValueError`` when *packed* is incomplete.\n Raises ``FormatError`` when *packed* is not valid msgpack.\n Raises ``StackError`` when *packed* contains too nested.\n Other exceptions can be raised during unpacking.\n\n See :class:`Unpacker` for options.\n\n *max_xxx_len* options are configured automatically from ``len(packed)``.\n ";
6887 static PyMethodDef __pyx_mdef_7msgpack_9_cmsgpack_3unpackb = {"unpackb", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7msgpack_9_cmsgpack_3unpackb, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7msgpack_9_cmsgpack_2unpackb};
6888 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_3unpackb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6889 PyObject *__pyx_v_packed = 0;
6890 PyObject *__pyx_v_object_hook = 0;
6891 PyObject *__pyx_v_list_hook = 0;
6892 int __pyx_v_use_list;
6893 int __pyx_v_raw;
6894 int __pyx_v_timestamp;
6895 int __pyx_v_strict_map_key;
6896 PyObject *__pyx_v_unicode_errors = 0;
6897 PyObject *__pyx_v_object_pairs_hook = 0;
6898 PyObject *__pyx_v_ext_hook = 0;
6899 Py_ssize_t __pyx_v_max_str_len;
6900 Py_ssize_t __pyx_v_max_bin_len;
6901 Py_ssize_t __pyx_v_max_array_len;
6902 Py_ssize_t __pyx_v_max_map_len;
6903 Py_ssize_t __pyx_v_max_ext_len;
6904 int __pyx_lineno = 0;
6905 const char *__pyx_filename = NULL;
6906 int __pyx_clineno = 0;
6907 PyObject *__pyx_r = 0;
6908 __Pyx_RefNannyDeclarations
6909 __Pyx_RefNannySetupContext("unpackb (wrapper)", 0);
6910 {
6911 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_packed,&__pyx_n_s_object_hook,&__pyx_n_s_list_hook,&__pyx_n_s_use_list,&__pyx_n_s_raw,&__pyx_n_s_timestamp,&__pyx_n_s_strict_map_key,&__pyx_n_s_unicode_errors,&__pyx_n_s_object_pairs_hook,&__pyx_n_s_ext_hook,&__pyx_n_s_max_str_len,&__pyx_n_s_max_bin_len,&__pyx_n_s_max_array_len,&__pyx_n_s_max_map_len,&__pyx_n_s_max_ext_len,0};
6912 PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
6913 values[1] = ((PyObject *)Py_None);
6914 values[2] = ((PyObject *)Py_None);
6915
6916 /* "msgpack/_unpacker.pyx":145
6917 * def unpackb(object packed, *, object object_hook=None, object list_hook=None,
6918 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
6919 * unicode_errors=None, # <<<<<<<<<<<<<<
6920 * object_pairs_hook=None, ext_hook=ExtType,
6921 * Py_ssize_t max_str_len=-1,
6922 */
6923 values[7] = ((PyObject *)Py_None);
6924
6925 /* "msgpack/_unpacker.pyx":146
6926 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
6927 * unicode_errors=None,
6928 * object_pairs_hook=None, ext_hook=ExtType, # <<<<<<<<<<<<<<
6929 * Py_ssize_t max_str_len=-1,
6930 * Py_ssize_t max_bin_len=-1,
6931 */
6932 values[8] = ((PyObject *)Py_None);
6933 values[9] = __pyx_k__23;
6934 if (unlikely(__pyx_kwds)) {
6935 Py_ssize_t kw_args;
6936 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6937 switch (pos_args) {
6938 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6939 CYTHON_FALLTHROUGH;
6940 case 0: break;
6941 default: goto __pyx_L5_argtuple_error;
6942 }
6943 kw_args = PyDict_Size(__pyx_kwds);
6944 switch (pos_args) {
6945 case 0:
6946 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_packed)) != 0)) kw_args--;
6947 else goto __pyx_L5_argtuple_error;
6948 }
6949 if (kw_args > 0 && likely(kw_args <= 14)) {
6950 Py_ssize_t index;
6951 for (index = 1; index < 15 && kw_args > 0; index++) {
6952 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]);
6953 if (value) { values[index] = value; kw_args--; }
6954 }
6955 }
6956 if (unlikely(kw_args > 0)) {
6957 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unpackb") < 0)) __PYX_ERR(1, 143, __pyx_L3_error)
6958 }
6959 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
6960 goto __pyx_L5_argtuple_error;
6961 } else {
6962 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6963 }
6964 __pyx_v_packed = values[0];
6965 __pyx_v_object_hook = values[1];
6966 __pyx_v_list_hook = values[2];
6967 if (values[3]) {
6968 __pyx_v_use_list = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_use_list == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 144, __pyx_L3_error)
6969 } else {
6970
6971 /* "msgpack/_unpacker.pyx":144
6972 *
6973 * def unpackb(object packed, *, object object_hook=None, object list_hook=None,
6974 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True, # <<<<<<<<<<<<<<
6975 * unicode_errors=None,
6976 * object_pairs_hook=None, ext_hook=ExtType,
6977 */
6978 __pyx_v_use_list = ((int)1);
6979 }
6980 if (values[4]) {
6981 __pyx_v_raw = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_raw == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 144, __pyx_L3_error)
6982 } else {
6983 __pyx_v_raw = ((int)0);
6984 }
6985 if (values[5]) {
6986 __pyx_v_timestamp = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_timestamp == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 144, __pyx_L3_error)
6987 } else {
6988 __pyx_v_timestamp = ((int)0);
6989 }
6990 if (values[6]) {
6991 __pyx_v_strict_map_key = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_strict_map_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 144, __pyx_L3_error)
6992 } else {
6993 __pyx_v_strict_map_key = ((int)1);
6994 }
6995 __pyx_v_unicode_errors = values[7];
6996 __pyx_v_object_pairs_hook = values[8];
6997 __pyx_v_ext_hook = values[9];
6998 if (values[10]) {
6999 __pyx_v_max_str_len = __Pyx_PyIndex_AsSsize_t(values[10]); if (unlikely((__pyx_v_max_str_len == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L3_error)
7000 } else {
7001 __pyx_v_max_str_len = ((Py_ssize_t)-1L);
7002 }
7003 if (values[11]) {
7004 __pyx_v_max_bin_len = __Pyx_PyIndex_AsSsize_t(values[11]); if (unlikely((__pyx_v_max_bin_len == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 148, __pyx_L3_error)
7005 } else {
7006 __pyx_v_max_bin_len = ((Py_ssize_t)-1L);
7007 }
7008 if (values[12]) {
7009 __pyx_v_max_array_len = __Pyx_PyIndex_AsSsize_t(values[12]); if (unlikely((__pyx_v_max_array_len == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 149, __pyx_L3_error)
7010 } else {
7011 __pyx_v_max_array_len = ((Py_ssize_t)-1L);
7012 }
7013 if (values[13]) {
7014 __pyx_v_max_map_len = __Pyx_PyIndex_AsSsize_t(values[13]); if (unlikely((__pyx_v_max_map_len == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 150, __pyx_L3_error)
7015 } else {
7016 __pyx_v_max_map_len = ((Py_ssize_t)-1L);
7017 }
7018 if (values[14]) {
7019 __pyx_v_max_ext_len = __Pyx_PyIndex_AsSsize_t(values[14]); if (unlikely((__pyx_v_max_ext_len == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L3_error)
7020 } else {
7021 __pyx_v_max_ext_len = ((Py_ssize_t)-1L);
7022 }
7023 }
7024 goto __pyx_L4_argument_unpacking_done;
7025 __pyx_L5_argtuple_error:;
7026 __Pyx_RaiseArgtupleInvalid("unpackb", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 143, __pyx_L3_error)
7027 __pyx_L3_error:;
7028 __Pyx_AddTraceback("msgpack._cmsgpack.unpackb", __pyx_clineno, __pyx_lineno, __pyx_filename);
7029 __Pyx_RefNannyFinishContext();
7030 return NULL;
7031 __pyx_L4_argument_unpacking_done:;
7032 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_2unpackb(__pyx_self, __pyx_v_packed, __pyx_v_object_hook, __pyx_v_list_hook, __pyx_v_use_list, __pyx_v_raw, __pyx_v_timestamp, __pyx_v_strict_map_key, __pyx_v_unicode_errors, __pyx_v_object_pairs_hook, __pyx_v_ext_hook, __pyx_v_max_str_len, __pyx_v_max_bin_len, __pyx_v_max_array_len, __pyx_v_max_map_len, __pyx_v_max_ext_len);
7033
7034 /* "msgpack/_unpacker.pyx":143
7035 *
7036 *
7037 * def unpackb(object packed, *, object object_hook=None, object list_hook=None, # <<<<<<<<<<<<<<
7038 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
7039 * unicode_errors=None,
7040 */
7041
7042 /* function exit code */
7043 __Pyx_RefNannyFinishContext();
7044 return __pyx_r;
7045 }
7046
7047 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_2unpackb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_packed, PyObject *__pyx_v_object_hook, PyObject *__pyx_v_list_hook, int __pyx_v_use_list, int __pyx_v_raw, int __pyx_v_timestamp, int __pyx_v_strict_map_key, PyObject *__pyx_v_unicode_errors, PyObject *__pyx_v_object_pairs_hook, PyObject *__pyx_v_ext_hook, Py_ssize_t __pyx_v_max_str_len, Py_ssize_t __pyx_v_max_bin_len, Py_ssize_t __pyx_v_max_array_len, Py_ssize_t __pyx_v_max_map_len, Py_ssize_t __pyx_v_max_ext_len) {
7048 unpack_context __pyx_v_ctx;
7049 Py_ssize_t __pyx_v_off;
7050 int __pyx_v_ret;
7051 Py_buffer __pyx_v_view;
7052 char *__pyx_v_buf;
7053 Py_ssize_t __pyx_v_buf_len;
7054 char const *__pyx_v_cerr;
7055 PyObject *__pyx_v_obj = NULL;
7056 PyObject *__pyx_r = NULL;
7057 __Pyx_RefNannyDeclarations
7058 int __pyx_t_1;
7059 int __pyx_t_2;
7060 char const *__pyx_t_3;
7061 int __pyx_t_4;
7062 PyObject *__pyx_t_5 = NULL;
7063 int __pyx_t_6;
7064 char const *__pyx_t_7;
7065 PyObject *__pyx_t_8 = NULL;
7066 PyObject *__pyx_t_9 = NULL;
7067 PyObject *__pyx_t_10 = NULL;
7068 PyObject *__pyx_t_11 = NULL;
7069 PyObject *__pyx_t_12 = NULL;
7070 PyObject *__pyx_t_13 = NULL;
7071 PyObject *__pyx_t_14 = NULL;
7072 PyObject *__pyx_t_15 = NULL;
7073 PyObject *__pyx_t_16 = NULL;
7074 PyObject *__pyx_t_17 = NULL;
7075 int __pyx_lineno = 0;
7076 const char *__pyx_filename = NULL;
7077 int __pyx_clineno = 0;
7078 __Pyx_RefNannySetupContext("unpackb", 0);
7079
7080 /* "msgpack/_unpacker.pyx":166
7081 * """
7082 * cdef unpack_context ctx
7083 * cdef Py_ssize_t off = 0 # <<<<<<<<<<<<<<
7084 * cdef int ret
7085 *
7086 */
7087 __pyx_v_off = 0;
7088
7089 /* "msgpack/_unpacker.pyx":170
7090 *
7091 * cdef Py_buffer view
7092 * cdef char* buf = NULL # <<<<<<<<<<<<<<
7093 * cdef Py_ssize_t buf_len
7094 * cdef const char* cerr = NULL
7095 */
7096 __pyx_v_buf = NULL;
7097
7098 /* "msgpack/_unpacker.pyx":172
7099 * cdef char* buf = NULL
7100 * cdef Py_ssize_t buf_len
7101 * cdef const char* cerr = NULL # <<<<<<<<<<<<<<
7102 *
7103 * if unicode_errors is not None:
7104 */
7105 __pyx_v_cerr = NULL;
7106
7107 /* "msgpack/_unpacker.pyx":174
7108 * cdef const char* cerr = NULL
7109 *
7110 * if unicode_errors is not None: # <<<<<<<<<<<<<<
7111 * cerr = unicode_errors
7112 *
7113 */
7114 __pyx_t_1 = (__pyx_v_unicode_errors != Py_None);
7115 __pyx_t_2 = (__pyx_t_1 != 0);
7116 if (__pyx_t_2) {
7117
7118 /* "msgpack/_unpacker.pyx":175
7119 *
7120 * if unicode_errors is not None:
7121 * cerr = unicode_errors # <<<<<<<<<<<<<<
7122 *
7123 * get_data_from_buffer(packed, &view, &buf, &buf_len)
7124 */
7125 __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_unicode_errors); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(1, 175, __pyx_L1_error)
7126 __pyx_v_cerr = __pyx_t_3;
7127
7128 /* "msgpack/_unpacker.pyx":174
7129 * cdef const char* cerr = NULL
7130 *
7131 * if unicode_errors is not None: # <<<<<<<<<<<<<<
7132 * cerr = unicode_errors
7133 *
7134 */
7135 }
7136
7137 /* "msgpack/_unpacker.pyx":177
7138 * cerr = unicode_errors
7139 *
7140 * get_data_from_buffer(packed, &view, &buf, &buf_len) # <<<<<<<<<<<<<<
7141 *
7142 * if max_str_len == -1:
7143 */
7144 __pyx_t_4 = __pyx_f_7msgpack_9_cmsgpack_get_data_from_buffer(__pyx_v_packed, (&__pyx_v_view), (&__pyx_v_buf), (&__pyx_v_buf_len)); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(1, 177, __pyx_L1_error)
7145
7146 /* "msgpack/_unpacker.pyx":179
7147 * get_data_from_buffer(packed, &view, &buf, &buf_len)
7148 *
7149 * if max_str_len == -1: # <<<<<<<<<<<<<<
7150 * max_str_len = buf_len
7151 * if max_bin_len == -1:
7152 */
7153 __pyx_t_2 = ((__pyx_v_max_str_len == -1L) != 0);
7154 if (__pyx_t_2) {
7155
7156 /* "msgpack/_unpacker.pyx":180
7157 *
7158 * if max_str_len == -1:
7159 * max_str_len = buf_len # <<<<<<<<<<<<<<
7160 * if max_bin_len == -1:
7161 * max_bin_len = buf_len
7162 */
7163 __pyx_v_max_str_len = __pyx_v_buf_len;
7164
7165 /* "msgpack/_unpacker.pyx":179
7166 * get_data_from_buffer(packed, &view, &buf, &buf_len)
7167 *
7168 * if max_str_len == -1: # <<<<<<<<<<<<<<
7169 * max_str_len = buf_len
7170 * if max_bin_len == -1:
7171 */
7172 }
7173
7174 /* "msgpack/_unpacker.pyx":181
7175 * if max_str_len == -1:
7176 * max_str_len = buf_len
7177 * if max_bin_len == -1: # <<<<<<<<<<<<<<
7178 * max_bin_len = buf_len
7179 * if max_array_len == -1:
7180 */
7181 __pyx_t_2 = ((__pyx_v_max_bin_len == -1L) != 0);
7182 if (__pyx_t_2) {
7183
7184 /* "msgpack/_unpacker.pyx":182
7185 * max_str_len = buf_len
7186 * if max_bin_len == -1:
7187 * max_bin_len = buf_len # <<<<<<<<<<<<<<
7188 * if max_array_len == -1:
7189 * max_array_len = buf_len
7190 */
7191 __pyx_v_max_bin_len = __pyx_v_buf_len;
7192
7193 /* "msgpack/_unpacker.pyx":181
7194 * if max_str_len == -1:
7195 * max_str_len = buf_len
7196 * if max_bin_len == -1: # <<<<<<<<<<<<<<
7197 * max_bin_len = buf_len
7198 * if max_array_len == -1:
7199 */
7200 }
7201
7202 /* "msgpack/_unpacker.pyx":183
7203 * if max_bin_len == -1:
7204 * max_bin_len = buf_len
7205 * if max_array_len == -1: # <<<<<<<<<<<<<<
7206 * max_array_len = buf_len
7207 * if max_map_len == -1:
7208 */
7209 __pyx_t_2 = ((__pyx_v_max_array_len == -1L) != 0);
7210 if (__pyx_t_2) {
7211
7212 /* "msgpack/_unpacker.pyx":184
7213 * max_bin_len = buf_len
7214 * if max_array_len == -1:
7215 * max_array_len = buf_len # <<<<<<<<<<<<<<
7216 * if max_map_len == -1:
7217 * max_map_len = buf_len//2
7218 */
7219 __pyx_v_max_array_len = __pyx_v_buf_len;
7220
7221 /* "msgpack/_unpacker.pyx":183
7222 * if max_bin_len == -1:
7223 * max_bin_len = buf_len
7224 * if max_array_len == -1: # <<<<<<<<<<<<<<
7225 * max_array_len = buf_len
7226 * if max_map_len == -1:
7227 */
7228 }
7229
7230 /* "msgpack/_unpacker.pyx":185
7231 * if max_array_len == -1:
7232 * max_array_len = buf_len
7233 * if max_map_len == -1: # <<<<<<<<<<<<<<
7234 * max_map_len = buf_len//2
7235 * if max_ext_len == -1:
7236 */
7237 __pyx_t_2 = ((__pyx_v_max_map_len == -1L) != 0);
7238 if (__pyx_t_2) {
7239
7240 /* "msgpack/_unpacker.pyx":186
7241 * max_array_len = buf_len
7242 * if max_map_len == -1:
7243 * max_map_len = buf_len//2 # <<<<<<<<<<<<<<
7244 * if max_ext_len == -1:
7245 * max_ext_len = buf_len
7246 */
7247 __pyx_v_max_map_len = __Pyx_div_Py_ssize_t(__pyx_v_buf_len, 2);
7248
7249 /* "msgpack/_unpacker.pyx":185
7250 * if max_array_len == -1:
7251 * max_array_len = buf_len
7252 * if max_map_len == -1: # <<<<<<<<<<<<<<
7253 * max_map_len = buf_len//2
7254 * if max_ext_len == -1:
7255 */
7256 }
7257
7258 /* "msgpack/_unpacker.pyx":187
7259 * if max_map_len == -1:
7260 * max_map_len = buf_len//2
7261 * if max_ext_len == -1: # <<<<<<<<<<<<<<
7262 * max_ext_len = buf_len
7263 *
7264 */
7265 __pyx_t_2 = ((__pyx_v_max_ext_len == -1L) != 0);
7266 if (__pyx_t_2) {
7267
7268 /* "msgpack/_unpacker.pyx":188
7269 * max_map_len = buf_len//2
7270 * if max_ext_len == -1:
7271 * max_ext_len = buf_len # <<<<<<<<<<<<<<
7272 *
7273 * try:
7274 */
7275 __pyx_v_max_ext_len = __pyx_v_buf_len;
7276
7277 /* "msgpack/_unpacker.pyx":187
7278 * if max_map_len == -1:
7279 * max_map_len = buf_len//2
7280 * if max_ext_len == -1: # <<<<<<<<<<<<<<
7281 * max_ext_len = buf_len
7282 *
7283 */
7284 }
7285
7286 /* "msgpack/_unpacker.pyx":190
7287 * max_ext_len = buf_len
7288 *
7289 * try: # <<<<<<<<<<<<<<
7290 * init_ctx(&ctx, object_hook, object_pairs_hook, list_hook, ext_hook,
7291 * use_list, raw, timestamp, strict_map_key, cerr,
7292 */
7293 /*try:*/ {
7294
7295 /* "msgpack/_unpacker.pyx":191
7296 *
7297 * try:
7298 * init_ctx(&ctx, object_hook, object_pairs_hook, list_hook, ext_hook, # <<<<<<<<<<<<<<
7299 * use_list, raw, timestamp, strict_map_key, cerr,
7300 * max_str_len, max_bin_len, max_array_len, max_map_len, max_ext_len)
7301 */
7302 __pyx_t_5 = __pyx_f_7msgpack_9_cmsgpack_init_ctx((&__pyx_v_ctx), __pyx_v_object_hook, __pyx_v_object_pairs_hook, __pyx_v_list_hook, __pyx_v_ext_hook, __pyx_v_use_list, __pyx_v_raw, __pyx_v_timestamp, __pyx_v_strict_map_key, __pyx_v_cerr, __pyx_v_max_str_len, __pyx_v_max_bin_len, __pyx_v_max_array_len, __pyx_v_max_map_len, __pyx_v_max_ext_len); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 191, __pyx_L10_error)
7303 __Pyx_GOTREF(__pyx_t_5);
7304 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7305
7306 /* "msgpack/_unpacker.pyx":194
7307 * use_list, raw, timestamp, strict_map_key, cerr,
7308 * max_str_len, max_bin_len, max_array_len, max_map_len, max_ext_len)
7309 * ret = unpack_construct(&ctx, buf, buf_len, &off) # <<<<<<<<<<<<<<
7310 * finally:
7311 * PyBuffer_Release(&view);
7312 */
7313 __pyx_t_4 = unpack_construct((&__pyx_v_ctx), __pyx_v_buf, __pyx_v_buf_len, (&__pyx_v_off)); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(1, 194, __pyx_L10_error)
7314 __pyx_v_ret = __pyx_t_4;
7315 }
7316
7317 /* "msgpack/_unpacker.pyx":196
7318 * ret = unpack_construct(&ctx, buf, buf_len, &off)
7319 * finally:
7320 * PyBuffer_Release(&view); # <<<<<<<<<<<<<<
7321 *
7322 * if ret == 1:
7323 */
7324 /*finally:*/ {
7325 /*normal exit:*/{
7326 PyBuffer_Release((&__pyx_v_view));
7327 goto __pyx_L11;
7328 }
7329 __pyx_L10_error:;
7330 /*exception exit:*/{
7331 __Pyx_PyThreadState_declare
7332 __Pyx_PyThreadState_assign
7333 __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
7334 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7335 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
7336 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
7337 __Pyx_XGOTREF(__pyx_t_8);
7338 __Pyx_XGOTREF(__pyx_t_9);
7339 __Pyx_XGOTREF(__pyx_t_10);
7340 __Pyx_XGOTREF(__pyx_t_11);
7341 __Pyx_XGOTREF(__pyx_t_12);
7342 __Pyx_XGOTREF(__pyx_t_13);
7343 __pyx_t_4 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
7344 {
7345 PyBuffer_Release((&__pyx_v_view));
7346 }
7347 if (PY_MAJOR_VERSION >= 3) {
7348 __Pyx_XGIVEREF(__pyx_t_11);
7349 __Pyx_XGIVEREF(__pyx_t_12);
7350 __Pyx_XGIVEREF(__pyx_t_13);
7351 __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
7352 }
7353 __Pyx_XGIVEREF(__pyx_t_8);
7354 __Pyx_XGIVEREF(__pyx_t_9);
7355 __Pyx_XGIVEREF(__pyx_t_10);
7356 __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
7357 __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
7358 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
7359 goto __pyx_L1_error;
7360 }
7361 __pyx_L11:;
7362 }
7363
7364 /* "msgpack/_unpacker.pyx":198
7365 * PyBuffer_Release(&view);
7366 *
7367 * if ret == 1: # <<<<<<<<<<<<<<
7368 * obj = unpack_data(&ctx)
7369 * if off < buf_len:
7370 */
7371 __pyx_t_2 = ((__pyx_v_ret == 1) != 0);
7372 if (__pyx_t_2) {
7373
7374 /* "msgpack/_unpacker.pyx":199
7375 *
7376 * if ret == 1:
7377 * obj = unpack_data(&ctx) # <<<<<<<<<<<<<<
7378 * if off < buf_len:
7379 * raise ExtraData(obj, PyBytes_FromStringAndSize(buf+off, buf_len-off))
7380 */
7381 __pyx_t_5 = unpack_data((&__pyx_v_ctx)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 199, __pyx_L1_error)
7382 __Pyx_GOTREF(__pyx_t_5);
7383 __pyx_v_obj = __pyx_t_5;
7384 __pyx_t_5 = 0;
7385
7386 /* "msgpack/_unpacker.pyx":200
7387 * if ret == 1:
7388 * obj = unpack_data(&ctx)
7389 * if off < buf_len: # <<<<<<<<<<<<<<
7390 * raise ExtraData(obj, PyBytes_FromStringAndSize(buf+off, buf_len-off))
7391 * return obj
7392 */
7393 __pyx_t_2 = ((__pyx_v_off < __pyx_v_buf_len) != 0);
7394 if (unlikely(__pyx_t_2)) {
7395
7396 /* "msgpack/_unpacker.pyx":201
7397 * obj = unpack_data(&ctx)
7398 * if off < buf_len:
7399 * raise ExtraData(obj, PyBytes_FromStringAndSize(buf+off, buf_len-off)) # <<<<<<<<<<<<<<
7400 * return obj
7401 * unpack_clear(&ctx)
7402 */
7403 __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_ExtraData); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 201, __pyx_L1_error)
7404 __Pyx_GOTREF(__pyx_t_14);
7405 __pyx_t_15 = PyBytes_FromStringAndSize((__pyx_v_buf + __pyx_v_off), (__pyx_v_buf_len - __pyx_v_off)); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 201, __pyx_L1_error)
7406 __Pyx_GOTREF(__pyx_t_15);
7407 __pyx_t_16 = NULL;
7408 __pyx_t_6 = 0;
7409 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
7410 __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_14);
7411 if (likely(__pyx_t_16)) {
7412 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
7413 __Pyx_INCREF(__pyx_t_16);
7414 __Pyx_INCREF(function);
7415 __Pyx_DECREF_SET(__pyx_t_14, function);
7416 __pyx_t_6 = 1;
7417 }
7418 }
7419 #if CYTHON_FAST_PYCALL
7420 if (PyFunction_Check(__pyx_t_14)) {
7421 PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_v_obj, __pyx_t_15};
7422 __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 201, __pyx_L1_error)
7423 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
7424 __Pyx_GOTREF(__pyx_t_5);
7425 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7426 } else
7427 #endif
7428 #if CYTHON_FAST_PYCCALL
7429 if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
7430 PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_v_obj, __pyx_t_15};
7431 __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 201, __pyx_L1_error)
7432 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
7433 __Pyx_GOTREF(__pyx_t_5);
7434 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7435 } else
7436 #endif
7437 {
7438 __pyx_t_17 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 201, __pyx_L1_error)
7439 __Pyx_GOTREF(__pyx_t_17);
7440 if (__pyx_t_16) {
7441 __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16); __pyx_t_16 = NULL;
7442 }
7443 __Pyx_INCREF(__pyx_v_obj);
7444 __Pyx_GIVEREF(__pyx_v_obj);
7445 PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_6, __pyx_v_obj);
7446 __Pyx_GIVEREF(__pyx_t_15);
7447 PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_6, __pyx_t_15);
7448 __pyx_t_15 = 0;
7449 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_17, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 201, __pyx_L1_error)
7450 __Pyx_GOTREF(__pyx_t_5);
7451 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7452 }
7453 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7454 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
7455 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7456 __PYX_ERR(1, 201, __pyx_L1_error)
7457
7458 /* "msgpack/_unpacker.pyx":200
7459 * if ret == 1:
7460 * obj = unpack_data(&ctx)
7461 * if off < buf_len: # <<<<<<<<<<<<<<
7462 * raise ExtraData(obj, PyBytes_FromStringAndSize(buf+off, buf_len-off))
7463 * return obj
7464 */
7465 }
7466
7467 /* "msgpack/_unpacker.pyx":202
7468 * if off < buf_len:
7469 * raise ExtraData(obj, PyBytes_FromStringAndSize(buf+off, buf_len-off))
7470 * return obj # <<<<<<<<<<<<<<
7471 * unpack_clear(&ctx)
7472 * if ret == 0:
7473 */
7474 __Pyx_XDECREF(__pyx_r);
7475 __Pyx_INCREF(__pyx_v_obj);
7476 __pyx_r = __pyx_v_obj;
7477 goto __pyx_L0;
7478
7479 /* "msgpack/_unpacker.pyx":198
7480 * PyBuffer_Release(&view);
7481 *
7482 * if ret == 1: # <<<<<<<<<<<<<<
7483 * obj = unpack_data(&ctx)
7484 * if off < buf_len:
7485 */
7486 }
7487
7488 /* "msgpack/_unpacker.pyx":203
7489 * raise ExtraData(obj, PyBytes_FromStringAndSize(buf+off, buf_len-off))
7490 * return obj
7491 * unpack_clear(&ctx) # <<<<<<<<<<<<<<
7492 * if ret == 0:
7493 * raise ValueError("Unpack failed: incomplete input")
7494 */
7495 unpack_clear((&__pyx_v_ctx));
7496
7497 /* "msgpack/_unpacker.pyx":204
7498 * return obj
7499 * unpack_clear(&ctx)
7500 * if ret == 0: # <<<<<<<<<<<<<<
7501 * raise ValueError("Unpack failed: incomplete input")
7502 * elif ret == -2:
7503 */
7504 switch (__pyx_v_ret) {
7505 case 0:
7506
7507 /* "msgpack/_unpacker.pyx":205
7508 * unpack_clear(&ctx)
7509 * if ret == 0:
7510 * raise ValueError("Unpack failed: incomplete input") # <<<<<<<<<<<<<<
7511 * elif ret == -2:
7512 * raise FormatError
7513 */
7514 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 205, __pyx_L1_error)
7515 __Pyx_GOTREF(__pyx_t_5);
7516 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
7517 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7518 __PYX_ERR(1, 205, __pyx_L1_error)
7519
7520 /* "msgpack/_unpacker.pyx":204
7521 * return obj
7522 * unpack_clear(&ctx)
7523 * if ret == 0: # <<<<<<<<<<<<<<
7524 * raise ValueError("Unpack failed: incomplete input")
7525 * elif ret == -2:
7526 */
7527 break;
7528 case -2L:
7529
7530 /* "msgpack/_unpacker.pyx":207
7531 * raise ValueError("Unpack failed: incomplete input")
7532 * elif ret == -2:
7533 * raise FormatError # <<<<<<<<<<<<<<
7534 * elif ret == -3:
7535 * raise StackError
7536 */
7537 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_FormatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 207, __pyx_L1_error)
7538 __Pyx_GOTREF(__pyx_t_5);
7539 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
7540 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7541 __PYX_ERR(1, 207, __pyx_L1_error)
7542
7543 /* "msgpack/_unpacker.pyx":206
7544 * if ret == 0:
7545 * raise ValueError("Unpack failed: incomplete input")
7546 * elif ret == -2: # <<<<<<<<<<<<<<
7547 * raise FormatError
7548 * elif ret == -3:
7549 */
7550 break;
7551 case -3L:
7552
7553 /* "msgpack/_unpacker.pyx":209
7554 * raise FormatError
7555 * elif ret == -3:
7556 * raise StackError # <<<<<<<<<<<<<<
7557 * raise ValueError("Unpack failed: error = %d" % (ret,))
7558 *
7559 */
7560 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_StackError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 209, __pyx_L1_error)
7561 __Pyx_GOTREF(__pyx_t_5);
7562 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
7563 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7564 __PYX_ERR(1, 209, __pyx_L1_error)
7565
7566 /* "msgpack/_unpacker.pyx":208
7567 * elif ret == -2:
7568 * raise FormatError
7569 * elif ret == -3: # <<<<<<<<<<<<<<
7570 * raise StackError
7571 * raise ValueError("Unpack failed: error = %d" % (ret,))
7572 */
7573 break;
7574 default: break;
7575 }
7576
7577 /* "msgpack/_unpacker.pyx":210
7578 * elif ret == -3:
7579 * raise StackError
7580 * raise ValueError("Unpack failed: error = %d" % (ret,)) # <<<<<<<<<<<<<<
7581 *
7582 *
7583 */
7584 __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_ret, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 210, __pyx_L1_error)
7585 __Pyx_GOTREF(__pyx_t_5);
7586 __pyx_t_14 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unpack_failed_error, __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 210, __pyx_L1_error)
7587 __Pyx_GOTREF(__pyx_t_14);
7588 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7589 __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 210, __pyx_L1_error)
7590 __Pyx_GOTREF(__pyx_t_5);
7591 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7592 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
7593 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7594 __PYX_ERR(1, 210, __pyx_L1_error)
7595
7596 /* "msgpack/_unpacker.pyx":143
7597 *
7598 *
7599 * def unpackb(object packed, *, object object_hook=None, object list_hook=None, # <<<<<<<<<<<<<<
7600 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
7601 * unicode_errors=None,
7602 */
7603
7604 /* function exit code */
7605 __pyx_L1_error:;
7606 __Pyx_XDECREF(__pyx_t_5);
7607 __Pyx_XDECREF(__pyx_t_14);
7608 __Pyx_XDECREF(__pyx_t_15);
7609 __Pyx_XDECREF(__pyx_t_16);
7610 __Pyx_XDECREF(__pyx_t_17);
7611 __Pyx_AddTraceback("msgpack._cmsgpack.unpackb", __pyx_clineno, __pyx_lineno, __pyx_filename);
7612 __pyx_r = NULL;
7613 __pyx_L0:;
7614 __Pyx_XDECREF(__pyx_v_obj);
7615 __Pyx_XGIVEREF(__pyx_r);
7616 __Pyx_RefNannyFinishContext();
7617 return __pyx_r;
7618 }
7619
7620 /* "msgpack/_unpacker.pyx":320
7621 * cdef uint64_t stream_offset
7622 *
7623 * def __cinit__(self): # <<<<<<<<<<<<<<
7624 * self.buf = NULL
7625 *
7626 */
7627
7628 /* Python wrapper */
7629 static int __pyx_pw_7msgpack_9_cmsgpack_8Unpacker_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7630 static int __pyx_pw_7msgpack_9_cmsgpack_8Unpacker_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7631 int __pyx_r;
7632 __Pyx_RefNannyDeclarations
7633 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
7634 if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
7635 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
7636 if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
7637 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker___cinit__(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self));
7638
7639 /* function exit code */
7640 __Pyx_RefNannyFinishContext();
7641 return __pyx_r;
7642 }
7643
7644 static int __pyx_pf_7msgpack_9_cmsgpack_8Unpacker___cinit__(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self) {
7645 int __pyx_r;
7646 __Pyx_RefNannyDeclarations
7647 __Pyx_RefNannySetupContext("__cinit__", 0);
7648
7649 /* "msgpack/_unpacker.pyx":321
7650 *
7651 * def __cinit__(self):
7652 * self.buf = NULL # <<<<<<<<<<<<<<
7653 *
7654 * def __dealloc__(self):
7655 */
7656 __pyx_v_self->buf = NULL;
7657
7658 /* "msgpack/_unpacker.pyx":320
7659 * cdef uint64_t stream_offset
7660 *
7661 * def __cinit__(self): # <<<<<<<<<<<<<<
7662 * self.buf = NULL
7663 *
7664 */
7665
7666 /* function exit code */
7667 __pyx_r = 0;
7668 __Pyx_RefNannyFinishContext();
7669 return __pyx_r;
7670 }
7671
7672 /* "msgpack/_unpacker.pyx":323
7673 * self.buf = NULL
7674 *
7675 * def __dealloc__(self): # <<<<<<<<<<<<<<
7676 * PyMem_Free(self.buf)
7677 * self.buf = NULL
7678 */
7679
7680 /* Python wrapper */
7681 static void __pyx_pw_7msgpack_9_cmsgpack_8Unpacker_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
7682 static void __pyx_pw_7msgpack_9_cmsgpack_8Unpacker_3__dealloc__(PyObject *__pyx_v_self) {
7683 __Pyx_RefNannyDeclarations
7684 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
7685 __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_2__dealloc__(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self));
7686
7687 /* function exit code */
7688 __Pyx_RefNannyFinishContext();
7689 }
7690
7691 static void __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_2__dealloc__(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self) {
7692 __Pyx_RefNannyDeclarations
7693 __Pyx_RefNannySetupContext("__dealloc__", 0);
7694
7695 /* "msgpack/_unpacker.pyx":324
7696 *
7697 * def __dealloc__(self):
7698 * PyMem_Free(self.buf) # <<<<<<<<<<<<<<
7699 * self.buf = NULL
7700 *
7701 */
7702 PyMem_Free(__pyx_v_self->buf);
7703
7704 /* "msgpack/_unpacker.pyx":325
7705 * def __dealloc__(self):
7706 * PyMem_Free(self.buf)
7707 * self.buf = NULL # <<<<<<<<<<<<<<
7708 *
7709 * def __init__(self, file_like=None, *, Py_ssize_t read_size=0,
7710 */
7711 __pyx_v_self->buf = NULL;
7712
7713 /* "msgpack/_unpacker.pyx":323
7714 * self.buf = NULL
7715 *
7716 * def __dealloc__(self): # <<<<<<<<<<<<<<
7717 * PyMem_Free(self.buf)
7718 * self.buf = NULL
7719 */
7720
7721 /* function exit code */
7722 __Pyx_RefNannyFinishContext();
7723 }
7724
7725 /* "msgpack/_unpacker.pyx":327
7726 * self.buf = NULL
7727 *
7728 * def __init__(self, file_like=None, *, Py_ssize_t read_size=0, # <<<<<<<<<<<<<<
7729 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
7730 * object object_hook=None, object object_pairs_hook=None, object list_hook=None,
7731 */
7732
7733 /* Python wrapper */
7734 static int __pyx_pw_7msgpack_9_cmsgpack_8Unpacker_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7735 static int __pyx_pw_7msgpack_9_cmsgpack_8Unpacker_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7736 PyObject *__pyx_v_file_like = 0;
7737 Py_ssize_t __pyx_v_read_size;
7738 int __pyx_v_use_list;
7739 int __pyx_v_raw;
7740 int __pyx_v_timestamp;
7741 int __pyx_v_strict_map_key;
7742 PyObject *__pyx_v_object_hook = 0;
7743 PyObject *__pyx_v_object_pairs_hook = 0;
7744 PyObject *__pyx_v_list_hook = 0;
7745 PyObject *__pyx_v_unicode_errors = 0;
7746 Py_ssize_t __pyx_v_max_buffer_size;
7747 PyObject *__pyx_v_ext_hook = 0;
7748 Py_ssize_t __pyx_v_max_str_len;
7749 Py_ssize_t __pyx_v_max_bin_len;
7750 Py_ssize_t __pyx_v_max_array_len;
7751 Py_ssize_t __pyx_v_max_map_len;
7752 Py_ssize_t __pyx_v_max_ext_len;
7753 int __pyx_lineno = 0;
7754 const char *__pyx_filename = NULL;
7755 int __pyx_clineno = 0;
7756 int __pyx_r;
7757 __Pyx_RefNannyDeclarations
7758 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
7759 {
7760 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_file_like,&__pyx_n_s_read_size,&__pyx_n_s_use_list,&__pyx_n_s_raw,&__pyx_n_s_timestamp,&__pyx_n_s_strict_map_key,&__pyx_n_s_object_hook,&__pyx_n_s_object_pairs_hook,&__pyx_n_s_list_hook,&__pyx_n_s_unicode_errors,&__pyx_n_s_max_buffer_size,&__pyx_n_s_ext_hook,&__pyx_n_s_max_str_len,&__pyx_n_s_max_bin_len,&__pyx_n_s_max_array_len,&__pyx_n_s_max_map_len,&__pyx_n_s_max_ext_len,0};
7761 PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
7762 values[0] = ((PyObject *)Py_None);
7763
7764 /* "msgpack/_unpacker.pyx":329
7765 * def __init__(self, file_like=None, *, Py_ssize_t read_size=0,
7766 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
7767 * object object_hook=None, object object_pairs_hook=None, object list_hook=None, # <<<<<<<<<<<<<<
7768 * unicode_errors=None, Py_ssize_t max_buffer_size=100*1024*1024,
7769 * object ext_hook=ExtType,
7770 */
7771 values[6] = ((PyObject *)Py_None);
7772 values[7] = ((PyObject *)Py_None);
7773 values[8] = ((PyObject *)Py_None);
7774
7775 /* "msgpack/_unpacker.pyx":330
7776 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
7777 * object object_hook=None, object object_pairs_hook=None, object list_hook=None,
7778 * unicode_errors=None, Py_ssize_t max_buffer_size=100*1024*1024, # <<<<<<<<<<<<<<
7779 * object ext_hook=ExtType,
7780 * Py_ssize_t max_str_len=-1,
7781 */
7782 values[9] = ((PyObject *)Py_None);
7783 values[11] = __pyx_k__25;
7784 if (unlikely(__pyx_kwds)) {
7785 Py_ssize_t kw_args;
7786 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7787 switch (pos_args) {
7788 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7789 CYTHON_FALLTHROUGH;
7790 case 0: break;
7791 default: goto __pyx_L5_argtuple_error;
7792 }
7793 kw_args = PyDict_Size(__pyx_kwds);
7794 switch (pos_args) {
7795 case 0:
7796 if (kw_args > 0) {
7797 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file_like);
7798 if (value) { values[0] = value; kw_args--; }
7799 }
7800 }
7801 if (kw_args > 0 && likely(kw_args <= 16)) {
7802 Py_ssize_t index;
7803 for (index = 1; index < 17 && kw_args > 0; index++) {
7804 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]);
7805 if (value) { values[index] = value; kw_args--; }
7806 }
7807 }
7808 if (unlikely(kw_args > 0)) {
7809 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 327, __pyx_L3_error)
7810 }
7811 } else {
7812 switch (PyTuple_GET_SIZE(__pyx_args)) {
7813 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7814 CYTHON_FALLTHROUGH;
7815 case 0: break;
7816 default: goto __pyx_L5_argtuple_error;
7817 }
7818 }
7819 __pyx_v_file_like = values[0];
7820 if (values[1]) {
7821 __pyx_v_read_size = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_read_size == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 327, __pyx_L3_error)
7822 } else {
7823 __pyx_v_read_size = ((Py_ssize_t)0);
7824 }
7825 if (values[2]) {
7826 __pyx_v_use_list = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_use_list == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 328, __pyx_L3_error)
7827 } else {
7828
7829 /* "msgpack/_unpacker.pyx":328
7830 *
7831 * def __init__(self, file_like=None, *, Py_ssize_t read_size=0,
7832 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True, # <<<<<<<<<<<<<<
7833 * object object_hook=None, object object_pairs_hook=None, object list_hook=None,
7834 * unicode_errors=None, Py_ssize_t max_buffer_size=100*1024*1024,
7835 */
7836 __pyx_v_use_list = ((int)1);
7837 }
7838 if (values[3]) {
7839 __pyx_v_raw = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_raw == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 328, __pyx_L3_error)
7840 } else {
7841 __pyx_v_raw = ((int)0);
7842 }
7843 if (values[4]) {
7844 __pyx_v_timestamp = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_timestamp == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 328, __pyx_L3_error)
7845 } else {
7846 __pyx_v_timestamp = ((int)0);
7847 }
7848 if (values[5]) {
7849 __pyx_v_strict_map_key = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_strict_map_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 328, __pyx_L3_error)
7850 } else {
7851 __pyx_v_strict_map_key = ((int)1);
7852 }
7853 __pyx_v_object_hook = values[6];
7854 __pyx_v_object_pairs_hook = values[7];
7855 __pyx_v_list_hook = values[8];
7856 __pyx_v_unicode_errors = values[9];
7857 if (values[10]) {
7858 __pyx_v_max_buffer_size = __Pyx_PyIndex_AsSsize_t(values[10]); if (unlikely((__pyx_v_max_buffer_size == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 330, __pyx_L3_error)
7859 } else {
7860 __pyx_v_max_buffer_size = ((Py_ssize_t)0x6400000);
7861 }
7862 __pyx_v_ext_hook = values[11];
7863 if (values[12]) {
7864 __pyx_v_max_str_len = __Pyx_PyIndex_AsSsize_t(values[12]); if (unlikely((__pyx_v_max_str_len == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 332, __pyx_L3_error)
7865 } else {
7866 __pyx_v_max_str_len = ((Py_ssize_t)-1L);
7867 }
7868 if (values[13]) {
7869 __pyx_v_max_bin_len = __Pyx_PyIndex_AsSsize_t(values[13]); if (unlikely((__pyx_v_max_bin_len == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 333, __pyx_L3_error)
7870 } else {
7871 __pyx_v_max_bin_len = ((Py_ssize_t)-1L);
7872 }
7873 if (values[14]) {
7874 __pyx_v_max_array_len = __Pyx_PyIndex_AsSsize_t(values[14]); if (unlikely((__pyx_v_max_array_len == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 334, __pyx_L3_error)
7875 } else {
7876 __pyx_v_max_array_len = ((Py_ssize_t)-1L);
7877 }
7878 if (values[15]) {
7879 __pyx_v_max_map_len = __Pyx_PyIndex_AsSsize_t(values[15]); if (unlikely((__pyx_v_max_map_len == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 335, __pyx_L3_error)
7880 } else {
7881 __pyx_v_max_map_len = ((Py_ssize_t)-1L);
7882 }
7883 if (values[16]) {
7884 __pyx_v_max_ext_len = __Pyx_PyIndex_AsSsize_t(values[16]); if (unlikely((__pyx_v_max_ext_len == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 336, __pyx_L3_error)
7885 } else {
7886 __pyx_v_max_ext_len = ((Py_ssize_t)-1L);
7887 }
7888 }
7889 goto __pyx_L4_argument_unpacking_done;
7890 __pyx_L5_argtuple_error:;
7891 __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 327, __pyx_L3_error)
7892 __pyx_L3_error:;
7893 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7894 __Pyx_RefNannyFinishContext();
7895 return -1;
7896 __pyx_L4_argument_unpacking_done:;
7897 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_4__init__(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self), __pyx_v_file_like, __pyx_v_read_size, __pyx_v_use_list, __pyx_v_raw, __pyx_v_timestamp, __pyx_v_strict_map_key, __pyx_v_object_hook, __pyx_v_object_pairs_hook, __pyx_v_list_hook, __pyx_v_unicode_errors, __pyx_v_max_buffer_size, __pyx_v_ext_hook, __pyx_v_max_str_len, __pyx_v_max_bin_len, __pyx_v_max_array_len, __pyx_v_max_map_len, __pyx_v_max_ext_len);
7898
7899 /* "msgpack/_unpacker.pyx":327
7900 * self.buf = NULL
7901 *
7902 * def __init__(self, file_like=None, *, Py_ssize_t read_size=0, # <<<<<<<<<<<<<<
7903 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
7904 * object object_hook=None, object object_pairs_hook=None, object list_hook=None,
7905 */
7906
7907 /* function exit code */
7908 __Pyx_RefNannyFinishContext();
7909 return __pyx_r;
7910 }
7911
7912 static int __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_4__init__(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, PyObject *__pyx_v_file_like, Py_ssize_t __pyx_v_read_size, int __pyx_v_use_list, int __pyx_v_raw, int __pyx_v_timestamp, int __pyx_v_strict_map_key, PyObject *__pyx_v_object_hook, PyObject *__pyx_v_object_pairs_hook, PyObject *__pyx_v_list_hook, PyObject *__pyx_v_unicode_errors, Py_ssize_t __pyx_v_max_buffer_size, PyObject *__pyx_v_ext_hook, Py_ssize_t __pyx_v_max_str_len, Py_ssize_t __pyx_v_max_bin_len, Py_ssize_t __pyx_v_max_array_len, Py_ssize_t __pyx_v_max_map_len, Py_ssize_t __pyx_v_max_ext_len) {
7913 char const *__pyx_v_cerr;
7914 int __pyx_r;
7915 __Pyx_RefNannyDeclarations
7916 int __pyx_t_1;
7917 PyObject *__pyx_t_2 = NULL;
7918 long __pyx_t_3;
7919 Py_ssize_t __pyx_t_4;
7920 Py_ssize_t __pyx_t_5;
7921 int __pyx_t_6;
7922 char const *__pyx_t_7;
7923 int __pyx_lineno = 0;
7924 const char *__pyx_filename = NULL;
7925 int __pyx_clineno = 0;
7926 __Pyx_RefNannySetupContext("__init__", 0);
7927
7928 /* "msgpack/_unpacker.pyx":337
7929 * Py_ssize_t max_map_len=-1,
7930 * Py_ssize_t max_ext_len=-1):
7931 * cdef const char *cerr=NULL # <<<<<<<<<<<<<<
7932 *
7933 * self.object_hook = object_hook
7934 */
7935 __pyx_v_cerr = NULL;
7936
7937 /* "msgpack/_unpacker.pyx":339
7938 * cdef const char *cerr=NULL
7939 *
7940 * self.object_hook = object_hook # <<<<<<<<<<<<<<
7941 * self.object_pairs_hook = object_pairs_hook
7942 * self.list_hook = list_hook
7943 */
7944 __Pyx_INCREF(__pyx_v_object_hook);
7945 __Pyx_GIVEREF(__pyx_v_object_hook);
7946 __Pyx_GOTREF(__pyx_v_self->object_hook);
7947 __Pyx_DECREF(__pyx_v_self->object_hook);
7948 __pyx_v_self->object_hook = __pyx_v_object_hook;
7949
7950 /* "msgpack/_unpacker.pyx":340
7951 *
7952 * self.object_hook = object_hook
7953 * self.object_pairs_hook = object_pairs_hook # <<<<<<<<<<<<<<
7954 * self.list_hook = list_hook
7955 * self.ext_hook = ext_hook
7956 */
7957 __Pyx_INCREF(__pyx_v_object_pairs_hook);
7958 __Pyx_GIVEREF(__pyx_v_object_pairs_hook);
7959 __Pyx_GOTREF(__pyx_v_self->object_pairs_hook);
7960 __Pyx_DECREF(__pyx_v_self->object_pairs_hook);
7961 __pyx_v_self->object_pairs_hook = __pyx_v_object_pairs_hook;
7962
7963 /* "msgpack/_unpacker.pyx":341
7964 * self.object_hook = object_hook
7965 * self.object_pairs_hook = object_pairs_hook
7966 * self.list_hook = list_hook # <<<<<<<<<<<<<<
7967 * self.ext_hook = ext_hook
7968 *
7969 */
7970 __Pyx_INCREF(__pyx_v_list_hook);
7971 __Pyx_GIVEREF(__pyx_v_list_hook);
7972 __Pyx_GOTREF(__pyx_v_self->list_hook);
7973 __Pyx_DECREF(__pyx_v_self->list_hook);
7974 __pyx_v_self->list_hook = __pyx_v_list_hook;
7975
7976 /* "msgpack/_unpacker.pyx":342
7977 * self.object_pairs_hook = object_pairs_hook
7978 * self.list_hook = list_hook
7979 * self.ext_hook = ext_hook # <<<<<<<<<<<<<<
7980 *
7981 * self.file_like = file_like
7982 */
7983 __Pyx_INCREF(__pyx_v_ext_hook);
7984 __Pyx_GIVEREF(__pyx_v_ext_hook);
7985 __Pyx_GOTREF(__pyx_v_self->ext_hook);
7986 __Pyx_DECREF(__pyx_v_self->ext_hook);
7987 __pyx_v_self->ext_hook = __pyx_v_ext_hook;
7988
7989 /* "msgpack/_unpacker.pyx":344
7990 * self.ext_hook = ext_hook
7991 *
7992 * self.file_like = file_like # <<<<<<<<<<<<<<
7993 * if file_like:
7994 * self.file_like_read = file_like.read
7995 */
7996 __Pyx_INCREF(__pyx_v_file_like);
7997 __Pyx_GIVEREF(__pyx_v_file_like);
7998 __Pyx_GOTREF(__pyx_v_self->file_like);
7999 __Pyx_DECREF(__pyx_v_self->file_like);
8000 __pyx_v_self->file_like = __pyx_v_file_like;
8001
8002 /* "msgpack/_unpacker.pyx":345
8003 *
8004 * self.file_like = file_like
8005 * if file_like: # <<<<<<<<<<<<<<
8006 * self.file_like_read = file_like.read
8007 * if not PyCallable_Check(self.file_like_read):
8008 */
8009 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_file_like); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 345, __pyx_L1_error)
8010 if (__pyx_t_1) {
8011
8012 /* "msgpack/_unpacker.pyx":346
8013 * self.file_like = file_like
8014 * if file_like:
8015 * self.file_like_read = file_like.read # <<<<<<<<<<<<<<
8016 * if not PyCallable_Check(self.file_like_read):
8017 * raise TypeError("`file_like.read` must be a callable.")
8018 */
8019 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_file_like, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 346, __pyx_L1_error)
8020 __Pyx_GOTREF(__pyx_t_2);
8021 __Pyx_GIVEREF(__pyx_t_2);
8022 __Pyx_GOTREF(__pyx_v_self->file_like_read);
8023 __Pyx_DECREF(__pyx_v_self->file_like_read);
8024 __pyx_v_self->file_like_read = __pyx_t_2;
8025 __pyx_t_2 = 0;
8026
8027 /* "msgpack/_unpacker.pyx":347
8028 * if file_like:
8029 * self.file_like_read = file_like.read
8030 * if not PyCallable_Check(self.file_like_read): # <<<<<<<<<<<<<<
8031 * raise TypeError("`file_like.read` must be a callable.")
8032 *
8033 */
8034 __pyx_t_2 = __pyx_v_self->file_like_read;
8035 __Pyx_INCREF(__pyx_t_2);
8036 __pyx_t_1 = ((!(PyCallable_Check(__pyx_t_2) != 0)) != 0);
8037 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8038 if (unlikely(__pyx_t_1)) {
8039
8040 /* "msgpack/_unpacker.pyx":348
8041 * self.file_like_read = file_like.read
8042 * if not PyCallable_Check(self.file_like_read):
8043 * raise TypeError("`file_like.read` must be a callable.") # <<<<<<<<<<<<<<
8044 *
8045 * if not max_buffer_size:
8046 */
8047 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 348, __pyx_L1_error)
8048 __Pyx_GOTREF(__pyx_t_2);
8049 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8050 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8051 __PYX_ERR(1, 348, __pyx_L1_error)
8052
8053 /* "msgpack/_unpacker.pyx":347
8054 * if file_like:
8055 * self.file_like_read = file_like.read
8056 * if not PyCallable_Check(self.file_like_read): # <<<<<<<<<<<<<<
8057 * raise TypeError("`file_like.read` must be a callable.")
8058 *
8059 */
8060 }
8061
8062 /* "msgpack/_unpacker.pyx":345
8063 *
8064 * self.file_like = file_like
8065 * if file_like: # <<<<<<<<<<<<<<
8066 * self.file_like_read = file_like.read
8067 * if not PyCallable_Check(self.file_like_read):
8068 */
8069 }
8070
8071 /* "msgpack/_unpacker.pyx":350
8072 * raise TypeError("`file_like.read` must be a callable.")
8073 *
8074 * if not max_buffer_size: # <<<<<<<<<<<<<<
8075 * max_buffer_size = INT_MAX
8076 * if max_str_len == -1:
8077 */
8078 __pyx_t_1 = ((!(__pyx_v_max_buffer_size != 0)) != 0);
8079 if (__pyx_t_1) {
8080
8081 /* "msgpack/_unpacker.pyx":351
8082 *
8083 * if not max_buffer_size:
8084 * max_buffer_size = INT_MAX # <<<<<<<<<<<<<<
8085 * if max_str_len == -1:
8086 * max_str_len = max_buffer_size
8087 */
8088 __pyx_v_max_buffer_size = INT_MAX;
8089
8090 /* "msgpack/_unpacker.pyx":350
8091 * raise TypeError("`file_like.read` must be a callable.")
8092 *
8093 * if not max_buffer_size: # <<<<<<<<<<<<<<
8094 * max_buffer_size = INT_MAX
8095 * if max_str_len == -1:
8096 */
8097 }
8098
8099 /* "msgpack/_unpacker.pyx":352
8100 * if not max_buffer_size:
8101 * max_buffer_size = INT_MAX
8102 * if max_str_len == -1: # <<<<<<<<<<<<<<
8103 * max_str_len = max_buffer_size
8104 * if max_bin_len == -1:
8105 */
8106 __pyx_t_1 = ((__pyx_v_max_str_len == -1L) != 0);
8107 if (__pyx_t_1) {
8108
8109 /* "msgpack/_unpacker.pyx":353
8110 * max_buffer_size = INT_MAX
8111 * if max_str_len == -1:
8112 * max_str_len = max_buffer_size # <<<<<<<<<<<<<<
8113 * if max_bin_len == -1:
8114 * max_bin_len = max_buffer_size
8115 */
8116 __pyx_v_max_str_len = __pyx_v_max_buffer_size;
8117
8118 /* "msgpack/_unpacker.pyx":352
8119 * if not max_buffer_size:
8120 * max_buffer_size = INT_MAX
8121 * if max_str_len == -1: # <<<<<<<<<<<<<<
8122 * max_str_len = max_buffer_size
8123 * if max_bin_len == -1:
8124 */
8125 }
8126
8127 /* "msgpack/_unpacker.pyx":354
8128 * if max_str_len == -1:
8129 * max_str_len = max_buffer_size
8130 * if max_bin_len == -1: # <<<<<<<<<<<<<<
8131 * max_bin_len = max_buffer_size
8132 * if max_array_len == -1:
8133 */
8134 __pyx_t_1 = ((__pyx_v_max_bin_len == -1L) != 0);
8135 if (__pyx_t_1) {
8136
8137 /* "msgpack/_unpacker.pyx":355
8138 * max_str_len = max_buffer_size
8139 * if max_bin_len == -1:
8140 * max_bin_len = max_buffer_size # <<<<<<<<<<<<<<
8141 * if max_array_len == -1:
8142 * max_array_len = max_buffer_size
8143 */
8144 __pyx_v_max_bin_len = __pyx_v_max_buffer_size;
8145
8146 /* "msgpack/_unpacker.pyx":354
8147 * if max_str_len == -1:
8148 * max_str_len = max_buffer_size
8149 * if max_bin_len == -1: # <<<<<<<<<<<<<<
8150 * max_bin_len = max_buffer_size
8151 * if max_array_len == -1:
8152 */
8153 }
8154
8155 /* "msgpack/_unpacker.pyx":356
8156 * if max_bin_len == -1:
8157 * max_bin_len = max_buffer_size
8158 * if max_array_len == -1: # <<<<<<<<<<<<<<
8159 * max_array_len = max_buffer_size
8160 * if max_map_len == -1:
8161 */
8162 __pyx_t_1 = ((__pyx_v_max_array_len == -1L) != 0);
8163 if (__pyx_t_1) {
8164
8165 /* "msgpack/_unpacker.pyx":357
8166 * max_bin_len = max_buffer_size
8167 * if max_array_len == -1:
8168 * max_array_len = max_buffer_size # <<<<<<<<<<<<<<
8169 * if max_map_len == -1:
8170 * max_map_len = max_buffer_size//2
8171 */
8172 __pyx_v_max_array_len = __pyx_v_max_buffer_size;
8173
8174 /* "msgpack/_unpacker.pyx":356
8175 * if max_bin_len == -1:
8176 * max_bin_len = max_buffer_size
8177 * if max_array_len == -1: # <<<<<<<<<<<<<<
8178 * max_array_len = max_buffer_size
8179 * if max_map_len == -1:
8180 */
8181 }
8182
8183 /* "msgpack/_unpacker.pyx":358
8184 * if max_array_len == -1:
8185 * max_array_len = max_buffer_size
8186 * if max_map_len == -1: # <<<<<<<<<<<<<<
8187 * max_map_len = max_buffer_size//2
8188 * if max_ext_len == -1:
8189 */
8190 __pyx_t_1 = ((__pyx_v_max_map_len == -1L) != 0);
8191 if (__pyx_t_1) {
8192
8193 /* "msgpack/_unpacker.pyx":359
8194 * max_array_len = max_buffer_size
8195 * if max_map_len == -1:
8196 * max_map_len = max_buffer_size//2 # <<<<<<<<<<<<<<
8197 * if max_ext_len == -1:
8198 * max_ext_len = max_buffer_size
8199 */
8200 __pyx_v_max_map_len = __Pyx_div_Py_ssize_t(__pyx_v_max_buffer_size, 2);
8201
8202 /* "msgpack/_unpacker.pyx":358
8203 * if max_array_len == -1:
8204 * max_array_len = max_buffer_size
8205 * if max_map_len == -1: # <<<<<<<<<<<<<<
8206 * max_map_len = max_buffer_size//2
8207 * if max_ext_len == -1:
8208 */
8209 }
8210
8211 /* "msgpack/_unpacker.pyx":360
8212 * if max_map_len == -1:
8213 * max_map_len = max_buffer_size//2
8214 * if max_ext_len == -1: # <<<<<<<<<<<<<<
8215 * max_ext_len = max_buffer_size
8216 *
8217 */
8218 __pyx_t_1 = ((__pyx_v_max_ext_len == -1L) != 0);
8219 if (__pyx_t_1) {
8220
8221 /* "msgpack/_unpacker.pyx":361
8222 * max_map_len = max_buffer_size//2
8223 * if max_ext_len == -1:
8224 * max_ext_len = max_buffer_size # <<<<<<<<<<<<<<
8225 *
8226 * if read_size > max_buffer_size:
8227 */
8228 __pyx_v_max_ext_len = __pyx_v_max_buffer_size;
8229
8230 /* "msgpack/_unpacker.pyx":360
8231 * if max_map_len == -1:
8232 * max_map_len = max_buffer_size//2
8233 * if max_ext_len == -1: # <<<<<<<<<<<<<<
8234 * max_ext_len = max_buffer_size
8235 *
8236 */
8237 }
8238
8239 /* "msgpack/_unpacker.pyx":363
8240 * max_ext_len = max_buffer_size
8241 *
8242 * if read_size > max_buffer_size: # <<<<<<<<<<<<<<
8243 * raise ValueError("read_size should be less or equal to max_buffer_size")
8244 * if not read_size:
8245 */
8246 __pyx_t_1 = ((__pyx_v_read_size > __pyx_v_max_buffer_size) != 0);
8247 if (unlikely(__pyx_t_1)) {
8248
8249 /* "msgpack/_unpacker.pyx":364
8250 *
8251 * if read_size > max_buffer_size:
8252 * raise ValueError("read_size should be less or equal to max_buffer_size") # <<<<<<<<<<<<<<
8253 * if not read_size:
8254 * read_size = min(max_buffer_size, 1024**2)
8255 */
8256 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 364, __pyx_L1_error)
8257 __Pyx_GOTREF(__pyx_t_2);
8258 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8259 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8260 __PYX_ERR(1, 364, __pyx_L1_error)
8261
8262 /* "msgpack/_unpacker.pyx":363
8263 * max_ext_len = max_buffer_size
8264 *
8265 * if read_size > max_buffer_size: # <<<<<<<<<<<<<<
8266 * raise ValueError("read_size should be less or equal to max_buffer_size")
8267 * if not read_size:
8268 */
8269 }
8270
8271 /* "msgpack/_unpacker.pyx":365
8272 * if read_size > max_buffer_size:
8273 * raise ValueError("read_size should be less or equal to max_buffer_size")
8274 * if not read_size: # <<<<<<<<<<<<<<
8275 * read_size = min(max_buffer_size, 1024**2)
8276 *
8277 */
8278 __pyx_t_1 = ((!(__pyx_v_read_size != 0)) != 0);
8279 if (__pyx_t_1) {
8280
8281 /* "msgpack/_unpacker.pyx":366
8282 * raise ValueError("read_size should be less or equal to max_buffer_size")
8283 * if not read_size:
8284 * read_size = min(max_buffer_size, 1024**2) # <<<<<<<<<<<<<<
8285 *
8286 * self.max_buffer_size = max_buffer_size
8287 */
8288 __pyx_t_3 = 0x100000;
8289 __pyx_t_4 = __pyx_v_max_buffer_size;
8290 if (((__pyx_t_3 < __pyx_t_4) != 0)) {
8291 __pyx_t_5 = __pyx_t_3;
8292 } else {
8293 __pyx_t_5 = __pyx_t_4;
8294 }
8295 __pyx_v_read_size = __pyx_t_5;
8296
8297 /* "msgpack/_unpacker.pyx":365
8298 * if read_size > max_buffer_size:
8299 * raise ValueError("read_size should be less or equal to max_buffer_size")
8300 * if not read_size: # <<<<<<<<<<<<<<
8301 * read_size = min(max_buffer_size, 1024**2)
8302 *
8303 */
8304 }
8305
8306 /* "msgpack/_unpacker.pyx":368
8307 * read_size = min(max_buffer_size, 1024**2)
8308 *
8309 * self.max_buffer_size = max_buffer_size # <<<<<<<<<<<<<<
8310 * self.read_size = read_size
8311 * self.buf = <char*>PyMem_Malloc(read_size)
8312 */
8313 __pyx_v_self->max_buffer_size = __pyx_v_max_buffer_size;
8314
8315 /* "msgpack/_unpacker.pyx":369
8316 *
8317 * self.max_buffer_size = max_buffer_size
8318 * self.read_size = read_size # <<<<<<<<<<<<<<
8319 * self.buf = <char*>PyMem_Malloc(read_size)
8320 * if self.buf == NULL:
8321 */
8322 __pyx_v_self->read_size = __pyx_v_read_size;
8323
8324 /* "msgpack/_unpacker.pyx":370
8325 * self.max_buffer_size = max_buffer_size
8326 * self.read_size = read_size
8327 * self.buf = <char*>PyMem_Malloc(read_size) # <<<<<<<<<<<<<<
8328 * if self.buf == NULL:
8329 * raise MemoryError("Unable to allocate internal buffer.")
8330 */
8331 __pyx_v_self->buf = ((char *)PyMem_Malloc(__pyx_v_read_size));
8332
8333 /* "msgpack/_unpacker.pyx":371
8334 * self.read_size = read_size
8335 * self.buf = <char*>PyMem_Malloc(read_size)
8336 * if self.buf == NULL: # <<<<<<<<<<<<<<
8337 * raise MemoryError("Unable to allocate internal buffer.")
8338 * self.buf_size = read_size
8339 */
8340 __pyx_t_1 = ((__pyx_v_self->buf == NULL) != 0);
8341 if (unlikely(__pyx_t_1)) {
8342
8343 /* "msgpack/_unpacker.pyx":372
8344 * self.buf = <char*>PyMem_Malloc(read_size)
8345 * if self.buf == NULL:
8346 * raise MemoryError("Unable to allocate internal buffer.") # <<<<<<<<<<<<<<
8347 * self.buf_size = read_size
8348 * self.buf_head = 0
8349 */
8350 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 372, __pyx_L1_error)
8351 __Pyx_GOTREF(__pyx_t_2);
8352 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8353 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8354 __PYX_ERR(1, 372, __pyx_L1_error)
8355
8356 /* "msgpack/_unpacker.pyx":371
8357 * self.read_size = read_size
8358 * self.buf = <char*>PyMem_Malloc(read_size)
8359 * if self.buf == NULL: # <<<<<<<<<<<<<<
8360 * raise MemoryError("Unable to allocate internal buffer.")
8361 * self.buf_size = read_size
8362 */
8363 }
8364
8365 /* "msgpack/_unpacker.pyx":373
8366 * if self.buf == NULL:
8367 * raise MemoryError("Unable to allocate internal buffer.")
8368 * self.buf_size = read_size # <<<<<<<<<<<<<<
8369 * self.buf_head = 0
8370 * self.buf_tail = 0
8371 */
8372 __pyx_v_self->buf_size = __pyx_v_read_size;
8373
8374 /* "msgpack/_unpacker.pyx":374
8375 * raise MemoryError("Unable to allocate internal buffer.")
8376 * self.buf_size = read_size
8377 * self.buf_head = 0 # <<<<<<<<<<<<<<
8378 * self.buf_tail = 0
8379 * self.stream_offset = 0
8380 */
8381 __pyx_v_self->buf_head = 0;
8382
8383 /* "msgpack/_unpacker.pyx":375
8384 * self.buf_size = read_size
8385 * self.buf_head = 0
8386 * self.buf_tail = 0 # <<<<<<<<<<<<<<
8387 * self.stream_offset = 0
8388 *
8389 */
8390 __pyx_v_self->buf_tail = 0;
8391
8392 /* "msgpack/_unpacker.pyx":376
8393 * self.buf_head = 0
8394 * self.buf_tail = 0
8395 * self.stream_offset = 0 # <<<<<<<<<<<<<<
8396 *
8397 * if unicode_errors is not None:
8398 */
8399 __pyx_v_self->stream_offset = 0;
8400
8401 /* "msgpack/_unpacker.pyx":378
8402 * self.stream_offset = 0
8403 *
8404 * if unicode_errors is not None: # <<<<<<<<<<<<<<
8405 * self.unicode_errors = unicode_errors
8406 * cerr = unicode_errors
8407 */
8408 __pyx_t_1 = (__pyx_v_unicode_errors != Py_None);
8409 __pyx_t_6 = (__pyx_t_1 != 0);
8410 if (__pyx_t_6) {
8411
8412 /* "msgpack/_unpacker.pyx":379
8413 *
8414 * if unicode_errors is not None:
8415 * self.unicode_errors = unicode_errors # <<<<<<<<<<<<<<
8416 * cerr = unicode_errors
8417 *
8418 */
8419 __Pyx_INCREF(__pyx_v_unicode_errors);
8420 __Pyx_GIVEREF(__pyx_v_unicode_errors);
8421 __Pyx_GOTREF(__pyx_v_self->unicode_errors);
8422 __Pyx_DECREF(__pyx_v_self->unicode_errors);
8423 __pyx_v_self->unicode_errors = __pyx_v_unicode_errors;
8424
8425 /* "msgpack/_unpacker.pyx":380
8426 * if unicode_errors is not None:
8427 * self.unicode_errors = unicode_errors
8428 * cerr = unicode_errors # <<<<<<<<<<<<<<
8429 *
8430 * init_ctx(&self.ctx, object_hook, object_pairs_hook, list_hook,
8431 */
8432 __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_unicode_errors); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 380, __pyx_L1_error)
8433 __pyx_v_cerr = __pyx_t_7;
8434
8435 /* "msgpack/_unpacker.pyx":378
8436 * self.stream_offset = 0
8437 *
8438 * if unicode_errors is not None: # <<<<<<<<<<<<<<
8439 * self.unicode_errors = unicode_errors
8440 * cerr = unicode_errors
8441 */
8442 }
8443
8444 /* "msgpack/_unpacker.pyx":382
8445 * cerr = unicode_errors
8446 *
8447 * init_ctx(&self.ctx, object_hook, object_pairs_hook, list_hook, # <<<<<<<<<<<<<<
8448 * ext_hook, use_list, raw, timestamp, strict_map_key, cerr,
8449 * max_str_len, max_bin_len, max_array_len,
8450 */
8451 __pyx_t_2 = __pyx_f_7msgpack_9_cmsgpack_init_ctx((&__pyx_v_self->ctx), __pyx_v_object_hook, __pyx_v_object_pairs_hook, __pyx_v_list_hook, __pyx_v_ext_hook, __pyx_v_use_list, __pyx_v_raw, __pyx_v_timestamp, __pyx_v_strict_map_key, __pyx_v_cerr, __pyx_v_max_str_len, __pyx_v_max_bin_len, __pyx_v_max_array_len, __pyx_v_max_map_len, __pyx_v_max_ext_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 382, __pyx_L1_error)
8452 __Pyx_GOTREF(__pyx_t_2);
8453 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8454
8455 /* "msgpack/_unpacker.pyx":327
8456 * self.buf = NULL
8457 *
8458 * def __init__(self, file_like=None, *, Py_ssize_t read_size=0, # <<<<<<<<<<<<<<
8459 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
8460 * object object_hook=None, object object_pairs_hook=None, object list_hook=None,
8461 */
8462
8463 /* function exit code */
8464 __pyx_r = 0;
8465 goto __pyx_L0;
8466 __pyx_L1_error:;
8467 __Pyx_XDECREF(__pyx_t_2);
8468 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8469 __pyx_r = -1;
8470 __pyx_L0:;
8471 __Pyx_RefNannyFinishContext();
8472 return __pyx_r;
8473 }
8474
8475 /* "msgpack/_unpacker.pyx":387
8476 * max_map_len, max_ext_len)
8477 *
8478 * def feed(self, object next_bytes): # <<<<<<<<<<<<<<
8479 * """Append `next_bytes` to internal buffer."""
8480 * cdef Py_buffer pybuff
8481 */
8482
8483 /* Python wrapper */
8484 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_7feed(PyObject *__pyx_v_self, PyObject *__pyx_v_next_bytes); /*proto*/
8485 static char __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_6feed[] = "Unpacker.feed(self, next_bytes)\nAppend `next_bytes` to internal buffer.";
8486 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_7feed(PyObject *__pyx_v_self, PyObject *__pyx_v_next_bytes) {
8487 PyObject *__pyx_r = 0;
8488 __Pyx_RefNannyDeclarations
8489 __Pyx_RefNannySetupContext("feed (wrapper)", 0);
8490 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_6feed(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self), ((PyObject *)__pyx_v_next_bytes));
8491
8492 /* function exit code */
8493 __Pyx_RefNannyFinishContext();
8494 return __pyx_r;
8495 }
8496
8497 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_6feed(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, PyObject *__pyx_v_next_bytes) {
8498 Py_buffer __pyx_v_pybuff;
8499 char *__pyx_v_buf;
8500 Py_ssize_t __pyx_v_buf_len;
8501 PyObject *__pyx_r = NULL;
8502 __Pyx_RefNannyDeclarations
8503 int __pyx_t_1;
8504 int __pyx_t_2;
8505 PyObject *__pyx_t_3 = NULL;
8506 int __pyx_t_4;
8507 int __pyx_t_5;
8508 char const *__pyx_t_6;
8509 PyObject *__pyx_t_7 = NULL;
8510 PyObject *__pyx_t_8 = NULL;
8511 PyObject *__pyx_t_9 = NULL;
8512 PyObject *__pyx_t_10 = NULL;
8513 PyObject *__pyx_t_11 = NULL;
8514 PyObject *__pyx_t_12 = NULL;
8515 int __pyx_lineno = 0;
8516 const char *__pyx_filename = NULL;
8517 int __pyx_clineno = 0;
8518 __Pyx_RefNannySetupContext("feed", 0);
8519
8520 /* "msgpack/_unpacker.pyx":393
8521 * cdef Py_ssize_t buf_len
8522 *
8523 * if self.file_like is not None: # <<<<<<<<<<<<<<
8524 * raise AssertionError(
8525 * "unpacker.feed() is not be able to use with `file_like`.")
8526 */
8527 __pyx_t_1 = (__pyx_v_self->file_like != Py_None);
8528 __pyx_t_2 = (__pyx_t_1 != 0);
8529 if (unlikely(__pyx_t_2)) {
8530
8531 /* "msgpack/_unpacker.pyx":394
8532 *
8533 * if self.file_like is not None:
8534 * raise AssertionError( # <<<<<<<<<<<<<<
8535 * "unpacker.feed() is not be able to use with `file_like`.")
8536 *
8537 */
8538 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_AssertionError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 394, __pyx_L1_error)
8539 __Pyx_GOTREF(__pyx_t_3);
8540 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8541 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8542 __PYX_ERR(1, 394, __pyx_L1_error)
8543
8544 /* "msgpack/_unpacker.pyx":393
8545 * cdef Py_ssize_t buf_len
8546 *
8547 * if self.file_like is not None: # <<<<<<<<<<<<<<
8548 * raise AssertionError(
8549 * "unpacker.feed() is not be able to use with `file_like`.")
8550 */
8551 }
8552
8553 /* "msgpack/_unpacker.pyx":397
8554 * "unpacker.feed() is not be able to use with `file_like`.")
8555 *
8556 * get_data_from_buffer(next_bytes, &pybuff, &buf, &buf_len) # <<<<<<<<<<<<<<
8557 * try:
8558 * self.append_buffer(buf, buf_len)
8559 */
8560 __pyx_t_4 = __pyx_f_7msgpack_9_cmsgpack_get_data_from_buffer(__pyx_v_next_bytes, (&__pyx_v_pybuff), (&__pyx_v_buf), (&__pyx_v_buf_len)); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(1, 397, __pyx_L1_error)
8561
8562 /* "msgpack/_unpacker.pyx":398
8563 *
8564 * get_data_from_buffer(next_bytes, &pybuff, &buf, &buf_len)
8565 * try: # <<<<<<<<<<<<<<
8566 * self.append_buffer(buf, buf_len)
8567 * finally:
8568 */
8569 /*try:*/ {
8570
8571 /* "msgpack/_unpacker.pyx":399
8572 * get_data_from_buffer(next_bytes, &pybuff, &buf, &buf_len)
8573 * try:
8574 * self.append_buffer(buf, buf_len) # <<<<<<<<<<<<<<
8575 * finally:
8576 * PyBuffer_Release(&pybuff)
8577 */
8578 __pyx_t_3 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self->__pyx_vtab)->append_buffer(__pyx_v_self, __pyx_v_buf, __pyx_v_buf_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 399, __pyx_L5_error)
8579 __Pyx_GOTREF(__pyx_t_3);
8580 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8581 }
8582
8583 /* "msgpack/_unpacker.pyx":401
8584 * self.append_buffer(buf, buf_len)
8585 * finally:
8586 * PyBuffer_Release(&pybuff) # <<<<<<<<<<<<<<
8587 *
8588 * cdef append_buffer(self, void* _buf, Py_ssize_t _buf_len):
8589 */
8590 /*finally:*/ {
8591 /*normal exit:*/{
8592 PyBuffer_Release((&__pyx_v_pybuff));
8593 goto __pyx_L6;
8594 }
8595 __pyx_L5_error:;
8596 /*exception exit:*/{
8597 __Pyx_PyThreadState_declare
8598 __Pyx_PyThreadState_assign
8599 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
8600 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8601 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
8602 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
8603 __Pyx_XGOTREF(__pyx_t_7);
8604 __Pyx_XGOTREF(__pyx_t_8);
8605 __Pyx_XGOTREF(__pyx_t_9);
8606 __Pyx_XGOTREF(__pyx_t_10);
8607 __Pyx_XGOTREF(__pyx_t_11);
8608 __Pyx_XGOTREF(__pyx_t_12);
8609 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
8610 {
8611 PyBuffer_Release((&__pyx_v_pybuff));
8612 }
8613 if (PY_MAJOR_VERSION >= 3) {
8614 __Pyx_XGIVEREF(__pyx_t_10);
8615 __Pyx_XGIVEREF(__pyx_t_11);
8616 __Pyx_XGIVEREF(__pyx_t_12);
8617 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
8618 }
8619 __Pyx_XGIVEREF(__pyx_t_7);
8620 __Pyx_XGIVEREF(__pyx_t_8);
8621 __Pyx_XGIVEREF(__pyx_t_9);
8622 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
8623 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
8624 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
8625 goto __pyx_L1_error;
8626 }
8627 __pyx_L6:;
8628 }
8629
8630 /* "msgpack/_unpacker.pyx":387
8631 * max_map_len, max_ext_len)
8632 *
8633 * def feed(self, object next_bytes): # <<<<<<<<<<<<<<
8634 * """Append `next_bytes` to internal buffer."""
8635 * cdef Py_buffer pybuff
8636 */
8637
8638 /* function exit code */
8639 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8640 goto __pyx_L0;
8641 __pyx_L1_error:;
8642 __Pyx_XDECREF(__pyx_t_3);
8643 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.feed", __pyx_clineno, __pyx_lineno, __pyx_filename);
8644 __pyx_r = NULL;
8645 __pyx_L0:;
8646 __Pyx_XGIVEREF(__pyx_r);
8647 __Pyx_RefNannyFinishContext();
8648 return __pyx_r;
8649 }
8650
8651 /* "msgpack/_unpacker.pyx":403
8652 * PyBuffer_Release(&pybuff)
8653 *
8654 * cdef append_buffer(self, void* _buf, Py_ssize_t _buf_len): # <<<<<<<<<<<<<<
8655 * cdef:
8656 * char* buf = self.buf
8657 */
8658
8659 static PyObject *__pyx_f_7msgpack_9_cmsgpack_8Unpacker_append_buffer(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, void *__pyx_v__buf, Py_ssize_t __pyx_v__buf_len) {
8660 char *__pyx_v_buf;
8661 char *__pyx_v_new_buf;
8662 Py_ssize_t __pyx_v_head;
8663 Py_ssize_t __pyx_v_tail;
8664 Py_ssize_t __pyx_v_buf_size;
8665 Py_ssize_t __pyx_v_new_size;
8666 PyObject *__pyx_r = NULL;
8667 __Pyx_RefNannyDeclarations
8668 char *__pyx_t_1;
8669 Py_ssize_t __pyx_t_2;
8670 int __pyx_t_3;
8671 PyObject *__pyx_t_4 = NULL;
8672 Py_ssize_t __pyx_t_5;
8673 Py_ssize_t __pyx_t_6;
8674 int __pyx_lineno = 0;
8675 const char *__pyx_filename = NULL;
8676 int __pyx_clineno = 0;
8677 __Pyx_RefNannySetupContext("append_buffer", 0);
8678
8679 /* "msgpack/_unpacker.pyx":405
8680 * cdef append_buffer(self, void* _buf, Py_ssize_t _buf_len):
8681 * cdef:
8682 * char* buf = self.buf # <<<<<<<<<<<<<<
8683 * char* new_buf
8684 * Py_ssize_t head = self.buf_head
8685 */
8686 __pyx_t_1 = __pyx_v_self->buf;
8687 __pyx_v_buf = __pyx_t_1;
8688
8689 /* "msgpack/_unpacker.pyx":407
8690 * char* buf = self.buf
8691 * char* new_buf
8692 * Py_ssize_t head = self.buf_head # <<<<<<<<<<<<<<
8693 * Py_ssize_t tail = self.buf_tail
8694 * Py_ssize_t buf_size = self.buf_size
8695 */
8696 __pyx_t_2 = __pyx_v_self->buf_head;
8697 __pyx_v_head = __pyx_t_2;
8698
8699 /* "msgpack/_unpacker.pyx":408
8700 * char* new_buf
8701 * Py_ssize_t head = self.buf_head
8702 * Py_ssize_t tail = self.buf_tail # <<<<<<<<<<<<<<
8703 * Py_ssize_t buf_size = self.buf_size
8704 * Py_ssize_t new_size
8705 */
8706 __pyx_t_2 = __pyx_v_self->buf_tail;
8707 __pyx_v_tail = __pyx_t_2;
8708
8709 /* "msgpack/_unpacker.pyx":409
8710 * Py_ssize_t head = self.buf_head
8711 * Py_ssize_t tail = self.buf_tail
8712 * Py_ssize_t buf_size = self.buf_size # <<<<<<<<<<<<<<
8713 * Py_ssize_t new_size
8714 *
8715 */
8716 __pyx_t_2 = __pyx_v_self->buf_size;
8717 __pyx_v_buf_size = __pyx_t_2;
8718
8719 /* "msgpack/_unpacker.pyx":412
8720 * Py_ssize_t new_size
8721 *
8722 * if tail + _buf_len > buf_size: # <<<<<<<<<<<<<<
8723 * if ((tail - head) + _buf_len) <= buf_size:
8724 * # move to front.
8725 */
8726 __pyx_t_3 = (((__pyx_v_tail + __pyx_v__buf_len) > __pyx_v_buf_size) != 0);
8727 if (__pyx_t_3) {
8728
8729 /* "msgpack/_unpacker.pyx":413
8730 *
8731 * if tail + _buf_len > buf_size:
8732 * if ((tail - head) + _buf_len) <= buf_size: # <<<<<<<<<<<<<<
8733 * # move to front.
8734 * memmove(buf, buf + head, tail - head)
8735 */
8736 __pyx_t_3 = ((((__pyx_v_tail - __pyx_v_head) + __pyx_v__buf_len) <= __pyx_v_buf_size) != 0);
8737 if (__pyx_t_3) {
8738
8739 /* "msgpack/_unpacker.pyx":415
8740 * if ((tail - head) + _buf_len) <= buf_size:
8741 * # move to front.
8742 * memmove(buf, buf + head, tail - head) # <<<<<<<<<<<<<<
8743 * tail -= head
8744 * head = 0
8745 */
8746 (void)(memmove(__pyx_v_buf, (__pyx_v_buf + __pyx_v_head), (__pyx_v_tail - __pyx_v_head)));
8747
8748 /* "msgpack/_unpacker.pyx":416
8749 * # move to front.
8750 * memmove(buf, buf + head, tail - head)
8751 * tail -= head # <<<<<<<<<<<<<<
8752 * head = 0
8753 * else:
8754 */
8755 __pyx_v_tail = (__pyx_v_tail - __pyx_v_head);
8756
8757 /* "msgpack/_unpacker.pyx":417
8758 * memmove(buf, buf + head, tail - head)
8759 * tail -= head
8760 * head = 0 # <<<<<<<<<<<<<<
8761 * else:
8762 * # expand buffer.
8763 */
8764 __pyx_v_head = 0;
8765
8766 /* "msgpack/_unpacker.pyx":413
8767 *
8768 * if tail + _buf_len > buf_size:
8769 * if ((tail - head) + _buf_len) <= buf_size: # <<<<<<<<<<<<<<
8770 * # move to front.
8771 * memmove(buf, buf + head, tail - head)
8772 */
8773 goto __pyx_L4;
8774 }
8775
8776 /* "msgpack/_unpacker.pyx":420
8777 * else:
8778 * # expand buffer.
8779 * new_size = (tail-head) + _buf_len # <<<<<<<<<<<<<<
8780 * if new_size > self.max_buffer_size:
8781 * raise BufferFull
8782 */
8783 /*else*/ {
8784 __pyx_v_new_size = ((__pyx_v_tail - __pyx_v_head) + __pyx_v__buf_len);
8785
8786 /* "msgpack/_unpacker.pyx":421
8787 * # expand buffer.
8788 * new_size = (tail-head) + _buf_len
8789 * if new_size > self.max_buffer_size: # <<<<<<<<<<<<<<
8790 * raise BufferFull
8791 * new_size = min(new_size*2, self.max_buffer_size)
8792 */
8793 __pyx_t_3 = ((__pyx_v_new_size > __pyx_v_self->max_buffer_size) != 0);
8794 if (unlikely(__pyx_t_3)) {
8795
8796 /* "msgpack/_unpacker.pyx":422
8797 * new_size = (tail-head) + _buf_len
8798 * if new_size > self.max_buffer_size:
8799 * raise BufferFull # <<<<<<<<<<<<<<
8800 * new_size = min(new_size*2, self.max_buffer_size)
8801 * new_buf = <char*>PyMem_Malloc(new_size)
8802 */
8803 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_BufferFull); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 422, __pyx_L1_error)
8804 __Pyx_GOTREF(__pyx_t_4);
8805 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
8806 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8807 __PYX_ERR(1, 422, __pyx_L1_error)
8808
8809 /* "msgpack/_unpacker.pyx":421
8810 * # expand buffer.
8811 * new_size = (tail-head) + _buf_len
8812 * if new_size > self.max_buffer_size: # <<<<<<<<<<<<<<
8813 * raise BufferFull
8814 * new_size = min(new_size*2, self.max_buffer_size)
8815 */
8816 }
8817
8818 /* "msgpack/_unpacker.pyx":423
8819 * if new_size > self.max_buffer_size:
8820 * raise BufferFull
8821 * new_size = min(new_size*2, self.max_buffer_size) # <<<<<<<<<<<<<<
8822 * new_buf = <char*>PyMem_Malloc(new_size)
8823 * if new_buf == NULL:
8824 */
8825 __pyx_t_2 = __pyx_v_self->max_buffer_size;
8826 __pyx_t_5 = (__pyx_v_new_size * 2);
8827 if (((__pyx_t_2 < __pyx_t_5) != 0)) {
8828 __pyx_t_6 = __pyx_t_2;
8829 } else {
8830 __pyx_t_6 = __pyx_t_5;
8831 }
8832 __pyx_v_new_size = __pyx_t_6;
8833
8834 /* "msgpack/_unpacker.pyx":424
8835 * raise BufferFull
8836 * new_size = min(new_size*2, self.max_buffer_size)
8837 * new_buf = <char*>PyMem_Malloc(new_size) # <<<<<<<<<<<<<<
8838 * if new_buf == NULL:
8839 * # self.buf still holds old buffer and will be freed during
8840 */
8841 __pyx_v_new_buf = ((char *)PyMem_Malloc(__pyx_v_new_size));
8842
8843 /* "msgpack/_unpacker.pyx":425
8844 * new_size = min(new_size*2, self.max_buffer_size)
8845 * new_buf = <char*>PyMem_Malloc(new_size)
8846 * if new_buf == NULL: # <<<<<<<<<<<<<<
8847 * # self.buf still holds old buffer and will be freed during
8848 * # obj destruction
8849 */
8850 __pyx_t_3 = ((__pyx_v_new_buf == NULL) != 0);
8851 if (unlikely(__pyx_t_3)) {
8852
8853 /* "msgpack/_unpacker.pyx":428
8854 * # self.buf still holds old buffer and will be freed during
8855 * # obj destruction
8856 * raise MemoryError("Unable to enlarge internal buffer.") # <<<<<<<<<<<<<<
8857 * memcpy(new_buf, buf + head, tail - head)
8858 * PyMem_Free(buf)
8859 */
8860 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 428, __pyx_L1_error)
8861 __Pyx_GOTREF(__pyx_t_4);
8862 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
8863 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8864 __PYX_ERR(1, 428, __pyx_L1_error)
8865
8866 /* "msgpack/_unpacker.pyx":425
8867 * new_size = min(new_size*2, self.max_buffer_size)
8868 * new_buf = <char*>PyMem_Malloc(new_size)
8869 * if new_buf == NULL: # <<<<<<<<<<<<<<
8870 * # self.buf still holds old buffer and will be freed during
8871 * # obj destruction
8872 */
8873 }
8874
8875 /* "msgpack/_unpacker.pyx":429
8876 * # obj destruction
8877 * raise MemoryError("Unable to enlarge internal buffer.")
8878 * memcpy(new_buf, buf + head, tail - head) # <<<<<<<<<<<<<<
8879 * PyMem_Free(buf)
8880 *
8881 */
8882 (void)(memcpy(__pyx_v_new_buf, (__pyx_v_buf + __pyx_v_head), (__pyx_v_tail - __pyx_v_head)));
8883
8884 /* "msgpack/_unpacker.pyx":430
8885 * raise MemoryError("Unable to enlarge internal buffer.")
8886 * memcpy(new_buf, buf + head, tail - head)
8887 * PyMem_Free(buf) # <<<<<<<<<<<<<<
8888 *
8889 * buf = new_buf
8890 */
8891 PyMem_Free(__pyx_v_buf);
8892
8893 /* "msgpack/_unpacker.pyx":432
8894 * PyMem_Free(buf)
8895 *
8896 * buf = new_buf # <<<<<<<<<<<<<<
8897 * buf_size = new_size
8898 * tail -= head
8899 */
8900 __pyx_v_buf = __pyx_v_new_buf;
8901
8902 /* "msgpack/_unpacker.pyx":433
8903 *
8904 * buf = new_buf
8905 * buf_size = new_size # <<<<<<<<<<<<<<
8906 * tail -= head
8907 * head = 0
8908 */
8909 __pyx_v_buf_size = __pyx_v_new_size;
8910
8911 /* "msgpack/_unpacker.pyx":434
8912 * buf = new_buf
8913 * buf_size = new_size
8914 * tail -= head # <<<<<<<<<<<<<<
8915 * head = 0
8916 *
8917 */
8918 __pyx_v_tail = (__pyx_v_tail - __pyx_v_head);
8919
8920 /* "msgpack/_unpacker.pyx":435
8921 * buf_size = new_size
8922 * tail -= head
8923 * head = 0 # <<<<<<<<<<<<<<
8924 *
8925 * memcpy(buf + tail, <char*>(_buf), _buf_len)
8926 */
8927 __pyx_v_head = 0;
8928 }
8929 __pyx_L4:;
8930
8931 /* "msgpack/_unpacker.pyx":412
8932 * Py_ssize_t new_size
8933 *
8934 * if tail + _buf_len > buf_size: # <<<<<<<<<<<<<<
8935 * if ((tail - head) + _buf_len) <= buf_size:
8936 * # move to front.
8937 */
8938 }
8939
8940 /* "msgpack/_unpacker.pyx":437
8941 * head = 0
8942 *
8943 * memcpy(buf + tail, <char*>(_buf), _buf_len) # <<<<<<<<<<<<<<
8944 * self.buf = buf
8945 * self.buf_head = head
8946 */
8947 (void)(memcpy((__pyx_v_buf + __pyx_v_tail), ((char *)__pyx_v__buf), __pyx_v__buf_len));
8948
8949 /* "msgpack/_unpacker.pyx":438
8950 *
8951 * memcpy(buf + tail, <char*>(_buf), _buf_len)
8952 * self.buf = buf # <<<<<<<<<<<<<<
8953 * self.buf_head = head
8954 * self.buf_size = buf_size
8955 */
8956 __pyx_v_self->buf = __pyx_v_buf;
8957
8958 /* "msgpack/_unpacker.pyx":439
8959 * memcpy(buf + tail, <char*>(_buf), _buf_len)
8960 * self.buf = buf
8961 * self.buf_head = head # <<<<<<<<<<<<<<
8962 * self.buf_size = buf_size
8963 * self.buf_tail = tail + _buf_len
8964 */
8965 __pyx_v_self->buf_head = __pyx_v_head;
8966
8967 /* "msgpack/_unpacker.pyx":440
8968 * self.buf = buf
8969 * self.buf_head = head
8970 * self.buf_size = buf_size # <<<<<<<<<<<<<<
8971 * self.buf_tail = tail + _buf_len
8972 *
8973 */
8974 __pyx_v_self->buf_size = __pyx_v_buf_size;
8975
8976 /* "msgpack/_unpacker.pyx":441
8977 * self.buf_head = head
8978 * self.buf_size = buf_size
8979 * self.buf_tail = tail + _buf_len # <<<<<<<<<<<<<<
8980 *
8981 * cdef read_from_file(self):
8982 */
8983 __pyx_v_self->buf_tail = (__pyx_v_tail + __pyx_v__buf_len);
8984
8985 /* "msgpack/_unpacker.pyx":403
8986 * PyBuffer_Release(&pybuff)
8987 *
8988 * cdef append_buffer(self, void* _buf, Py_ssize_t _buf_len): # <<<<<<<<<<<<<<
8989 * cdef:
8990 * char* buf = self.buf
8991 */
8992
8993 /* function exit code */
8994 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8995 goto __pyx_L0;
8996 __pyx_L1_error:;
8997 __Pyx_XDECREF(__pyx_t_4);
8998 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.append_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8999 __pyx_r = 0;
9000 __pyx_L0:;
9001 __Pyx_XGIVEREF(__pyx_r);
9002 __Pyx_RefNannyFinishContext();
9003 return __pyx_r;
9004 }
9005
9006 /* "msgpack/_unpacker.pyx":443
9007 * self.buf_tail = tail + _buf_len
9008 *
9009 * cdef read_from_file(self): # <<<<<<<<<<<<<<
9010 * next_bytes = self.file_like_read(
9011 * min(self.read_size,
9012 */
9013
9014 static PyObject *__pyx_f_7msgpack_9_cmsgpack_8Unpacker_read_from_file(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self) {
9015 PyObject *__pyx_v_next_bytes = NULL;
9016 PyObject *__pyx_r = NULL;
9017 __Pyx_RefNannyDeclarations
9018 PyObject *__pyx_t_1 = NULL;
9019 Py_ssize_t __pyx_t_2;
9020 Py_ssize_t __pyx_t_3;
9021 Py_ssize_t __pyx_t_4;
9022 PyObject *__pyx_t_5 = NULL;
9023 PyObject *__pyx_t_6 = NULL;
9024 PyObject *__pyx_t_7 = NULL;
9025 int __pyx_t_8;
9026 char *__pyx_t_9;
9027 int __pyx_lineno = 0;
9028 const char *__pyx_filename = NULL;
9029 int __pyx_clineno = 0;
9030 __Pyx_RefNannySetupContext("read_from_file", 0);
9031
9032 /* "msgpack/_unpacker.pyx":446
9033 * next_bytes = self.file_like_read(
9034 * min(self.read_size,
9035 * self.max_buffer_size - (self.buf_tail - self.buf_head) # <<<<<<<<<<<<<<
9036 * ))
9037 * if next_bytes:
9038 */
9039 __pyx_t_2 = (__pyx_v_self->max_buffer_size - (__pyx_v_self->buf_tail - __pyx_v_self->buf_head));
9040
9041 /* "msgpack/_unpacker.pyx":445
9042 * cdef read_from_file(self):
9043 * next_bytes = self.file_like_read(
9044 * min(self.read_size, # <<<<<<<<<<<<<<
9045 * self.max_buffer_size - (self.buf_tail - self.buf_head)
9046 * ))
9047 */
9048 __pyx_t_3 = __pyx_v_self->read_size;
9049
9050 /* "msgpack/_unpacker.pyx":446
9051 * next_bytes = self.file_like_read(
9052 * min(self.read_size,
9053 * self.max_buffer_size - (self.buf_tail - self.buf_head) # <<<<<<<<<<<<<<
9054 * ))
9055 * if next_bytes:
9056 */
9057 if (((__pyx_t_2 < __pyx_t_3) != 0)) {
9058 __pyx_t_4 = __pyx_t_2;
9059 } else {
9060 __pyx_t_4 = __pyx_t_3;
9061 }
9062 __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 446, __pyx_L1_error)
9063 __Pyx_GOTREF(__pyx_t_5);
9064 __Pyx_INCREF(__pyx_v_self->file_like_read);
9065 __pyx_t_6 = __pyx_v_self->file_like_read; __pyx_t_7 = NULL;
9066 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
9067 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
9068 if (likely(__pyx_t_7)) {
9069 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9070 __Pyx_INCREF(__pyx_t_7);
9071 __Pyx_INCREF(function);
9072 __Pyx_DECREF_SET(__pyx_t_6, function);
9073 }
9074 }
9075 __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
9076 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9077 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9078 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 444, __pyx_L1_error)
9079 __Pyx_GOTREF(__pyx_t_1);
9080 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9081 __pyx_v_next_bytes = __pyx_t_1;
9082 __pyx_t_1 = 0;
9083
9084 /* "msgpack/_unpacker.pyx":448
9085 * self.max_buffer_size - (self.buf_tail - self.buf_head)
9086 * ))
9087 * if next_bytes: # <<<<<<<<<<<<<<
9088 * self.append_buffer(PyBytes_AsString(next_bytes), PyBytes_Size(next_bytes))
9089 * else:
9090 */
9091 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_next_bytes); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(1, 448, __pyx_L1_error)
9092 if (__pyx_t_8) {
9093
9094 /* "msgpack/_unpacker.pyx":449
9095 * ))
9096 * if next_bytes:
9097 * self.append_buffer(PyBytes_AsString(next_bytes), PyBytes_Size(next_bytes)) # <<<<<<<<<<<<<<
9098 * else:
9099 * self.file_like = None
9100 */
9101 __pyx_t_9 = PyBytes_AsString(__pyx_v_next_bytes); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error)
9102 __pyx_t_4 = PyBytes_Size(__pyx_v_next_bytes); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1L))) __PYX_ERR(1, 449, __pyx_L1_error)
9103 __pyx_t_1 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self->__pyx_vtab)->append_buffer(__pyx_v_self, __pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 449, __pyx_L1_error)
9104 __Pyx_GOTREF(__pyx_t_1);
9105 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9106
9107 /* "msgpack/_unpacker.pyx":448
9108 * self.max_buffer_size - (self.buf_tail - self.buf_head)
9109 * ))
9110 * if next_bytes: # <<<<<<<<<<<<<<
9111 * self.append_buffer(PyBytes_AsString(next_bytes), PyBytes_Size(next_bytes))
9112 * else:
9113 */
9114 goto __pyx_L3;
9115 }
9116
9117 /* "msgpack/_unpacker.pyx":451
9118 * self.append_buffer(PyBytes_AsString(next_bytes), PyBytes_Size(next_bytes))
9119 * else:
9120 * self.file_like = None # <<<<<<<<<<<<<<
9121 *
9122 * cdef object _unpack(self, execute_fn execute, bint iter=0):
9123 */
9124 /*else*/ {
9125 __Pyx_INCREF(Py_None);
9126 __Pyx_GIVEREF(Py_None);
9127 __Pyx_GOTREF(__pyx_v_self->file_like);
9128 __Pyx_DECREF(__pyx_v_self->file_like);
9129 __pyx_v_self->file_like = Py_None;
9130 }
9131 __pyx_L3:;
9132
9133 /* "msgpack/_unpacker.pyx":443
9134 * self.buf_tail = tail + _buf_len
9135 *
9136 * cdef read_from_file(self): # <<<<<<<<<<<<<<
9137 * next_bytes = self.file_like_read(
9138 * min(self.read_size,
9139 */
9140
9141 /* function exit code */
9142 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9143 goto __pyx_L0;
9144 __pyx_L1_error:;
9145 __Pyx_XDECREF(__pyx_t_1);
9146 __Pyx_XDECREF(__pyx_t_5);
9147 __Pyx_XDECREF(__pyx_t_6);
9148 __Pyx_XDECREF(__pyx_t_7);
9149 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.read_from_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
9150 __pyx_r = 0;
9151 __pyx_L0:;
9152 __Pyx_XDECREF(__pyx_v_next_bytes);
9153 __Pyx_XGIVEREF(__pyx_r);
9154 __Pyx_RefNannyFinishContext();
9155 return __pyx_r;
9156 }
9157
9158 /* "msgpack/_unpacker.pyx":453
9159 * self.file_like = None
9160 *
9161 * cdef object _unpack(self, execute_fn execute, bint iter=0): # <<<<<<<<<<<<<<
9162 * cdef int ret
9163 * cdef object obj
9164 */
9165
9166 static PyObject *__pyx_f_7msgpack_9_cmsgpack_8Unpacker__unpack(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, execute_fn __pyx_v_execute, struct __pyx_opt_args_7msgpack_9_cmsgpack_8Unpacker__unpack *__pyx_optional_args) {
9167 int __pyx_v_iter = ((int)0);
9168 int __pyx_v_ret;
9169 PyObject *__pyx_v_obj = 0;
9170 Py_ssize_t __pyx_v_prev_head;
9171 PyObject *__pyx_r = NULL;
9172 __Pyx_RefNannyDeclarations
9173 int __pyx_t_1;
9174 int __pyx_t_2;
9175 int __pyx_t_3;
9176 PyObject *__pyx_t_4 = NULL;
9177 Py_ssize_t __pyx_t_5;
9178 PyObject *__pyx_t_6 = NULL;
9179 PyObject *__pyx_t_7 = NULL;
9180 int __pyx_t_8;
9181 int __pyx_lineno = 0;
9182 const char *__pyx_filename = NULL;
9183 int __pyx_clineno = 0;
9184 __Pyx_RefNannySetupContext("_unpack", 0);
9185 if (__pyx_optional_args) {
9186 if (__pyx_optional_args->__pyx_n > 0) {
9187 __pyx_v_iter = __pyx_optional_args->iter;
9188 }
9189 }
9190
9191 /* "msgpack/_unpacker.pyx":458
9192 * cdef Py_ssize_t prev_head
9193 *
9194 * if self.buf_head >= self.buf_tail and self.file_like is not None: # <<<<<<<<<<<<<<
9195 * self.read_from_file()
9196 *
9197 */
9198 __pyx_t_2 = ((__pyx_v_self->buf_head >= __pyx_v_self->buf_tail) != 0);
9199 if (__pyx_t_2) {
9200 } else {
9201 __pyx_t_1 = __pyx_t_2;
9202 goto __pyx_L4_bool_binop_done;
9203 }
9204 __pyx_t_2 = (__pyx_v_self->file_like != Py_None);
9205 __pyx_t_3 = (__pyx_t_2 != 0);
9206 __pyx_t_1 = __pyx_t_3;
9207 __pyx_L4_bool_binop_done:;
9208 if (__pyx_t_1) {
9209
9210 /* "msgpack/_unpacker.pyx":459
9211 *
9212 * if self.buf_head >= self.buf_tail and self.file_like is not None:
9213 * self.read_from_file() # <<<<<<<<<<<<<<
9214 *
9215 * while 1:
9216 */
9217 __pyx_t_4 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self->__pyx_vtab)->read_from_file(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 459, __pyx_L1_error)
9218 __Pyx_GOTREF(__pyx_t_4);
9219 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9220
9221 /* "msgpack/_unpacker.pyx":458
9222 * cdef Py_ssize_t prev_head
9223 *
9224 * if self.buf_head >= self.buf_tail and self.file_like is not None: # <<<<<<<<<<<<<<
9225 * self.read_from_file()
9226 *
9227 */
9228 }
9229
9230 /* "msgpack/_unpacker.pyx":461
9231 * self.read_from_file()
9232 *
9233 * while 1: # <<<<<<<<<<<<<<
9234 * prev_head = self.buf_head
9235 * if prev_head >= self.buf_tail:
9236 */
9237 while (1) {
9238
9239 /* "msgpack/_unpacker.pyx":462
9240 *
9241 * while 1:
9242 * prev_head = self.buf_head # <<<<<<<<<<<<<<
9243 * if prev_head >= self.buf_tail:
9244 * if iter:
9245 */
9246 __pyx_t_5 = __pyx_v_self->buf_head;
9247 __pyx_v_prev_head = __pyx_t_5;
9248
9249 /* "msgpack/_unpacker.pyx":463
9250 * while 1:
9251 * prev_head = self.buf_head
9252 * if prev_head >= self.buf_tail: # <<<<<<<<<<<<<<
9253 * if iter:
9254 * raise StopIteration("No more data to unpack.")
9255 */
9256 __pyx_t_1 = ((__pyx_v_prev_head >= __pyx_v_self->buf_tail) != 0);
9257 if (__pyx_t_1) {
9258
9259 /* "msgpack/_unpacker.pyx":464
9260 * prev_head = self.buf_head
9261 * if prev_head >= self.buf_tail:
9262 * if iter: # <<<<<<<<<<<<<<
9263 * raise StopIteration("No more data to unpack.")
9264 * else:
9265 */
9266 __pyx_t_1 = (__pyx_v_iter != 0);
9267 if (unlikely(__pyx_t_1)) {
9268
9269 /* "msgpack/_unpacker.pyx":465
9270 * if prev_head >= self.buf_tail:
9271 * if iter:
9272 * raise StopIteration("No more data to unpack.") # <<<<<<<<<<<<<<
9273 * else:
9274 * raise OutOfData("No more data to unpack.")
9275 */
9276 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_StopIteration, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 465, __pyx_L1_error)
9277 __Pyx_GOTREF(__pyx_t_4);
9278 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
9279 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9280 __PYX_ERR(1, 465, __pyx_L1_error)
9281
9282 /* "msgpack/_unpacker.pyx":464
9283 * prev_head = self.buf_head
9284 * if prev_head >= self.buf_tail:
9285 * if iter: # <<<<<<<<<<<<<<
9286 * raise StopIteration("No more data to unpack.")
9287 * else:
9288 */
9289 }
9290
9291 /* "msgpack/_unpacker.pyx":467
9292 * raise StopIteration("No more data to unpack.")
9293 * else:
9294 * raise OutOfData("No more data to unpack.") # <<<<<<<<<<<<<<
9295 *
9296 * ret = execute(&self.ctx, self.buf, self.buf_tail, &self.buf_head)
9297 */
9298 /*else*/ {
9299 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_OutOfData); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 467, __pyx_L1_error)
9300 __Pyx_GOTREF(__pyx_t_6);
9301 __pyx_t_7 = NULL;
9302 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
9303 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
9304 if (likely(__pyx_t_7)) {
9305 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9306 __Pyx_INCREF(__pyx_t_7);
9307 __Pyx_INCREF(function);
9308 __Pyx_DECREF_SET(__pyx_t_6, function);
9309 }
9310 }
9311 __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_kp_u_No_more_data_to_unpack) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_No_more_data_to_unpack);
9312 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9313 if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 467, __pyx_L1_error)
9314 __Pyx_GOTREF(__pyx_t_4);
9315 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9316 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
9317 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9318 __PYX_ERR(1, 467, __pyx_L1_error)
9319 }
9320
9321 /* "msgpack/_unpacker.pyx":463
9322 * while 1:
9323 * prev_head = self.buf_head
9324 * if prev_head >= self.buf_tail: # <<<<<<<<<<<<<<
9325 * if iter:
9326 * raise StopIteration("No more data to unpack.")
9327 */
9328 }
9329
9330 /* "msgpack/_unpacker.pyx":469
9331 * raise OutOfData("No more data to unpack.")
9332 *
9333 * ret = execute(&self.ctx, self.buf, self.buf_tail, &self.buf_head) # <<<<<<<<<<<<<<
9334 * self.stream_offset += self.buf_head - prev_head
9335 *
9336 */
9337 __pyx_t_8 = __pyx_v_execute((&__pyx_v_self->ctx), __pyx_v_self->buf, __pyx_v_self->buf_tail, (&__pyx_v_self->buf_head)); if (unlikely(__pyx_t_8 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(1, 469, __pyx_L1_error)
9338 __pyx_v_ret = __pyx_t_8;
9339
9340 /* "msgpack/_unpacker.pyx":470
9341 *
9342 * ret = execute(&self.ctx, self.buf, self.buf_tail, &self.buf_head)
9343 * self.stream_offset += self.buf_head - prev_head # <<<<<<<<<<<<<<
9344 *
9345 * if ret == 1:
9346 */
9347 __pyx_v_self->stream_offset = (__pyx_v_self->stream_offset + (__pyx_v_self->buf_head - __pyx_v_prev_head));
9348
9349 /* "msgpack/_unpacker.pyx":472
9350 * self.stream_offset += self.buf_head - prev_head
9351 *
9352 * if ret == 1: # <<<<<<<<<<<<<<
9353 * obj = unpack_data(&self.ctx)
9354 * unpack_init(&self.ctx)
9355 */
9356 switch (__pyx_v_ret) {
9357 case 1:
9358
9359 /* "msgpack/_unpacker.pyx":473
9360 *
9361 * if ret == 1:
9362 * obj = unpack_data(&self.ctx) # <<<<<<<<<<<<<<
9363 * unpack_init(&self.ctx)
9364 * return obj
9365 */
9366 __pyx_t_4 = unpack_data((&__pyx_v_self->ctx)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 473, __pyx_L1_error)
9367 __Pyx_GOTREF(__pyx_t_4);
9368 __pyx_v_obj = __pyx_t_4;
9369 __pyx_t_4 = 0;
9370
9371 /* "msgpack/_unpacker.pyx":474
9372 * if ret == 1:
9373 * obj = unpack_data(&self.ctx)
9374 * unpack_init(&self.ctx) # <<<<<<<<<<<<<<
9375 * return obj
9376 * elif ret == 0:
9377 */
9378 unpack_init((&__pyx_v_self->ctx));
9379
9380 /* "msgpack/_unpacker.pyx":475
9381 * obj = unpack_data(&self.ctx)
9382 * unpack_init(&self.ctx)
9383 * return obj # <<<<<<<<<<<<<<
9384 * elif ret == 0:
9385 * if self.file_like is not None:
9386 */
9387 __Pyx_XDECREF(__pyx_r);
9388 __Pyx_INCREF(__pyx_v_obj);
9389 __pyx_r = __pyx_v_obj;
9390 goto __pyx_L0;
9391
9392 /* "msgpack/_unpacker.pyx":472
9393 * self.stream_offset += self.buf_head - prev_head
9394 *
9395 * if ret == 1: # <<<<<<<<<<<<<<
9396 * obj = unpack_data(&self.ctx)
9397 * unpack_init(&self.ctx)
9398 */
9399 break;
9400 case 0:
9401
9402 /* "msgpack/_unpacker.pyx":477
9403 * return obj
9404 * elif ret == 0:
9405 * if self.file_like is not None: # <<<<<<<<<<<<<<
9406 * self.read_from_file()
9407 * continue
9408 */
9409 __pyx_t_1 = (__pyx_v_self->file_like != Py_None);
9410 __pyx_t_3 = (__pyx_t_1 != 0);
9411 if (__pyx_t_3) {
9412
9413 /* "msgpack/_unpacker.pyx":478
9414 * elif ret == 0:
9415 * if self.file_like is not None:
9416 * self.read_from_file() # <<<<<<<<<<<<<<
9417 * continue
9418 * if iter:
9419 */
9420 __pyx_t_4 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self->__pyx_vtab)->read_from_file(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 478, __pyx_L1_error)
9421 __Pyx_GOTREF(__pyx_t_4);
9422 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9423
9424 /* "msgpack/_unpacker.pyx":479
9425 * if self.file_like is not None:
9426 * self.read_from_file()
9427 * continue # <<<<<<<<<<<<<<
9428 * if iter:
9429 * raise StopIteration("No more data to unpack.")
9430 */
9431 goto __pyx_L6_continue;
9432
9433 /* "msgpack/_unpacker.pyx":477
9434 * return obj
9435 * elif ret == 0:
9436 * if self.file_like is not None: # <<<<<<<<<<<<<<
9437 * self.read_from_file()
9438 * continue
9439 */
9440 }
9441
9442 /* "msgpack/_unpacker.pyx":480
9443 * self.read_from_file()
9444 * continue
9445 * if iter: # <<<<<<<<<<<<<<
9446 * raise StopIteration("No more data to unpack.")
9447 * else:
9448 */
9449 __pyx_t_3 = (__pyx_v_iter != 0);
9450 if (unlikely(__pyx_t_3)) {
9451
9452 /* "msgpack/_unpacker.pyx":481
9453 * continue
9454 * if iter:
9455 * raise StopIteration("No more data to unpack.") # <<<<<<<<<<<<<<
9456 * else:
9457 * raise OutOfData("No more data to unpack.")
9458 */
9459 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_StopIteration, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 481, __pyx_L1_error)
9460 __Pyx_GOTREF(__pyx_t_4);
9461 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
9462 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9463 __PYX_ERR(1, 481, __pyx_L1_error)
9464
9465 /* "msgpack/_unpacker.pyx":480
9466 * self.read_from_file()
9467 * continue
9468 * if iter: # <<<<<<<<<<<<<<
9469 * raise StopIteration("No more data to unpack.")
9470 * else:
9471 */
9472 }
9473
9474 /* "msgpack/_unpacker.pyx":483
9475 * raise StopIteration("No more data to unpack.")
9476 * else:
9477 * raise OutOfData("No more data to unpack.") # <<<<<<<<<<<<<<
9478 * elif ret == -2:
9479 * raise FormatError
9480 */
9481 /*else*/ {
9482 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_OutOfData); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 483, __pyx_L1_error)
9483 __Pyx_GOTREF(__pyx_t_6);
9484 __pyx_t_7 = NULL;
9485 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
9486 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
9487 if (likely(__pyx_t_7)) {
9488 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9489 __Pyx_INCREF(__pyx_t_7);
9490 __Pyx_INCREF(function);
9491 __Pyx_DECREF_SET(__pyx_t_6, function);
9492 }
9493 }
9494 __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_kp_u_No_more_data_to_unpack) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_No_more_data_to_unpack);
9495 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9496 if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 483, __pyx_L1_error)
9497 __Pyx_GOTREF(__pyx_t_4);
9498 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9499 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
9500 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9501 __PYX_ERR(1, 483, __pyx_L1_error)
9502 }
9503
9504 /* "msgpack/_unpacker.pyx":476
9505 * unpack_init(&self.ctx)
9506 * return obj
9507 * elif ret == 0: # <<<<<<<<<<<<<<
9508 * if self.file_like is not None:
9509 * self.read_from_file()
9510 */
9511 break;
9512 case -2L:
9513
9514 /* "msgpack/_unpacker.pyx":485
9515 * raise OutOfData("No more data to unpack.")
9516 * elif ret == -2:
9517 * raise FormatError # <<<<<<<<<<<<<<
9518 * elif ret == -3:
9519 * raise StackError
9520 */
9521 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FormatError); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 485, __pyx_L1_error)
9522 __Pyx_GOTREF(__pyx_t_4);
9523 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
9524 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9525 __PYX_ERR(1, 485, __pyx_L1_error)
9526
9527 /* "msgpack/_unpacker.pyx":484
9528 * else:
9529 * raise OutOfData("No more data to unpack.")
9530 * elif ret == -2: # <<<<<<<<<<<<<<
9531 * raise FormatError
9532 * elif ret == -3:
9533 */
9534 break;
9535 case -3L:
9536
9537 /* "msgpack/_unpacker.pyx":487
9538 * raise FormatError
9539 * elif ret == -3:
9540 * raise StackError # <<<<<<<<<<<<<<
9541 * else:
9542 * raise ValueError("Unpack failed: error = %d" % (ret,))
9543 */
9544 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_StackError); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 487, __pyx_L1_error)
9545 __Pyx_GOTREF(__pyx_t_4);
9546 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
9547 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9548 __PYX_ERR(1, 487, __pyx_L1_error)
9549
9550 /* "msgpack/_unpacker.pyx":486
9551 * elif ret == -2:
9552 * raise FormatError
9553 * elif ret == -3: # <<<<<<<<<<<<<<
9554 * raise StackError
9555 * else:
9556 */
9557 break;
9558 default:
9559
9560 /* "msgpack/_unpacker.pyx":489
9561 * raise StackError
9562 * else:
9563 * raise ValueError("Unpack failed: error = %d" % (ret,)) # <<<<<<<<<<<<<<
9564 *
9565 * def read_bytes(self, Py_ssize_t nbytes):
9566 */
9567 __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_ret, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 489, __pyx_L1_error)
9568 __Pyx_GOTREF(__pyx_t_4);
9569 __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unpack_failed_error, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 489, __pyx_L1_error)
9570 __Pyx_GOTREF(__pyx_t_6);
9571 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9572 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 489, __pyx_L1_error)
9573 __Pyx_GOTREF(__pyx_t_4);
9574 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9575 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
9576 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9577 __PYX_ERR(1, 489, __pyx_L1_error)
9578 break;
9579 }
9580 __pyx_L6_continue:;
9581 }
9582
9583 /* "msgpack/_unpacker.pyx":453
9584 * self.file_like = None
9585 *
9586 * cdef object _unpack(self, execute_fn execute, bint iter=0): # <<<<<<<<<<<<<<
9587 * cdef int ret
9588 * cdef object obj
9589 */
9590
9591 /* function exit code */
9592 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9593 goto __pyx_L0;
9594 __pyx_L1_error:;
9595 __Pyx_XDECREF(__pyx_t_4);
9596 __Pyx_XDECREF(__pyx_t_6);
9597 __Pyx_XDECREF(__pyx_t_7);
9598 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker._unpack", __pyx_clineno, __pyx_lineno, __pyx_filename);
9599 __pyx_r = 0;
9600 __pyx_L0:;
9601 __Pyx_XDECREF(__pyx_v_obj);
9602 __Pyx_XGIVEREF(__pyx_r);
9603 __Pyx_RefNannyFinishContext();
9604 return __pyx_r;
9605 }
9606
9607 /* "msgpack/_unpacker.pyx":491
9608 * raise ValueError("Unpack failed: error = %d" % (ret,))
9609 *
9610 * def read_bytes(self, Py_ssize_t nbytes): # <<<<<<<<<<<<<<
9611 * """Read a specified number of raw bytes from the stream"""
9612 * cdef Py_ssize_t nread
9613 */
9614
9615 /* Python wrapper */
9616 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_9read_bytes(PyObject *__pyx_v_self, PyObject *__pyx_arg_nbytes); /*proto*/
9617 static char __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_8read_bytes[] = "Unpacker.read_bytes(self, Py_ssize_t nbytes)\nRead a specified number of raw bytes from the stream";
9618 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_9read_bytes(PyObject *__pyx_v_self, PyObject *__pyx_arg_nbytes) {
9619 Py_ssize_t __pyx_v_nbytes;
9620 int __pyx_lineno = 0;
9621 const char *__pyx_filename = NULL;
9622 int __pyx_clineno = 0;
9623 PyObject *__pyx_r = 0;
9624 __Pyx_RefNannyDeclarations
9625 __Pyx_RefNannySetupContext("read_bytes (wrapper)", 0);
9626 assert(__pyx_arg_nbytes); {
9627 __pyx_v_nbytes = __Pyx_PyIndex_AsSsize_t(__pyx_arg_nbytes); if (unlikely((__pyx_v_nbytes == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 491, __pyx_L3_error)
9628 }
9629 goto __pyx_L4_argument_unpacking_done;
9630 __pyx_L3_error:;
9631 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.read_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
9632 __Pyx_RefNannyFinishContext();
9633 return NULL;
9634 __pyx_L4_argument_unpacking_done:;
9635 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_8read_bytes(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self), ((Py_ssize_t)__pyx_v_nbytes));
9636
9637 /* function exit code */
9638 __Pyx_RefNannyFinishContext();
9639 return __pyx_r;
9640 }
9641
9642 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_8read_bytes(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, Py_ssize_t __pyx_v_nbytes) {
9643 Py_ssize_t __pyx_v_nread;
9644 PyObject *__pyx_v_ret = NULL;
9645 PyObject *__pyx_r = NULL;
9646 __Pyx_RefNannyDeclarations
9647 Py_ssize_t __pyx_t_1;
9648 Py_ssize_t __pyx_t_2;
9649 Py_ssize_t __pyx_t_3;
9650 PyObject *__pyx_t_4 = NULL;
9651 int __pyx_t_5;
9652 int __pyx_t_6;
9653 int __pyx_t_7;
9654 PyObject *__pyx_t_8 = NULL;
9655 PyObject *__pyx_t_9 = NULL;
9656 PyObject *__pyx_t_10 = NULL;
9657 int __pyx_lineno = 0;
9658 const char *__pyx_filename = NULL;
9659 int __pyx_clineno = 0;
9660 __Pyx_RefNannySetupContext("read_bytes", 0);
9661
9662 /* "msgpack/_unpacker.pyx":494
9663 * """Read a specified number of raw bytes from the stream"""
9664 * cdef Py_ssize_t nread
9665 * nread = min(self.buf_tail - self.buf_head, nbytes) # <<<<<<<<<<<<<<
9666 * ret = PyBytes_FromStringAndSize(self.buf + self.buf_head, nread)
9667 * self.buf_head += nread
9668 */
9669 __pyx_t_1 = __pyx_v_nbytes;
9670 __pyx_t_2 = (__pyx_v_self->buf_tail - __pyx_v_self->buf_head);
9671 if (((__pyx_t_1 < __pyx_t_2) != 0)) {
9672 __pyx_t_3 = __pyx_t_1;
9673 } else {
9674 __pyx_t_3 = __pyx_t_2;
9675 }
9676 __pyx_v_nread = __pyx_t_3;
9677
9678 /* "msgpack/_unpacker.pyx":495
9679 * cdef Py_ssize_t nread
9680 * nread = min(self.buf_tail - self.buf_head, nbytes)
9681 * ret = PyBytes_FromStringAndSize(self.buf + self.buf_head, nread) # <<<<<<<<<<<<<<
9682 * self.buf_head += nread
9683 * if nread < nbytes and self.file_like is not None:
9684 */
9685 __pyx_t_4 = PyBytes_FromStringAndSize((__pyx_v_self->buf + __pyx_v_self->buf_head), __pyx_v_nread); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 495, __pyx_L1_error)
9686 __Pyx_GOTREF(__pyx_t_4);
9687 __pyx_v_ret = __pyx_t_4;
9688 __pyx_t_4 = 0;
9689
9690 /* "msgpack/_unpacker.pyx":496
9691 * nread = min(self.buf_tail - self.buf_head, nbytes)
9692 * ret = PyBytes_FromStringAndSize(self.buf + self.buf_head, nread)
9693 * self.buf_head += nread # <<<<<<<<<<<<<<
9694 * if nread < nbytes and self.file_like is not None:
9695 * ret += self.file_like.read(nbytes - nread)
9696 */
9697 __pyx_v_self->buf_head = (__pyx_v_self->buf_head + __pyx_v_nread);
9698
9699 /* "msgpack/_unpacker.pyx":497
9700 * ret = PyBytes_FromStringAndSize(self.buf + self.buf_head, nread)
9701 * self.buf_head += nread
9702 * if nread < nbytes and self.file_like is not None: # <<<<<<<<<<<<<<
9703 * ret += self.file_like.read(nbytes - nread)
9704 * nread = len(ret)
9705 */
9706 __pyx_t_6 = ((__pyx_v_nread < __pyx_v_nbytes) != 0);
9707 if (__pyx_t_6) {
9708 } else {
9709 __pyx_t_5 = __pyx_t_6;
9710 goto __pyx_L4_bool_binop_done;
9711 }
9712 __pyx_t_6 = (__pyx_v_self->file_like != Py_None);
9713 __pyx_t_7 = (__pyx_t_6 != 0);
9714 __pyx_t_5 = __pyx_t_7;
9715 __pyx_L4_bool_binop_done:;
9716 if (__pyx_t_5) {
9717
9718 /* "msgpack/_unpacker.pyx":498
9719 * self.buf_head += nread
9720 * if nread < nbytes and self.file_like is not None:
9721 * ret += self.file_like.read(nbytes - nread) # <<<<<<<<<<<<<<
9722 * nread = len(ret)
9723 * self.stream_offset += nread
9724 */
9725 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->file_like, __pyx_n_s_read); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 498, __pyx_L1_error)
9726 __Pyx_GOTREF(__pyx_t_8);
9727 __pyx_t_9 = PyInt_FromSsize_t((__pyx_v_nbytes - __pyx_v_nread)); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 498, __pyx_L1_error)
9728 __Pyx_GOTREF(__pyx_t_9);
9729 __pyx_t_10 = NULL;
9730 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
9731 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
9732 if (likely(__pyx_t_10)) {
9733 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
9734 __Pyx_INCREF(__pyx_t_10);
9735 __Pyx_INCREF(function);
9736 __Pyx_DECREF_SET(__pyx_t_8, function);
9737 }
9738 }
9739 __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
9740 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
9741 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9742 if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 498, __pyx_L1_error)
9743 __Pyx_GOTREF(__pyx_t_4);
9744 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9745 __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_ret, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 498, __pyx_L1_error)
9746 __Pyx_GOTREF(__pyx_t_8);
9747 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9748 __Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_8);
9749 __pyx_t_8 = 0;
9750
9751 /* "msgpack/_unpacker.pyx":499
9752 * if nread < nbytes and self.file_like is not None:
9753 * ret += self.file_like.read(nbytes - nread)
9754 * nread = len(ret) # <<<<<<<<<<<<<<
9755 * self.stream_offset += nread
9756 * return ret
9757 */
9758 __pyx_t_3 = PyObject_Length(__pyx_v_ret); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 499, __pyx_L1_error)
9759 __pyx_v_nread = __pyx_t_3;
9760
9761 /* "msgpack/_unpacker.pyx":497
9762 * ret = PyBytes_FromStringAndSize(self.buf + self.buf_head, nread)
9763 * self.buf_head += nread
9764 * if nread < nbytes and self.file_like is not None: # <<<<<<<<<<<<<<
9765 * ret += self.file_like.read(nbytes - nread)
9766 * nread = len(ret)
9767 */
9768 }
9769
9770 /* "msgpack/_unpacker.pyx":500
9771 * ret += self.file_like.read(nbytes - nread)
9772 * nread = len(ret)
9773 * self.stream_offset += nread # <<<<<<<<<<<<<<
9774 * return ret
9775 *
9776 */
9777 __pyx_v_self->stream_offset = (__pyx_v_self->stream_offset + __pyx_v_nread);
9778
9779 /* "msgpack/_unpacker.pyx":501
9780 * nread = len(ret)
9781 * self.stream_offset += nread
9782 * return ret # <<<<<<<<<<<<<<
9783 *
9784 * def unpack(self):
9785 */
9786 __Pyx_XDECREF(__pyx_r);
9787 __Pyx_INCREF(__pyx_v_ret);
9788 __pyx_r = __pyx_v_ret;
9789 goto __pyx_L0;
9790
9791 /* "msgpack/_unpacker.pyx":491
9792 * raise ValueError("Unpack failed: error = %d" % (ret,))
9793 *
9794 * def read_bytes(self, Py_ssize_t nbytes): # <<<<<<<<<<<<<<
9795 * """Read a specified number of raw bytes from the stream"""
9796 * cdef Py_ssize_t nread
9797 */
9798
9799 /* function exit code */
9800 __pyx_L1_error:;
9801 __Pyx_XDECREF(__pyx_t_4);
9802 __Pyx_XDECREF(__pyx_t_8);
9803 __Pyx_XDECREF(__pyx_t_9);
9804 __Pyx_XDECREF(__pyx_t_10);
9805 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.read_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
9806 __pyx_r = NULL;
9807 __pyx_L0:;
9808 __Pyx_XDECREF(__pyx_v_ret);
9809 __Pyx_XGIVEREF(__pyx_r);
9810 __Pyx_RefNannyFinishContext();
9811 return __pyx_r;
9812 }
9813
9814 /* "msgpack/_unpacker.pyx":503
9815 * return ret
9816 *
9817 * def unpack(self): # <<<<<<<<<<<<<<
9818 * """Unpack one object
9819 *
9820 */
9821
9822 /* Python wrapper */
9823 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_11unpack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
9824 static char __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_10unpack[] = "Unpacker.unpack(self)\nUnpack one object\n\n Raises `OutOfData` when there are no more bytes to unpack.\n ";
9825 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_11unpack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9826 PyObject *__pyx_r = 0;
9827 __Pyx_RefNannyDeclarations
9828 __Pyx_RefNannySetupContext("unpack (wrapper)", 0);
9829 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_10unpack(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self));
9830
9831 /* function exit code */
9832 __Pyx_RefNannyFinishContext();
9833 return __pyx_r;
9834 }
9835
9836 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_10unpack(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self) {
9837 PyObject *__pyx_r = NULL;
9838 __Pyx_RefNannyDeclarations
9839 PyObject *__pyx_t_1 = NULL;
9840 int __pyx_lineno = 0;
9841 const char *__pyx_filename = NULL;
9842 int __pyx_clineno = 0;
9843 __Pyx_RefNannySetupContext("unpack", 0);
9844
9845 /* "msgpack/_unpacker.pyx":508
9846 * Raises `OutOfData` when there are no more bytes to unpack.
9847 * """
9848 * return self._unpack(unpack_construct) # <<<<<<<<<<<<<<
9849 *
9850 * def skip(self):
9851 */
9852 __Pyx_XDECREF(__pyx_r);
9853 __pyx_t_1 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self->__pyx_vtab)->_unpack(__pyx_v_self, unpack_construct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error)
9854 __Pyx_GOTREF(__pyx_t_1);
9855 __pyx_r = __pyx_t_1;
9856 __pyx_t_1 = 0;
9857 goto __pyx_L0;
9858
9859 /* "msgpack/_unpacker.pyx":503
9860 * return ret
9861 *
9862 * def unpack(self): # <<<<<<<<<<<<<<
9863 * """Unpack one object
9864 *
9865 */
9866
9867 /* function exit code */
9868 __pyx_L1_error:;
9869 __Pyx_XDECREF(__pyx_t_1);
9870 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.unpack", __pyx_clineno, __pyx_lineno, __pyx_filename);
9871 __pyx_r = NULL;
9872 __pyx_L0:;
9873 __Pyx_XGIVEREF(__pyx_r);
9874 __Pyx_RefNannyFinishContext();
9875 return __pyx_r;
9876 }
9877
9878 /* "msgpack/_unpacker.pyx":510
9879 * return self._unpack(unpack_construct)
9880 *
9881 * def skip(self): # <<<<<<<<<<<<<<
9882 * """Read and ignore one object, returning None
9883 *
9884 */
9885
9886 /* Python wrapper */
9887 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_13skip(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
9888 static char __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_12skip[] = "Unpacker.skip(self)\nRead and ignore one object, returning None\n\n Raises `OutOfData` when there are no more bytes to unpack.\n ";
9889 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_13skip(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9890 PyObject *__pyx_r = 0;
9891 __Pyx_RefNannyDeclarations
9892 __Pyx_RefNannySetupContext("skip (wrapper)", 0);
9893 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_12skip(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self));
9894
9895 /* function exit code */
9896 __Pyx_RefNannyFinishContext();
9897 return __pyx_r;
9898 }
9899
9900 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_12skip(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self) {
9901 PyObject *__pyx_r = NULL;
9902 __Pyx_RefNannyDeclarations
9903 PyObject *__pyx_t_1 = NULL;
9904 int __pyx_lineno = 0;
9905 const char *__pyx_filename = NULL;
9906 int __pyx_clineno = 0;
9907 __Pyx_RefNannySetupContext("skip", 0);
9908
9909 /* "msgpack/_unpacker.pyx":515
9910 * Raises `OutOfData` when there are no more bytes to unpack.
9911 * """
9912 * return self._unpack(unpack_skip) # <<<<<<<<<<<<<<
9913 *
9914 * def read_array_header(self):
9915 */
9916 __Pyx_XDECREF(__pyx_r);
9917 __pyx_t_1 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self->__pyx_vtab)->_unpack(__pyx_v_self, unpack_skip, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 515, __pyx_L1_error)
9918 __Pyx_GOTREF(__pyx_t_1);
9919 __pyx_r = __pyx_t_1;
9920 __pyx_t_1 = 0;
9921 goto __pyx_L0;
9922
9923 /* "msgpack/_unpacker.pyx":510
9924 * return self._unpack(unpack_construct)
9925 *
9926 * def skip(self): # <<<<<<<<<<<<<<
9927 * """Read and ignore one object, returning None
9928 *
9929 */
9930
9931 /* function exit code */
9932 __pyx_L1_error:;
9933 __Pyx_XDECREF(__pyx_t_1);
9934 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.skip", __pyx_clineno, __pyx_lineno, __pyx_filename);
9935 __pyx_r = NULL;
9936 __pyx_L0:;
9937 __Pyx_XGIVEREF(__pyx_r);
9938 __Pyx_RefNannyFinishContext();
9939 return __pyx_r;
9940 }
9941
9942 /* "msgpack/_unpacker.pyx":517
9943 * return self._unpack(unpack_skip)
9944 *
9945 * def read_array_header(self): # <<<<<<<<<<<<<<
9946 * """assuming the next object is an array, return its size n, such that
9947 * the next n unpack() calls will iterate over its contents.
9948 */
9949
9950 /* Python wrapper */
9951 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_15read_array_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
9952 static char __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_14read_array_header[] = "Unpacker.read_array_header(self)\nassuming the next object is an array, return its size n, such that\n the next n unpack() calls will iterate over its contents.\n\n Raises `OutOfData` when there are no more bytes to unpack.\n ";
9953 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_15read_array_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9954 PyObject *__pyx_r = 0;
9955 __Pyx_RefNannyDeclarations
9956 __Pyx_RefNannySetupContext("read_array_header (wrapper)", 0);
9957 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_14read_array_header(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self));
9958
9959 /* function exit code */
9960 __Pyx_RefNannyFinishContext();
9961 return __pyx_r;
9962 }
9963
9964 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_14read_array_header(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self) {
9965 PyObject *__pyx_r = NULL;
9966 __Pyx_RefNannyDeclarations
9967 PyObject *__pyx_t_1 = NULL;
9968 int __pyx_lineno = 0;
9969 const char *__pyx_filename = NULL;
9970 int __pyx_clineno = 0;
9971 __Pyx_RefNannySetupContext("read_array_header", 0);
9972
9973 /* "msgpack/_unpacker.pyx":523
9974 * Raises `OutOfData` when there are no more bytes to unpack.
9975 * """
9976 * return self._unpack(read_array_header) # <<<<<<<<<<<<<<
9977 *
9978 * def read_map_header(self):
9979 */
9980 __Pyx_XDECREF(__pyx_r);
9981 __pyx_t_1 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self->__pyx_vtab)->_unpack(__pyx_v_self, read_array_header, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 523, __pyx_L1_error)
9982 __Pyx_GOTREF(__pyx_t_1);
9983 __pyx_r = __pyx_t_1;
9984 __pyx_t_1 = 0;
9985 goto __pyx_L0;
9986
9987 /* "msgpack/_unpacker.pyx":517
9988 * return self._unpack(unpack_skip)
9989 *
9990 * def read_array_header(self): # <<<<<<<<<<<<<<
9991 * """assuming the next object is an array, return its size n, such that
9992 * the next n unpack() calls will iterate over its contents.
9993 */
9994
9995 /* function exit code */
9996 __pyx_L1_error:;
9997 __Pyx_XDECREF(__pyx_t_1);
9998 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.read_array_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
9999 __pyx_r = NULL;
10000 __pyx_L0:;
10001 __Pyx_XGIVEREF(__pyx_r);
10002 __Pyx_RefNannyFinishContext();
10003 return __pyx_r;
10004 }
10005
10006 /* "msgpack/_unpacker.pyx":525
10007 * return self._unpack(read_array_header)
10008 *
10009 * def read_map_header(self): # <<<<<<<<<<<<<<
10010 * """assuming the next object is a map, return its size n, such that the
10011 * next n * 2 unpack() calls will iterate over its key-value pairs.
10012 */
10013
10014 /* Python wrapper */
10015 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_17read_map_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
10016 static char __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_16read_map_header[] = "Unpacker.read_map_header(self)\nassuming the next object is a map, return its size n, such that the\n next n * 2 unpack() calls will iterate over its key-value pairs.\n\n Raises `OutOfData` when there are no more bytes to unpack.\n ";
10017 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_17read_map_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
10018 PyObject *__pyx_r = 0;
10019 __Pyx_RefNannyDeclarations
10020 __Pyx_RefNannySetupContext("read_map_header (wrapper)", 0);
10021 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_16read_map_header(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self));
10022
10023 /* function exit code */
10024 __Pyx_RefNannyFinishContext();
10025 return __pyx_r;
10026 }
10027
10028 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_16read_map_header(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self) {
10029 PyObject *__pyx_r = NULL;
10030 __Pyx_RefNannyDeclarations
10031 PyObject *__pyx_t_1 = NULL;
10032 int __pyx_lineno = 0;
10033 const char *__pyx_filename = NULL;
10034 int __pyx_clineno = 0;
10035 __Pyx_RefNannySetupContext("read_map_header", 0);
10036
10037 /* "msgpack/_unpacker.pyx":531
10038 * Raises `OutOfData` when there are no more bytes to unpack.
10039 * """
10040 * return self._unpack(read_map_header) # <<<<<<<<<<<<<<
10041 *
10042 * def tell(self):
10043 */
10044 __Pyx_XDECREF(__pyx_r);
10045 __pyx_t_1 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self->__pyx_vtab)->_unpack(__pyx_v_self, read_map_header, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 531, __pyx_L1_error)
10046 __Pyx_GOTREF(__pyx_t_1);
10047 __pyx_r = __pyx_t_1;
10048 __pyx_t_1 = 0;
10049 goto __pyx_L0;
10050
10051 /* "msgpack/_unpacker.pyx":525
10052 * return self._unpack(read_array_header)
10053 *
10054 * def read_map_header(self): # <<<<<<<<<<<<<<
10055 * """assuming the next object is a map, return its size n, such that the
10056 * next n * 2 unpack() calls will iterate over its key-value pairs.
10057 */
10058
10059 /* function exit code */
10060 __pyx_L1_error:;
10061 __Pyx_XDECREF(__pyx_t_1);
10062 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.read_map_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
10063 __pyx_r = NULL;
10064 __pyx_L0:;
10065 __Pyx_XGIVEREF(__pyx_r);
10066 __Pyx_RefNannyFinishContext();
10067 return __pyx_r;
10068 }
10069
10070 /* "msgpack/_unpacker.pyx":533
10071 * return self._unpack(read_map_header)
10072 *
10073 * def tell(self): # <<<<<<<<<<<<<<
10074 * """Returns the current position of the Unpacker in bytes, i.e., the
10075 * number of bytes that were read from the input, also the starting
10076 */
10077
10078 /* Python wrapper */
10079 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_19tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
10080 static char __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_18tell[] = "Unpacker.tell(self)\nReturns the current position of the Unpacker in bytes, i.e., the\n number of bytes that were read from the input, also the starting\n position of the next object.\n ";
10081 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_19tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
10082 PyObject *__pyx_r = 0;
10083 __Pyx_RefNannyDeclarations
10084 __Pyx_RefNannySetupContext("tell (wrapper)", 0);
10085 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_18tell(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self));
10086
10087 /* function exit code */
10088 __Pyx_RefNannyFinishContext();
10089 return __pyx_r;
10090 }
10091
10092 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_18tell(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self) {
10093 PyObject *__pyx_r = NULL;
10094 __Pyx_RefNannyDeclarations
10095 PyObject *__pyx_t_1 = NULL;
10096 int __pyx_lineno = 0;
10097 const char *__pyx_filename = NULL;
10098 int __pyx_clineno = 0;
10099 __Pyx_RefNannySetupContext("tell", 0);
10100
10101 /* "msgpack/_unpacker.pyx":538
10102 * position of the next object.
10103 * """
10104 * return self.stream_offset # <<<<<<<<<<<<<<
10105 *
10106 * def __iter__(self):
10107 */
10108 __Pyx_XDECREF(__pyx_r);
10109 __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->stream_offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 538, __pyx_L1_error)
10110 __Pyx_GOTREF(__pyx_t_1);
10111 __pyx_r = __pyx_t_1;
10112 __pyx_t_1 = 0;
10113 goto __pyx_L0;
10114
10115 /* "msgpack/_unpacker.pyx":533
10116 * return self._unpack(read_map_header)
10117 *
10118 * def tell(self): # <<<<<<<<<<<<<<
10119 * """Returns the current position of the Unpacker in bytes, i.e., the
10120 * number of bytes that were read from the input, also the starting
10121 */
10122
10123 /* function exit code */
10124 __pyx_L1_error:;
10125 __Pyx_XDECREF(__pyx_t_1);
10126 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.tell", __pyx_clineno, __pyx_lineno, __pyx_filename);
10127 __pyx_r = NULL;
10128 __pyx_L0:;
10129 __Pyx_XGIVEREF(__pyx_r);
10130 __Pyx_RefNannyFinishContext();
10131 return __pyx_r;
10132 }
10133
10134 /* "msgpack/_unpacker.pyx":540
10135 * return self.stream_offset
10136 *
10137 * def __iter__(self): # <<<<<<<<<<<<<<
10138 * return self
10139 *
10140 */
10141
10142 /* Python wrapper */
10143 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_21__iter__(PyObject *__pyx_v_self); /*proto*/
10144 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_21__iter__(PyObject *__pyx_v_self) {
10145 PyObject *__pyx_r = 0;
10146 __Pyx_RefNannyDeclarations
10147 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
10148 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_20__iter__(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self));
10149
10150 /* function exit code */
10151 __Pyx_RefNannyFinishContext();
10152 return __pyx_r;
10153 }
10154
10155 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_20__iter__(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self) {
10156 PyObject *__pyx_r = NULL;
10157 __Pyx_RefNannyDeclarations
10158 __Pyx_RefNannySetupContext("__iter__", 0);
10159
10160 /* "msgpack/_unpacker.pyx":541
10161 *
10162 * def __iter__(self):
10163 * return self # <<<<<<<<<<<<<<
10164 *
10165 * def __next__(self):
10166 */
10167 __Pyx_XDECREF(__pyx_r);
10168 __Pyx_INCREF(((PyObject *)__pyx_v_self));
10169 __pyx_r = ((PyObject *)__pyx_v_self);
10170 goto __pyx_L0;
10171
10172 /* "msgpack/_unpacker.pyx":540
10173 * return self.stream_offset
10174 *
10175 * def __iter__(self): # <<<<<<<<<<<<<<
10176 * return self
10177 *
10178 */
10179
10180 /* function exit code */
10181 __pyx_L0:;
10182 __Pyx_XGIVEREF(__pyx_r);
10183 __Pyx_RefNannyFinishContext();
10184 return __pyx_r;
10185 }
10186
10187 /* "msgpack/_unpacker.pyx":543
10188 * return self
10189 *
10190 * def __next__(self): # <<<<<<<<<<<<<<
10191 * return self._unpack(unpack_construct, 1)
10192 *
10193 */
10194
10195 /* Python wrapper */
10196 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_23__next__(PyObject *__pyx_v_self); /*proto*/
10197 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_23__next__(PyObject *__pyx_v_self) {
10198 PyObject *__pyx_r = 0;
10199 __Pyx_RefNannyDeclarations
10200 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
10201 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_22__next__(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self));
10202
10203 /* function exit code */
10204 __Pyx_RefNannyFinishContext();
10205 return __pyx_r;
10206 }
10207
10208 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_22__next__(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self) {
10209 PyObject *__pyx_r = NULL;
10210 __Pyx_RefNannyDeclarations
10211 PyObject *__pyx_t_1 = NULL;
10212 struct __pyx_opt_args_7msgpack_9_cmsgpack_8Unpacker__unpack __pyx_t_2;
10213 int __pyx_lineno = 0;
10214 const char *__pyx_filename = NULL;
10215 int __pyx_clineno = 0;
10216 __Pyx_RefNannySetupContext("__next__", 0);
10217
10218 /* "msgpack/_unpacker.pyx":544
10219 *
10220 * def __next__(self):
10221 * return self._unpack(unpack_construct, 1) # <<<<<<<<<<<<<<
10222 *
10223 * # for debug.
10224 */
10225 __Pyx_XDECREF(__pyx_r);
10226 __pyx_t_2.__pyx_n = 1;
10227 __pyx_t_2.iter = 1;
10228 __pyx_t_1 = ((struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self->__pyx_vtab)->_unpack(__pyx_v_self, unpack_construct, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 544, __pyx_L1_error)
10229 __Pyx_GOTREF(__pyx_t_1);
10230 __pyx_r = __pyx_t_1;
10231 __pyx_t_1 = 0;
10232 goto __pyx_L0;
10233
10234 /* "msgpack/_unpacker.pyx":543
10235 * return self
10236 *
10237 * def __next__(self): # <<<<<<<<<<<<<<
10238 * return self._unpack(unpack_construct, 1)
10239 *
10240 */
10241
10242 /* function exit code */
10243 __pyx_L1_error:;
10244 __Pyx_XDECREF(__pyx_t_1);
10245 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10246 __pyx_r = NULL;
10247 __pyx_L0:;
10248 __Pyx_XGIVEREF(__pyx_r);
10249 __Pyx_RefNannyFinishContext();
10250 return __pyx_r;
10251 }
10252
10253 /* "(tree fragment)":1
10254 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
10255 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10256 * def __setstate_cython__(self, __pyx_state):
10257 */
10258
10259 /* Python wrapper */
10260 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_25__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
10261 static char __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_24__reduce_cython__[] = "Unpacker.__reduce_cython__(self)";
10262 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_25__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
10263 PyObject *__pyx_r = 0;
10264 __Pyx_RefNannyDeclarations
10265 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
10266 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_24__reduce_cython__(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self));
10267
10268 /* function exit code */
10269 __Pyx_RefNannyFinishContext();
10270 return __pyx_r;
10271 }
10272
10273 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_24__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self) {
10274 PyObject *__pyx_r = NULL;
10275 __Pyx_RefNannyDeclarations
10276 PyObject *__pyx_t_1 = NULL;
10277 int __pyx_lineno = 0;
10278 const char *__pyx_filename = NULL;
10279 int __pyx_clineno = 0;
10280 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
10281
10282 /* "(tree fragment)":2
10283 * def __reduce_cython__(self):
10284 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10285 * def __setstate_cython__(self, __pyx_state):
10286 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10287 */
10288 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
10289 __Pyx_GOTREF(__pyx_t_1);
10290 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10291 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10292 __PYX_ERR(2, 2, __pyx_L1_error)
10293
10294 /* "(tree fragment)":1
10295 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
10296 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10297 * def __setstate_cython__(self, __pyx_state):
10298 */
10299
10300 /* function exit code */
10301 __pyx_L1_error:;
10302 __Pyx_XDECREF(__pyx_t_1);
10303 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10304 __pyx_r = NULL;
10305 __Pyx_XGIVEREF(__pyx_r);
10306 __Pyx_RefNannyFinishContext();
10307 return __pyx_r;
10308 }
10309
10310 /* "(tree fragment)":3
10311 * def __reduce_cython__(self):
10312 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10313 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
10314 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10315 */
10316
10317 /* Python wrapper */
10318 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_27__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
10319 static char __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_26__setstate_cython__[] = "Unpacker.__setstate_cython__(self, __pyx_state)";
10320 static PyObject *__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_27__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
10321 PyObject *__pyx_r = 0;
10322 __Pyx_RefNannyDeclarations
10323 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
10324 __pyx_r = __pyx_pf_7msgpack_9_cmsgpack_8Unpacker_26__setstate_cython__(((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
10325
10326 /* function exit code */
10327 __Pyx_RefNannyFinishContext();
10328 return __pyx_r;
10329 }
10330
10331 static PyObject *__pyx_pf_7msgpack_9_cmsgpack_8Unpacker_26__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
10332 PyObject *__pyx_r = NULL;
10333 __Pyx_RefNannyDeclarations
10334 PyObject *__pyx_t_1 = NULL;
10335 int __pyx_lineno = 0;
10336 const char *__pyx_filename = NULL;
10337 int __pyx_clineno = 0;
10338 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
10339
10340 /* "(tree fragment)":4
10341 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10342 * def __setstate_cython__(self, __pyx_state):
10343 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
10344 */
10345 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
10346 __Pyx_GOTREF(__pyx_t_1);
10347 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10348 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10349 __PYX_ERR(2, 4, __pyx_L1_error)
10350
10351 /* "(tree fragment)":3
10352 * def __reduce_cython__(self):
10353 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10354 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
10355 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10356 */
10357
10358 /* function exit code */
10359 __pyx_L1_error:;
10360 __Pyx_XDECREF(__pyx_t_1);
10361 __Pyx_AddTraceback("msgpack._cmsgpack.Unpacker.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10362 __pyx_r = NULL;
10363 __Pyx_XGIVEREF(__pyx_r);
10364 __Pyx_RefNannyFinishContext();
10365 return __pyx_r;
10366 }
10367
10368 /* "cpython/datetime.pxd":104
10369 * # Datetime C API initialization function.
10370 * # You have to call it before any usage of DateTime CAPI functions.
10371 * cdef inline void import_datetime(): # <<<<<<<<<<<<<<
10372 * PyDateTime_IMPORT
10373 *
10374 */
10375
10376 static CYTHON_INLINE void __pyx_f_7cpython_8datetime_import_datetime(void) {
10377 __Pyx_RefNannyDeclarations
10378 __Pyx_RefNannySetupContext("import_datetime", 0);
10379
10380 /* "cpython/datetime.pxd":105
10381 * # You have to call it before any usage of DateTime CAPI functions.
10382 * cdef inline void import_datetime():
10383 * PyDateTime_IMPORT # <<<<<<<<<<<<<<
10384 *
10385 * # Create date object using DateTime CAPI factory function.
10386 */
10387 (void)(PyDateTime_IMPORT);
10388
10389 /* "cpython/datetime.pxd":104
10390 * # Datetime C API initialization function.
10391 * # You have to call it before any usage of DateTime CAPI functions.
10392 * cdef inline void import_datetime(): # <<<<<<<<<<<<<<
10393 * PyDateTime_IMPORT
10394 *
10395 */
10396
10397 /* function exit code */
10398 __Pyx_RefNannyFinishContext();
10399 }
10400
10401 /* "cpython/datetime.pxd":109
10402 * # Create date object using DateTime CAPI factory function.
10403 * # Note, there are no range checks for any of the arguments.
10404 * cdef inline object date_new(int year, int month, int day): # <<<<<<<<<<<<<<
10405 * return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType)
10406 *
10407 */
10408
10409 static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_date_new(int __pyx_v_year, int __pyx_v_month, int __pyx_v_day) {
10410 PyObject *__pyx_r = NULL;
10411 __Pyx_RefNannyDeclarations
10412 PyObject *__pyx_t_1 = NULL;
10413 int __pyx_lineno = 0;
10414 const char *__pyx_filename = NULL;
10415 int __pyx_clineno = 0;
10416 __Pyx_RefNannySetupContext("date_new", 0);
10417
10418 /* "cpython/datetime.pxd":110
10419 * # Note, there are no range checks for any of the arguments.
10420 * cdef inline object date_new(int year, int month, int day):
10421 * return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType) # <<<<<<<<<<<<<<
10422 *
10423 * # Create time object using DateTime CAPI factory function
10424 */
10425 __Pyx_XDECREF(__pyx_r);
10426 __pyx_t_1 = PyDateTimeAPI->Date_FromDate(__pyx_v_year, __pyx_v_month, __pyx_v_day, PyDateTimeAPI->DateType); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 110, __pyx_L1_error)
10427 __Pyx_GOTREF(__pyx_t_1);
10428 __pyx_r = __pyx_t_1;
10429 __pyx_t_1 = 0;
10430 goto __pyx_L0;
10431
10432 /* "cpython/datetime.pxd":109
10433 * # Create date object using DateTime CAPI factory function.
10434 * # Note, there are no range checks for any of the arguments.
10435 * cdef inline object date_new(int year, int month, int day): # <<<<<<<<<<<<<<
10436 * return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType)
10437 *
10438 */
10439
10440 /* function exit code */
10441 __pyx_L1_error:;
10442 __Pyx_XDECREF(__pyx_t_1);
10443 __Pyx_AddTraceback("cpython.datetime.date_new", __pyx_clineno, __pyx_lineno, __pyx_filename);
10444 __pyx_r = 0;
10445 __pyx_L0:;
10446 __Pyx_XGIVEREF(__pyx_r);
10447 __Pyx_RefNannyFinishContext();
10448 return __pyx_r;
10449 }
10450
10451 /* "cpython/datetime.pxd":114
10452 * # Create time object using DateTime CAPI factory function
10453 * # Note, there are no range checks for any of the arguments.
10454 * cdef inline object time_new(int hour, int minute, int second, int microsecond, object tz): # <<<<<<<<<<<<<<
10455 * return PyDateTimeAPI.Time_FromTime(hour, minute, second, microsecond, tz, PyDateTimeAPI.TimeType)
10456 *
10457 */
10458
10459 static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_time_new(int __pyx_v_hour, int __pyx_v_minute, int __pyx_v_second, int __pyx_v_microsecond, PyObject *__pyx_v_tz) {
10460 PyObject *__pyx_r = NULL;
10461 __Pyx_RefNannyDeclarations
10462 PyObject *__pyx_t_1 = NULL;
10463 int __pyx_lineno = 0;
10464 const char *__pyx_filename = NULL;
10465 int __pyx_clineno = 0;
10466 __Pyx_RefNannySetupContext("time_new", 0);
10467
10468 /* "cpython/datetime.pxd":115
10469 * # Note, there are no range checks for any of the arguments.
10470 * cdef inline object time_new(int hour, int minute, int second, int microsecond, object tz):
10471 * return PyDateTimeAPI.Time_FromTime(hour, minute, second, microsecond, tz, PyDateTimeAPI.TimeType) # <<<<<<<<<<<<<<
10472 *
10473 * # Create datetime object using DateTime CAPI factory function.
10474 */
10475 __Pyx_XDECREF(__pyx_r);
10476 __pyx_t_1 = PyDateTimeAPI->Time_FromTime(__pyx_v_hour, __pyx_v_minute, __pyx_v_second, __pyx_v_microsecond, __pyx_v_tz, PyDateTimeAPI->TimeType); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 115, __pyx_L1_error)
10477 __Pyx_GOTREF(__pyx_t_1);
10478 __pyx_r = __pyx_t_1;
10479 __pyx_t_1 = 0;
10480 goto __pyx_L0;
10481
10482 /* "cpython/datetime.pxd":114
10483 * # Create time object using DateTime CAPI factory function
10484 * # Note, there are no range checks for any of the arguments.
10485 * cdef inline object time_new(int hour, int minute, int second, int microsecond, object tz): # <<<<<<<<<<<<<<
10486 * return PyDateTimeAPI.Time_FromTime(hour, minute, second, microsecond, tz, PyDateTimeAPI.TimeType)
10487 *
10488 */
10489
10490 /* function exit code */
10491 __pyx_L1_error:;
10492 __Pyx_XDECREF(__pyx_t_1);
10493 __Pyx_AddTraceback("cpython.datetime.time_new", __pyx_clineno, __pyx_lineno, __pyx_filename);
10494 __pyx_r = 0;
10495 __pyx_L0:;
10496 __Pyx_XGIVEREF(__pyx_r);
10497 __Pyx_RefNannyFinishContext();
10498 return __pyx_r;
10499 }
10500
10501 /* "cpython/datetime.pxd":119
10502 * # Create datetime object using DateTime CAPI factory function.
10503 * # Note, there are no range checks for any of the arguments.
10504 * cdef inline object datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz): # <<<<<<<<<<<<<<
10505 * return PyDateTimeAPI.DateTime_FromDateAndTime(year, month, day, hour, minute, second, microsecond, tz, PyDateTimeAPI.DateTimeType)
10506 *
10507 */
10508
10509 static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_datetime_new(int __pyx_v_year, int __pyx_v_month, int __pyx_v_day, int __pyx_v_hour, int __pyx_v_minute, int __pyx_v_second, int __pyx_v_microsecond, PyObject *__pyx_v_tz) {
10510 PyObject *__pyx_r = NULL;
10511 __Pyx_RefNannyDeclarations
10512 PyObject *__pyx_t_1 = NULL;
10513 int __pyx_lineno = 0;
10514 const char *__pyx_filename = NULL;
10515 int __pyx_clineno = 0;
10516 __Pyx_RefNannySetupContext("datetime_new", 0);
10517
10518 /* "cpython/datetime.pxd":120
10519 * # Note, there are no range checks for any of the arguments.
10520 * cdef inline object datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz):
10521 * return PyDateTimeAPI.DateTime_FromDateAndTime(year, month, day, hour, minute, second, microsecond, tz, PyDateTimeAPI.DateTimeType) # <<<<<<<<<<<<<<
10522 *
10523 * # Create timedelta object using DateTime CAPI factory function.
10524 */
10525 __Pyx_XDECREF(__pyx_r);
10526 __pyx_t_1 = PyDateTimeAPI->DateTime_FromDateAndTime(__pyx_v_year, __pyx_v_month, __pyx_v_day, __pyx_v_hour, __pyx_v_minute, __pyx_v_second, __pyx_v_microsecond, __pyx_v_tz, PyDateTimeAPI->DateTimeType); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 120, __pyx_L1_error)
10527 __Pyx_GOTREF(__pyx_t_1);
10528 __pyx_r = __pyx_t_1;
10529 __pyx_t_1 = 0;
10530 goto __pyx_L0;
10531
10532 /* "cpython/datetime.pxd":119
10533 * # Create datetime object using DateTime CAPI factory function.
10534 * # Note, there are no range checks for any of the arguments.
10535 * cdef inline object datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz): # <<<<<<<<<<<<<<
10536 * return PyDateTimeAPI.DateTime_FromDateAndTime(year, month, day, hour, minute, second, microsecond, tz, PyDateTimeAPI.DateTimeType)
10537 *
10538 */
10539
10540 /* function exit code */
10541 __pyx_L1_error:;
10542 __Pyx_XDECREF(__pyx_t_1);
10543 __Pyx_AddTraceback("cpython.datetime.datetime_new", __pyx_clineno, __pyx_lineno, __pyx_filename);
10544 __pyx_r = 0;
10545 __pyx_L0:;
10546 __Pyx_XGIVEREF(__pyx_r);
10547 __Pyx_RefNannyFinishContext();
10548 return __pyx_r;
10549 }
10550
10551 /* "cpython/datetime.pxd":124
10552 * # Create timedelta object using DateTime CAPI factory function.
10553 * # Note, there are no range checks for any of the arguments.
10554 * cdef inline object timedelta_new(int days, int seconds, int useconds): # <<<<<<<<<<<<<<
10555 * return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType)
10556 *
10557 */
10558
10559 static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_timedelta_new(int __pyx_v_days, int __pyx_v_seconds, int __pyx_v_useconds) {
10560 PyObject *__pyx_r = NULL;
10561 __Pyx_RefNannyDeclarations
10562 PyObject *__pyx_t_1 = NULL;
10563 int __pyx_lineno = 0;
10564 const char *__pyx_filename = NULL;
10565 int __pyx_clineno = 0;
10566 __Pyx_RefNannySetupContext("timedelta_new", 0);
10567
10568 /* "cpython/datetime.pxd":125
10569 * # Note, there are no range checks for any of the arguments.
10570 * cdef inline object timedelta_new(int days, int seconds, int useconds):
10571 * return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType) # <<<<<<<<<<<<<<
10572 *
10573 * # More recognizable getters for date/time/datetime/timedelta.
10574 */
10575 __Pyx_XDECREF(__pyx_r);
10576 __pyx_t_1 = PyDateTimeAPI->Delta_FromDelta(__pyx_v_days, __pyx_v_seconds, __pyx_v_useconds, 1, PyDateTimeAPI->DeltaType); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 125, __pyx_L1_error)
10577 __Pyx_GOTREF(__pyx_t_1);
10578 __pyx_r = __pyx_t_1;
10579 __pyx_t_1 = 0;
10580 goto __pyx_L0;
10581
10582 /* "cpython/datetime.pxd":124
10583 * # Create timedelta object using DateTime CAPI factory function.
10584 * # Note, there are no range checks for any of the arguments.
10585 * cdef inline object timedelta_new(int days, int seconds, int useconds): # <<<<<<<<<<<<<<
10586 * return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType)
10587 *
10588 */
10589
10590 /* function exit code */
10591 __pyx_L1_error:;
10592 __Pyx_XDECREF(__pyx_t_1);
10593 __Pyx_AddTraceback("cpython.datetime.timedelta_new", __pyx_clineno, __pyx_lineno, __pyx_filename);
10594 __pyx_r = 0;
10595 __pyx_L0:;
10596 __Pyx_XGIVEREF(__pyx_r);
10597 __Pyx_RefNannyFinishContext();
10598 return __pyx_r;
10599 }
10600
10601 /* "cpython/datetime.pxd":133
10602 *
10603 * # Get tzinfo of time
10604 * cdef inline object time_tzinfo(object o): # <<<<<<<<<<<<<<
10605 * if (<PyDateTime_Time*>o).hastzinfo:
10606 * return <object>(<PyDateTime_Time*>o).tzinfo
10607 */
10608
10609 static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_time_tzinfo(PyObject *__pyx_v_o) {
10610 PyObject *__pyx_r = NULL;
10611 __Pyx_RefNannyDeclarations
10612 int __pyx_t_1;
10613 __Pyx_RefNannySetupContext("time_tzinfo", 0);
10614
10615 /* "cpython/datetime.pxd":134
10616 * # Get tzinfo of time
10617 * cdef inline object time_tzinfo(object o):
10618 * if (<PyDateTime_Time*>o).hastzinfo: # <<<<<<<<<<<<<<
10619 * return <object>(<PyDateTime_Time*>o).tzinfo
10620 * else:
10621 */
10622 __pyx_t_1 = (((PyDateTime_Time *)__pyx_v_o)->hastzinfo != 0);
10623 if (__pyx_t_1) {
10624
10625 /* "cpython/datetime.pxd":135
10626 * cdef inline object time_tzinfo(object o):
10627 * if (<PyDateTime_Time*>o).hastzinfo:
10628 * return <object>(<PyDateTime_Time*>o).tzinfo # <<<<<<<<<<<<<<
10629 * else:
10630 * return None
10631 */
10632 __Pyx_XDECREF(__pyx_r);
10633 __Pyx_INCREF(((PyObject *)((PyDateTime_Time *)__pyx_v_o)->tzinfo));
10634 __pyx_r = ((PyObject *)((PyDateTime_Time *)__pyx_v_o)->tzinfo);
10635 goto __pyx_L0;
10636
10637 /* "cpython/datetime.pxd":134
10638 * # Get tzinfo of time
10639 * cdef inline object time_tzinfo(object o):
10640 * if (<PyDateTime_Time*>o).hastzinfo: # <<<<<<<<<<<<<<
10641 * return <object>(<PyDateTime_Time*>o).tzinfo
10642 * else:
10643 */
10644 }
10645
10646 /* "cpython/datetime.pxd":137
10647 * return <object>(<PyDateTime_Time*>o).tzinfo
10648 * else:
10649 * return None # <<<<<<<<<<<<<<
10650 *
10651 * # Get tzinfo of datetime
10652 */
10653 /*else*/ {
10654 __Pyx_XDECREF(__pyx_r);
10655 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10656 goto __pyx_L0;
10657 }
10658
10659 /* "cpython/datetime.pxd":133
10660 *
10661 * # Get tzinfo of time
10662 * cdef inline object time_tzinfo(object o): # <<<<<<<<<<<<<<
10663 * if (<PyDateTime_Time*>o).hastzinfo:
10664 * return <object>(<PyDateTime_Time*>o).tzinfo
10665 */
10666
10667 /* function exit code */
10668 __pyx_L0:;
10669 __Pyx_XGIVEREF(__pyx_r);
10670 __Pyx_RefNannyFinishContext();
10671 return __pyx_r;
10672 }
10673
10674 /* "cpython/datetime.pxd":140
10675 *
10676 * # Get tzinfo of datetime
10677 * cdef inline object datetime_tzinfo(object o): # <<<<<<<<<<<<<<
10678 * if (<PyDateTime_DateTime*>o).hastzinfo:
10679 * return <object>(<PyDateTime_DateTime*>o).tzinfo
10680 */
10681
10682 static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_datetime_tzinfo(PyObject *__pyx_v_o) {
10683 PyObject *__pyx_r = NULL;
10684 __Pyx_RefNannyDeclarations
10685 int __pyx_t_1;
10686 __Pyx_RefNannySetupContext("datetime_tzinfo", 0);
10687
10688 /* "cpython/datetime.pxd":141
10689 * # Get tzinfo of datetime
10690 * cdef inline object datetime_tzinfo(object o):
10691 * if (<PyDateTime_DateTime*>o).hastzinfo: # <<<<<<<<<<<<<<
10692 * return <object>(<PyDateTime_DateTime*>o).tzinfo
10693 * else:
10694 */
10695 __pyx_t_1 = (((PyDateTime_DateTime *)__pyx_v_o)->hastzinfo != 0);
10696 if (__pyx_t_1) {
10697
10698 /* "cpython/datetime.pxd":142
10699 * cdef inline object datetime_tzinfo(object o):
10700 * if (<PyDateTime_DateTime*>o).hastzinfo:
10701 * return <object>(<PyDateTime_DateTime*>o).tzinfo # <<<<<<<<<<<<<<
10702 * else:
10703 * return None
10704 */
10705 __Pyx_XDECREF(__pyx_r);
10706 __Pyx_INCREF(((PyObject *)((PyDateTime_DateTime *)__pyx_v_o)->tzinfo));
10707 __pyx_r = ((PyObject *)((PyDateTime_DateTime *)__pyx_v_o)->tzinfo);
10708 goto __pyx_L0;
10709
10710 /* "cpython/datetime.pxd":141
10711 * # Get tzinfo of datetime
10712 * cdef inline object datetime_tzinfo(object o):
10713 * if (<PyDateTime_DateTime*>o).hastzinfo: # <<<<<<<<<<<<<<
10714 * return <object>(<PyDateTime_DateTime*>o).tzinfo
10715 * else:
10716 */
10717 }
10718
10719 /* "cpython/datetime.pxd":144
10720 * return <object>(<PyDateTime_DateTime*>o).tzinfo
10721 * else:
10722 * return None # <<<<<<<<<<<<<<
10723 *
10724 * # Get year of date
10725 */
10726 /*else*/ {
10727 __Pyx_XDECREF(__pyx_r);
10728 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10729 goto __pyx_L0;
10730 }
10731
10732 /* "cpython/datetime.pxd":140
10733 *
10734 * # Get tzinfo of datetime
10735 * cdef inline object datetime_tzinfo(object o): # <<<<<<<<<<<<<<
10736 * if (<PyDateTime_DateTime*>o).hastzinfo:
10737 * return <object>(<PyDateTime_DateTime*>o).tzinfo
10738 */
10739
10740 /* function exit code */
10741 __pyx_L0:;
10742 __Pyx_XGIVEREF(__pyx_r);
10743 __Pyx_RefNannyFinishContext();
10744 return __pyx_r;
10745 }
10746
10747 /* "cpython/datetime.pxd":147
10748 *
10749 * # Get year of date
10750 * cdef inline int date_year(object o): # <<<<<<<<<<<<<<
10751 * return PyDateTime_GET_YEAR(o)
10752 *
10753 */
10754
10755 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_year(PyObject *__pyx_v_o) {
10756 int __pyx_r;
10757 __Pyx_RefNannyDeclarations
10758 __Pyx_RefNannySetupContext("date_year", 0);
10759
10760 /* "cpython/datetime.pxd":148
10761 * # Get year of date
10762 * cdef inline int date_year(object o):
10763 * return PyDateTime_GET_YEAR(o) # <<<<<<<<<<<<<<
10764 *
10765 * # Get month of date
10766 */
10767 __pyx_r = PyDateTime_GET_YEAR(__pyx_v_o);
10768 goto __pyx_L0;
10769
10770 /* "cpython/datetime.pxd":147
10771 *
10772 * # Get year of date
10773 * cdef inline int date_year(object o): # <<<<<<<<<<<<<<
10774 * return PyDateTime_GET_YEAR(o)
10775 *
10776 */
10777
10778 /* function exit code */
10779 __pyx_L0:;
10780 __Pyx_RefNannyFinishContext();
10781 return __pyx_r;
10782 }
10783
10784 /* "cpython/datetime.pxd":151
10785 *
10786 * # Get month of date
10787 * cdef inline int date_month(object o): # <<<<<<<<<<<<<<
10788 * return PyDateTime_GET_MONTH(o)
10789 *
10790 */
10791
10792 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_month(PyObject *__pyx_v_o) {
10793 int __pyx_r;
10794 __Pyx_RefNannyDeclarations
10795 __Pyx_RefNannySetupContext("date_month", 0);
10796
10797 /* "cpython/datetime.pxd":152
10798 * # Get month of date
10799 * cdef inline int date_month(object o):
10800 * return PyDateTime_GET_MONTH(o) # <<<<<<<<<<<<<<
10801 *
10802 * # Get day of date
10803 */
10804 __pyx_r = PyDateTime_GET_MONTH(__pyx_v_o);
10805 goto __pyx_L0;
10806
10807 /* "cpython/datetime.pxd":151
10808 *
10809 * # Get month of date
10810 * cdef inline int date_month(object o): # <<<<<<<<<<<<<<
10811 * return PyDateTime_GET_MONTH(o)
10812 *
10813 */
10814
10815 /* function exit code */
10816 __pyx_L0:;
10817 __Pyx_RefNannyFinishContext();
10818 return __pyx_r;
10819 }
10820
10821 /* "cpython/datetime.pxd":155
10822 *
10823 * # Get day of date
10824 * cdef inline int date_day(object o): # <<<<<<<<<<<<<<
10825 * return PyDateTime_GET_DAY(o)
10826 *
10827 */
10828
10829 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_day(PyObject *__pyx_v_o) {
10830 int __pyx_r;
10831 __Pyx_RefNannyDeclarations
10832 __Pyx_RefNannySetupContext("date_day", 0);
10833
10834 /* "cpython/datetime.pxd":156
10835 * # Get day of date
10836 * cdef inline int date_day(object o):
10837 * return PyDateTime_GET_DAY(o) # <<<<<<<<<<<<<<
10838 *
10839 * # Get year of datetime
10840 */
10841 __pyx_r = PyDateTime_GET_DAY(__pyx_v_o);
10842 goto __pyx_L0;
10843
10844 /* "cpython/datetime.pxd":155
10845 *
10846 * # Get day of date
10847 * cdef inline int date_day(object o): # <<<<<<<<<<<<<<
10848 * return PyDateTime_GET_DAY(o)
10849 *
10850 */
10851
10852 /* function exit code */
10853 __pyx_L0:;
10854 __Pyx_RefNannyFinishContext();
10855 return __pyx_r;
10856 }
10857
10858 /* "cpython/datetime.pxd":159
10859 *
10860 * # Get year of datetime
10861 * cdef inline int datetime_year(object o): # <<<<<<<<<<<<<<
10862 * return PyDateTime_GET_YEAR(o)
10863 *
10864 */
10865
10866 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_year(PyObject *__pyx_v_o) {
10867 int __pyx_r;
10868 __Pyx_RefNannyDeclarations
10869 __Pyx_RefNannySetupContext("datetime_year", 0);
10870
10871 /* "cpython/datetime.pxd":160
10872 * # Get year of datetime
10873 * cdef inline int datetime_year(object o):
10874 * return PyDateTime_GET_YEAR(o) # <<<<<<<<<<<<<<
10875 *
10876 * # Get month of datetime
10877 */
10878 __pyx_r = PyDateTime_GET_YEAR(__pyx_v_o);
10879 goto __pyx_L0;
10880
10881 /* "cpython/datetime.pxd":159
10882 *
10883 * # Get year of datetime
10884 * cdef inline int datetime_year(object o): # <<<<<<<<<<<<<<
10885 * return PyDateTime_GET_YEAR(o)
10886 *
10887 */
10888
10889 /* function exit code */
10890 __pyx_L0:;
10891 __Pyx_RefNannyFinishContext();
10892 return __pyx_r;
10893 }
10894
10895 /* "cpython/datetime.pxd":163
10896 *
10897 * # Get month of datetime
10898 * cdef inline int datetime_month(object o): # <<<<<<<<<<<<<<
10899 * return PyDateTime_GET_MONTH(o)
10900 *
10901 */
10902
10903 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_month(PyObject *__pyx_v_o) {
10904 int __pyx_r;
10905 __Pyx_RefNannyDeclarations
10906 __Pyx_RefNannySetupContext("datetime_month", 0);
10907
10908 /* "cpython/datetime.pxd":164
10909 * # Get month of datetime
10910 * cdef inline int datetime_month(object o):
10911 * return PyDateTime_GET_MONTH(o) # <<<<<<<<<<<<<<
10912 *
10913 * # Get day of datetime
10914 */
10915 __pyx_r = PyDateTime_GET_MONTH(__pyx_v_o);
10916 goto __pyx_L0;
10917
10918 /* "cpython/datetime.pxd":163
10919 *
10920 * # Get month of datetime
10921 * cdef inline int datetime_month(object o): # <<<<<<<<<<<<<<
10922 * return PyDateTime_GET_MONTH(o)
10923 *
10924 */
10925
10926 /* function exit code */
10927 __pyx_L0:;
10928 __Pyx_RefNannyFinishContext();
10929 return __pyx_r;
10930 }
10931
10932 /* "cpython/datetime.pxd":167
10933 *
10934 * # Get day of datetime
10935 * cdef inline int datetime_day(object o): # <<<<<<<<<<<<<<
10936 * return PyDateTime_GET_DAY(o)
10937 *
10938 */
10939
10940 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_day(PyObject *__pyx_v_o) {
10941 int __pyx_r;
10942 __Pyx_RefNannyDeclarations
10943 __Pyx_RefNannySetupContext("datetime_day", 0);
10944
10945 /* "cpython/datetime.pxd":168
10946 * # Get day of datetime
10947 * cdef inline int datetime_day(object o):
10948 * return PyDateTime_GET_DAY(o) # <<<<<<<<<<<<<<
10949 *
10950 * # Get hour of time
10951 */
10952 __pyx_r = PyDateTime_GET_DAY(__pyx_v_o);
10953 goto __pyx_L0;
10954
10955 /* "cpython/datetime.pxd":167
10956 *
10957 * # Get day of datetime
10958 * cdef inline int datetime_day(object o): # <<<<<<<<<<<<<<
10959 * return PyDateTime_GET_DAY(o)
10960 *
10961 */
10962
10963 /* function exit code */
10964 __pyx_L0:;
10965 __Pyx_RefNannyFinishContext();
10966 return __pyx_r;
10967 }
10968
10969 /* "cpython/datetime.pxd":171
10970 *
10971 * # Get hour of time
10972 * cdef inline int time_hour(object o): # <<<<<<<<<<<<<<
10973 * return PyDateTime_TIME_GET_HOUR(o)
10974 *
10975 */
10976
10977 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_hour(PyObject *__pyx_v_o) {
10978 int __pyx_r;
10979 __Pyx_RefNannyDeclarations
10980 __Pyx_RefNannySetupContext("time_hour", 0);
10981
10982 /* "cpython/datetime.pxd":172
10983 * # Get hour of time
10984 * cdef inline int time_hour(object o):
10985 * return PyDateTime_TIME_GET_HOUR(o) # <<<<<<<<<<<<<<
10986 *
10987 * # Get minute of time
10988 */
10989 __pyx_r = PyDateTime_TIME_GET_HOUR(__pyx_v_o);
10990 goto __pyx_L0;
10991
10992 /* "cpython/datetime.pxd":171
10993 *
10994 * # Get hour of time
10995 * cdef inline int time_hour(object o): # <<<<<<<<<<<<<<
10996 * return PyDateTime_TIME_GET_HOUR(o)
10997 *
10998 */
10999
11000 /* function exit code */
11001 __pyx_L0:;
11002 __Pyx_RefNannyFinishContext();
11003 return __pyx_r;
11004 }
11005
11006 /* "cpython/datetime.pxd":175
11007 *
11008 * # Get minute of time
11009 * cdef inline int time_minute(object o): # <<<<<<<<<<<<<<
11010 * return PyDateTime_TIME_GET_MINUTE(o)
11011 *
11012 */
11013
11014 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_minute(PyObject *__pyx_v_o) {
11015 int __pyx_r;
11016 __Pyx_RefNannyDeclarations
11017 __Pyx_RefNannySetupContext("time_minute", 0);
11018
11019 /* "cpython/datetime.pxd":176
11020 * # Get minute of time
11021 * cdef inline int time_minute(object o):
11022 * return PyDateTime_TIME_GET_MINUTE(o) # <<<<<<<<<<<<<<
11023 *
11024 * # Get second of time
11025 */
11026 __pyx_r = PyDateTime_TIME_GET_MINUTE(__pyx_v_o);
11027 goto __pyx_L0;
11028
11029 /* "cpython/datetime.pxd":175
11030 *
11031 * # Get minute of time
11032 * cdef inline int time_minute(object o): # <<<<<<<<<<<<<<
11033 * return PyDateTime_TIME_GET_MINUTE(o)
11034 *
11035 */
11036
11037 /* function exit code */
11038 __pyx_L0:;
11039 __Pyx_RefNannyFinishContext();
11040 return __pyx_r;
11041 }
11042
11043 /* "cpython/datetime.pxd":179
11044 *
11045 * # Get second of time
11046 * cdef inline int time_second(object o): # <<<<<<<<<<<<<<
11047 * return PyDateTime_TIME_GET_SECOND(o)
11048 *
11049 */
11050
11051 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_second(PyObject *__pyx_v_o) {
11052 int __pyx_r;
11053 __Pyx_RefNannyDeclarations
11054 __Pyx_RefNannySetupContext("time_second", 0);
11055
11056 /* "cpython/datetime.pxd":180
11057 * # Get second of time
11058 * cdef inline int time_second(object o):
11059 * return PyDateTime_TIME_GET_SECOND(o) # <<<<<<<<<<<<<<
11060 *
11061 * # Get microsecond of time
11062 */
11063 __pyx_r = PyDateTime_TIME_GET_SECOND(__pyx_v_o);
11064 goto __pyx_L0;
11065
11066 /* "cpython/datetime.pxd":179
11067 *
11068 * # Get second of time
11069 * cdef inline int time_second(object o): # <<<<<<<<<<<<<<
11070 * return PyDateTime_TIME_GET_SECOND(o)
11071 *
11072 */
11073
11074 /* function exit code */
11075 __pyx_L0:;
11076 __Pyx_RefNannyFinishContext();
11077 return __pyx_r;
11078 }
11079
11080 /* "cpython/datetime.pxd":183
11081 *
11082 * # Get microsecond of time
11083 * cdef inline int time_microsecond(object o): # <<<<<<<<<<<<<<
11084 * return PyDateTime_TIME_GET_MICROSECOND(o)
11085 *
11086 */
11087
11088 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_microsecond(PyObject *__pyx_v_o) {
11089 int __pyx_r;
11090 __Pyx_RefNannyDeclarations
11091 __Pyx_RefNannySetupContext("time_microsecond", 0);
11092
11093 /* "cpython/datetime.pxd":184
11094 * # Get microsecond of time
11095 * cdef inline int time_microsecond(object o):
11096 * return PyDateTime_TIME_GET_MICROSECOND(o) # <<<<<<<<<<<<<<
11097 *
11098 * # Get hour of datetime
11099 */
11100 __pyx_r = PyDateTime_TIME_GET_MICROSECOND(__pyx_v_o);
11101 goto __pyx_L0;
11102
11103 /* "cpython/datetime.pxd":183
11104 *
11105 * # Get microsecond of time
11106 * cdef inline int time_microsecond(object o): # <<<<<<<<<<<<<<
11107 * return PyDateTime_TIME_GET_MICROSECOND(o)
11108 *
11109 */
11110
11111 /* function exit code */
11112 __pyx_L0:;
11113 __Pyx_RefNannyFinishContext();
11114 return __pyx_r;
11115 }
11116
11117 /* "cpython/datetime.pxd":187
11118 *
11119 * # Get hour of datetime
11120 * cdef inline int datetime_hour(object o): # <<<<<<<<<<<<<<
11121 * return PyDateTime_DATE_GET_HOUR(o)
11122 *
11123 */
11124
11125 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_hour(PyObject *__pyx_v_o) {
11126 int __pyx_r;
11127 __Pyx_RefNannyDeclarations
11128 __Pyx_RefNannySetupContext("datetime_hour", 0);
11129
11130 /* "cpython/datetime.pxd":188
11131 * # Get hour of datetime
11132 * cdef inline int datetime_hour(object o):
11133 * return PyDateTime_DATE_GET_HOUR(o) # <<<<<<<<<<<<<<
11134 *
11135 * # Get minute of datetime
11136 */
11137 __pyx_r = PyDateTime_DATE_GET_HOUR(__pyx_v_o);
11138 goto __pyx_L0;
11139
11140 /* "cpython/datetime.pxd":187
11141 *
11142 * # Get hour of datetime
11143 * cdef inline int datetime_hour(object o): # <<<<<<<<<<<<<<
11144 * return PyDateTime_DATE_GET_HOUR(o)
11145 *
11146 */
11147
11148 /* function exit code */
11149 __pyx_L0:;
11150 __Pyx_RefNannyFinishContext();
11151 return __pyx_r;
11152 }
11153
11154 /* "cpython/datetime.pxd":191
11155 *
11156 * # Get minute of datetime
11157 * cdef inline int datetime_minute(object o): # <<<<<<<<<<<<<<
11158 * return PyDateTime_DATE_GET_MINUTE(o)
11159 *
11160 */
11161
11162 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_minute(PyObject *__pyx_v_o) {
11163 int __pyx_r;
11164 __Pyx_RefNannyDeclarations
11165 __Pyx_RefNannySetupContext("datetime_minute", 0);
11166
11167 /* "cpython/datetime.pxd":192
11168 * # Get minute of datetime
11169 * cdef inline int datetime_minute(object o):
11170 * return PyDateTime_DATE_GET_MINUTE(o) # <<<<<<<<<<<<<<
11171 *
11172 * # Get second of datetime
11173 */
11174 __pyx_r = PyDateTime_DATE_GET_MINUTE(__pyx_v_o);
11175 goto __pyx_L0;
11176
11177 /* "cpython/datetime.pxd":191
11178 *
11179 * # Get minute of datetime
11180 * cdef inline int datetime_minute(object o): # <<<<<<<<<<<<<<
11181 * return PyDateTime_DATE_GET_MINUTE(o)
11182 *
11183 */
11184
11185 /* function exit code */
11186 __pyx_L0:;
11187 __Pyx_RefNannyFinishContext();
11188 return __pyx_r;
11189 }
11190
11191 /* "cpython/datetime.pxd":195
11192 *
11193 * # Get second of datetime
11194 * cdef inline int datetime_second(object o): # <<<<<<<<<<<<<<
11195 * return PyDateTime_DATE_GET_SECOND(o)
11196 *
11197 */
11198
11199 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_second(PyObject *__pyx_v_o) {
11200 int __pyx_r;
11201 __Pyx_RefNannyDeclarations
11202 __Pyx_RefNannySetupContext("datetime_second", 0);
11203
11204 /* "cpython/datetime.pxd":196
11205 * # Get second of datetime
11206 * cdef inline int datetime_second(object o):
11207 * return PyDateTime_DATE_GET_SECOND(o) # <<<<<<<<<<<<<<
11208 *
11209 * # Get microsecond of datetime
11210 */
11211 __pyx_r = PyDateTime_DATE_GET_SECOND(__pyx_v_o);
11212 goto __pyx_L0;
11213
11214 /* "cpython/datetime.pxd":195
11215 *
11216 * # Get second of datetime
11217 * cdef inline int datetime_second(object o): # <<<<<<<<<<<<<<
11218 * return PyDateTime_DATE_GET_SECOND(o)
11219 *
11220 */
11221
11222 /* function exit code */
11223 __pyx_L0:;
11224 __Pyx_RefNannyFinishContext();
11225 return __pyx_r;
11226 }
11227
11228 /* "cpython/datetime.pxd":199
11229 *
11230 * # Get microsecond of datetime
11231 * cdef inline int datetime_microsecond(object o): # <<<<<<<<<<<<<<
11232 * return PyDateTime_DATE_GET_MICROSECOND(o)
11233 *
11234 */
11235
11236 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_microsecond(PyObject *__pyx_v_o) {
11237 int __pyx_r;
11238 __Pyx_RefNannyDeclarations
11239 __Pyx_RefNannySetupContext("datetime_microsecond", 0);
11240
11241 /* "cpython/datetime.pxd":200
11242 * # Get microsecond of datetime
11243 * cdef inline int datetime_microsecond(object o):
11244 * return PyDateTime_DATE_GET_MICROSECOND(o) # <<<<<<<<<<<<<<
11245 *
11246 * # Get days of timedelta
11247 */
11248 __pyx_r = PyDateTime_DATE_GET_MICROSECOND(__pyx_v_o);
11249 goto __pyx_L0;
11250
11251 /* "cpython/datetime.pxd":199
11252 *
11253 * # Get microsecond of datetime
11254 * cdef inline int datetime_microsecond(object o): # <<<<<<<<<<<<<<
11255 * return PyDateTime_DATE_GET_MICROSECOND(o)
11256 *
11257 */
11258
11259 /* function exit code */
11260 __pyx_L0:;
11261 __Pyx_RefNannyFinishContext();
11262 return __pyx_r;
11263 }
11264
11265 /* "cpython/datetime.pxd":203
11266 *
11267 * # Get days of timedelta
11268 * cdef inline int timedelta_days(object o): # <<<<<<<<<<<<<<
11269 * return (<PyDateTime_Delta*>o).days
11270 *
11271 */
11272
11273 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_days(PyObject *__pyx_v_o) {
11274 int __pyx_r;
11275 __Pyx_RefNannyDeclarations
11276 __Pyx_RefNannySetupContext("timedelta_days", 0);
11277
11278 /* "cpython/datetime.pxd":204
11279 * # Get days of timedelta
11280 * cdef inline int timedelta_days(object o):
11281 * return (<PyDateTime_Delta*>o).days # <<<<<<<<<<<<<<
11282 *
11283 * # Get seconds of timedelta
11284 */
11285 __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->days;
11286 goto __pyx_L0;
11287
11288 /* "cpython/datetime.pxd":203
11289 *
11290 * # Get days of timedelta
11291 * cdef inline int timedelta_days(object o): # <<<<<<<<<<<<<<
11292 * return (<PyDateTime_Delta*>o).days
11293 *
11294 */
11295
11296 /* function exit code */
11297 __pyx_L0:;
11298 __Pyx_RefNannyFinishContext();
11299 return __pyx_r;
11300 }
11301
11302 /* "cpython/datetime.pxd":207
11303 *
11304 * # Get seconds of timedelta
11305 * cdef inline int timedelta_seconds(object o): # <<<<<<<<<<<<<<
11306 * return (<PyDateTime_Delta*>o).seconds
11307 *
11308 */
11309
11310 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_seconds(PyObject *__pyx_v_o) {
11311 int __pyx_r;
11312 __Pyx_RefNannyDeclarations
11313 __Pyx_RefNannySetupContext("timedelta_seconds", 0);
11314
11315 /* "cpython/datetime.pxd":208
11316 * # Get seconds of timedelta
11317 * cdef inline int timedelta_seconds(object o):
11318 * return (<PyDateTime_Delta*>o).seconds # <<<<<<<<<<<<<<
11319 *
11320 * # Get microseconds of timedelta
11321 */
11322 __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->seconds;
11323 goto __pyx_L0;
11324
11325 /* "cpython/datetime.pxd":207
11326 *
11327 * # Get seconds of timedelta
11328 * cdef inline int timedelta_seconds(object o): # <<<<<<<<<<<<<<
11329 * return (<PyDateTime_Delta*>o).seconds
11330 *
11331 */
11332
11333 /* function exit code */
11334 __pyx_L0:;
11335 __Pyx_RefNannyFinishContext();
11336 return __pyx_r;
11337 }
11338
11339 /* "cpython/datetime.pxd":211
11340 *
11341 * # Get microseconds of timedelta
11342 * cdef inline int timedelta_microseconds(object o): # <<<<<<<<<<<<<<
11343 * return (<PyDateTime_Delta*>o).microseconds
11344 */
11345
11346 static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_microseconds(PyObject *__pyx_v_o) {
11347 int __pyx_r;
11348 __Pyx_RefNannyDeclarations
11349 __Pyx_RefNannySetupContext("timedelta_microseconds", 0);
11350
11351 /* "cpython/datetime.pxd":212
11352 * # Get microseconds of timedelta
11353 * cdef inline int timedelta_microseconds(object o):
11354 * return (<PyDateTime_Delta*>o).microseconds # <<<<<<<<<<<<<<
11355 */
11356 __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->microseconds;
11357 goto __pyx_L0;
11358
11359 /* "cpython/datetime.pxd":211
11360 *
11361 * # Get microseconds of timedelta
11362 * cdef inline int timedelta_microseconds(object o): # <<<<<<<<<<<<<<
11363 * return (<PyDateTime_Delta*>o).microseconds
11364 */
11365
11366 /* function exit code */
11367 __pyx_L0:;
11368 __Pyx_RefNannyFinishContext();
11369 return __pyx_r;
11370 }
11371 static struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Packer __pyx_vtable_7msgpack_9_cmsgpack_Packer;
11372
11373 static PyObject *__pyx_tp_new_7msgpack_9_cmsgpack_Packer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11374 struct __pyx_obj_7msgpack_9_cmsgpack_Packer *p;
11375 PyObject *o;
11376 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
11377 o = (*t->tp_alloc)(t, 0);
11378 } else {
11379 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
11380 }
11381 if (unlikely(!o)) return 0;
11382 p = ((struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)o);
11383 p->__pyx_vtab = __pyx_vtabptr_7msgpack_9_cmsgpack_Packer;
11384 p->_default = Py_None; Py_INCREF(Py_None);
11385 p->_berrors = Py_None; Py_INCREF(Py_None);
11386 if (unlikely(__pyx_pw_7msgpack_9_cmsgpack_6Packer_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
11387 return o;
11388 bad:
11389 Py_DECREF(o); o = 0;
11390 return NULL;
11391 }
11392
11393 static void __pyx_tp_dealloc_7msgpack_9_cmsgpack_Packer(PyObject *o) {
11394 struct __pyx_obj_7msgpack_9_cmsgpack_Packer *p = (struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)o;
11395 #if CYTHON_USE_TP_FINALIZE
11396 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
11397 if (PyObject_CallFinalizerFromDealloc(o)) return;
11398 }
11399 #endif
11400 PyObject_GC_UnTrack(o);
11401 {
11402 PyObject *etype, *eval, *etb;
11403 PyErr_Fetch(&etype, &eval, &etb);
11404 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
11405 __pyx_pw_7msgpack_9_cmsgpack_6Packer_5__dealloc__(o);
11406 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
11407 PyErr_Restore(etype, eval, etb);
11408 }
11409 Py_CLEAR(p->_default);
11410 Py_CLEAR(p->_berrors);
11411 (*Py_TYPE(o)->tp_free)(o);
11412 }
11413
11414 static int __pyx_tp_traverse_7msgpack_9_cmsgpack_Packer(PyObject *o, visitproc v, void *a) {
11415 int e;
11416 struct __pyx_obj_7msgpack_9_cmsgpack_Packer *p = (struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)o;
11417 if (p->_default) {
11418 e = (*v)(p->_default, a); if (e) return e;
11419 }
11420 if (p->_berrors) {
11421 e = (*v)(p->_berrors, a); if (e) return e;
11422 }
11423 return 0;
11424 }
11425
11426 static int __pyx_tp_clear_7msgpack_9_cmsgpack_Packer(PyObject *o) {
11427 PyObject* tmp;
11428 struct __pyx_obj_7msgpack_9_cmsgpack_Packer *p = (struct __pyx_obj_7msgpack_9_cmsgpack_Packer *)o;
11429 tmp = ((PyObject*)p->_default);
11430 p->_default = Py_None; Py_INCREF(Py_None);
11431 Py_XDECREF(tmp);
11432 tmp = ((PyObject*)p->_berrors);
11433 p->_berrors = Py_None; Py_INCREF(Py_None);
11434 Py_XDECREF(tmp);
11435 return 0;
11436 }
11437
11438 static PyMethodDef __pyx_methods_7msgpack_9_cmsgpack_Packer[] = {
11439 {"pack", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_6Packer_7pack, METH_O, __pyx_doc_7msgpack_9_cmsgpack_6Packer_6pack},
11440 {"pack_ext_type", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7msgpack_9_cmsgpack_6Packer_9pack_ext_type, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7msgpack_9_cmsgpack_6Packer_8pack_ext_type},
11441 {"pack_array_header", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_6Packer_11pack_array_header, METH_O, __pyx_doc_7msgpack_9_cmsgpack_6Packer_10pack_array_header},
11442 {"pack_map_header", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_6Packer_13pack_map_header, METH_O, __pyx_doc_7msgpack_9_cmsgpack_6Packer_12pack_map_header},
11443 {"pack_map_pairs", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_6Packer_15pack_map_pairs, METH_O, __pyx_doc_7msgpack_9_cmsgpack_6Packer_14pack_map_pairs},
11444 {"reset", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_6Packer_17reset, METH_NOARGS, __pyx_doc_7msgpack_9_cmsgpack_6Packer_16reset},
11445 {"bytes", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_6Packer_19bytes, METH_NOARGS, __pyx_doc_7msgpack_9_cmsgpack_6Packer_18bytes},
11446 {"getbuffer", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_6Packer_21getbuffer, METH_NOARGS, __pyx_doc_7msgpack_9_cmsgpack_6Packer_20getbuffer},
11447 {"__reduce_cython__", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_6Packer_23__reduce_cython__, METH_NOARGS, __pyx_doc_7msgpack_9_cmsgpack_6Packer_22__reduce_cython__},
11448 {"__setstate_cython__", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_6Packer_25__setstate_cython__, METH_O, __pyx_doc_7msgpack_9_cmsgpack_6Packer_24__setstate_cython__},
11449 {0, 0, 0, 0}
11450 };
11451
11452 static PyTypeObject __pyx_type_7msgpack_9_cmsgpack_Packer = {
11453 PyVarObject_HEAD_INIT(0, 0)
11454 "msgpack._cmsgpack.Packer", /*tp_name*/
11455 sizeof(struct __pyx_obj_7msgpack_9_cmsgpack_Packer), /*tp_basicsize*/
11456 0, /*tp_itemsize*/
11457 __pyx_tp_dealloc_7msgpack_9_cmsgpack_Packer, /*tp_dealloc*/
11458 #if PY_VERSION_HEX < 0x030800b4
11459 0, /*tp_print*/
11460 #endif
11461 #if PY_VERSION_HEX >= 0x030800b4
11462 0, /*tp_vectorcall_offset*/
11463 #endif
11464 0, /*tp_getattr*/
11465 0, /*tp_setattr*/
11466 #if PY_MAJOR_VERSION < 3
11467 0, /*tp_compare*/
11468 #endif
11469 #if PY_MAJOR_VERSION >= 3
11470 0, /*tp_as_async*/
11471 #endif
11472 0, /*tp_repr*/
11473 0, /*tp_as_number*/
11474 0, /*tp_as_sequence*/
11475 0, /*tp_as_mapping*/
11476 0, /*tp_hash*/
11477 0, /*tp_call*/
11478 0, /*tp_str*/
11479 0, /*tp_getattro*/
11480 0, /*tp_setattro*/
11481 0, /*tp_as_buffer*/
11482 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11483 "Packer(default=None, *, bool use_single_float=False, bool autoreset=True, bool use_bin_type=True, bool strict_types=False, bool datetime=False, unicode_errors=None)\n\n MessagePack Packer\n\n Usage::\n\n packer = Packer()\n astream.write(packer.pack(a))\n astream.write(packer.pack(b))\n\n Packer's constructor has some keyword arguments:\n\n :param callable default:\n Convert user type to builtin type that Packer supports.\n See also simplejson's document.\n\n :param bool use_single_float:\n Use single precision float type for float. (default: False)\n\n :param bool autoreset:\n Reset buffer after each pack and return its content as `bytes`. (default: True).\n If set this to false, use `bytes()` to get content and `.reset()` to clear buffer.\n\n :param bool use_bin_type:\n Use bin type introduced in msgpack spec 2.0 for bytes.\n It also enables str8 type for unicode. (default: True)\n\n :param bool strict_types:\n If set to true, types will be checked to be exact. Derived classes\n from serializeable types will not be serialized and will be\n treated as unsupported type and forwarded to default.\n Additionally tuples will not be serialized as lists.\n This is useful when trying to implement accurate serialization\n for python types.\n\n :param bool datetime:\n If set to true, datetime with tzinfo is packed into Timestamp type.\n Note that the tzinfo is stripped in the timestamp.\n You can get UTC datetime with `timestamp=3` option of the Unpacker.\n (Python 2 is not supported).\n\n :param str unicode_errors:\n The error handler for encoding unicode. (default: 'strict')\n DO NOT USE THIS!! This option is kept for very specific usage.\n ", /*tp_doc*/
11484 __pyx_tp_traverse_7msgpack_9_cmsgpack_Packer, /*tp_traverse*/
11485 __pyx_tp_clear_7msgpack_9_cmsgpack_Packer, /*tp_clear*/
11486 0, /*tp_richcompare*/
11487 0, /*tp_weaklistoffset*/
11488 0, /*tp_iter*/
11489 0, /*tp_iternext*/
11490 __pyx_methods_7msgpack_9_cmsgpack_Packer, /*tp_methods*/
11491 0, /*tp_members*/
11492 0, /*tp_getset*/
11493 0, /*tp_base*/
11494 0, /*tp_dict*/
11495 0, /*tp_descr_get*/
11496 0, /*tp_descr_set*/
11497 0, /*tp_dictoffset*/
11498 __pyx_pw_7msgpack_9_cmsgpack_6Packer_3__init__, /*tp_init*/
11499 0, /*tp_alloc*/
11500 __pyx_tp_new_7msgpack_9_cmsgpack_Packer, /*tp_new*/
11501 0, /*tp_free*/
11502 0, /*tp_is_gc*/
11503 0, /*tp_bases*/
11504 0, /*tp_mro*/
11505 0, /*tp_cache*/
11506 0, /*tp_subclasses*/
11507 0, /*tp_weaklist*/
11508 0, /*tp_del*/
11509 0, /*tp_version_tag*/
11510 #if PY_VERSION_HEX >= 0x030400a1
11511 0, /*tp_finalize*/
11512 #endif
11513 #if PY_VERSION_HEX >= 0x030800b1
11514 0, /*tp_vectorcall*/
11515 #endif
11516 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11517 0, /*tp_print*/
11518 #endif
11519 };
11520 static struct __pyx_vtabstruct_7msgpack_9_cmsgpack_Unpacker __pyx_vtable_7msgpack_9_cmsgpack_Unpacker;
11521
11522 static PyObject *__pyx_tp_new_7msgpack_9_cmsgpack_Unpacker(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11523 struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *p;
11524 PyObject *o;
11525 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
11526 o = (*t->tp_alloc)(t, 0);
11527 } else {
11528 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
11529 }
11530 if (unlikely(!o)) return 0;
11531 p = ((struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)o);
11532 p->__pyx_vtab = __pyx_vtabptr_7msgpack_9_cmsgpack_Unpacker;
11533 p->file_like = Py_None; Py_INCREF(Py_None);
11534 p->file_like_read = Py_None; Py_INCREF(Py_None);
11535 p->object_hook = Py_None; Py_INCREF(Py_None);
11536 p->object_pairs_hook = Py_None; Py_INCREF(Py_None);
11537 p->list_hook = Py_None; Py_INCREF(Py_None);
11538 p->ext_hook = Py_None; Py_INCREF(Py_None);
11539 p->unicode_errors = Py_None; Py_INCREF(Py_None);
11540 if (unlikely(__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
11541 return o;
11542 bad:
11543 Py_DECREF(o); o = 0;
11544 return NULL;
11545 }
11546
11547 static void __pyx_tp_dealloc_7msgpack_9_cmsgpack_Unpacker(PyObject *o) {
11548 struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *p = (struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)o;
11549 #if CYTHON_USE_TP_FINALIZE
11550 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
11551 if (PyObject_CallFinalizerFromDealloc(o)) return;
11552 }
11553 #endif
11554 PyObject_GC_UnTrack(o);
11555 {
11556 PyObject *etype, *eval, *etb;
11557 PyErr_Fetch(&etype, &eval, &etb);
11558 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
11559 __pyx_pw_7msgpack_9_cmsgpack_8Unpacker_3__dealloc__(o);
11560 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
11561 PyErr_Restore(etype, eval, etb);
11562 }
11563 Py_CLEAR(p->file_like);
11564 Py_CLEAR(p->file_like_read);
11565 Py_CLEAR(p->object_hook);
11566 Py_CLEAR(p->object_pairs_hook);
11567 Py_CLEAR(p->list_hook);
11568 Py_CLEAR(p->ext_hook);
11569 Py_CLEAR(p->unicode_errors);
11570 (*Py_TYPE(o)->tp_free)(o);
11571 }
11572
11573 static int __pyx_tp_traverse_7msgpack_9_cmsgpack_Unpacker(PyObject *o, visitproc v, void *a) {
11574 int e;
11575 struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *p = (struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)o;
11576 if (p->file_like) {
11577 e = (*v)(p->file_like, a); if (e) return e;
11578 }
11579 if (p->file_like_read) {
11580 e = (*v)(p->file_like_read, a); if (e) return e;
11581 }
11582 if (p->object_hook) {
11583 e = (*v)(p->object_hook, a); if (e) return e;
11584 }
11585 if (p->object_pairs_hook) {
11586 e = (*v)(p->object_pairs_hook, a); if (e) return e;
11587 }
11588 if (p->list_hook) {
11589 e = (*v)(p->list_hook, a); if (e) return e;
11590 }
11591 if (p->ext_hook) {
11592 e = (*v)(p->ext_hook, a); if (e) return e;
11593 }
11594 if (p->unicode_errors) {
11595 e = (*v)(p->unicode_errors, a); if (e) return e;
11596 }
11597 return 0;
11598 }
11599
11600 static int __pyx_tp_clear_7msgpack_9_cmsgpack_Unpacker(PyObject *o) {
11601 PyObject* tmp;
11602 struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *p = (struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *)o;
11603 tmp = ((PyObject*)p->file_like);
11604 p->file_like = Py_None; Py_INCREF(Py_None);
11605 Py_XDECREF(tmp);
11606 tmp = ((PyObject*)p->file_like_read);
11607 p->file_like_read = Py_None; Py_INCREF(Py_None);
11608 Py_XDECREF(tmp);
11609 tmp = ((PyObject*)p->object_hook);
11610 p->object_hook = Py_None; Py_INCREF(Py_None);
11611 Py_XDECREF(tmp);
11612 tmp = ((PyObject*)p->object_pairs_hook);
11613 p->object_pairs_hook = Py_None; Py_INCREF(Py_None);
11614 Py_XDECREF(tmp);
11615 tmp = ((PyObject*)p->list_hook);
11616 p->list_hook = Py_None; Py_INCREF(Py_None);
11617 Py_XDECREF(tmp);
11618 tmp = ((PyObject*)p->ext_hook);
11619 p->ext_hook = Py_None; Py_INCREF(Py_None);
11620 Py_XDECREF(tmp);
11621 tmp = ((PyObject*)p->unicode_errors);
11622 p->unicode_errors = Py_None; Py_INCREF(Py_None);
11623 Py_XDECREF(tmp);
11624 return 0;
11625 }
11626
11627 static PyObject *__pyx_specialmethod___pyx_pw_7msgpack_9_cmsgpack_8Unpacker_23__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_7msgpack_9_cmsgpack_8Unpacker_23__next__(self);}
11628
11629 static PyMethodDef __pyx_methods_7msgpack_9_cmsgpack_Unpacker[] = {
11630 {"feed", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_7feed, METH_O, __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_6feed},
11631 {"read_bytes", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_9read_bytes, METH_O, __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_8read_bytes},
11632 {"unpack", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_11unpack, METH_NOARGS, __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_10unpack},
11633 {"skip", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_13skip, METH_NOARGS, __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_12skip},
11634 {"read_array_header", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_15read_array_header, METH_NOARGS, __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_14read_array_header},
11635 {"read_map_header", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_17read_map_header, METH_NOARGS, __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_16read_map_header},
11636 {"tell", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_19tell, METH_NOARGS, __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_18tell},
11637 {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_7msgpack_9_cmsgpack_8Unpacker_23__next__, METH_NOARGS|METH_COEXIST, 0},
11638 {"__reduce_cython__", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_25__reduce_cython__, METH_NOARGS, __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_24__reduce_cython__},
11639 {"__setstate_cython__", (PyCFunction)__pyx_pw_7msgpack_9_cmsgpack_8Unpacker_27__setstate_cython__, METH_O, __pyx_doc_7msgpack_9_cmsgpack_8Unpacker_26__setstate_cython__},
11640 {0, 0, 0, 0}
11641 };
11642
11643 static PyTypeObject __pyx_type_7msgpack_9_cmsgpack_Unpacker = {
11644 PyVarObject_HEAD_INIT(0, 0)
11645 "msgpack._cmsgpack.Unpacker", /*tp_name*/
11646 sizeof(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker), /*tp_basicsize*/
11647 0, /*tp_itemsize*/
11648 __pyx_tp_dealloc_7msgpack_9_cmsgpack_Unpacker, /*tp_dealloc*/
11649 #if PY_VERSION_HEX < 0x030800b4
11650 0, /*tp_print*/
11651 #endif
11652 #if PY_VERSION_HEX >= 0x030800b4
11653 0, /*tp_vectorcall_offset*/
11654 #endif
11655 0, /*tp_getattr*/
11656 0, /*tp_setattr*/
11657 #if PY_MAJOR_VERSION < 3
11658 0, /*tp_compare*/
11659 #endif
11660 #if PY_MAJOR_VERSION >= 3
11661 0, /*tp_as_async*/
11662 #endif
11663 0, /*tp_repr*/
11664 0, /*tp_as_number*/
11665 0, /*tp_as_sequence*/
11666 0, /*tp_as_mapping*/
11667 0, /*tp_hash*/
11668 0, /*tp_call*/
11669 0, /*tp_str*/
11670 0, /*tp_getattro*/
11671 0, /*tp_setattro*/
11672 0, /*tp_as_buffer*/
11673 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11674 "Unpacker(file_like=None, Py_ssize_t read_size=0, *, bool use_list=True, bool raw=False, int timestamp=0, bool strict_map_key=True, object_hook=None, object_pairs_hook=None, list_hook=None, unicode_errors=None, Py_ssize_t max_buffer_size=104857600, ext_hook=ExtType, Py_ssize_t max_str_len=-1, Py_ssize_t max_bin_len=-1, Py_ssize_t max_array_len=-1, Py_ssize_t max_map_len=-1, Py_ssize_t max_ext_len=-1)\nStreaming unpacker.\n\n Arguments:\n\n :param file_like:\n File-like object having `.read(n)` method.\n If specified, unpacker reads serialized data from it and :meth:`feed()` is not usable.\n\n :param int read_size:\n Used as `file_like.read(read_size)`. (default: `min(16*1024, max_buffer_size)`)\n\n :param bool use_list:\n If true, unpack msgpack array to Python list.\n Otherwise, unpack to Python tuple. (default: True)\n\n :param bool raw:\n If true, unpack msgpack raw to Python bytes.\n Otherwise, unpack to Python str by decoding with UTF-8 encoding (default).\n\n :param int timestamp:\n Control how timestamp type is unpacked:\n\n 0 - Timestamp\n 1 - float (Seconds from the EPOCH)\n 2 - int (Nanoseconds from the EPOCH)\n 3 - datetime.datetime (UTC). Python 2 is not supported.\n\n :param bool strict_map_key:\n If true (default), only str or bytes are accepted for map (dict) keys.\n\n :param callable object_hook:\n When specified, it should be callable.\n Unpacker calls it with a dict argument after unpacking msgpack map.\n (See also simplejson)\n\n :param callable object_pairs_hook:\n When specified, it should be callable.\n Unpacker calls it with a list of key-value pairs after unpacking msgpack map.\n (See also simplejson)\n\n :param str unicode_errors:\n The error handler for decoding unicode. (default: 'strict')\n This option should be used only when you have msgpack da""ta which\n contains invalid UTF-8 string.\n\n :param int max_buffer_size:\n Limits size of data waiting unpacked. 0 means 2**32-1.\n The default value is 100*1024*1024 (100MiB).\n Raises `BufferFull` exception when it is insufficient.\n You should set this parameter when unpacking data from untrusted source.\n\n :param int max_str_len:\n Deprecated, use *max_buffer_size* instead.\n Limits max length of str. (default: max_buffer_size)\n\n :param int max_bin_len:\n Deprecated, use *max_buffer_size* instead.\n Limits max length of bin. (default: max_buffer_size)\n\n :param int max_array_len:\n Limits max length of array.\n (default: max_buffer_size)\n\n :param int max_map_len:\n Limits max length of map.\n (default: max_buffer_size//2)\n\n :param int max_ext_len:\n Deprecated, use *max_buffer_size* instead.\n Limits max size of ext type. (default: max_buffer_size)\n\n Example of streaming deserialize from file-like object::\n\n unpacker = Unpacker(file_like)\n for o in unpacker:\n process(o)\n\n Example of streaming deserialize from socket::\n\n unpacker = Unpacker()\n while True:\n buf = sock.recv(1024**2)\n if not buf:\n break\n unpacker.feed(buf)\n for o in unpacker:\n process(o)\n\n Raises ``ExtraData`` when *packed* contains extra bytes.\n Raises ``OutOfData`` when *packed* is incomplete.\n Raises ``FormatError`` when *packed* is not valid msgpack.\n Raises ``StackError`` when *packed* contains too nested.\n Other exceptions can be raised during unpacking.\n ", /*tp_doc*/
11675 __pyx_tp_traverse_7msgpack_9_cmsgpack_Unpacker, /*tp_traverse*/
11676 __pyx_tp_clear_7msgpack_9_cmsgpack_Unpacker, /*tp_clear*/
11677 0, /*tp_richcompare*/
11678 0, /*tp_weaklistoffset*/
11679 __pyx_pw_7msgpack_9_cmsgpack_8Unpacker_21__iter__, /*tp_iter*/
11680 __pyx_pw_7msgpack_9_cmsgpack_8Unpacker_23__next__, /*tp_iternext*/
11681 __pyx_methods_7msgpack_9_cmsgpack_Unpacker, /*tp_methods*/
11682 0, /*tp_members*/
11683 0, /*tp_getset*/
11684 0, /*tp_base*/
11685 0, /*tp_dict*/
11686 0, /*tp_descr_get*/
11687 0, /*tp_descr_set*/
11688 0, /*tp_dictoffset*/
11689 __pyx_pw_7msgpack_9_cmsgpack_8Unpacker_5__init__, /*tp_init*/
11690 0, /*tp_alloc*/
11691 __pyx_tp_new_7msgpack_9_cmsgpack_Unpacker, /*tp_new*/
11692 0, /*tp_free*/
11693 0, /*tp_is_gc*/
11694 0, /*tp_bases*/
11695 0, /*tp_mro*/
11696 0, /*tp_cache*/
11697 0, /*tp_subclasses*/
11698 0, /*tp_weaklist*/
11699 0, /*tp_del*/
11700 0, /*tp_version_tag*/
11701 #if PY_VERSION_HEX >= 0x030400a1
11702 0, /*tp_finalize*/
11703 #endif
11704 #if PY_VERSION_HEX >= 0x030800b1
11705 0, /*tp_vectorcall*/
11706 #endif
11707 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11708 0, /*tp_print*/
11709 #endif
11710 };
11711
11712 static PyMethodDef __pyx_methods[] = {
11713 {0, 0, 0, 0}
11714 };
11715
11716 #if PY_MAJOR_VERSION >= 3
11717 #if CYTHON_PEP489_MULTI_PHASE_INIT
11718 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
11719 static int __pyx_pymod_exec__cmsgpack(PyObject* module); /*proto*/
11720 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
11721 {Py_mod_create, (void*)__pyx_pymod_create},
11722 {Py_mod_exec, (void*)__pyx_pymod_exec__cmsgpack},
11723 {0, NULL}
11724 };
11725 #endif
11726
11727 static struct PyModuleDef __pyx_moduledef = {
11728 PyModuleDef_HEAD_INIT,
11729 "_cmsgpack",
11730 0, /* m_doc */
11731 #if CYTHON_PEP489_MULTI_PHASE_INIT
11732 0, /* m_size */
11733 #else
11734 -1, /* m_size */
11735 #endif
11736 __pyx_methods /* m_methods */,
11737 #if CYTHON_PEP489_MULTI_PHASE_INIT
11738 __pyx_moduledef_slots, /* m_slots */
11739 #else
11740 NULL, /* m_reload */
11741 #endif
11742 NULL, /* m_traverse */
11743 NULL, /* m_clear */
11744 NULL /* m_free */
11745 };
11746 #endif
11747 #ifndef CYTHON_SMALL_CODE
11748 #if defined(__clang__)
11749 #define CYTHON_SMALL_CODE
11750 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
11751 #define CYTHON_SMALL_CODE __attribute__((cold))
11752 #else
11753 #define CYTHON_SMALL_CODE
11754 #endif
11755 #endif
11756
11757 static __Pyx_StringTabEntry __pyx_string_tab[] = {
11758 {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1},
11759 {&__pyx_n_s_BufferError, __pyx_k_BufferError, sizeof(__pyx_k_BufferError), 0, 0, 1, 1},
11760 {&__pyx_n_s_BufferFull, __pyx_k_BufferFull, sizeof(__pyx_k_BufferFull), 0, 0, 1, 1},
11761 {&__pyx_kp_u_Cannot_decode_extended_type_with, __pyx_k_Cannot_decode_extended_type_with, sizeof(__pyx_k_Cannot_decode_extended_type_with), 0, 1, 0, 0},
11762 {&__pyx_kp_u_EXT_data_is_too_large, __pyx_k_EXT_data_is_too_large, sizeof(__pyx_k_EXT_data_is_too_large), 0, 1, 0, 0},
11763 {&__pyx_n_s_ExtType, __pyx_k_ExtType, sizeof(__pyx_k_ExtType), 0, 0, 1, 1},
11764 {&__pyx_n_s_ExtraData, __pyx_k_ExtraData, sizeof(__pyx_k_ExtraData), 0, 0, 1, 1},
11765 {&__pyx_n_s_FormatError, __pyx_k_FormatError, sizeof(__pyx_k_FormatError), 0, 0, 1, 1},
11766 {&__pyx_kp_u_Integer_value_out_of_range, __pyx_k_Integer_value_out_of_range, sizeof(__pyx_k_Integer_value_out_of_range), 0, 1, 0, 0},
11767 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
11768 {&__pyx_kp_u_No_more_data_to_unpack, __pyx_k_No_more_data_to_unpack, sizeof(__pyx_k_No_more_data_to_unpack), 0, 1, 0, 0},
11769 {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
11770 {&__pyx_n_s_OutOfData, __pyx_k_OutOfData, sizeof(__pyx_k_OutOfData), 0, 0, 1, 1},
11771 {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1},
11772 {&__pyx_n_s_Packer, __pyx_k_Packer, sizeof(__pyx_k_Packer), 0, 0, 1, 1},
11773 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
11774 {&__pyx_n_s_StackError, __pyx_k_StackError, sizeof(__pyx_k_StackError), 0, 0, 1, 1},
11775 {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
11776 {&__pyx_n_s_Timestamp, __pyx_k_Timestamp, sizeof(__pyx_k_Timestamp), 0, 0, 1, 1},
11777 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
11778 {&__pyx_kp_u_Unable_to_allocate_internal_buff, __pyx_k_Unable_to_allocate_internal_buff, sizeof(__pyx_k_Unable_to_allocate_internal_buff), 0, 1, 0, 0},
11779 {&__pyx_kp_u_Unable_to_enlarge_internal_buffe, __pyx_k_Unable_to_enlarge_internal_buffe, sizeof(__pyx_k_Unable_to_enlarge_internal_buffe), 0, 1, 0, 0},
11780 {&__pyx_kp_u_Unpack_failed_error, __pyx_k_Unpack_failed_error, sizeof(__pyx_k_Unpack_failed_error), 0, 1, 0, 0},
11781 {&__pyx_kp_u_Unpack_failed_incomplete_input, __pyx_k_Unpack_failed_incomplete_input, sizeof(__pyx_k_Unpack_failed_incomplete_input), 0, 1, 0, 0},
11782 {&__pyx_n_s_Unpacker, __pyx_k_Unpacker, sizeof(__pyx_k_Unpacker), 0, 0, 1, 1},
11783 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
11784 {&__pyx_n_s_autoreset, __pyx_k_autoreset, sizeof(__pyx_k_autoreset), 0, 0, 1, 1},
11785 {&__pyx_n_s_buf, __pyx_k_buf, sizeof(__pyx_k_buf), 0, 0, 1, 1},
11786 {&__pyx_n_s_buf_len, __pyx_k_buf_len, sizeof(__pyx_k_buf_len), 0, 0, 1, 1},
11787 {&__pyx_kp_u_cannot_unpack_from_multi_byte_ob, __pyx_k_cannot_unpack_from_multi_byte_ob, sizeof(__pyx_k_cannot_unpack_from_multi_byte_ob), 0, 1, 0, 0},
11788 {&__pyx_n_s_cerr, __pyx_k_cerr, sizeof(__pyx_k_cerr), 0, 0, 1, 1},
11789 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
11790 {&__pyx_n_s_code, __pyx_k_code, sizeof(__pyx_k_code), 0, 0, 1, 1},
11791 {&__pyx_kp_u_could_not_get_buffer_for_memoryv, __pyx_k_could_not_get_buffer_for_memoryv, sizeof(__pyx_k_could_not_get_buffer_for_memoryv), 0, 1, 0, 0},
11792 {&__pyx_n_s_ctx, __pyx_k_ctx, sizeof(__pyx_k_ctx), 0, 0, 1, 1},
11793 {&__pyx_n_u_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 1, 0, 1},
11794 {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
11795 {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 0, 0, 1, 1},
11796 {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
11797 {&__pyx_kp_u_default_must_be_a_callable, __pyx_k_default_must_be_a_callable, sizeof(__pyx_k_default_must_be_a_callable), 0, 1, 0, 0},
11798 {&__pyx_n_s_default_read_extended_type, __pyx_k_default_read_extended_type, sizeof(__pyx_k_default_read_extended_type), 0, 0, 1, 1},
11799 {&__pyx_kp_u_dict_is_too_large, __pyx_k_dict_is_too_large, sizeof(__pyx_k_dict_is_too_large), 0, 1, 0, 0},
11800 {&__pyx_n_s_exceptions, __pyx_k_exceptions, sizeof(__pyx_k_exceptions), 0, 0, 1, 1},
11801 {&__pyx_n_s_ext, __pyx_k_ext, sizeof(__pyx_k_ext), 0, 0, 1, 1},
11802 {&__pyx_n_s_ext_hook, __pyx_k_ext_hook, sizeof(__pyx_k_ext_hook), 0, 0, 1, 1},
11803 {&__pyx_kp_u_ext_hook_must_be_a_callable, __pyx_k_ext_hook_must_be_a_callable, sizeof(__pyx_k_ext_hook_must_be_a_callable), 0, 1, 0, 0},
11804 {&__pyx_kp_u_failed_to_calculate_delta, __pyx_k_failed_to_calculate_delta, sizeof(__pyx_k_failed_to_calculate_delta), 0, 1, 0, 0},
11805 {&__pyx_n_s_file_like, __pyx_k_file_like, sizeof(__pyx_k_file_like), 0, 0, 1, 1},
11806 {&__pyx_kp_u_file_like_read_must_be_a_callab, __pyx_k_file_like_read_must_be_a_callab, sizeof(__pyx_k_file_like_read_must_be_a_callab), 0, 1, 0, 0},
11807 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
11808 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
11809 {&__pyx_kp_u_internal_error, __pyx_k_internal_error, sizeof(__pyx_k_internal_error), 0, 1, 0, 0},
11810 {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
11811 {&__pyx_n_s_list_hook, __pyx_k_list_hook, sizeof(__pyx_k_list_hook), 0, 0, 1, 1},
11812 {&__pyx_kp_u_list_hook_must_be_a_callable, __pyx_k_list_hook_must_be_a_callable, sizeof(__pyx_k_list_hook_must_be_a_callable), 0, 1, 0, 0},
11813 {&__pyx_kp_u_list_is_too_large, __pyx_k_list_is_too_large, sizeof(__pyx_k_list_is_too_large), 0, 1, 0, 0},
11814 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
11815 {&__pyx_n_s_max_array_len, __pyx_k_max_array_len, sizeof(__pyx_k_max_array_len), 0, 0, 1, 1},
11816 {&__pyx_n_s_max_bin_len, __pyx_k_max_bin_len, sizeof(__pyx_k_max_bin_len), 0, 0, 1, 1},
11817 {&__pyx_n_s_max_buffer_size, __pyx_k_max_buffer_size, sizeof(__pyx_k_max_buffer_size), 0, 0, 1, 1},
11818 {&__pyx_n_s_max_ext_len, __pyx_k_max_ext_len, sizeof(__pyx_k_max_ext_len), 0, 0, 1, 1},
11819 {&__pyx_n_s_max_map_len, __pyx_k_max_map_len, sizeof(__pyx_k_max_map_len), 0, 0, 1, 1},
11820 {&__pyx_n_s_max_str_len, __pyx_k_max_str_len, sizeof(__pyx_k_max_str_len), 0, 0, 1, 1},
11821 {&__pyx_kp_u_memoryview_is_too_large, __pyx_k_memoryview_is_too_large, sizeof(__pyx_k_memoryview_is_too_large), 0, 1, 0, 0},
11822 {&__pyx_n_s_msgpack__cmsgpack, __pyx_k_msgpack__cmsgpack, sizeof(__pyx_k_msgpack__cmsgpack), 0, 0, 1, 1},
11823 {&__pyx_kp_s_msgpack__unpacker_pyx, __pyx_k_msgpack__unpacker_pyx, sizeof(__pyx_k_msgpack__unpacker_pyx), 0, 0, 1, 0},
11824 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
11825 {&__pyx_n_s_nanoseconds, __pyx_k_nanoseconds, sizeof(__pyx_k_nanoseconds), 0, 0, 1, 1},
11826 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
11827 {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
11828 {&__pyx_n_s_object_hook, __pyx_k_object_hook, sizeof(__pyx_k_object_hook), 0, 0, 1, 1},
11829 {&__pyx_kp_u_object_hook_must_be_a_callable, __pyx_k_object_hook_must_be_a_callable, sizeof(__pyx_k_object_hook_must_be_a_callable), 0, 1, 0, 0},
11830 {&__pyx_n_s_object_pairs_hook, __pyx_k_object_pairs_hook, sizeof(__pyx_k_object_pairs_hook), 0, 0, 1, 1},
11831 {&__pyx_kp_u_object_pairs_hook_and_object_hoo, __pyx_k_object_pairs_hook_and_object_hoo, sizeof(__pyx_k_object_pairs_hook_and_object_hoo), 0, 1, 0, 0},
11832 {&__pyx_kp_u_object_pairs_hook_must_be_a_call, __pyx_k_object_pairs_hook_must_be_a_call, sizeof(__pyx_k_object_pairs_hook_must_be_a_call), 0, 1, 0, 0},
11833 {&__pyx_n_s_off, __pyx_k_off, sizeof(__pyx_k_off), 0, 0, 1, 1},
11834 {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
11835 {&__pyx_n_s_packed, __pyx_k_packed, sizeof(__pyx_k_packed), 0, 0, 1, 1},
11836 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
11837 {&__pyx_n_s_raw, __pyx_k_raw, sizeof(__pyx_k_raw), 0, 0, 1, 1},
11838 {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
11839 {&__pyx_n_s_read_size, __pyx_k_read_size, sizeof(__pyx_k_read_size), 0, 0, 1, 1},
11840 {&__pyx_kp_u_read_size_should_be_less_or_equa, __pyx_k_read_size_should_be_less_or_equa, sizeof(__pyx_k_read_size_should_be_less_or_equa), 0, 1, 0, 0},
11841 {&__pyx_kp_u_recursion_limit_exceeded, __pyx_k_recursion_limit_exceeded, sizeof(__pyx_k_recursion_limit_exceeded), 0, 1, 0, 0},
11842 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
11843 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
11844 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
11845 {&__pyx_n_s_ret, __pyx_k_ret, sizeof(__pyx_k_ret), 0, 0, 1, 1},
11846 {&__pyx_n_s_seconds, __pyx_k_seconds, sizeof(__pyx_k_seconds), 0, 0, 1, 1},
11847 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
11848 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
11849 {&__pyx_n_s_strict_map_key, __pyx_k_strict_map_key, sizeof(__pyx_k_strict_map_key), 0, 0, 1, 1},
11850 {&__pyx_n_s_strict_types, __pyx_k_strict_types, sizeof(__pyx_k_strict_types), 0, 0, 1, 1},
11851 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
11852 {&__pyx_n_s_timestamp, __pyx_k_timestamp, sizeof(__pyx_k_timestamp), 0, 0, 1, 1},
11853 {&__pyx_kp_u_timestamp_must_be_0_3, __pyx_k_timestamp_must_be_0_3, sizeof(__pyx_k_timestamp_must_be_0_3), 0, 1, 0, 0},
11854 {&__pyx_n_s_timezone, __pyx_k_timezone, sizeof(__pyx_k_timezone), 0, 0, 1, 1},
11855 {&__pyx_n_s_typecode, __pyx_k_typecode, sizeof(__pyx_k_typecode), 0, 0, 1, 1},
11856 {&__pyx_n_s_unicode_errors, __pyx_k_unicode_errors, sizeof(__pyx_k_unicode_errors), 0, 0, 1, 1},
11857 {&__pyx_kp_u_unicode_string_is_too_large, __pyx_k_unicode_string_is_too_large, sizeof(__pyx_k_unicode_string_is_too_large), 0, 1, 0, 0},
11858 {&__pyx_n_s_unpackb, __pyx_k_unpackb, sizeof(__pyx_k_unpackb), 0, 0, 1, 1},
11859 {&__pyx_kp_u_unpacker_feed_is_not_be_able_to, __pyx_k_unpacker_feed_is_not_be_able_to, sizeof(__pyx_k_unpacker_feed_is_not_be_able_to), 0, 1, 0, 0},
11860 {&__pyx_n_s_use_bin_type, __pyx_k_use_bin_type, sizeof(__pyx_k_use_bin_type), 0, 0, 1, 1},
11861 {&__pyx_n_s_use_list, __pyx_k_use_list, sizeof(__pyx_k_use_list), 0, 0, 1, 1},
11862 {&__pyx_n_s_use_single_float, __pyx_k_use_single_float, sizeof(__pyx_k_use_single_float), 0, 0, 1, 1},
11863 {&__pyx_n_s_utc, __pyx_k_utc, sizeof(__pyx_k_utc), 0, 0, 1, 1},
11864 {&__pyx_n_s_view, __pyx_k_view, sizeof(__pyx_k_view), 0, 0, 1, 1},
11865 {0, 0, 0, 0, 0, 0, 0}
11866 };
11867 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
11868 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 120, __pyx_L1_error)
11869 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 134, __pyx_L1_error)
11870 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 163, __pyx_L1_error)
11871 __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(0, 182, __pyx_L1_error)
11872 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 300, __pyx_L1_error)
11873 __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(1, 117, __pyx_L1_error)
11874 __pyx_builtin_BufferError = __Pyx_GetBuiltinName(__pyx_n_s_BufferError); if (!__pyx_builtin_BufferError) __PYX_ERR(1, 129, __pyx_L1_error)
11875 __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 394, __pyx_L1_error)
11876 __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(1, 465, __pyx_L1_error)
11877 return 0;
11878 __pyx_L1_error:;
11879 return -1;
11880 }
11881
11882 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
11883 __Pyx_RefNannyDeclarations
11884 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
11885
11886 /* "msgpack/_packer.pyx":120
11887 * self.pk.buf = <char*> PyMem_Malloc(buf_size)
11888 * if self.pk.buf == NULL:
11889 * raise MemoryError("Unable to allocate internal buffer.") # <<<<<<<<<<<<<<
11890 * self.pk.buf_size = buf_size
11891 * self.pk.length = 0
11892 */
11893 __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Unable_to_allocate_internal_buff); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 120, __pyx_L1_error)
11894 __Pyx_GOTREF(__pyx_tuple_);
11895 __Pyx_GIVEREF(__pyx_tuple_);
11896
11897 /* "msgpack/_packer.pyx":134
11898 * if default is not None:
11899 * if not PyCallable_Check(default):
11900 * raise TypeError("default must be a callable.") # <<<<<<<<<<<<<<
11901 * self._default = default
11902 *
11903 */
11904 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_default_must_be_a_callable); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 134, __pyx_L1_error)
11905 __Pyx_GOTREF(__pyx_tuple__2);
11906 __Pyx_GIVEREF(__pyx_tuple__2);
11907
11908 /* "msgpack/_packer.pyx":163
11909 *
11910 * if nest_limit < 0:
11911 * raise ValueError("recursion limit exceeded.") # <<<<<<<<<<<<<<
11912 *
11913 * while True:
11914 */
11915 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_recursion_limit_exceeded); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 163, __pyx_L1_error)
11916 __Pyx_GOTREF(__pyx_tuple__4);
11917 __Pyx_GIVEREF(__pyx_tuple__4);
11918
11919 /* "msgpack/_packer.pyx":188
11920 * continue
11921 * else:
11922 * raise OverflowError("Integer value out of range") # <<<<<<<<<<<<<<
11923 * elif PyInt_CheckExact(o) if strict_types else PyInt_Check(o):
11924 * longval = o
11925 */
11926 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Integer_value_out_of_range); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 188, __pyx_L1_error)
11927 __Pyx_GOTREF(__pyx_tuple__5);
11928 __Pyx_GIVEREF(__pyx_tuple__5);
11929
11930 /* "msgpack/_packer.pyx":211
11931 * ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
11932 * if ret == -2:
11933 * raise ValueError("unicode string is too large") # <<<<<<<<<<<<<<
11934 * else:
11935 * o = PyUnicode_AsEncodedString(o, NULL, self.unicode_errors)
11936 */
11937 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_unicode_string_is_too_large); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 211, __pyx_L1_error)
11938 __Pyx_GOTREF(__pyx_tuple__6);
11939 __Pyx_GIVEREF(__pyx_tuple__6);
11940
11941 /* "msgpack/_packer.pyx":225
11942 * L = len(d)
11943 * if L > ITEM_LIMIT:
11944 * raise ValueError("dict is too large") # <<<<<<<<<<<<<<
11945 * ret = msgpack_pack_map(&self.pk, L)
11946 * if ret == 0:
11947 */
11948 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_dict_is_too_large); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 225, __pyx_L1_error)
11949 __Pyx_GOTREF(__pyx_tuple__7);
11950 __Pyx_GIVEREF(__pyx_tuple__7);
11951
11952 /* "msgpack/_packer.pyx":250
11953 * L = len(o.data)
11954 * if L > ITEM_LIMIT:
11955 * raise ValueError("EXT data is too large") # <<<<<<<<<<<<<<
11956 * ret = msgpack_pack_ext(&self.pk, longval, L)
11957 * ret = msgpack_pack_raw_body(&self.pk, rawval, L)
11958 */
11959 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_EXT_data_is_too_large); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 250, __pyx_L1_error)
11960 __Pyx_GOTREF(__pyx_tuple__8);
11961 __Pyx_GIVEREF(__pyx_tuple__8);
11962
11963 /* "msgpack/_packer.pyx":260
11964 * L = Py_SIZE(o)
11965 * if L > ITEM_LIMIT:
11966 * raise ValueError("list is too large") # <<<<<<<<<<<<<<
11967 * ret = msgpack_pack_array(&self.pk, L)
11968 * if ret == 0:
11969 */
11970 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_list_is_too_large); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 260, __pyx_L1_error)
11971 __Pyx_GOTREF(__pyx_tuple__9);
11972 __Pyx_GIVEREF(__pyx_tuple__9);
11973
11974 /* "msgpack/_packer.pyx":268
11975 * elif PyMemoryView_Check(o):
11976 * if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:
11977 * raise ValueError("could not get buffer for memoryview") # <<<<<<<<<<<<<<
11978 * L = view.len
11979 * if L > ITEM_LIMIT:
11980 */
11981 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_could_not_get_buffer_for_memoryv); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 268, __pyx_L1_error)
11982 __Pyx_GOTREF(__pyx_tuple__10);
11983 __Pyx_GIVEREF(__pyx_tuple__10);
11984
11985 /* "msgpack/_packer.pyx":272
11986 * if L > ITEM_LIMIT:
11987 * PyBuffer_Release(&view);
11988 * raise ValueError("memoryview is too large") # <<<<<<<<<<<<<<
11989 * ret = msgpack_pack_bin(&self.pk, L)
11990 * if ret == 0:
11991 */
11992 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_memoryview_is_too_large); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 272, __pyx_L1_error)
11993 __Pyx_GOTREF(__pyx_tuple__11);
11994 __Pyx_GIVEREF(__pyx_tuple__11);
11995
11996 /* "msgpack/_packer.pyx":280
11997 * delta = o - epoch
11998 * if not PyDelta_CheckExact(delta):
11999 * raise ValueError("failed to calculate delta") # <<<<<<<<<<<<<<
12000 * llval = timedelta_days(delta) * <long long>(24*60*60) + timedelta_seconds(delta)
12001 * ulval = timedelta_microseconds(delta) * 1000
12002 */
12003 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_failed_to_calculate_delta); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 280, __pyx_L1_error)
12004 __Pyx_GOTREF(__pyx_tuple__12);
12005 __Pyx_GIVEREF(__pyx_tuple__12);
12006
12007 /* "msgpack/_packer.pyx":300
12008 * raise
12009 * if ret: # should not happen.
12010 * raise RuntimeError("internal error") # <<<<<<<<<<<<<<
12011 * if self.autoreset:
12012 * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
12013 */
12014 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_internal_error); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 300, __pyx_L1_error)
12015 __Pyx_GOTREF(__pyx_tuple__13);
12016 __Pyx_GIVEREF(__pyx_tuple__13);
12017
12018 /* "(tree fragment)":2
12019 * def __reduce_cython__(self):
12020 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
12021 * def __setstate_cython__(self, __pyx_state):
12022 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12023 */
12024 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 2, __pyx_L1_error)
12025 __Pyx_GOTREF(__pyx_tuple__14);
12026 __Pyx_GIVEREF(__pyx_tuple__14);
12027
12028 /* "(tree fragment)":4
12029 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12030 * def __setstate_cython__(self, __pyx_state):
12031 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
12032 */
12033 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 4, __pyx_L1_error)
12034 __Pyx_GOTREF(__pyx_tuple__15);
12035 __Pyx_GIVEREF(__pyx_tuple__15);
12036
12037 /* "msgpack/_unpacker.pyx":81
12038 *
12039 * if object_hook is not None and object_pairs_hook is not None:
12040 * raise TypeError("object_pairs_hook and object_hook are mutually exclusive.") # <<<<<<<<<<<<<<
12041 *
12042 * if object_hook is not None:
12043 */
12044 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_u_object_pairs_hook_and_object_hoo); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 81, __pyx_L1_error)
12045 __Pyx_GOTREF(__pyx_tuple__16);
12046 __Pyx_GIVEREF(__pyx_tuple__16);
12047
12048 /* "msgpack/_unpacker.pyx":85
12049 * if object_hook is not None:
12050 * if not PyCallable_Check(object_hook):
12051 * raise TypeError("object_hook must be a callable.") # <<<<<<<<<<<<<<
12052 * ctx.user.object_hook = <PyObject*>object_hook
12053 *
12054 */
12055 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_u_object_hook_must_be_a_callable); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 85, __pyx_L1_error)
12056 __Pyx_GOTREF(__pyx_tuple__17);
12057 __Pyx_GIVEREF(__pyx_tuple__17);
12058
12059 /* "msgpack/_unpacker.pyx":92
12060 * else:
12061 * if not PyCallable_Check(object_pairs_hook):
12062 * raise TypeError("object_pairs_hook must be a callable.") # <<<<<<<<<<<<<<
12063 * ctx.user.object_hook = <PyObject*>object_pairs_hook
12064 * ctx.user.has_pairs_hook = True
12065 */
12066 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_u_object_pairs_hook_must_be_a_call); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 92, __pyx_L1_error)
12067 __Pyx_GOTREF(__pyx_tuple__18);
12068 __Pyx_GIVEREF(__pyx_tuple__18);
12069
12070 /* "msgpack/_unpacker.pyx":98
12071 * if list_hook is not None:
12072 * if not PyCallable_Check(list_hook):
12073 * raise TypeError("list_hook must be a callable.") # <<<<<<<<<<<<<<
12074 * ctx.user.list_hook = <PyObject*>list_hook
12075 *
12076 */
12077 __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_u_list_hook_must_be_a_callable); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 98, __pyx_L1_error)
12078 __Pyx_GOTREF(__pyx_tuple__19);
12079 __Pyx_GIVEREF(__pyx_tuple__19);
12080
12081 /* "msgpack/_unpacker.pyx":103
12082 * if ext_hook is not None:
12083 * if not PyCallable_Check(ext_hook):
12084 * raise TypeError("ext_hook must be a callable.") # <<<<<<<<<<<<<<
12085 * ctx.user.ext_hook = <PyObject*>ext_hook
12086 *
12087 */
12088 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_u_ext_hook_must_be_a_callable); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 103, __pyx_L1_error)
12089 __Pyx_GOTREF(__pyx_tuple__20);
12090 __Pyx_GIVEREF(__pyx_tuple__20);
12091
12092 /* "msgpack/_unpacker.pyx":107
12093 *
12094 * if timestamp < 0 or 3 < timestamp:
12095 * raise ValueError("timestamp must be 0..3") # <<<<<<<<<<<<<<
12096 *
12097 * # Add Timestamp type to the user object so it may be used in unpack.h
12098 */
12099 __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_u_timestamp_must_be_0_3); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 107, __pyx_L1_error)
12100 __Pyx_GOTREF(__pyx_tuple__21);
12101 __Pyx_GIVEREF(__pyx_tuple__21);
12102
12103 /* "msgpack/_unpacker.pyx":129
12104 * if view.itemsize != 1:
12105 * PyBuffer_Release(view)
12106 * raise BufferError("cannot unpack from multi-byte object") # <<<<<<<<<<<<<<
12107 * if PyBuffer_IsContiguous(view, b'A') == 0:
12108 * PyBuffer_Release(view)
12109 */
12110 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_u_cannot_unpack_from_multi_byte_ob); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 129, __pyx_L1_error)
12111 __Pyx_GOTREF(__pyx_tuple__22);
12112 __Pyx_GIVEREF(__pyx_tuple__22);
12113
12114 /* "msgpack/_unpacker.pyx":205
12115 * unpack_clear(&ctx)
12116 * if ret == 0:
12117 * raise ValueError("Unpack failed: incomplete input") # <<<<<<<<<<<<<<
12118 * elif ret == -2:
12119 * raise FormatError
12120 */
12121 __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_u_Unpack_failed_incomplete_input); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 205, __pyx_L1_error)
12122 __Pyx_GOTREF(__pyx_tuple__24);
12123 __Pyx_GIVEREF(__pyx_tuple__24);
12124
12125 /* "msgpack/_unpacker.pyx":348
12126 * self.file_like_read = file_like.read
12127 * if not PyCallable_Check(self.file_like_read):
12128 * raise TypeError("`file_like.read` must be a callable.") # <<<<<<<<<<<<<<
12129 *
12130 * if not max_buffer_size:
12131 */
12132 __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_u_file_like_read_must_be_a_callab); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 348, __pyx_L1_error)
12133 __Pyx_GOTREF(__pyx_tuple__26);
12134 __Pyx_GIVEREF(__pyx_tuple__26);
12135
12136 /* "msgpack/_unpacker.pyx":364
12137 *
12138 * if read_size > max_buffer_size:
12139 * raise ValueError("read_size should be less or equal to max_buffer_size") # <<<<<<<<<<<<<<
12140 * if not read_size:
12141 * read_size = min(max_buffer_size, 1024**2)
12142 */
12143 __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_u_read_size_should_be_less_or_equa); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 364, __pyx_L1_error)
12144 __Pyx_GOTREF(__pyx_tuple__27);
12145 __Pyx_GIVEREF(__pyx_tuple__27);
12146
12147 /* "msgpack/_unpacker.pyx":394
12148 *
12149 * if self.file_like is not None:
12150 * raise AssertionError( # <<<<<<<<<<<<<<
12151 * "unpacker.feed() is not be able to use with `file_like`.")
12152 *
12153 */
12154 __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_u_unpacker_feed_is_not_be_able_to); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 394, __pyx_L1_error)
12155 __Pyx_GOTREF(__pyx_tuple__28);
12156 __Pyx_GIVEREF(__pyx_tuple__28);
12157
12158 /* "msgpack/_unpacker.pyx":428
12159 * # self.buf still holds old buffer and will be freed during
12160 * # obj destruction
12161 * raise MemoryError("Unable to enlarge internal buffer.") # <<<<<<<<<<<<<<
12162 * memcpy(new_buf, buf + head, tail - head)
12163 * PyMem_Free(buf)
12164 */
12165 __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_u_Unable_to_enlarge_internal_buffe); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 428, __pyx_L1_error)
12166 __Pyx_GOTREF(__pyx_tuple__29);
12167 __Pyx_GIVEREF(__pyx_tuple__29);
12168
12169 /* "msgpack/_unpacker.pyx":465
12170 * if prev_head >= self.buf_tail:
12171 * if iter:
12172 * raise StopIteration("No more data to unpack.") # <<<<<<<<<<<<<<
12173 * else:
12174 * raise OutOfData("No more data to unpack.")
12175 */
12176 __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_u_No_more_data_to_unpack); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 465, __pyx_L1_error)
12177 __Pyx_GOTREF(__pyx_tuple__30);
12178 __Pyx_GIVEREF(__pyx_tuple__30);
12179
12180 /* "(tree fragment)":2
12181 * def __reduce_cython__(self):
12182 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
12183 * def __setstate_cython__(self, __pyx_state):
12184 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12185 */
12186 __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(2, 2, __pyx_L1_error)
12187 __Pyx_GOTREF(__pyx_tuple__31);
12188 __Pyx_GIVEREF(__pyx_tuple__31);
12189
12190 /* "(tree fragment)":4
12191 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12192 * def __setstate_cython__(self, __pyx_state):
12193 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
12194 */
12195 __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(2, 4, __pyx_L1_error)
12196 __Pyx_GOTREF(__pyx_tuple__32);
12197 __Pyx_GIVEREF(__pyx_tuple__32);
12198
12199 /* "msgpack/_unpacker.pyx":116
12200 * ctx.user.unicode_errors = unicode_errors
12201 *
12202 * def default_read_extended_type(typecode, data): # <<<<<<<<<<<<<<
12203 * raise NotImplementedError("Cannot decode extended type with typecode=%d" % typecode)
12204 *
12205 */
12206 __pyx_tuple__33 = PyTuple_Pack(2, __pyx_n_s_typecode, __pyx_n_s_data); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 116, __pyx_L1_error)
12207 __Pyx_GOTREF(__pyx_tuple__33);
12208 __Pyx_GIVEREF(__pyx_tuple__33);
12209 __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_msgpack__unpacker_pyx, __pyx_n_s_default_read_extended_type, 116, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(1, 116, __pyx_L1_error)
12210
12211 /* "msgpack/_unpacker.pyx":143
12212 *
12213 *
12214 * def unpackb(object packed, *, object object_hook=None, object list_hook=None, # <<<<<<<<<<<<<<
12215 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
12216 * unicode_errors=None,
12217 */
12218 __pyx_tuple__35 = PyTuple_Pack(23, __pyx_n_s_packed, __pyx_n_s_object_hook, __pyx_n_s_list_hook, __pyx_n_s_use_list, __pyx_n_s_raw, __pyx_n_s_timestamp, __pyx_n_s_strict_map_key, __pyx_n_s_unicode_errors, __pyx_n_s_object_pairs_hook, __pyx_n_s_ext_hook, __pyx_n_s_max_str_len, __pyx_n_s_max_bin_len, __pyx_n_s_max_array_len, __pyx_n_s_max_map_len, __pyx_n_s_max_ext_len, __pyx_n_s_ctx, __pyx_n_s_off, __pyx_n_s_ret, __pyx_n_s_view, __pyx_n_s_buf, __pyx_n_s_buf_len, __pyx_n_s_cerr, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 143, __pyx_L1_error)
12219 __Pyx_GOTREF(__pyx_tuple__35);
12220 __Pyx_GIVEREF(__pyx_tuple__35);
12221 __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 14, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_msgpack__unpacker_pyx, __pyx_n_s_unpackb, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(1, 143, __pyx_L1_error)
12222 __Pyx_RefNannyFinishContext();
12223 return 0;
12224 __pyx_L1_error:;
12225 __Pyx_RefNannyFinishContext();
12226 return -1;
12227 }
12228
12229 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
12230 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(4, 1, __pyx_L1_error);
12231 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(4, 1, __pyx_L1_error)
12232 __pyx_int_1000000000 = PyInt_FromLong(1000000000L); if (unlikely(!__pyx_int_1000000000)) __PYX_ERR(4, 1, __pyx_L1_error)
12233 return 0;
12234 __pyx_L1_error:;
12235 return -1;
12236 }
12237
12238 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
12239 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
12240 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
12241 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
12242 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
12243 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
12244 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
12245
12246 static int __Pyx_modinit_global_init_code(void) {
12247 __Pyx_RefNannyDeclarations
12248 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
12249 /*--- Global init code ---*/
12250 __pyx_v_7msgpack_9_cmsgpack_utc = Py_None; Py_INCREF(Py_None);
12251 __pyx_v_7msgpack_9_cmsgpack_epoch = Py_None; Py_INCREF(Py_None);
12252 __pyx_v_7msgpack_9_cmsgpack_ExtType = Py_None; Py_INCREF(Py_None);
12253 __pyx_v_7msgpack_9_cmsgpack_Timestamp = Py_None; Py_INCREF(Py_None);
12254 __pyx_v_7msgpack_9_cmsgpack_giga = Py_None; Py_INCREF(Py_None);
12255 __Pyx_RefNannyFinishContext();
12256 return 0;
12257 }
12258
12259 static int __Pyx_modinit_variable_export_code(void) {
12260 __Pyx_RefNannyDeclarations
12261 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
12262 /*--- Variable export code ---*/
12263 __Pyx_RefNannyFinishContext();
12264 return 0;
12265 }
12266
12267 static int __Pyx_modinit_function_export_code(void) {
12268 __Pyx_RefNannyDeclarations
12269 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
12270 /*--- Function export code ---*/
12271 __Pyx_RefNannyFinishContext();
12272 return 0;
12273 }
12274
12275 static int __Pyx_modinit_type_init_code(void) {
12276 __Pyx_RefNannyDeclarations
12277 int __pyx_lineno = 0;
12278 const char *__pyx_filename = NULL;
12279 int __pyx_clineno = 0;
12280 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
12281 /*--- Type init code ---*/
12282 __pyx_vtabptr_7msgpack_9_cmsgpack_Packer = &__pyx_vtable_7msgpack_9_cmsgpack_Packer;
12283 __pyx_vtable_7msgpack_9_cmsgpack_Packer._pack = (int (*)(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *, PyObject *, struct __pyx_opt_args_7msgpack_9_cmsgpack_6Packer__pack *__pyx_optional_args))__pyx_f_7msgpack_9_cmsgpack_6Packer__pack;
12284 __pyx_vtable_7msgpack_9_cmsgpack_Packer.pack = (PyObject *(*)(struct __pyx_obj_7msgpack_9_cmsgpack_Packer *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7msgpack_9_cmsgpack_6Packer_pack;
12285 if (PyType_Ready(&__pyx_type_7msgpack_9_cmsgpack_Packer) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
12286 #if PY_VERSION_HEX < 0x030800B1
12287 __pyx_type_7msgpack_9_cmsgpack_Packer.tp_print = 0;
12288 #endif
12289 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7msgpack_9_cmsgpack_Packer.tp_dictoffset && __pyx_type_7msgpack_9_cmsgpack_Packer.tp_getattro == PyObject_GenericGetAttr)) {
12290 __pyx_type_7msgpack_9_cmsgpack_Packer.tp_getattro = __Pyx_PyObject_GenericGetAttr;
12291 }
12292 if (__Pyx_SetVtable(__pyx_type_7msgpack_9_cmsgpack_Packer.tp_dict, __pyx_vtabptr_7msgpack_9_cmsgpack_Packer) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
12293 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Packer, (PyObject *)&__pyx_type_7msgpack_9_cmsgpack_Packer) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
12294 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7msgpack_9_cmsgpack_Packer) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
12295 __pyx_ptype_7msgpack_9_cmsgpack_Packer = &__pyx_type_7msgpack_9_cmsgpack_Packer;
12296 __pyx_vtabptr_7msgpack_9_cmsgpack_Unpacker = &__pyx_vtable_7msgpack_9_cmsgpack_Unpacker;
12297 __pyx_vtable_7msgpack_9_cmsgpack_Unpacker.append_buffer = (PyObject *(*)(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *, void *, Py_ssize_t))__pyx_f_7msgpack_9_cmsgpack_8Unpacker_append_buffer;
12298 __pyx_vtable_7msgpack_9_cmsgpack_Unpacker.read_from_file = (PyObject *(*)(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *))__pyx_f_7msgpack_9_cmsgpack_8Unpacker_read_from_file;
12299 __pyx_vtable_7msgpack_9_cmsgpack_Unpacker._unpack = (PyObject *(*)(struct __pyx_obj_7msgpack_9_cmsgpack_Unpacker *, execute_fn, struct __pyx_opt_args_7msgpack_9_cmsgpack_8Unpacker__unpack *__pyx_optional_args))__pyx_f_7msgpack_9_cmsgpack_8Unpacker__unpack;
12300 if (PyType_Ready(&__pyx_type_7msgpack_9_cmsgpack_Unpacker) < 0) __PYX_ERR(1, 213, __pyx_L1_error)
12301 #if PY_VERSION_HEX < 0x030800B1
12302 __pyx_type_7msgpack_9_cmsgpack_Unpacker.tp_print = 0;
12303 #endif
12304 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7msgpack_9_cmsgpack_Unpacker.tp_dictoffset && __pyx_type_7msgpack_9_cmsgpack_Unpacker.tp_getattro == PyObject_GenericGetAttr)) {
12305 __pyx_type_7msgpack_9_cmsgpack_Unpacker.tp_getattro = __Pyx_PyObject_GenericGetAttr;
12306 }
12307 if (__Pyx_SetVtable(__pyx_type_7msgpack_9_cmsgpack_Unpacker.tp_dict, __pyx_vtabptr_7msgpack_9_cmsgpack_Unpacker) < 0) __PYX_ERR(1, 213, __pyx_L1_error)
12308 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Unpacker, (PyObject *)&__pyx_type_7msgpack_9_cmsgpack_Unpacker) < 0) __PYX_ERR(1, 213, __pyx_L1_error)
12309 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7msgpack_9_cmsgpack_Unpacker) < 0) __PYX_ERR(1, 213, __pyx_L1_error)
12310 __pyx_ptype_7msgpack_9_cmsgpack_Unpacker = &__pyx_type_7msgpack_9_cmsgpack_Unpacker;
12311 __Pyx_RefNannyFinishContext();
12312 return 0;
12313 __pyx_L1_error:;
12314 __Pyx_RefNannyFinishContext();
12315 return -1;
12316 }
12317
12318 static int __Pyx_modinit_type_import_code(void) {
12319 __Pyx_RefNannyDeclarations
12320 PyObject *__pyx_t_1 = NULL;
12321 int __pyx_lineno = 0;
12322 const char *__pyx_filename = NULL;
12323 int __pyx_clineno = 0;
12324 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
12325 /*--- Type import code ---*/
12326 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 9, __pyx_L1_error)
12327 __Pyx_GOTREF(__pyx_t_1);
12328 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
12329 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
12330 sizeof(PyTypeObject),
12331 #else
12332 sizeof(PyHeapTypeObject),
12333 #endif
12334 __Pyx_ImportType_CheckSize_Warn);
12335 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(5, 9, __pyx_L1_error)
12336 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12337 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 8, __pyx_L1_error)
12338 __Pyx_GOTREF(__pyx_t_1);
12339 __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
12340 if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(6, 8, __pyx_L1_error)
12341 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12342 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 15, __pyx_L1_error)
12343 __Pyx_GOTREF(__pyx_t_1);
12344 __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
12345 if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(7, 15, __pyx_L1_error)
12346 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12347 __pyx_t_1 = PyImport_ImportModule("datetime"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
12348 __Pyx_GOTREF(__pyx_t_1);
12349 __pyx_ptype_7cpython_8datetime_date = __Pyx_ImportType(__pyx_t_1, "datetime", "date", sizeof(PyDateTime_Date), __Pyx_ImportType_CheckSize_Warn);
12350 if (!__pyx_ptype_7cpython_8datetime_date) __PYX_ERR(3, 9, __pyx_L1_error)
12351 __pyx_ptype_7cpython_8datetime_time = __Pyx_ImportType(__pyx_t_1, "datetime", "time", sizeof(PyDateTime_Time), __Pyx_ImportType_CheckSize_Warn);
12352 if (!__pyx_ptype_7cpython_8datetime_time) __PYX_ERR(3, 12, __pyx_L1_error)
12353 __pyx_ptype_7cpython_8datetime_datetime = __Pyx_ImportType(__pyx_t_1, "datetime", "datetime", sizeof(PyDateTime_DateTime), __Pyx_ImportType_CheckSize_Warn);
12354 if (!__pyx_ptype_7cpython_8datetime_datetime) __PYX_ERR(3, 15, __pyx_L1_error)
12355 __pyx_ptype_7cpython_8datetime_timedelta = __Pyx_ImportType(__pyx_t_1, "datetime", "timedelta", sizeof(PyDateTime_Delta), __Pyx_ImportType_CheckSize_Warn);
12356 if (!__pyx_ptype_7cpython_8datetime_timedelta) __PYX_ERR(3, 18, __pyx_L1_error)
12357 __pyx_ptype_7cpython_8datetime_tzinfo = __Pyx_ImportType(__pyx_t_1, "datetime", "tzinfo", sizeof(PyDateTime_TZInfo), __Pyx_ImportType_CheckSize_Warn);
12358 if (!__pyx_ptype_7cpython_8datetime_tzinfo) __PYX_ERR(3, 21, __pyx_L1_error)
12359 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12360 __Pyx_RefNannyFinishContext();
12361 return 0;
12362 __pyx_L1_error:;
12363 __Pyx_XDECREF(__pyx_t_1);
12364 __Pyx_RefNannyFinishContext();
12365 return -1;
12366 }
12367
12368 static int __Pyx_modinit_variable_import_code(void) {
12369 __Pyx_RefNannyDeclarations
12370 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
12371 /*--- Variable import code ---*/
12372 __Pyx_RefNannyFinishContext();
12373 return 0;
12374 }
12375
12376 static int __Pyx_modinit_function_import_code(void) {
12377 __Pyx_RefNannyDeclarations
12378 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
12379 /*--- Function import code ---*/
12380 __Pyx_RefNannyFinishContext();
12381 return 0;
12382 }
12383
12384
12385 #ifndef CYTHON_NO_PYINIT_EXPORT
12386 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
12387 #elif PY_MAJOR_VERSION < 3
12388 #ifdef __cplusplus
12389 #define __Pyx_PyMODINIT_FUNC extern "C" void
12390 #else
12391 #define __Pyx_PyMODINIT_FUNC void
12392 #endif
12393 #else
12394 #ifdef __cplusplus
12395 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
12396 #else
12397 #define __Pyx_PyMODINIT_FUNC PyObject *
12398 #endif
12399 #endif
12400
12401
12402 #if PY_MAJOR_VERSION < 3
12403 __Pyx_PyMODINIT_FUNC init_cmsgpack(void) CYTHON_SMALL_CODE; /*proto*/
12404 __Pyx_PyMODINIT_FUNC init_cmsgpack(void)
12405 #else
12406 __Pyx_PyMODINIT_FUNC PyInit__cmsgpack(void) CYTHON_SMALL_CODE; /*proto*/
12407 __Pyx_PyMODINIT_FUNC PyInit__cmsgpack(void)
12408 #if CYTHON_PEP489_MULTI_PHASE_INIT
12409 {
12410 return PyModuleDef_Init(&__pyx_moduledef);
12411 }
12412 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
12413 #if PY_VERSION_HEX >= 0x030700A1
12414 static PY_INT64_T main_interpreter_id = -1;
12415 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
12416 if (main_interpreter_id == -1) {
12417 main_interpreter_id = current_id;
12418 return (unlikely(current_id == -1)) ? -1 : 0;
12419 } else if (unlikely(main_interpreter_id != current_id))
12420 #else
12421 static PyInterpreterState *main_interpreter = NULL;
12422 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
12423 if (!main_interpreter) {
12424 main_interpreter = current_interpreter;
12425 } else if (unlikely(main_interpreter != current_interpreter))
12426 #endif
12427 {
12428 PyErr_SetString(
12429 PyExc_ImportError,
12430 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
12431 return -1;
12432 }
12433 return 0;
12434 }
12435 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
12436 PyObject *value = PyObject_GetAttrString(spec, from_name);
12437 int result = 0;
12438 if (likely(value)) {
12439 if (allow_none || value != Py_None) {
12440 result = PyDict_SetItemString(moddict, to_name, value);
12441 }
12442 Py_DECREF(value);
12443 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
12444 PyErr_Clear();
12445 } else {
12446 result = -1;
12447 }
12448 return result;
12449 }
12450 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
12451 PyObject *module = NULL, *moddict, *modname;
12452 if (__Pyx_check_single_interpreter())
12453 return NULL;
12454 if (__pyx_m)
12455 return __Pyx_NewRef(__pyx_m);
12456 modname = PyObject_GetAttrString(spec, "name");
12457 if (unlikely(!modname)) goto bad;
12458 module = PyModule_NewObject(modname);
12459 Py_DECREF(modname);
12460 if (unlikely(!module)) goto bad;
12461 moddict = PyModule_GetDict(module);
12462 if (unlikely(!moddict)) goto bad;
12463 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
12464 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
12465 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
12466 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
12467 return module;
12468 bad:
12469 Py_XDECREF(module);
12470 return NULL;
12471 }
12472
12473
12474 static CYTHON_SMALL_CODE int __pyx_pymod_exec__cmsgpack(PyObject *__pyx_pyinit_module)
12475 #endif
12476 #endif
12477 {
12478 PyObject *__pyx_t_1 = NULL;
12479 PyObject *__pyx_t_2 = NULL;
12480 int __pyx_lineno = 0;
12481 const char *__pyx_filename = NULL;
12482 int __pyx_clineno = 0;
12483 __Pyx_RefNannyDeclarations
12484 #if CYTHON_PEP489_MULTI_PHASE_INIT
12485 if (__pyx_m) {
12486 if (__pyx_m == __pyx_pyinit_module) return 0;
12487 PyErr_SetString(PyExc_RuntimeError, "Module '_cmsgpack' has already been imported. Re-initialisation is not supported.");
12488 return -1;
12489 }
12490 #elif PY_MAJOR_VERSION >= 3
12491 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
12492 #endif
12493 #if CYTHON_REFNANNY
12494 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
12495 if (!__Pyx_RefNanny) {
12496 PyErr_Clear();
12497 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
12498 if (!__Pyx_RefNanny)
12499 Py_FatalError("failed to import 'refnanny' module");
12500 }
12501 #endif
12502 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__cmsgpack(void)", 0);
12503 if (__Pyx_check_binary_version() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12504 #ifdef __Pxy_PyFrame_Initialize_Offsets
12505 __Pxy_PyFrame_Initialize_Offsets();
12506 #endif
12507 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(4, 1, __pyx_L1_error)
12508 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(4, 1, __pyx_L1_error)
12509 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(4, 1, __pyx_L1_error)
12510 #ifdef __Pyx_CyFunction_USED
12511 if (__pyx_CyFunction_init() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12512 #endif
12513 #ifdef __Pyx_FusedFunction_USED
12514 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12515 #endif
12516 #ifdef __Pyx_Coroutine_USED
12517 if (__pyx_Coroutine_init() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12518 #endif
12519 #ifdef __Pyx_Generator_USED
12520 if (__pyx_Generator_init() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12521 #endif
12522 #ifdef __Pyx_AsyncGen_USED
12523 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12524 #endif
12525 #ifdef __Pyx_StopAsyncIteration_USED
12526 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12527 #endif
12528 /*--- Library function declarations ---*/
12529 /*--- Threads initialization code ---*/
12530 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
12531 PyEval_InitThreads();
12532 #endif
12533 /*--- Module creation code ---*/
12534 #if CYTHON_PEP489_MULTI_PHASE_INIT
12535 __pyx_m = __pyx_pyinit_module;
12536 Py_INCREF(__pyx_m);
12537 #else
12538 #if PY_MAJOR_VERSION < 3
12539 __pyx_m = Py_InitModule4("_cmsgpack", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
12540 #else
12541 __pyx_m = PyModule_Create(&__pyx_moduledef);
12542 #endif
12543 if (unlikely(!__pyx_m)) __PYX_ERR(4, 1, __pyx_L1_error)
12544 #endif
12545 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(4, 1, __pyx_L1_error)
12546 Py_INCREF(__pyx_d);
12547 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(4, 1, __pyx_L1_error)
12548 Py_INCREF(__pyx_b);
12549 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(4, 1, __pyx_L1_error)
12550 Py_INCREF(__pyx_cython_runtime);
12551 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(4, 1, __pyx_L1_error);
12552 /*--- Initialize various global constants etc. ---*/
12553 if (__Pyx_InitGlobals() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12554 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
12555 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12556 #endif
12557 if (__pyx_module_is_main_msgpack___cmsgpack) {
12558 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12559 }
12560 #if PY_MAJOR_VERSION >= 3
12561 {
12562 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(4, 1, __pyx_L1_error)
12563 if (!PyDict_GetItemString(modules, "msgpack._cmsgpack")) {
12564 if (unlikely(PyDict_SetItemString(modules, "msgpack._cmsgpack", __pyx_m) < 0)) __PYX_ERR(4, 1, __pyx_L1_error)
12565 }
12566 }
12567 #endif
12568 /*--- Builtin init code ---*/
12569 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12570 /*--- Constants init code ---*/
12571 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12572 /*--- Global type/function init code ---*/
12573 (void)__Pyx_modinit_global_init_code();
12574 (void)__Pyx_modinit_variable_export_code();
12575 (void)__Pyx_modinit_function_export_code();
12576 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(4, 1, __pyx_L1_error)
12577 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(4, 1, __pyx_L1_error)
12578 (void)__Pyx_modinit_variable_import_code();
12579 (void)__Pyx_modinit_function_import_code();
12580 /*--- Execution code ---*/
12581 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
12582 if (__Pyx_patch_abc() < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12583 #endif
12584
12585 /* "msgpack/_cmsgpack.pyx":4
12586 * #cython: embedsignature=True, c_string_encoding=ascii, language_level=3
12587 * from cpython.datetime cimport import_datetime, datetime_new
12588 * import_datetime() # <<<<<<<<<<<<<<
12589 *
12590 * import datetime
12591 */
12592 __pyx_f_7cpython_8datetime_import_datetime();
12593
12594 /* "msgpack/_cmsgpack.pyx":6
12595 * import_datetime()
12596 *
12597 * import datetime # <<<<<<<<<<<<<<
12598 * cdef object utc = datetime.timezone.utc
12599 * cdef object epoch = datetime_new(1970, 1, 1, 0, 0, 0, 0, tz=utc)
12600 */
12601 __pyx_t_1 = __Pyx_Import(__pyx_n_s_datetime, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
12602 __Pyx_GOTREF(__pyx_t_1);
12603 if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_1) < 0) __PYX_ERR(4, 6, __pyx_L1_error)
12604 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12605
12606 /* "msgpack/_cmsgpack.pyx":7
12607 *
12608 * import datetime
12609 * cdef object utc = datetime.timezone.utc # <<<<<<<<<<<<<<
12610 * cdef object epoch = datetime_new(1970, 1, 1, 0, 0, 0, 0, tz=utc)
12611 *
12612 */
12613 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
12614 __Pyx_GOTREF(__pyx_t_1);
12615 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_timezone); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 7, __pyx_L1_error)
12616 __Pyx_GOTREF(__pyx_t_2);
12617 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12618 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utc); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
12619 __Pyx_GOTREF(__pyx_t_1);
12620 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12621 __Pyx_XGOTREF(__pyx_v_7msgpack_9_cmsgpack_utc);
12622 __Pyx_DECREF_SET(__pyx_v_7msgpack_9_cmsgpack_utc, __pyx_t_1);
12623 __Pyx_GIVEREF(__pyx_t_1);
12624 __pyx_t_1 = 0;
12625
12626 /* "msgpack/_cmsgpack.pyx":8
12627 * import datetime
12628 * cdef object utc = datetime.timezone.utc
12629 * cdef object epoch = datetime_new(1970, 1, 1, 0, 0, 0, 0, tz=utc) # <<<<<<<<<<<<<<
12630 *
12631 * include "_packer.pyx"
12632 */
12633 __pyx_t_1 = __pyx_v_7msgpack_9_cmsgpack_utc;
12634 __Pyx_INCREF(__pyx_t_1);
12635 __pyx_t_2 = __pyx_f_7cpython_8datetime_datetime_new(0x7B2, 1, 1, 0, 0, 0, 0, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 8, __pyx_L1_error)
12636 __Pyx_GOTREF(__pyx_t_2);
12637 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12638 __Pyx_XGOTREF(__pyx_v_7msgpack_9_cmsgpack_epoch);
12639 __Pyx_DECREF_SET(__pyx_v_7msgpack_9_cmsgpack_epoch, __pyx_t_2);
12640 __Pyx_GIVEREF(__pyx_t_2);
12641 __pyx_t_2 = 0;
12642
12643 /* "msgpack/_packer.pyx":13
12644 * cdef Timestamp
12645 *
12646 * from .ext import ExtType, Timestamp # <<<<<<<<<<<<<<
12647 *
12648 *
12649 */
12650 __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
12651 __Pyx_GOTREF(__pyx_t_2);
12652 __Pyx_INCREF(__pyx_n_s_ExtType);
12653 __Pyx_GIVEREF(__pyx_n_s_ExtType);
12654 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ExtType);
12655 __Pyx_INCREF(__pyx_n_s_Timestamp);
12656 __Pyx_GIVEREF(__pyx_n_s_Timestamp);
12657 PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Timestamp);
12658 __pyx_t_1 = __Pyx_Import(__pyx_n_s_ext, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
12659 __Pyx_GOTREF(__pyx_t_1);
12660 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12661 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ExtType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
12662 __Pyx_GOTREF(__pyx_t_2);
12663 __Pyx_INCREF(__pyx_t_2);
12664 __Pyx_XGOTREF(__pyx_v_7msgpack_9_cmsgpack_ExtType);
12665 __Pyx_DECREF_SET(__pyx_v_7msgpack_9_cmsgpack_ExtType, __pyx_t_2);
12666 __Pyx_GIVEREF(__pyx_t_2);
12667 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12668 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
12669 __Pyx_GOTREF(__pyx_t_2);
12670 __Pyx_INCREF(__pyx_t_2);
12671 __Pyx_XGOTREF(__pyx_v_7msgpack_9_cmsgpack_Timestamp);
12672 __Pyx_DECREF_SET(__pyx_v_7msgpack_9_cmsgpack_Timestamp, __pyx_t_2);
12673 __Pyx_GIVEREF(__pyx_t_2);
12674 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12675 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12676
12677 /* "msgpack/_packer.pyx":50
12678 * object buff_to_buff(char *, Py_ssize_t)
12679 *
12680 * cdef int DEFAULT_RECURSE_LIMIT=511 # <<<<<<<<<<<<<<
12681 * cdef long long ITEM_LIMIT = (2**32)-1
12682 *
12683 */
12684 __pyx_v_7msgpack_9_cmsgpack_DEFAULT_RECURSE_LIMIT = 0x1FF;
12685
12686 /* "msgpack/_packer.pyx":51
12687 *
12688 * cdef int DEFAULT_RECURSE_LIMIT=511
12689 * cdef long long ITEM_LIMIT = (2**32)-1 # <<<<<<<<<<<<<<
12690 *
12691 *
12692 */
12693 __pyx_v_7msgpack_9_cmsgpack_ITEM_LIMIT = 0xFFFFFFFF;
12694
12695 /* "msgpack/_packer.pyx":147
12696 * self.pk.buf = NULL
12697 *
12698 * cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1: # <<<<<<<<<<<<<<
12699 * cdef long long llval
12700 * cdef unsigned long long ullval
12701 */
12702 __pyx_k__3 = __pyx_v_7msgpack_9_cmsgpack_DEFAULT_RECURSE_LIMIT;
12703
12704 /* "msgpack/_unpacker.pyx":14
12705 *
12706 * from .exceptions import (
12707 * BufferFull, # <<<<<<<<<<<<<<
12708 * OutOfData,
12709 * ExtraData,
12710 */
12711 __pyx_t_1 = PyList_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
12712 __Pyx_GOTREF(__pyx_t_1);
12713 __Pyx_INCREF(__pyx_n_s_BufferFull);
12714 __Pyx_GIVEREF(__pyx_n_s_BufferFull);
12715 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_BufferFull);
12716 __Pyx_INCREF(__pyx_n_s_OutOfData);
12717 __Pyx_GIVEREF(__pyx_n_s_OutOfData);
12718 PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_OutOfData);
12719 __Pyx_INCREF(__pyx_n_s_ExtraData);
12720 __Pyx_GIVEREF(__pyx_n_s_ExtraData);
12721 PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_ExtraData);
12722 __Pyx_INCREF(__pyx_n_s_FormatError);
12723 __Pyx_GIVEREF(__pyx_n_s_FormatError);
12724 PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_FormatError);
12725 __Pyx_INCREF(__pyx_n_s_StackError);
12726 __Pyx_GIVEREF(__pyx_n_s_StackError);
12727 PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_StackError);
12728
12729 /* "msgpack/_unpacker.pyx":13
12730 * from libc.stdint cimport uint64_t
12731 *
12732 * from .exceptions import ( # <<<<<<<<<<<<<<
12733 * BufferFull,
12734 * OutOfData,
12735 */
12736 __pyx_t_2 = __Pyx_Import(__pyx_n_s_exceptions, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
12737 __Pyx_GOTREF(__pyx_t_2);
12738 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12739 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_BufferFull); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
12740 __Pyx_GOTREF(__pyx_t_1);
12741 if (PyDict_SetItem(__pyx_d, __pyx_n_s_BufferFull, __pyx_t_1) < 0) __PYX_ERR(1, 14, __pyx_L1_error)
12742 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12743 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_OutOfData); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
12744 __Pyx_GOTREF(__pyx_t_1);
12745 if (PyDict_SetItem(__pyx_d, __pyx_n_s_OutOfData, __pyx_t_1) < 0) __PYX_ERR(1, 15, __pyx_L1_error)
12746 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12747 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ExtraData); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
12748 __Pyx_GOTREF(__pyx_t_1);
12749 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ExtraData, __pyx_t_1) < 0) __PYX_ERR(1, 16, __pyx_L1_error)
12750 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12751 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_FormatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
12752 __Pyx_GOTREF(__pyx_t_1);
12753 if (PyDict_SetItem(__pyx_d, __pyx_n_s_FormatError, __pyx_t_1) < 0) __PYX_ERR(1, 17, __pyx_L1_error)
12754 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12755 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_StackError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
12756 __Pyx_GOTREF(__pyx_t_1);
12757 if (PyDict_SetItem(__pyx_d, __pyx_n_s_StackError, __pyx_t_1) < 0) __PYX_ERR(1, 18, __pyx_L1_error)
12758 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12759 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12760
12761 /* "msgpack/_unpacker.pyx":20
12762 * StackError,
12763 * )
12764 * from .ext import ExtType, Timestamp # <<<<<<<<<<<<<<
12765 *
12766 * cdef object giga = 1_000_000_000
12767 */
12768 __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __pyx_L1_error)
12769 __Pyx_GOTREF(__pyx_t_2);
12770 __Pyx_INCREF(__pyx_n_s_ExtType);
12771 __Pyx_GIVEREF(__pyx_n_s_ExtType);
12772 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ExtType);
12773 __Pyx_INCREF(__pyx_n_s_Timestamp);
12774 __Pyx_GIVEREF(__pyx_n_s_Timestamp);
12775 PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Timestamp);
12776 __pyx_t_1 = __Pyx_Import(__pyx_n_s_ext, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 20, __pyx_L1_error)
12777 __Pyx_GOTREF(__pyx_t_1);
12778 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12779 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ExtType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __pyx_L1_error)
12780 __Pyx_GOTREF(__pyx_t_2);
12781 __Pyx_INCREF(__pyx_t_2);
12782 __Pyx_XGOTREF(__pyx_v_7msgpack_9_cmsgpack_ExtType);
12783 __Pyx_DECREF_SET(__pyx_v_7msgpack_9_cmsgpack_ExtType, __pyx_t_2);
12784 __Pyx_GIVEREF(__pyx_t_2);
12785 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12786 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __pyx_L1_error)
12787 __Pyx_GOTREF(__pyx_t_2);
12788 __Pyx_INCREF(__pyx_t_2);
12789 __Pyx_XGOTREF(__pyx_v_7msgpack_9_cmsgpack_Timestamp);
12790 __Pyx_DECREF_SET(__pyx_v_7msgpack_9_cmsgpack_Timestamp, __pyx_t_2);
12791 __Pyx_GIVEREF(__pyx_t_2);
12792 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12793 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12794
12795 /* "msgpack/_unpacker.pyx":22
12796 * from .ext import ExtType, Timestamp
12797 *
12798 * cdef object giga = 1_000_000_000 # <<<<<<<<<<<<<<
12799 *
12800 *
12801 */
12802 __Pyx_INCREF(__pyx_int_1000000000);
12803 __Pyx_XGOTREF(__pyx_v_7msgpack_9_cmsgpack_giga);
12804 __Pyx_DECREF_SET(__pyx_v_7msgpack_9_cmsgpack_giga, __pyx_int_1000000000);
12805 __Pyx_GIVEREF(__pyx_int_1000000000);
12806
12807 /* "msgpack/_unpacker.pyx":116
12808 * ctx.user.unicode_errors = unicode_errors
12809 *
12810 * def default_read_extended_type(typecode, data): # <<<<<<<<<<<<<<
12811 * raise NotImplementedError("Cannot decode extended type with typecode=%d" % typecode)
12812 *
12813 */
12814 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7msgpack_9_cmsgpack_1default_read_extended_type, NULL, __pyx_n_s_msgpack__cmsgpack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 116, __pyx_L1_error)
12815 __Pyx_GOTREF(__pyx_t_1);
12816 if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_read_extended_type, __pyx_t_1) < 0) __PYX_ERR(1, 116, __pyx_L1_error)
12817 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12818
12819 /* "msgpack/_unpacker.pyx":146
12820 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
12821 * unicode_errors=None,
12822 * object_pairs_hook=None, ext_hook=ExtType, # <<<<<<<<<<<<<<
12823 * Py_ssize_t max_str_len=-1,
12824 * Py_ssize_t max_bin_len=-1,
12825 */
12826 __Pyx_INCREF(__pyx_v_7msgpack_9_cmsgpack_ExtType);
12827 __pyx_k__23 = __pyx_v_7msgpack_9_cmsgpack_ExtType;
12828 __Pyx_GIVEREF(__pyx_v_7msgpack_9_cmsgpack_ExtType);
12829
12830 /* "msgpack/_unpacker.pyx":143
12831 *
12832 *
12833 * def unpackb(object packed, *, object object_hook=None, object list_hook=None, # <<<<<<<<<<<<<<
12834 * bint use_list=True, bint raw=False, int timestamp=0, bint strict_map_key=True,
12835 * unicode_errors=None,
12836 */
12837 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7msgpack_9_cmsgpack_3unpackb, NULL, __pyx_n_s_msgpack__cmsgpack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 143, __pyx_L1_error)
12838 __Pyx_GOTREF(__pyx_t_1);
12839 if (PyDict_SetItem(__pyx_d, __pyx_n_s_unpackb, __pyx_t_1) < 0) __PYX_ERR(1, 143, __pyx_L1_error)
12840 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12841
12842 /* "msgpack/_unpacker.pyx":331
12843 * object object_hook=None, object object_pairs_hook=None, object list_hook=None,
12844 * unicode_errors=None, Py_ssize_t max_buffer_size=100*1024*1024,
12845 * object ext_hook=ExtType, # <<<<<<<<<<<<<<
12846 * Py_ssize_t max_str_len=-1,
12847 * Py_ssize_t max_bin_len=-1,
12848 */
12849 __Pyx_INCREF(__pyx_v_7msgpack_9_cmsgpack_ExtType);
12850 __pyx_k__25 = __pyx_v_7msgpack_9_cmsgpack_ExtType;
12851 __Pyx_GIVEREF(__pyx_v_7msgpack_9_cmsgpack_ExtType);
12852
12853 /* "msgpack/_cmsgpack.pyx":1
12854 * # coding: utf-8 # <<<<<<<<<<<<<<
12855 * #cython: embedsignature=True, c_string_encoding=ascii, language_level=3
12856 * from cpython.datetime cimport import_datetime, datetime_new
12857 */
12858 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1, __pyx_L1_error)
12859 __Pyx_GOTREF(__pyx_t_1);
12860 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
12861 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12862
12863 /* "cpython/datetime.pxd":211
12864 *
12865 * # Get microseconds of timedelta
12866 * cdef inline int timedelta_microseconds(object o): # <<<<<<<<<<<<<<
12867 * return (<PyDateTime_Delta*>o).microseconds
12868 */
12869
12870 /*--- Wrapped vars code ---*/
12871
12872 goto __pyx_L0;
12873 __pyx_L1_error:;
12874 __Pyx_XDECREF(__pyx_t_1);
12875 __Pyx_XDECREF(__pyx_t_2);
12876 if (__pyx_m) {
12877 if (__pyx_d) {
12878 __Pyx_AddTraceback("init msgpack._cmsgpack", __pyx_clineno, __pyx_lineno, __pyx_filename);
12879 }
12880 Py_CLEAR(__pyx_m);
12881 } else if (!PyErr_Occurred()) {
12882 PyErr_SetString(PyExc_ImportError, "init msgpack._cmsgpack");
12883 }
12884 __pyx_L0:;
12885 __Pyx_RefNannyFinishContext();
12886 #if CYTHON_PEP489_MULTI_PHASE_INIT
12887 return (__pyx_m != NULL) ? 0 : -1;
12888 #elif PY_MAJOR_VERSION >= 3
12889 return __pyx_m;
12890 #else
12891 return;
12892 #endif
12893 }
12894
12895 /* --- Runtime support code --- */
12896 /* Refnanny */
12897 #if CYTHON_REFNANNY
12898 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
12899 PyObject *m = NULL, *p = NULL;
12900 void *r = NULL;
12901 m = PyImport_ImportModule(modname);
12902 if (!m) goto end;
12903 p = PyObject_GetAttrString(m, "RefNannyAPI");
12904 if (!p) goto end;
12905 r = PyLong_AsVoidPtr(p);
12906 end:
12907 Py_XDECREF(p);
12908 Py_XDECREF(m);
12909 return (__Pyx_RefNannyAPIStruct *)r;
12910 }
12911 #endif
12912
12913 /* PyObjectGetAttrStr */
12914 #if CYTHON_USE_TYPE_SLOTS
12915 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
12916 PyTypeObject* tp = Py_TYPE(obj);
12917 if (likely(tp->tp_getattro))
12918 return tp->tp_getattro(obj, attr_name);
12919 #if PY_MAJOR_VERSION < 3
12920 if (likely(tp->tp_getattr))
12921 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
12922 #endif
12923 return PyObject_GetAttr(obj, attr_name);
12924 }
12925 #endif
12926
12927 /* GetBuiltinName */
12928 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
12929 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
12930 if (unlikely(!result)) {
12931 PyErr_Format(PyExc_NameError,
12932 #if PY_MAJOR_VERSION >= 3
12933 "name '%U' is not defined", name);
12934 #else
12935 "name '%.200s' is not defined", PyString_AS_STRING(name));
12936 #endif
12937 }
12938 return result;
12939 }
12940
12941 /* RaiseArgTupleInvalid */
12942 static void __Pyx_RaiseArgtupleInvalid(
12943 const char* func_name,
12944 int exact,
12945 Py_ssize_t num_min,
12946 Py_ssize_t num_max,
12947 Py_ssize_t num_found)
12948 {
12949 Py_ssize_t num_expected;
12950 const char *more_or_less;
12951 if (num_found < num_min) {
12952 num_expected = num_min;
12953 more_or_less = "at least";
12954 } else {
12955 num_expected = num_max;
12956 more_or_less = "at most";
12957 }
12958 if (exact) {
12959 more_or_less = "exactly";
12960 }
12961 PyErr_Format(PyExc_TypeError,
12962 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
12963 func_name, more_or_less, num_expected,
12964 (num_expected == 1) ? "" : "s", num_found);
12965 }
12966
12967 /* KeywordStringCheck */
12968 static int __Pyx_CheckKeywordStrings(
12969 PyObject *kwdict,
12970 const char* function_name,
12971 int kw_allowed)
12972 {
12973 PyObject* key = 0;
12974 Py_ssize_t pos = 0;
12975 #if CYTHON_COMPILING_IN_PYPY
12976 if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
12977 goto invalid_keyword;
12978 return 1;
12979 #else
12980 while (PyDict_Next(kwdict, &pos, &key, 0)) {
12981 #if PY_MAJOR_VERSION < 3
12982 if (unlikely(!PyString_Check(key)))
12983 #endif
12984 if (unlikely(!PyUnicode_Check(key)))
12985 goto invalid_keyword_type;
12986 }
12987 if ((!kw_allowed) && unlikely(key))
12988 goto invalid_keyword;
12989 return 1;
12990 invalid_keyword_type:
12991 PyErr_Format(PyExc_TypeError,
12992 "%.200s() keywords must be strings", function_name);
12993 return 0;
12994 #endif
12995 invalid_keyword:
12996 PyErr_Format(PyExc_TypeError,
12997 #if PY_MAJOR_VERSION < 3
12998 "%.200s() got an unexpected keyword argument '%.200s'",
12999 function_name, PyString_AsString(key));
13000 #else
13001 "%s() got an unexpected keyword argument '%U'",
13002 function_name, key);
13003 #endif
13004 return 0;
13005 }
13006
13007 /* PyObjectCall */
13008 #if CYTHON_COMPILING_IN_CPYTHON
13009 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
13010 PyObject *result;
13011 ternaryfunc call = Py_TYPE(func)->tp_call;
13012 if (unlikely(!call))
13013 return PyObject_Call(func, arg, kw);
13014 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
13015 return NULL;
13016 result = (*call)(func, arg, kw);
13017 Py_LeaveRecursiveCall();
13018 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
13019 PyErr_SetString(
13020 PyExc_SystemError,
13021 "NULL result without error in PyObject_Call");
13022 }
13023 return result;
13024 }
13025 #endif
13026
13027 /* PyErrFetchRestore */
13028 #if CYTHON_FAST_THREAD_STATE
13029 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
13030 PyObject *tmp_type, *tmp_value, *tmp_tb;
13031 tmp_type = tstate->curexc_type;
13032 tmp_value = tstate->curexc_value;
13033 tmp_tb = tstate->curexc_traceback;
13034 tstate->curexc_type = type;
13035 tstate->curexc_value = value;
13036 tstate->curexc_traceback = tb;
13037 Py_XDECREF(tmp_type);
13038 Py_XDECREF(tmp_value);
13039 Py_XDECREF(tmp_tb);
13040 }
13041 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
13042 *type = tstate->curexc_type;
13043 *value = tstate->curexc_value;
13044 *tb = tstate->curexc_traceback;
13045 tstate->curexc_type = 0;
13046 tstate->curexc_value = 0;
13047 tstate->curexc_traceback = 0;
13048 }
13049 #endif
13050
13051 /* RaiseException */
13052 #if PY_MAJOR_VERSION < 3
13053 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
13054 CYTHON_UNUSED PyObject *cause) {
13055 __Pyx_PyThreadState_declare
13056 Py_XINCREF(type);
13057 if (!value || value == Py_None)
13058 value = NULL;
13059 else
13060 Py_INCREF(value);
13061 if (!tb || tb == Py_None)
13062 tb = NULL;
13063 else {
13064 Py_INCREF(tb);
13065 if (!PyTraceBack_Check(tb)) {
13066 PyErr_SetString(PyExc_TypeError,
13067 "raise: arg 3 must be a traceback or None");
13068 goto raise_error;
13069 }
13070 }
13071 if (PyType_Check(type)) {
13072 #if CYTHON_COMPILING_IN_PYPY
13073 if (!value) {
13074 Py_INCREF(Py_None);
13075 value = Py_None;
13076 }
13077 #endif
13078 PyErr_NormalizeException(&type, &value, &tb);
13079 } else {
13080 if (value) {
13081 PyErr_SetString(PyExc_TypeError,
13082 "instance exception may not have a separate value");
13083 goto raise_error;
13084 }
13085 value = type;
13086 type = (PyObject*) Py_TYPE(type);
13087 Py_INCREF(type);
13088 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
13089 PyErr_SetString(PyExc_TypeError,
13090 "raise: exception class must be a subclass of BaseException");
13091 goto raise_error;
13092 }
13093 }
13094 __Pyx_PyThreadState_assign
13095 __Pyx_ErrRestore(type, value, tb);
13096 return;
13097 raise_error:
13098 Py_XDECREF(value);
13099 Py_XDECREF(type);
13100 Py_XDECREF(tb);
13101 return;
13102 }
13103 #else
13104 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
13105 PyObject* owned_instance = NULL;
13106 if (tb == Py_None) {
13107 tb = 0;
13108 } else if (tb && !PyTraceBack_Check(tb)) {
13109 PyErr_SetString(PyExc_TypeError,
13110 "raise: arg 3 must be a traceback or None");
13111 goto bad;
13112 }
13113 if (value == Py_None)
13114 value = 0;
13115 if (PyExceptionInstance_Check(type)) {
13116 if (value) {
13117 PyErr_SetString(PyExc_TypeError,
13118 "instance exception may not have a separate value");
13119 goto bad;
13120 }
13121 value = type;
13122 type = (PyObject*) Py_TYPE(value);
13123 } else if (PyExceptionClass_Check(type)) {
13124 PyObject *instance_class = NULL;
13125 if (value && PyExceptionInstance_Check(value)) {
13126 instance_class = (PyObject*) Py_TYPE(value);
13127 if (instance_class != type) {
13128 int is_subclass = PyObject_IsSubclass(instance_class, type);
13129 if (!is_subclass) {
13130 instance_class = NULL;
13131 } else if (unlikely(is_subclass == -1)) {
13132 goto bad;
13133 } else {
13134 type = instance_class;
13135 }
13136 }
13137 }
13138 if (!instance_class) {
13139 PyObject *args;
13140 if (!value)
13141 args = PyTuple_New(0);
13142 else if (PyTuple_Check(value)) {
13143 Py_INCREF(value);
13144 args = value;
13145 } else
13146 args = PyTuple_Pack(1, value);
13147 if (!args)
13148 goto bad;
13149 owned_instance = PyObject_Call(type, args, NULL);
13150 Py_DECREF(args);
13151 if (!owned_instance)
13152 goto bad;
13153 value = owned_instance;
13154 if (!PyExceptionInstance_Check(value)) {
13155 PyErr_Format(PyExc_TypeError,
13156 "calling %R should have returned an instance of "
13157 "BaseException, not %R",
13158 type, Py_TYPE(value));
13159 goto bad;
13160 }
13161 }
13162 } else {
13163 PyErr_SetString(PyExc_TypeError,
13164 "raise: exception class must be a subclass of BaseException");
13165 goto bad;
13166 }
13167 if (cause) {
13168 PyObject *fixed_cause;
13169 if (cause == Py_None) {
13170 fixed_cause = NULL;
13171 } else if (PyExceptionClass_Check(cause)) {
13172 fixed_cause = PyObject_CallObject(cause, NULL);
13173 if (fixed_cause == NULL)
13174 goto bad;
13175 } else if (PyExceptionInstance_Check(cause)) {
13176 fixed_cause = cause;
13177 Py_INCREF(fixed_cause);
13178 } else {
13179 PyErr_SetString(PyExc_TypeError,
13180 "exception causes must derive from "
13181 "BaseException");
13182 goto bad;
13183 }
13184 PyException_SetCause(value, fixed_cause);
13185 }
13186 PyErr_SetObject(type, value);
13187 if (tb) {
13188 #if CYTHON_COMPILING_IN_PYPY
13189 PyObject *tmp_type, *tmp_value, *tmp_tb;
13190 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
13191 Py_INCREF(tb);
13192 PyErr_Restore(tmp_type, tmp_value, tb);
13193 Py_XDECREF(tmp_tb);
13194 #else
13195 PyThreadState *tstate = __Pyx_PyThreadState_Current;
13196 PyObject* tmp_tb = tstate->curexc_traceback;
13197 if (tb != tmp_tb) {
13198 Py_INCREF(tb);
13199 tstate->curexc_traceback = tb;
13200 Py_XDECREF(tmp_tb);
13201 }
13202 #endif
13203 }
13204 bad:
13205 Py_XDECREF(owned_instance);
13206 return;
13207 }
13208 #endif
13209
13210 /* RaiseDoubleKeywords */
13211 static void __Pyx_RaiseDoubleKeywordsError(
13212 const char* func_name,
13213 PyObject* kw_name)
13214 {
13215 PyErr_Format(PyExc_TypeError,
13216 #if PY_MAJOR_VERSION >= 3
13217 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
13218 #else
13219 "%s() got multiple values for keyword argument '%s'", func_name,
13220 PyString_AsString(kw_name));
13221 #endif
13222 }
13223
13224 /* ParseKeywords */
13225 static int __Pyx_ParseOptionalKeywords(
13226 PyObject *kwds,
13227 PyObject **argnames[],
13228 PyObject *kwds2,
13229 PyObject *values[],
13230 Py_ssize_t num_pos_args,
13231 const char* function_name)
13232 {
13233 PyObject *key = 0, *value = 0;
13234 Py_ssize_t pos = 0;
13235 PyObject*** name;
13236 PyObject*** first_kw_arg = argnames + num_pos_args;
13237 while (PyDict_Next(kwds, &pos, &key, &value)) {
13238 name = first_kw_arg;
13239 while (*name && (**name != key)) name++;
13240 if (*name) {
13241 values[name-argnames] = value;
13242 continue;
13243 }
13244 name = first_kw_arg;
13245 #if PY_MAJOR_VERSION < 3
13246 if (likely(PyString_Check(key))) {
13247 while (*name) {
13248 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
13249 && _PyString_Eq(**name, key)) {
13250 values[name-argnames] = value;
13251 break;
13252 }
13253 name++;
13254 }
13255 if (*name) continue;
13256 else {
13257 PyObject*** argname = argnames;
13258 while (argname != first_kw_arg) {
13259 if ((**argname == key) || (
13260 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
13261 && _PyString_Eq(**argname, key))) {
13262 goto arg_passed_twice;
13263 }
13264 argname++;
13265 }
13266 }
13267 } else
13268 #endif
13269 if (likely(PyUnicode_Check(key))) {
13270 while (*name) {
13271 int cmp = (**name == key) ? 0 :
13272 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
13273 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
13274 #endif
13275 PyUnicode_Compare(**name, key);
13276 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
13277 if (cmp == 0) {
13278 values[name-argnames] = value;
13279 break;
13280 }
13281 name++;
13282 }
13283 if (*name) continue;
13284 else {
13285 PyObject*** argname = argnames;
13286 while (argname != first_kw_arg) {
13287 int cmp = (**argname == key) ? 0 :
13288 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
13289 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
13290 #endif
13291 PyUnicode_Compare(**argname, key);
13292 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
13293 if (cmp == 0) goto arg_passed_twice;
13294 argname++;
13295 }
13296 }
13297 } else
13298 goto invalid_keyword_type;
13299 if (kwds2) {
13300 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
13301 } else {
13302 goto invalid_keyword;
13303 }
13304 }
13305 return 0;
13306 arg_passed_twice:
13307 __Pyx_RaiseDoubleKeywordsError(function_name, key);
13308 goto bad;
13309 invalid_keyword_type:
13310 PyErr_Format(PyExc_TypeError,
13311 "%.200s() keywords must be strings", function_name);
13312 goto bad;
13313 invalid_keyword:
13314 PyErr_Format(PyExc_TypeError,
13315 #if PY_MAJOR_VERSION < 3
13316 "%.200s() got an unexpected keyword argument '%.200s'",
13317 function_name, PyString_AsString(key));
13318 #else
13319 "%s() got an unexpected keyword argument '%U'",
13320 function_name, key);
13321 #endif
13322 bad:
13323 return -1;
13324 }
13325
13326 /* GetTopmostException */
13327 #if CYTHON_USE_EXC_INFO_STACK
13328 static _PyErr_StackItem *
13329 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
13330 {
13331 _PyErr_StackItem *exc_info = tstate->exc_info;
13332 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
13333 exc_info->previous_item != NULL)
13334 {
13335 exc_info = exc_info->previous_item;
13336 }
13337 return exc_info;
13338 }
13339 #endif
13340
13341 /* SaveResetException */
13342 #if CYTHON_FAST_THREAD_STATE
13343 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
13344 #if CYTHON_USE_EXC_INFO_STACK
13345 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
13346 *type = exc_info->exc_type;
13347 *value = exc_info->exc_value;
13348 *tb = exc_info->exc_traceback;
13349 #else
13350 *type = tstate->exc_type;
13351 *value = tstate->exc_value;
13352 *tb = tstate->exc_traceback;
13353 #endif
13354 Py_XINCREF(*type);
13355 Py_XINCREF(*value);
13356 Py_XINCREF(*tb);
13357 }
13358 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
13359 PyObject *tmp_type, *tmp_value, *tmp_tb;
13360 #if CYTHON_USE_EXC_INFO_STACK
13361 _PyErr_StackItem *exc_info = tstate->exc_info;
13362 tmp_type = exc_info->exc_type;
13363 tmp_value = exc_info->exc_value;
13364 tmp_tb = exc_info->exc_traceback;
13365 exc_info->exc_type = type;
13366 exc_info->exc_value = value;
13367 exc_info->exc_traceback = tb;
13368 #else
13369 tmp_type = tstate->exc_type;
13370 tmp_value = tstate->exc_value;
13371 tmp_tb = tstate->exc_traceback;
13372 tstate->exc_type = type;
13373 tstate->exc_value = value;
13374 tstate->exc_traceback = tb;
13375 #endif
13376 Py_XDECREF(tmp_type);
13377 Py_XDECREF(tmp_value);
13378 Py_XDECREF(tmp_tb);
13379 }
13380 #endif
13381
13382 /* PyErrExceptionMatches */
13383 #if CYTHON_FAST_THREAD_STATE
13384 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
13385 Py_ssize_t i, n;
13386 n = PyTuple_GET_SIZE(tuple);
13387 #if PY_MAJOR_VERSION >= 3
13388 for (i=0; i<n; i++) {
13389 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
13390 }
13391 #endif
13392 for (i=0; i<n; i++) {
13393 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
13394 }
13395 return 0;
13396 }
13397 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
13398 PyObject *exc_type = tstate->curexc_type;
13399 if (exc_type == err) return 1;
13400 if (unlikely(!exc_type)) return 0;
13401 if (unlikely(PyTuple_Check(err)))
13402 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
13403 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
13404 }
13405 #endif
13406
13407 /* GetException */
13408 #if CYTHON_FAST_THREAD_STATE
13409 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
13410 #else
13411 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
13412 #endif
13413 {
13414 PyObject *local_type, *local_value, *local_tb;
13415 #if CYTHON_FAST_THREAD_STATE
13416 PyObject *tmp_type, *tmp_value, *tmp_tb;
13417 local_type = tstate->curexc_type;
13418 local_value = tstate->curexc_value;
13419 local_tb = tstate->curexc_traceback;
13420 tstate->curexc_type = 0;
13421 tstate->curexc_value = 0;
13422 tstate->curexc_traceback = 0;
13423 #else
13424 PyErr_Fetch(&local_type, &local_value, &local_tb);
13425 #endif
13426 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
13427 #if CYTHON_FAST_THREAD_STATE
13428 if (unlikely(tstate->curexc_type))
13429 #else
13430 if (unlikely(PyErr_Occurred()))
13431 #endif
13432 goto bad;
13433 #if PY_MAJOR_VERSION >= 3
13434 if (local_tb) {
13435 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
13436 goto bad;
13437 }
13438 #endif
13439 Py_XINCREF(local_tb);
13440 Py_XINCREF(local_type);
13441 Py_XINCREF(local_value);
13442 *type = local_type;
13443 *value = local_value;
13444 *tb = local_tb;
13445 #if CYTHON_FAST_THREAD_STATE
13446 #if CYTHON_USE_EXC_INFO_STACK
13447 {
13448 _PyErr_StackItem *exc_info = tstate->exc_info;
13449 tmp_type = exc_info->exc_type;
13450 tmp_value = exc_info->exc_value;
13451 tmp_tb = exc_info->exc_traceback;
13452 exc_info->exc_type = local_type;
13453 exc_info->exc_value = local_value;
13454 exc_info->exc_traceback = local_tb;
13455 }
13456 #else
13457 tmp_type = tstate->exc_type;
13458 tmp_value = tstate->exc_value;
13459 tmp_tb = tstate->exc_traceback;
13460 tstate->exc_type = local_type;
13461 tstate->exc_value = local_value;
13462 tstate->exc_traceback = local_tb;
13463 #endif
13464 Py_XDECREF(tmp_type);
13465 Py_XDECREF(tmp_value);
13466 Py_XDECREF(tmp_tb);
13467 #else
13468 PyErr_SetExcInfo(local_type, local_value, local_tb);
13469 #endif
13470 return 0;
13471 bad:
13472 *type = 0;
13473 *value = 0;
13474 *tb = 0;
13475 Py_XDECREF(local_type);
13476 Py_XDECREF(local_value);
13477 Py_XDECREF(local_tb);
13478 return -1;
13479 }
13480
13481 /* PyCFunctionFastCall */
13482 #if CYTHON_FAST_PYCCALL
13483 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
13484 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
13485 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
13486 PyObject *self = PyCFunction_GET_SELF(func);
13487 int flags = PyCFunction_GET_FLAGS(func);
13488 assert(PyCFunction_Check(func));
13489 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
13490 assert(nargs >= 0);
13491 assert(nargs == 0 || args != NULL);
13492 /* _PyCFunction_FastCallDict() must not be called with an exception set,
13493 because it may clear it (directly or indirectly) and so the
13494 caller loses its exception */
13495 assert(!PyErr_Occurred());
13496 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
13497 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
13498 } else {
13499 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
13500 }
13501 }
13502 #endif
13503
13504 /* PyFunctionFastCall */
13505 #if CYTHON_FAST_PYCALL
13506 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
13507 PyObject *globals) {
13508 PyFrameObject *f;
13509 PyThreadState *tstate = __Pyx_PyThreadState_Current;
13510 PyObject **fastlocals;
13511 Py_ssize_t i;
13512 PyObject *result;
13513 assert(globals != NULL);
13514 /* XXX Perhaps we should create a specialized
13515 PyFrame_New() that doesn't take locals, but does
13516 take builtins without sanity checking them.
13517 */
13518 assert(tstate != NULL);
13519 f = PyFrame_New(tstate, co, globals, NULL);
13520 if (f == NULL) {
13521 return NULL;
13522 }
13523 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
13524 for (i = 0; i < na; i++) {
13525 Py_INCREF(*args);
13526 fastlocals[i] = *args++;
13527 }
13528 result = PyEval_EvalFrameEx(f,0);
13529 ++tstate->recursion_depth;
13530 Py_DECREF(f);
13531 --tstate->recursion_depth;
13532 return result;
13533 }
13534 #if 1 || PY_VERSION_HEX < 0x030600B1
13535 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
13536 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
13537 PyObject *globals = PyFunction_GET_GLOBALS(func);
13538 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
13539 PyObject *closure;
13540 #if PY_MAJOR_VERSION >= 3
13541 PyObject *kwdefs;
13542 #endif
13543 PyObject *kwtuple, **k;
13544 PyObject **d;
13545 Py_ssize_t nd;
13546 Py_ssize_t nk;
13547 PyObject *result;
13548 assert(kwargs == NULL || PyDict_Check(kwargs));
13549 nk = kwargs ? PyDict_Size(kwargs) : 0;
13550 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
13551 return NULL;
13552 }
13553 if (
13554 #if PY_MAJOR_VERSION >= 3
13555 co->co_kwonlyargcount == 0 &&
13556 #endif
13557 likely(kwargs == NULL || nk == 0) &&
13558 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
13559 if (argdefs == NULL && co->co_argcount == nargs) {
13560 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
13561 goto done;
13562 }
13563 else if (nargs == 0 && argdefs != NULL
13564 && co->co_argcount == Py_SIZE(argdefs)) {
13565 /* function called with no arguments, but all parameters have
13566 a default value: use default values as arguments .*/
13567 args = &PyTuple_GET_ITEM(argdefs, 0);
13568 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
13569 goto done;
13570 }
13571 }
13572 if (kwargs != NULL) {
13573 Py_ssize_t pos, i;
13574 kwtuple = PyTuple_New(2 * nk);
13575 if (kwtuple == NULL) {
13576 result = NULL;
13577 goto done;
13578 }
13579 k = &PyTuple_GET_ITEM(kwtuple, 0);
13580 pos = i = 0;
13581 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
13582 Py_INCREF(k[i]);
13583 Py_INCREF(k[i+1]);
13584 i += 2;
13585 }
13586 nk = i / 2;
13587 }
13588 else {
13589 kwtuple = NULL;
13590 k = NULL;
13591 }
13592 closure = PyFunction_GET_CLOSURE(func);
13593 #if PY_MAJOR_VERSION >= 3
13594 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
13595 #endif
13596 if (argdefs != NULL) {
13597 d = &PyTuple_GET_ITEM(argdefs, 0);
13598 nd = Py_SIZE(argdefs);
13599 }
13600 else {
13601 d = NULL;
13602 nd = 0;
13603 }
13604 #if PY_MAJOR_VERSION >= 3
13605 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
13606 args, (int)nargs,
13607 k, (int)nk,
13608 d, (int)nd, kwdefs, closure);
13609 #else
13610 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
13611 args, (int)nargs,
13612 k, (int)nk,
13613 d, (int)nd, closure);
13614 #endif
13615 Py_XDECREF(kwtuple);
13616 done:
13617 Py_LeaveRecursiveCall();
13618 return result;
13619 }
13620 #endif
13621 #endif
13622
13623 /* PyObjectCall2Args */
13624 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
13625 PyObject *args, *result = NULL;
13626 #if CYTHON_FAST_PYCALL
13627 if (PyFunction_Check(function)) {
13628 PyObject *args[2] = {arg1, arg2};
13629 return __Pyx_PyFunction_FastCall(function, args, 2);
13630 }
13631 #endif
13632 #if CYTHON_FAST_PYCCALL
13633 if (__Pyx_PyFastCFunction_Check(function)) {
13634 PyObject *args[2] = {arg1, arg2};
13635 return __Pyx_PyCFunction_FastCall(function, args, 2);
13636 }
13637 #endif
13638 args = PyTuple_New(2);
13639 if (unlikely(!args)) goto done;
13640 Py_INCREF(arg1);
13641 PyTuple_SET_ITEM(args, 0, arg1);
13642 Py_INCREF(arg2);
13643 PyTuple_SET_ITEM(args, 1, arg2);
13644 Py_INCREF(function);
13645 result = __Pyx_PyObject_Call(function, args, NULL);
13646 Py_DECREF(args);
13647 Py_DECREF(function);
13648 done:
13649 return result;
13650 }
13651
13652 /* PyObjectCallMethO */
13653 #if CYTHON_COMPILING_IN_CPYTHON
13654 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
13655 PyObject *self, *result;
13656 PyCFunction cfunc;
13657 cfunc = PyCFunction_GET_FUNCTION(func);
13658 self = PyCFunction_GET_SELF(func);
13659 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
13660 return NULL;
13661 result = cfunc(self, arg);
13662 Py_LeaveRecursiveCall();
13663 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
13664 PyErr_SetString(
13665 PyExc_SystemError,
13666 "NULL result without error in PyObject_Call");
13667 }
13668 return result;
13669 }
13670 #endif
13671
13672 /* PyObjectCallOneArg */
13673 #if CYTHON_COMPILING_IN_CPYTHON
13674 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
13675 PyObject *result;
13676 PyObject *args = PyTuple_New(1);
13677 if (unlikely(!args)) return NULL;
13678 Py_INCREF(arg);
13679 PyTuple_SET_ITEM(args, 0, arg);
13680 result = __Pyx_PyObject_Call(func, args, NULL);
13681 Py_DECREF(args);
13682 return result;
13683 }
13684 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
13685 #if CYTHON_FAST_PYCALL
13686 if (PyFunction_Check(func)) {
13687 return __Pyx_PyFunction_FastCall(func, &arg, 1);
13688 }
13689 #endif
13690 if (likely(PyCFunction_Check(func))) {
13691 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
13692 return __Pyx_PyObject_CallMethO(func, arg);
13693 #if CYTHON_FAST_PYCCALL
13694 } else if (__Pyx_PyFastCFunction_Check(func)) {
13695 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
13696 #endif
13697 }
13698 }
13699 return __Pyx__PyObject_CallOneArg(func, arg);
13700 }
13701 #else
13702 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
13703 PyObject *result;
13704 PyObject *args = PyTuple_Pack(1, arg);
13705 if (unlikely(!args)) return NULL;
13706 result = __Pyx_PyObject_Call(func, args, NULL);
13707 Py_DECREF(args);
13708 return result;
13709 }
13710 #endif
13711
13712 /* SwapException */
13713 #if CYTHON_FAST_THREAD_STATE
13714 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
13715 PyObject *tmp_type, *tmp_value, *tmp_tb;
13716 #if CYTHON_USE_EXC_INFO_STACK
13717 _PyErr_StackItem *exc_info = tstate->exc_info;
13718 tmp_type = exc_info->exc_type;
13719 tmp_value = exc_info->exc_value;
13720 tmp_tb = exc_info->exc_traceback;
13721 exc_info->exc_type = *type;
13722 exc_info->exc_value = *value;
13723 exc_info->exc_traceback = *tb;
13724 #else
13725 tmp_type = tstate->exc_type;
13726 tmp_value = tstate->exc_value;
13727 tmp_tb = tstate->exc_traceback;
13728 tstate->exc_type = *type;
13729 tstate->exc_value = *value;
13730 tstate->exc_traceback = *tb;
13731 #endif
13732 *type = tmp_type;
13733 *value = tmp_value;
13734 *tb = tmp_tb;
13735 }
13736 #else
13737 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
13738 PyObject *tmp_type, *tmp_value, *tmp_tb;
13739 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
13740 PyErr_SetExcInfo(*type, *value, *tb);
13741 *type = tmp_type;
13742 *value = tmp_value;
13743 *tb = tmp_tb;
13744 }
13745 #endif
13746
13747 /* IterFinish */
13748 static CYTHON_INLINE int __Pyx_IterFinish(void) {
13749 #if CYTHON_FAST_THREAD_STATE
13750 PyThreadState *tstate = __Pyx_PyThreadState_Current;
13751 PyObject* exc_type = tstate->curexc_type;
13752 if (unlikely(exc_type)) {
13753 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
13754 PyObject *exc_value, *exc_tb;
13755 exc_value = tstate->curexc_value;
13756 exc_tb = tstate->curexc_traceback;
13757 tstate->curexc_type = 0;
13758 tstate->curexc_value = 0;
13759 tstate->curexc_traceback = 0;
13760 Py_DECREF(exc_type);
13761 Py_XDECREF(exc_value);
13762 Py_XDECREF(exc_tb);
13763 return 0;
13764 } else {
13765 return -1;
13766 }
13767 }
13768 return 0;
13769 #else
13770 if (unlikely(PyErr_Occurred())) {
13771 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
13772 PyErr_Clear();
13773 return 0;
13774 } else {
13775 return -1;
13776 }
13777 }
13778 return 0;
13779 #endif
13780 }
13781
13782 /* PyObjectCallNoArg */
13783 #if CYTHON_COMPILING_IN_CPYTHON
13784 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
13785 #if CYTHON_FAST_PYCALL
13786 if (PyFunction_Check(func)) {
13787 return __Pyx_PyFunction_FastCall(func, NULL, 0);
13788 }
13789 #endif
13790 #ifdef __Pyx_CyFunction_USED
13791 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
13792 #else
13793 if (likely(PyCFunction_Check(func)))
13794 #endif
13795 {
13796 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
13797 return __Pyx_PyObject_CallMethO(func, NULL);
13798 }
13799 }
13800 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
13801 }
13802 #endif
13803
13804 /* PyObjectGetMethod */
13805 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
13806 PyObject *attr;
13807 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
13808 PyTypeObject *tp = Py_TYPE(obj);
13809 PyObject *descr;
13810 descrgetfunc f = NULL;
13811 PyObject **dictptr, *dict;
13812 int meth_found = 0;
13813 assert (*method == NULL);
13814 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
13815 attr = __Pyx_PyObject_GetAttrStr(obj, name);
13816 goto try_unpack;
13817 }
13818 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
13819 return 0;
13820 }
13821 descr = _PyType_Lookup(tp, name);
13822 if (likely(descr != NULL)) {
13823 Py_INCREF(descr);
13824 #if PY_MAJOR_VERSION >= 3
13825 #ifdef __Pyx_CyFunction_USED
13826 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
13827 #else
13828 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
13829 #endif
13830 #else
13831 #ifdef __Pyx_CyFunction_USED
13832 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
13833 #else
13834 if (likely(PyFunction_Check(descr)))
13835 #endif
13836 #endif
13837 {
13838 meth_found = 1;
13839 } else {
13840 f = Py_TYPE(descr)->tp_descr_get;
13841 if (f != NULL && PyDescr_IsData(descr)) {
13842 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
13843 Py_DECREF(descr);
13844 goto try_unpack;
13845 }
13846 }
13847 }
13848 dictptr = _PyObject_GetDictPtr(obj);
13849 if (dictptr != NULL && (dict = *dictptr) != NULL) {
13850 Py_INCREF(dict);
13851 attr = __Pyx_PyDict_GetItemStr(dict, name);
13852 if (attr != NULL) {
13853 Py_INCREF(attr);
13854 Py_DECREF(dict);
13855 Py_XDECREF(descr);
13856 goto try_unpack;
13857 }
13858 Py_DECREF(dict);
13859 }
13860 if (meth_found) {
13861 *method = descr;
13862 return 1;
13863 }
13864 if (f != NULL) {
13865 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
13866 Py_DECREF(descr);
13867 goto try_unpack;
13868 }
13869 if (descr != NULL) {
13870 *method = descr;
13871 return 0;
13872 }
13873 PyErr_Format(PyExc_AttributeError,
13874 #if PY_MAJOR_VERSION >= 3
13875 "'%.50s' object has no attribute '%U'",
13876 tp->tp_name, name);
13877 #else
13878 "'%.50s' object has no attribute '%.400s'",
13879 tp->tp_name, PyString_AS_STRING(name));
13880 #endif
13881 return 0;
13882 #else
13883 attr = __Pyx_PyObject_GetAttrStr(obj, name);
13884 goto try_unpack;
13885 #endif
13886 try_unpack:
13887 #if CYTHON_UNPACK_METHODS
13888 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
13889 PyObject *function = PyMethod_GET_FUNCTION(attr);
13890 Py_INCREF(function);
13891 Py_DECREF(attr);
13892 *method = function;
13893 return 1;
13894 }
13895 #endif
13896 *method = attr;
13897 return 0;
13898 }
13899
13900 /* PyObjectCallMethod0 */
13901 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
13902 PyObject *method = NULL, *result = NULL;
13903 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
13904 if (likely(is_method)) {
13905 result = __Pyx_PyObject_CallOneArg(method, obj);
13906 Py_DECREF(method);
13907 return result;
13908 }
13909 if (unlikely(!method)) goto bad;
13910 result = __Pyx_PyObject_CallNoArg(method);
13911 Py_DECREF(method);
13912 bad:
13913 return result;
13914 }
13915
13916 /* RaiseNeedMoreValuesToUnpack */
13917 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
13918 PyErr_Format(PyExc_ValueError,
13919 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
13920 index, (index == 1) ? "" : "s");
13921 }
13922
13923 /* RaiseTooManyValuesToUnpack */
13924 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
13925 PyErr_Format(PyExc_ValueError,
13926 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
13927 }
13928
13929 /* UnpackItemEndCheck */
13930 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
13931 if (unlikely(retval)) {
13932 Py_DECREF(retval);
13933 __Pyx_RaiseTooManyValuesError(expected);
13934 return -1;
13935 } else {
13936 return __Pyx_IterFinish();
13937 }
13938 return 0;
13939 }
13940
13941 /* RaiseNoneIterError */
13942 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
13943 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
13944 }
13945
13946 /* UnpackTupleError */
13947 static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
13948 if (t == Py_None) {
13949 __Pyx_RaiseNoneNotIterableError();
13950 } else if (PyTuple_GET_SIZE(t) < index) {
13951 __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
13952 } else {
13953 __Pyx_RaiseTooManyValuesError(index);
13954 }
13955 }
13956
13957 /* UnpackTuple2 */
13958 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
13959 PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
13960 PyObject *value1 = NULL, *value2 = NULL;
13961 #if CYTHON_COMPILING_IN_PYPY
13962 value1 = PySequence_ITEM(tuple, 0); if (unlikely(!value1)) goto bad;
13963 value2 = PySequence_ITEM(tuple, 1); if (unlikely(!value2)) goto bad;
13964 #else
13965 value1 = PyTuple_GET_ITEM(tuple, 0); Py_INCREF(value1);
13966 value2 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(value2);
13967 #endif
13968 if (decref_tuple) {
13969 Py_DECREF(tuple);
13970 }
13971 *pvalue1 = value1;
13972 *pvalue2 = value2;
13973 return 0;
13974 #if CYTHON_COMPILING_IN_PYPY
13975 bad:
13976 Py_XDECREF(value1);
13977 Py_XDECREF(value2);
13978 if (decref_tuple) { Py_XDECREF(tuple); }
13979 return -1;
13980 #endif
13981 }
13982 static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
13983 int has_known_size, int decref_tuple) {
13984 Py_ssize_t index;
13985 PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
13986 iternextfunc iternext;
13987 iter = PyObject_GetIter(tuple);
13988 if (unlikely(!iter)) goto bad;
13989 if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
13990 iternext = Py_TYPE(iter)->tp_iternext;
13991 value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
13992 value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
13993 if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
13994 Py_DECREF(iter);
13995 *pvalue1 = value1;
13996 *pvalue2 = value2;
13997 return 0;
13998 unpacking_failed:
13999 if (!has_known_size && __Pyx_IterFinish() == 0)
14000 __Pyx_RaiseNeedMoreValuesError(index);
14001 bad:
14002 Py_XDECREF(iter);
14003 Py_XDECREF(value1);
14004 Py_XDECREF(value2);
14005 if (decref_tuple) { Py_XDECREF(tuple); }
14006 return -1;
14007 }
14008
14009 /* dict_iter */
14010 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
14011 Py_ssize_t* p_orig_length, int* p_source_is_dict) {
14012 is_dict = is_dict || likely(PyDict_CheckExact(iterable));
14013 *p_source_is_dict = is_dict;
14014 if (is_dict) {
14015 #if !CYTHON_COMPILING_IN_PYPY
14016 *p_orig_length = PyDict_Size(iterable);
14017 Py_INCREF(iterable);
14018 return iterable;
14019 #elif PY_MAJOR_VERSION >= 3
14020 static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
14021 PyObject **pp = NULL;
14022 if (method_name) {
14023 const char *name = PyUnicode_AsUTF8(method_name);
14024 if (strcmp(name, "iteritems") == 0) pp = &py_items;
14025 else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
14026 else if (strcmp(name, "itervalues") == 0) pp = &py_values;
14027 if (pp) {
14028 if (!*pp) {
14029 *pp = PyUnicode_FromString(name + 4);
14030 if (!*pp)
14031 return NULL;
14032 }
14033 method_name = *pp;
14034 }
14035 }
14036 #endif
14037 }
14038 *p_orig_length = 0;
14039 if (method_name) {
14040 PyObject* iter;
14041 iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
14042 if (!iterable)
14043 return NULL;
14044 #if !CYTHON_COMPILING_IN_PYPY
14045 if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
14046 return iterable;
14047 #endif
14048 iter = PyObject_GetIter(iterable);
14049 Py_DECREF(iterable);
14050 return iter;
14051 }
14052 return PyObject_GetIter(iterable);
14053 }
14054 static CYTHON_INLINE int __Pyx_dict_iter_next(
14055 PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
14056 PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
14057 PyObject* next_item;
14058 #if !CYTHON_COMPILING_IN_PYPY
14059 if (source_is_dict) {
14060 PyObject *key, *value;
14061 if (unlikely(orig_length != PyDict_Size(iter_obj))) {
14062 PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
14063 return -1;
14064 }
14065 if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
14066 return 0;
14067 }
14068 if (pitem) {
14069 PyObject* tuple = PyTuple_New(2);
14070 if (unlikely(!tuple)) {
14071 return -1;
14072 }
14073 Py_INCREF(key);
14074 Py_INCREF(value);
14075 PyTuple_SET_ITEM(tuple, 0, key);
14076 PyTuple_SET_ITEM(tuple, 1, value);
14077 *pitem = tuple;
14078 } else {
14079 if (pkey) {
14080 Py_INCREF(key);
14081 *pkey = key;
14082 }
14083 if (pvalue) {
14084 Py_INCREF(value);
14085 *pvalue = value;
14086 }
14087 }
14088 return 1;
14089 } else if (PyTuple_CheckExact(iter_obj)) {
14090 Py_ssize_t pos = *ppos;
14091 if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
14092 *ppos = pos + 1;
14093 next_item = PyTuple_GET_ITEM(iter_obj, pos);
14094 Py_INCREF(next_item);
14095 } else if (PyList_CheckExact(iter_obj)) {
14096 Py_ssize_t pos = *ppos;
14097 if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
14098 *ppos = pos + 1;
14099 next_item = PyList_GET_ITEM(iter_obj, pos);
14100 Py_INCREF(next_item);
14101 } else
14102 #endif
14103 {
14104 next_item = PyIter_Next(iter_obj);
14105 if (unlikely(!next_item)) {
14106 return __Pyx_IterFinish();
14107 }
14108 }
14109 if (pitem) {
14110 *pitem = next_item;
14111 } else if (pkey && pvalue) {
14112 if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
14113 return -1;
14114 } else if (pkey) {
14115 *pkey = next_item;
14116 } else {
14117 *pvalue = next_item;
14118 }
14119 return 1;
14120 }
14121
14122 /* PyDictVersioning */
14123 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
14124 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
14125 PyObject *dict = Py_TYPE(obj)->tp_dict;
14126 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
14127 }
14128 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
14129 PyObject **dictptr = NULL;
14130 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
14131 if (offset) {
14132 #if CYTHON_COMPILING_IN_CPYTHON
14133 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
14134 #else
14135 dictptr = _PyObject_GetDictPtr(obj);
14136 #endif
14137 }
14138 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
14139 }
14140 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
14141 PyObject *dict = Py_TYPE(obj)->tp_dict;
14142 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
14143 return 0;
14144 return obj_dict_version == __Pyx_get_object_dict_version(obj);
14145 }
14146 #endif
14147
14148 /* ReRaiseException */
14149 static CYTHON_INLINE void __Pyx_ReraiseException(void) {
14150 PyObject *type = NULL, *value = NULL, *tb = NULL;
14151 #if CYTHON_FAST_THREAD_STATE
14152 PyThreadState *tstate = PyThreadState_GET();
14153 #if CYTHON_USE_EXC_INFO_STACK
14154 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
14155 type = exc_info->exc_type;
14156 value = exc_info->exc_value;
14157 tb = exc_info->exc_traceback;
14158 #else
14159 type = tstate->exc_type;
14160 value = tstate->exc_value;
14161 tb = tstate->exc_traceback;
14162 #endif
14163 #else
14164 PyErr_GetExcInfo(&type, &value, &tb);
14165 #endif
14166 if (!type || type == Py_None) {
14167 #if !CYTHON_FAST_THREAD_STATE
14168 Py_XDECREF(type);
14169 Py_XDECREF(value);
14170 Py_XDECREF(tb);
14171 #endif
14172 PyErr_SetString(PyExc_RuntimeError,
14173 "No active exception to reraise");
14174 } else {
14175 #if CYTHON_FAST_THREAD_STATE
14176 Py_INCREF(type);
14177 Py_XINCREF(value);
14178 Py_XINCREF(tb);
14179 #endif
14180 PyErr_Restore(type, value, tb);
14181 }
14182 }
14183
14184 /* None */
14185 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
14186 Py_ssize_t q = a / b;
14187 Py_ssize_t r = a - q*b;
14188 q -= ((r != 0) & ((r ^ b) < 0));
14189 return q;
14190 }
14191
14192 /* GetModuleGlobalName */
14193 #if CYTHON_USE_DICT_VERSIONS
14194 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
14195 #else
14196 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
14197 #endif
14198 {
14199 PyObject *result;
14200 #if !CYTHON_AVOID_BORROWED_REFS
14201 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
14202 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
14203 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
14204 if (likely(result)) {
14205 return __Pyx_NewRef(result);
14206 } else if (unlikely(PyErr_Occurred())) {
14207 return NULL;
14208 }
14209 #else
14210 result = PyDict_GetItem(__pyx_d, name);
14211 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
14212 if (likely(result)) {
14213 return __Pyx_NewRef(result);
14214 }
14215 #endif
14216 #else
14217 result = PyObject_GetItem(__pyx_d, name);
14218 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
14219 if (likely(result)) {
14220 return __Pyx_NewRef(result);
14221 }
14222 PyErr_Clear();
14223 #endif
14224 return __Pyx_GetBuiltinName(name);
14225 }
14226
14227 /* CIntToDigits */
14228 static const char DIGIT_PAIRS_10[2*10*10+1] = {
14229 "00010203040506070809"
14230 "10111213141516171819"
14231 "20212223242526272829"
14232 "30313233343536373839"
14233 "40414243444546474849"
14234 "50515253545556575859"
14235 "60616263646566676869"
14236 "70717273747576777879"
14237 "80818283848586878889"
14238 "90919293949596979899"
14239 };
14240 static const char DIGIT_PAIRS_8[2*8*8+1] = {
14241 "0001020304050607"
14242 "1011121314151617"
14243 "2021222324252627"
14244 "3031323334353637"
14245 "4041424344454647"
14246 "5051525354555657"
14247 "6061626364656667"
14248 "7071727374757677"
14249 };
14250 static const char DIGITS_HEX[2*16+1] = {
14251 "0123456789abcdef"
14252 "0123456789ABCDEF"
14253 };
14254
14255 /* BuildPyUnicode */
14256 static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength,
14257 int prepend_sign, char padding_char) {
14258 PyObject *uval;
14259 Py_ssize_t uoffset = ulength - clength;
14260 #if CYTHON_USE_UNICODE_INTERNALS
14261 Py_ssize_t i;
14262 #if CYTHON_PEP393_ENABLED
14263 void *udata;
14264 uval = PyUnicode_New(ulength, 127);
14265 if (unlikely(!uval)) return NULL;
14266 udata = PyUnicode_DATA(uval);
14267 #else
14268 Py_UNICODE *udata;
14269 uval = PyUnicode_FromUnicode(NULL, ulength);
14270 if (unlikely(!uval)) return NULL;
14271 udata = PyUnicode_AS_UNICODE(uval);
14272 #endif
14273 if (uoffset > 0) {
14274 i = 0;
14275 if (prepend_sign) {
14276 __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
14277 i++;
14278 }
14279 for (; i < uoffset; i++) {
14280 __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
14281 }
14282 }
14283 for (i=0; i < clength; i++) {
14284 __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
14285 }
14286 #else
14287 {
14288 PyObject *sign = NULL, *padding = NULL;
14289 uval = NULL;
14290 if (uoffset > 0) {
14291 prepend_sign = !!prepend_sign;
14292 if (uoffset > prepend_sign) {
14293 padding = PyUnicode_FromOrdinal(padding_char);
14294 if (likely(padding) && uoffset > prepend_sign + 1) {
14295 PyObject *tmp;
14296 PyObject *repeat = PyInt_FromSize_t(uoffset - prepend_sign);
14297 if (unlikely(!repeat)) goto done_or_error;
14298 tmp = PyNumber_Multiply(padding, repeat);
14299 Py_DECREF(repeat);
14300 Py_DECREF(padding);
14301 padding = tmp;
14302 }
14303 if (unlikely(!padding)) goto done_or_error;
14304 }
14305 if (prepend_sign) {
14306 sign = PyUnicode_FromOrdinal('-');
14307 if (unlikely(!sign)) goto done_or_error;
14308 }
14309 }
14310 uval = PyUnicode_DecodeASCII(chars, clength, NULL);
14311 if (likely(uval) && padding) {
14312 PyObject *tmp = PyNumber_Add(padding, uval);
14313 Py_DECREF(uval);
14314 uval = tmp;
14315 }
14316 if (likely(uval) && sign) {
14317 PyObject *tmp = PyNumber_Add(sign, uval);
14318 Py_DECREF(uval);
14319 uval = tmp;
14320 }
14321 done_or_error:
14322 Py_XDECREF(padding);
14323 Py_XDECREF(sign);
14324 }
14325 #endif
14326 return uval;
14327 }
14328
14329 /* CIntToPyUnicode */
14330 #ifdef _MSC_VER
14331 #ifndef _MSC_STDINT_H_
14332 #if _MSC_VER < 1300
14333 typedef unsigned short uint16_t;
14334 #else
14335 typedef unsigned __int16 uint16_t;
14336 #endif
14337 #endif
14338 #else
14339 #include <stdint.h>
14340 #endif
14341 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) {
14342 char digits[sizeof(int)*3+2];
14343 char *dpos, *end = digits + sizeof(int)*3+2;
14344 const char *hex_digits = DIGITS_HEX;
14345 Py_ssize_t length, ulength;
14346 int prepend_sign, last_one_off;
14347 int remaining;
14348 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14349 #pragma GCC diagnostic push
14350 #pragma GCC diagnostic ignored "-Wconversion"
14351 #endif
14352 const int neg_one = (int) -1, const_zero = (int) 0;
14353 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14354 #pragma GCC diagnostic pop
14355 #endif
14356 const int is_unsigned = neg_one > const_zero;
14357 if (format_char == 'X') {
14358 hex_digits += 16;
14359 format_char = 'x';
14360 }
14361 remaining = value;
14362 last_one_off = 0;
14363 dpos = end;
14364 do {
14365 int digit_pos;
14366 switch (format_char) {
14367 case 'o':
14368 digit_pos = abs((int)(remaining % (8*8)));
14369 remaining = (int) (remaining / (8*8));
14370 dpos -= 2;
14371 *(uint16_t*)dpos = ((const uint16_t*)DIGIT_PAIRS_8)[digit_pos];
14372 last_one_off = (digit_pos < 8);
14373 break;
14374 case 'd':
14375 digit_pos = abs((int)(remaining % (10*10)));
14376 remaining = (int) (remaining / (10*10));
14377 dpos -= 2;
14378 *(uint16_t*)dpos = ((const uint16_t*)DIGIT_PAIRS_10)[digit_pos];
14379 last_one_off = (digit_pos < 10);
14380 break;
14381 case 'x':
14382 *(--dpos) = hex_digits[abs((int)(remaining % 16))];
14383 remaining = (int) (remaining / 16);
14384 break;
14385 default:
14386 assert(0);
14387 break;
14388 }
14389 } while (unlikely(remaining != 0));
14390 if (last_one_off) {
14391 assert(*dpos == '0');
14392 dpos++;
14393 }
14394 length = end - dpos;
14395 ulength = length;
14396 prepend_sign = 0;
14397 if (!is_unsigned && value <= neg_one) {
14398 if (padding_char == ' ' || width <= length + 1) {
14399 *(--dpos) = '-';
14400 ++length;
14401 } else {
14402 prepend_sign = 1;
14403 }
14404 ++ulength;
14405 }
14406 if (width > ulength) {
14407 ulength = width;
14408 }
14409 if (ulength == 1) {
14410 return PyUnicode_FromOrdinal(*dpos);
14411 }
14412 return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
14413 }
14414
14415 /* PyObject_GenericGetAttrNoDict */
14416 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
14417 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
14418 PyErr_Format(PyExc_AttributeError,
14419 #if PY_MAJOR_VERSION >= 3
14420 "'%.50s' object has no attribute '%U'",
14421 tp->tp_name, attr_name);
14422 #else
14423 "'%.50s' object has no attribute '%.400s'",
14424 tp->tp_name, PyString_AS_STRING(attr_name));
14425 #endif
14426 return NULL;
14427 }
14428 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
14429 PyObject *descr;
14430 PyTypeObject *tp = Py_TYPE(obj);
14431 if (unlikely(!PyString_Check(attr_name))) {
14432 return PyObject_GenericGetAttr(obj, attr_name);
14433 }
14434 assert(!tp->tp_dictoffset);
14435 descr = _PyType_Lookup(tp, attr_name);
14436 if (unlikely(!descr)) {
14437 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
14438 }
14439 Py_INCREF(descr);
14440 #if PY_MAJOR_VERSION < 3
14441 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
14442 #endif
14443 {
14444 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
14445 if (unlikely(f)) {
14446 PyObject *res = f(descr, obj, (PyObject *)tp);
14447 Py_DECREF(descr);
14448 return res;
14449 }
14450 }
14451 return descr;
14452 }
14453 #endif
14454
14455 /* PyObject_GenericGetAttr */
14456 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
14457 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
14458 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
14459 return PyObject_GenericGetAttr(obj, attr_name);
14460 }
14461 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
14462 }
14463 #endif
14464
14465 /* SetVTable */
14466 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
14467 #if PY_VERSION_HEX >= 0x02070000
14468 PyObject *ob = PyCapsule_New(vtable, 0, 0);
14469 #else
14470 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
14471 #endif
14472 if (!ob)
14473 goto bad;
14474 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
14475 goto bad;
14476 Py_DECREF(ob);
14477 return 0;
14478 bad:
14479 Py_XDECREF(ob);
14480 return -1;
14481 }
14482
14483 /* PyObjectGetAttrStrNoError */
14484 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
14485 __Pyx_PyThreadState_declare
14486 __Pyx_PyThreadState_assign
14487 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
14488 __Pyx_PyErr_Clear();
14489 }
14490 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
14491 PyObject *result;
14492 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
14493 PyTypeObject* tp = Py_TYPE(obj);
14494 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
14495 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
14496 }
14497 #endif
14498 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
14499 if (unlikely(!result)) {
14500 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
14501 }
14502 return result;
14503 }
14504
14505 /* SetupReduce */
14506 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
14507 int ret;
14508 PyObject *name_attr;
14509 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
14510 if (likely(name_attr)) {
14511 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
14512 } else {
14513 ret = -1;
14514 }
14515 if (unlikely(ret < 0)) {
14516 PyErr_Clear();
14517 ret = 0;
14518 }
14519 Py_XDECREF(name_attr);
14520 return ret;
14521 }
14522 static int __Pyx_setup_reduce(PyObject* type_obj) {
14523 int ret = 0;
14524 PyObject *object_reduce = NULL;
14525 PyObject *object_reduce_ex = NULL;
14526 PyObject *reduce = NULL;
14527 PyObject *reduce_ex = NULL;
14528 PyObject *reduce_cython = NULL;
14529 PyObject *setstate = NULL;
14530 PyObject *setstate_cython = NULL;
14531 #if CYTHON_USE_PYTYPE_LOOKUP
14532 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
14533 #else
14534 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
14535 #endif
14536 #if CYTHON_USE_PYTYPE_LOOKUP
14537 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
14538 #else
14539 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
14540 #endif
14541 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
14542 if (reduce_ex == object_reduce_ex) {
14543 #if CYTHON_USE_PYTYPE_LOOKUP
14544 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
14545 #else
14546 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
14547 #endif
14548 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
14549 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
14550 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
14551 if (likely(reduce_cython)) {
14552 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
14553 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
14554 } else if (reduce == object_reduce || PyErr_Occurred()) {
14555 goto __PYX_BAD;
14556 }
14557 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
14558 if (!setstate) PyErr_Clear();
14559 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
14560 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
14561 if (likely(setstate_cython)) {
14562 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
14563 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
14564 } else if (!setstate || PyErr_Occurred()) {
14565 goto __PYX_BAD;
14566 }
14567 }
14568 PyType_Modified((PyTypeObject*)type_obj);
14569 }
14570 }
14571 goto __PYX_GOOD;
14572 __PYX_BAD:
14573 if (!PyErr_Occurred())
14574 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
14575 ret = -1;
14576 __PYX_GOOD:
14577 #if !CYTHON_USE_PYTYPE_LOOKUP
14578 Py_XDECREF(object_reduce);
14579 Py_XDECREF(object_reduce_ex);
14580 #endif
14581 Py_XDECREF(reduce);
14582 Py_XDECREF(reduce_ex);
14583 Py_XDECREF(reduce_cython);
14584 Py_XDECREF(setstate);
14585 Py_XDECREF(setstate_cython);
14586 return ret;
14587 }
14588
14589 /* TypeImport */
14590 #ifndef __PYX_HAVE_RT_ImportType
14591 #define __PYX_HAVE_RT_ImportType
14592 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
14593 size_t size, enum __Pyx_ImportType_CheckSize check_size)
14594 {
14595 PyObject *result = 0;
14596 char warning[200];
14597 Py_ssize_t basicsize;
14598 #ifdef Py_LIMITED_API
14599 PyObject *py_basicsize;
14600 #endif
14601 result = PyObject_GetAttrString(module, class_name);
14602 if (!result)
14603 goto bad;
14604 if (!PyType_Check(result)) {
14605 PyErr_Format(PyExc_TypeError,
14606 "%.200s.%.200s is not a type object",
14607 module_name, class_name);
14608 goto bad;
14609 }
14610 #ifndef Py_LIMITED_API
14611 basicsize = ((PyTypeObject *)result)->tp_basicsize;
14612 #else
14613 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
14614 if (!py_basicsize)
14615 goto bad;
14616 basicsize = PyLong_AsSsize_t(py_basicsize);
14617 Py_DECREF(py_basicsize);
14618 py_basicsize = 0;
14619 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
14620 goto bad;
14621 #endif
14622 if ((size_t)basicsize < size) {
14623 PyErr_Format(PyExc_ValueError,
14624 "%.200s.%.200s size changed, may indicate binary incompatibility. "
14625 "Expected %zd from C header, got %zd from PyObject",
14626 module_name, class_name, size, basicsize);
14627 goto bad;
14628 }
14629 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
14630 PyErr_Format(PyExc_ValueError,
14631 "%.200s.%.200s size changed, may indicate binary incompatibility. "
14632 "Expected %zd from C header, got %zd from PyObject",
14633 module_name, class_name, size, basicsize);
14634 goto bad;
14635 }
14636 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
14637 PyOS_snprintf(warning, sizeof(warning),
14638 "%s.%s size changed, may indicate binary incompatibility. "
14639 "Expected %zd from C header, got %zd from PyObject",
14640 module_name, class_name, size, basicsize);
14641 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
14642 }
14643 return (PyTypeObject *)result;
14644 bad:
14645 Py_XDECREF(result);
14646 return NULL;
14647 }
14648 #endif
14649
14650 /* Import */
14651 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
14652 PyObject *empty_list = 0;
14653 PyObject *module = 0;
14654 PyObject *global_dict = 0;
14655 PyObject *empty_dict = 0;
14656 PyObject *list;
14657 #if PY_MAJOR_VERSION < 3
14658 PyObject *py_import;
14659 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
14660 if (!py_import)
14661 goto bad;
14662 #endif
14663 if (from_list)
14664 list = from_list;
14665 else {
14666 empty_list = PyList_New(0);
14667 if (!empty_list)
14668 goto bad;
14669 list = empty_list;
14670 }
14671 global_dict = PyModule_GetDict(__pyx_m);
14672 if (!global_dict)
14673 goto bad;
14674 empty_dict = PyDict_New();
14675 if (!empty_dict)
14676 goto bad;
14677 {
14678 #if PY_MAJOR_VERSION >= 3
14679 if (level == -1) {
14680 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
14681 module = PyImport_ImportModuleLevelObject(
14682 name, global_dict, empty_dict, list, 1);
14683 if (!module) {
14684 if (!PyErr_ExceptionMatches(PyExc_ImportError))
14685 goto bad;
14686 PyErr_Clear();
14687 }
14688 }
14689 level = 0;
14690 }
14691 #endif
14692 if (!module) {
14693 #if PY_MAJOR_VERSION < 3
14694 PyObject *py_level = PyInt_FromLong(level);
14695 if (!py_level)
14696 goto bad;
14697 module = PyObject_CallFunctionObjArgs(py_import,
14698 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
14699 Py_DECREF(py_level);
14700 #else
14701 module = PyImport_ImportModuleLevelObject(
14702 name, global_dict, empty_dict, list, level);
14703 #endif
14704 }
14705 }
14706 bad:
14707 #if PY_MAJOR_VERSION < 3
14708 Py_XDECREF(py_import);
14709 #endif
14710 Py_XDECREF(empty_list);
14711 Py_XDECREF(empty_dict);
14712 return module;
14713 }
14714
14715 /* ImportFrom */
14716 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
14717 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
14718 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
14719 PyErr_Format(PyExc_ImportError,
14720 #if PY_MAJOR_VERSION < 3
14721 "cannot import name %.230s", PyString_AS_STRING(name));
14722 #else
14723 "cannot import name %S", name);
14724 #endif
14725 }
14726 return value;
14727 }
14728
14729 /* CLineInTraceback */
14730 #ifndef CYTHON_CLINE_IN_TRACEBACK
14731 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
14732 PyObject *use_cline;
14733 PyObject *ptype, *pvalue, *ptraceback;
14734 #if CYTHON_COMPILING_IN_CPYTHON
14735 PyObject **cython_runtime_dict;
14736 #endif
14737 if (unlikely(!__pyx_cython_runtime)) {
14738 return c_line;
14739 }
14740 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
14741 #if CYTHON_COMPILING_IN_CPYTHON
14742 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
14743 if (likely(cython_runtime_dict)) {
14744 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
14745 use_cline, *cython_runtime_dict,
14746 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
14747 } else
14748 #endif
14749 {
14750 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
14751 if (use_cline_obj) {
14752 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
14753 Py_DECREF(use_cline_obj);
14754 } else {
14755 PyErr_Clear();
14756 use_cline = NULL;
14757 }
14758 }
14759 if (!use_cline) {
14760 c_line = 0;
14761 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
14762 }
14763 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
14764 c_line = 0;
14765 }
14766 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
14767 return c_line;
14768 }
14769 #endif
14770
14771 /* CodeObjectCache */
14772 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
14773 int start = 0, mid = 0, end = count - 1;
14774 if (end >= 0 && code_line > entries[end].code_line) {
14775 return count;
14776 }
14777 while (start < end) {
14778 mid = start + (end - start) / 2;
14779 if (code_line < entries[mid].code_line) {
14780 end = mid;
14781 } else if (code_line > entries[mid].code_line) {
14782 start = mid + 1;
14783 } else {
14784 return mid;
14785 }
14786 }
14787 if (code_line <= entries[mid].code_line) {
14788 return mid;
14789 } else {
14790 return mid + 1;
14791 }
14792 }
14793 static PyCodeObject *__pyx_find_code_object(int code_line) {
14794 PyCodeObject* code_object;
14795 int pos;
14796 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
14797 return NULL;
14798 }
14799 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
14800 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
14801 return NULL;
14802 }
14803 code_object = __pyx_code_cache.entries[pos].code_object;
14804 Py_INCREF(code_object);
14805 return code_object;
14806 }
14807 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
14808 int pos, i;
14809 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
14810 if (unlikely(!code_line)) {
14811 return;
14812 }
14813 if (unlikely(!entries)) {
14814 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
14815 if (likely(entries)) {
14816 __pyx_code_cache.entries = entries;
14817 __pyx_code_cache.max_count = 64;
14818 __pyx_code_cache.count = 1;
14819 entries[0].code_line = code_line;
14820 entries[0].code_object = code_object;
14821 Py_INCREF(code_object);
14822 }
14823 return;
14824 }
14825 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
14826 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
14827 PyCodeObject* tmp = entries[pos].code_object;
14828 entries[pos].code_object = code_object;
14829 Py_DECREF(tmp);
14830 return;
14831 }
14832 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
14833 int new_max = __pyx_code_cache.max_count + 64;
14834 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
14835 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
14836 if (unlikely(!entries)) {
14837 return;
14838 }
14839 __pyx_code_cache.entries = entries;
14840 __pyx_code_cache.max_count = new_max;
14841 }
14842 for (i=__pyx_code_cache.count; i>pos; i--) {
14843 entries[i] = entries[i-1];
14844 }
14845 entries[pos].code_line = code_line;
14846 entries[pos].code_object = code_object;
14847 __pyx_code_cache.count++;
14848 Py_INCREF(code_object);
14849 }
14850
14851 /* AddTraceback */
14852 #include "compile.h"
14853 #include "frameobject.h"
14854 #include "traceback.h"
14855 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
14856 const char *funcname, int c_line,
14857 int py_line, const char *filename) {
14858 PyCodeObject *py_code = 0;
14859 PyObject *py_srcfile = 0;
14860 PyObject *py_funcname = 0;
14861 #if PY_MAJOR_VERSION < 3
14862 py_srcfile = PyString_FromString(filename);
14863 #else
14864 py_srcfile = PyUnicode_FromString(filename);
14865 #endif
14866 if (!py_srcfile) goto bad;
14867 if (c_line) {
14868 #if PY_MAJOR_VERSION < 3
14869 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
14870 #else
14871 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
14872 #endif
14873 }
14874 else {
14875 #if PY_MAJOR_VERSION < 3
14876 py_funcname = PyString_FromString(funcname);
14877 #else
14878 py_funcname = PyUnicode_FromString(funcname);
14879 #endif
14880 }
14881 if (!py_funcname) goto bad;
14882 py_code = __Pyx_PyCode_New(
14883 0,
14884 0,
14885 0,
14886 0,
14887 0,
14888 __pyx_empty_bytes, /*PyObject *code,*/
14889 __pyx_empty_tuple, /*PyObject *consts,*/
14890 __pyx_empty_tuple, /*PyObject *names,*/
14891 __pyx_empty_tuple, /*PyObject *varnames,*/
14892 __pyx_empty_tuple, /*PyObject *freevars,*/
14893 __pyx_empty_tuple, /*PyObject *cellvars,*/
14894 py_srcfile, /*PyObject *filename,*/
14895 py_funcname, /*PyObject *name,*/
14896 py_line,
14897 __pyx_empty_bytes /*PyObject *lnotab*/
14898 );
14899 Py_DECREF(py_srcfile);
14900 Py_DECREF(py_funcname);
14901 return py_code;
14902 bad:
14903 Py_XDECREF(py_srcfile);
14904 Py_XDECREF(py_funcname);
14905 return NULL;
14906 }
14907 static void __Pyx_AddTraceback(const char *funcname, int c_line,
14908 int py_line, const char *filename) {
14909 PyCodeObject *py_code = 0;
14910 PyFrameObject *py_frame = 0;
14911 PyThreadState *tstate = __Pyx_PyThreadState_Current;
14912 if (c_line) {
14913 c_line = __Pyx_CLineForTraceback(tstate, c_line);
14914 }
14915 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
14916 if (!py_code) {
14917 py_code = __Pyx_CreateCodeObjectForTraceback(
14918 funcname, c_line, py_line, filename);
14919 if (!py_code) goto bad;
14920 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
14921 }
14922 py_frame = PyFrame_New(
14923 tstate, /*PyThreadState *tstate,*/
14924 py_code, /*PyCodeObject *code,*/
14925 __pyx_d, /*PyObject *globals,*/
14926 0 /*PyObject *locals*/
14927 );
14928 if (!py_frame) goto bad;
14929 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
14930 PyTraceBack_Here(py_frame);
14931 bad:
14932 Py_XDECREF(py_code);
14933 Py_XDECREF(py_frame);
14934 }
14935
14936 /* CIntFromPyVerify */
14937 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
14938 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
14939 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
14940 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
14941 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
14942 {\
14943 func_type value = func_value;\
14944 if (sizeof(target_type) < sizeof(func_type)) {\
14945 if (unlikely(value != (func_type) (target_type) value)) {\
14946 func_type zero = 0;\
14947 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
14948 return (target_type) -1;\
14949 if (is_unsigned && unlikely(value < zero))\
14950 goto raise_neg_overflow;\
14951 else\
14952 goto raise_overflow;\
14953 }\
14954 }\
14955 return (target_type) value;\
14956 }
14957
14958 /* CIntFromPy */
14959 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) {
14960 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14961 #pragma GCC diagnostic push
14962 #pragma GCC diagnostic ignored "-Wconversion"
14963 #endif
14964 const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0;
14965 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14966 #pragma GCC diagnostic pop
14967 #endif
14968 const int is_unsigned = neg_one > const_zero;
14969 #if PY_MAJOR_VERSION < 3
14970 if (likely(PyInt_Check(x))) {
14971 if (sizeof(PY_LONG_LONG) < sizeof(long)) {
14972 __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, PyInt_AS_LONG(x))
14973 } else {
14974 long val = PyInt_AS_LONG(x);
14975 if (is_unsigned && unlikely(val < 0)) {
14976 goto raise_neg_overflow;
14977 }
14978 return (PY_LONG_LONG) val;
14979 }
14980 } else
14981 #endif
14982 if (likely(PyLong_Check(x))) {
14983 if (is_unsigned) {
14984 #if CYTHON_USE_PYLONG_INTERNALS
14985 const digit* digits = ((PyLongObject*)x)->ob_digit;
14986 switch (Py_SIZE(x)) {
14987 case 0: return (PY_LONG_LONG) 0;
14988 case 1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, digit, digits[0])
14989 case 2:
14990 if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
14991 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
14992 __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14993 } else if (8 * sizeof(PY_LONG_LONG) >= 2 * PyLong_SHIFT) {
14994 return (PY_LONG_LONG) (((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
14995 }
14996 }
14997 break;
14998 case 3:
14999 if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
15000 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15001 __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15002 } else if (8 * sizeof(PY_LONG_LONG) >= 3 * PyLong_SHIFT) {
15003 return (PY_LONG_LONG) (((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
15004 }
15005 }
15006 break;
15007 case 4:
15008 if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
15009 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15010 __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15011 } else if (8 * sizeof(PY_LONG_LONG) >= 4 * PyLong_SHIFT) {
15012 return (PY_LONG_LONG) (((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
15013 }
15014 }
15015 break;
15016 }
15017 #endif
15018 #if CYTHON_COMPILING_IN_CPYTHON
15019 if (unlikely(Py_SIZE(x) < 0)) {
15020 goto raise_neg_overflow;
15021 }
15022 #else
15023 {
15024 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15025 if (unlikely(result < 0))
15026 return (PY_LONG_LONG) -1;
15027 if (unlikely(result == 1))
15028 goto raise_neg_overflow;
15029 }
15030 #endif
15031 if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) {
15032 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong(x))
15033 #ifdef HAVE_LONG_LONG
15034 } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
15035 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15036 #endif
15037 }
15038 } else {
15039 #if CYTHON_USE_PYLONG_INTERNALS
15040 const digit* digits = ((PyLongObject*)x)->ob_digit;
15041 switch (Py_SIZE(x)) {
15042 case 0: return (PY_LONG_LONG) 0;
15043 case -1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, sdigit, (sdigit) (-(sdigit)digits[0]))
15044 case 1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, digit, +digits[0])
15045 case -2:
15046 if (8 * sizeof(PY_LONG_LONG) - 1 > 1 * PyLong_SHIFT) {
15047 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15048 __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15049 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15050 return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
15051 }
15052 }
15053 break;
15054 case 2:
15055 if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
15056 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15057 __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15058 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15059 return (PY_LONG_LONG) ((((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
15060 }
15061 }
15062 break;
15063 case -3:
15064 if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15065 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15066 __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15067 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15068 return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
15069 }
15070 }
15071 break;
15072 case 3:
15073 if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
15074 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15075 __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15076 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15077 return (PY_LONG_LONG) ((((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
15078 }
15079 }
15080 break;
15081 case -4:
15082 if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15083 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15084 __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15085 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
15086 return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
15087 }
15088 }
15089 break;
15090 case 4:
15091 if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
15092 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15093 __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15094 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
15095 return (PY_LONG_LONG) ((((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
15096 }
15097 }
15098 break;
15099 }
15100 #endif
15101 if (sizeof(PY_LONG_LONG) <= sizeof(long)) {
15102 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, long, PyLong_AsLong(x))
15103 #ifdef HAVE_LONG_LONG
15104 } else if (sizeof(PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
15105 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, PY_LONG_LONG, PyLong_AsLongLong(x))
15106 #endif
15107 }
15108 }
15109 {
15110 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15111 PyErr_SetString(PyExc_RuntimeError,
15112 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15113 #else
15114 PY_LONG_LONG val;
15115 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15116 #if PY_MAJOR_VERSION < 3
15117 if (likely(v) && !PyLong_Check(v)) {
15118 PyObject *tmp = v;
15119 v = PyNumber_Long(tmp);
15120 Py_DECREF(tmp);
15121 }
15122 #endif
15123 if (likely(v)) {
15124 int one = 1; int is_little = (int)*(unsigned char *)&one;
15125 unsigned char *bytes = (unsigned char *)&val;
15126 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15127 bytes, sizeof(val),
15128 is_little, !is_unsigned);
15129 Py_DECREF(v);
15130 if (likely(!ret))
15131 return val;
15132 }
15133 #endif
15134 return (PY_LONG_LONG) -1;
15135 }
15136 } else {
15137 PY_LONG_LONG val;
15138 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15139 if (!tmp) return (PY_LONG_LONG) -1;
15140 val = __Pyx_PyInt_As_PY_LONG_LONG(tmp);
15141 Py_DECREF(tmp);
15142 return val;
15143 }
15144 raise_overflow:
15145 PyErr_SetString(PyExc_OverflowError,
15146 "value too large to convert to PY_LONG_LONG");
15147 return (PY_LONG_LONG) -1;
15148 raise_neg_overflow:
15149 PyErr_SetString(PyExc_OverflowError,
15150 "can't convert negative value to PY_LONG_LONG");
15151 return (PY_LONG_LONG) -1;
15152 }
15153
15154 /* CIntFromPy */
15155 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
15156 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15157 #pragma GCC diagnostic push
15158 #pragma GCC diagnostic ignored "-Wconversion"
15159 #endif
15160 const int neg_one = (int) -1, const_zero = (int) 0;
15161 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15162 #pragma GCC diagnostic pop
15163 #endif
15164 const int is_unsigned = neg_one > const_zero;
15165 #if PY_MAJOR_VERSION < 3
15166 if (likely(PyInt_Check(x))) {
15167 if (sizeof(int) < sizeof(long)) {
15168 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
15169 } else {
15170 long val = PyInt_AS_LONG(x);
15171 if (is_unsigned && unlikely(val < 0)) {
15172 goto raise_neg_overflow;
15173 }
15174 return (int) val;
15175 }
15176 } else
15177 #endif
15178 if (likely(PyLong_Check(x))) {
15179 if (is_unsigned) {
15180 #if CYTHON_USE_PYLONG_INTERNALS
15181 const digit* digits = ((PyLongObject*)x)->ob_digit;
15182 switch (Py_SIZE(x)) {
15183 case 0: return (int) 0;
15184 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
15185 case 2:
15186 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
15187 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15188 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15189 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
15190 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15191 }
15192 }
15193 break;
15194 case 3:
15195 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
15196 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15197 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15198 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
15199 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15200 }
15201 }
15202 break;
15203 case 4:
15204 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
15205 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15206 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15207 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
15208 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15209 }
15210 }
15211 break;
15212 }
15213 #endif
15214 #if CYTHON_COMPILING_IN_CPYTHON
15215 if (unlikely(Py_SIZE(x) < 0)) {
15216 goto raise_neg_overflow;
15217 }
15218 #else
15219 {
15220 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15221 if (unlikely(result < 0))
15222 return (int) -1;
15223 if (unlikely(result == 1))
15224 goto raise_neg_overflow;
15225 }
15226 #endif
15227 if (sizeof(int) <= sizeof(unsigned long)) {
15228 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
15229 #ifdef HAVE_LONG_LONG
15230 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
15231 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15232 #endif
15233 }
15234 } else {
15235 #if CYTHON_USE_PYLONG_INTERNALS
15236 const digit* digits = ((PyLongObject*)x)->ob_digit;
15237 switch (Py_SIZE(x)) {
15238 case 0: return (int) 0;
15239 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
15240 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
15241 case -2:
15242 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
15243 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15244 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15245 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
15246 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15247 }
15248 }
15249 break;
15250 case 2:
15251 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
15252 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15253 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15254 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
15255 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15256 }
15257 }
15258 break;
15259 case -3:
15260 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
15261 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15262 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15263 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
15264 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15265 }
15266 }
15267 break;
15268 case 3:
15269 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
15270 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15271 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15272 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
15273 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15274 }
15275 }
15276 break;
15277 case -4:
15278 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
15279 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15280 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15281 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
15282 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15283 }
15284 }
15285 break;
15286 case 4:
15287 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
15288 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15289 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15290 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
15291 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15292 }
15293 }
15294 break;
15295 }
15296 #endif
15297 if (sizeof(int) <= sizeof(long)) {
15298 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
15299 #ifdef HAVE_LONG_LONG
15300 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
15301 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
15302 #endif
15303 }
15304 }
15305 {
15306 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15307 PyErr_SetString(PyExc_RuntimeError,
15308 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15309 #else
15310 int val;
15311 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15312 #if PY_MAJOR_VERSION < 3
15313 if (likely(v) && !PyLong_Check(v)) {
15314 PyObject *tmp = v;
15315 v = PyNumber_Long(tmp);
15316 Py_DECREF(tmp);
15317 }
15318 #endif
15319 if (likely(v)) {
15320 int one = 1; int is_little = (int)*(unsigned char *)&one;
15321 unsigned char *bytes = (unsigned char *)&val;
15322 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15323 bytes, sizeof(val),
15324 is_little, !is_unsigned);
15325 Py_DECREF(v);
15326 if (likely(!ret))
15327 return val;
15328 }
15329 #endif
15330 return (int) -1;
15331 }
15332 } else {
15333 int val;
15334 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15335 if (!tmp) return (int) -1;
15336 val = __Pyx_PyInt_As_int(tmp);
15337 Py_DECREF(tmp);
15338 return val;
15339 }
15340 raise_overflow:
15341 PyErr_SetString(PyExc_OverflowError,
15342 "value too large to convert to int");
15343 return (int) -1;
15344 raise_neg_overflow:
15345 PyErr_SetString(PyExc_OverflowError,
15346 "can't convert negative value to int");
15347 return (int) -1;
15348 }
15349
15350 /* CIntFromPy */
15351 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *x) {
15352 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15353 #pragma GCC diagnostic push
15354 #pragma GCC diagnostic ignored "-Wconversion"
15355 #endif
15356 const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0;
15357 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15358 #pragma GCC diagnostic pop
15359 #endif
15360 const int is_unsigned = neg_one > const_zero;
15361 #if PY_MAJOR_VERSION < 3
15362 if (likely(PyInt_Check(x))) {
15363 if (sizeof(unsigned PY_LONG_LONG) < sizeof(long)) {
15364 __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, PyInt_AS_LONG(x))
15365 } else {
15366 long val = PyInt_AS_LONG(x);
15367 if (is_unsigned && unlikely(val < 0)) {
15368 goto raise_neg_overflow;
15369 }
15370 return (unsigned PY_LONG_LONG) val;
15371 }
15372 } else
15373 #endif
15374 if (likely(PyLong_Check(x))) {
15375 if (is_unsigned) {
15376 #if CYTHON_USE_PYLONG_INTERNALS
15377 const digit* digits = ((PyLongObject*)x)->ob_digit;
15378 switch (Py_SIZE(x)) {
15379 case 0: return (unsigned PY_LONG_LONG) 0;
15380 case 1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, digit, digits[0])
15381 case 2:
15382 if (8 * sizeof(unsigned PY_LONG_LONG) > 1 * PyLong_SHIFT) {
15383 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15384 __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15385 } else if (8 * sizeof(unsigned PY_LONG_LONG) >= 2 * PyLong_SHIFT) {
15386 return (unsigned PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15387 }
15388 }
15389 break;
15390 case 3:
15391 if (8 * sizeof(unsigned PY_LONG_LONG) > 2 * PyLong_SHIFT) {
15392 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15393 __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15394 } else if (8 * sizeof(unsigned PY_LONG_LONG) >= 3 * PyLong_SHIFT) {
15395 return (unsigned PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15396 }
15397 }
15398 break;
15399 case 4:
15400 if (8 * sizeof(unsigned PY_LONG_LONG) > 3 * PyLong_SHIFT) {
15401 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15402 __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15403 } else if (8 * sizeof(unsigned PY_LONG_LONG) >= 4 * PyLong_SHIFT) {
15404 return (unsigned PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15405 }
15406 }
15407 break;
15408 }
15409 #endif
15410 #if CYTHON_COMPILING_IN_CPYTHON
15411 if (unlikely(Py_SIZE(x) < 0)) {
15412 goto raise_neg_overflow;
15413 }
15414 #else
15415 {
15416 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15417 if (unlikely(result < 0))
15418 return (unsigned PY_LONG_LONG) -1;
15419 if (unlikely(result == 1))
15420 goto raise_neg_overflow;
15421 }
15422 #endif
15423 if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned long)) {
15424 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong(x))
15425 #ifdef HAVE_LONG_LONG
15426 } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
15427 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15428 #endif
15429 }
15430 } else {
15431 #if CYTHON_USE_PYLONG_INTERNALS
15432 const digit* digits = ((PyLongObject*)x)->ob_digit;
15433 switch (Py_SIZE(x)) {
15434 case 0: return (unsigned PY_LONG_LONG) 0;
15435 case -1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, sdigit, (sdigit) (-(sdigit)digits[0]))
15436 case 1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, digit, +digits[0])
15437 case -2:
15438 if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 1 * PyLong_SHIFT) {
15439 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15440 __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15441 } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15442 return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
15443 }
15444 }
15445 break;
15446 case 2:
15447 if (8 * sizeof(unsigned PY_LONG_LONG) > 1 * PyLong_SHIFT) {
15448 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15449 __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15450 } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15451 return (unsigned PY_LONG_LONG) ((((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
15452 }
15453 }
15454 break;
15455 case -3:
15456 if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15457 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15458 __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15459 } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15460 return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
15461 }
15462 }
15463 break;
15464 case 3:
15465 if (8 * sizeof(unsigned PY_LONG_LONG) > 2 * PyLong_SHIFT) {
15466 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15467 __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15468 } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15469 return (unsigned PY_LONG_LONG) ((((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
15470 }
15471 }
15472 break;
15473 case -4:
15474 if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15475 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15476 __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15477 } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
15478 return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
15479 }
15480 }
15481 break;
15482 case 4:
15483 if (8 * sizeof(unsigned PY_LONG_LONG) > 3 * PyLong_SHIFT) {
15484 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15485 __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15486 } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
15487 return (unsigned PY_LONG_LONG) ((((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
15488 }
15489 }
15490 break;
15491 }
15492 #endif
15493 if (sizeof(unsigned PY_LONG_LONG) <= sizeof(long)) {
15494 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, long, PyLong_AsLong(x))
15495 #ifdef HAVE_LONG_LONG
15496 } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
15497 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, PY_LONG_LONG, PyLong_AsLongLong(x))
15498 #endif
15499 }
15500 }
15501 {
15502 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15503 PyErr_SetString(PyExc_RuntimeError,
15504 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15505 #else
15506 unsigned PY_LONG_LONG val;
15507 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15508 #if PY_MAJOR_VERSION < 3
15509 if (likely(v) && !PyLong_Check(v)) {
15510 PyObject *tmp = v;
15511 v = PyNumber_Long(tmp);
15512 Py_DECREF(tmp);
15513 }
15514 #endif
15515 if (likely(v)) {
15516 int one = 1; int is_little = (int)*(unsigned char *)&one;
15517 unsigned char *bytes = (unsigned char *)&val;
15518 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15519 bytes, sizeof(val),
15520 is_little, !is_unsigned);
15521 Py_DECREF(v);
15522 if (likely(!ret))
15523 return val;
15524 }
15525 #endif
15526 return (unsigned PY_LONG_LONG) -1;
15527 }
15528 } else {
15529 unsigned PY_LONG_LONG val;
15530 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15531 if (!tmp) return (unsigned PY_LONG_LONG) -1;
15532 val = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(tmp);
15533 Py_DECREF(tmp);
15534 return val;
15535 }
15536 raise_overflow:
15537 PyErr_SetString(PyExc_OverflowError,
15538 "value too large to convert to unsigned PY_LONG_LONG");
15539 return (unsigned PY_LONG_LONG) -1;
15540 raise_neg_overflow:
15541 PyErr_SetString(PyExc_OverflowError,
15542 "can't convert negative value to unsigned PY_LONG_LONG");
15543 return (unsigned PY_LONG_LONG) -1;
15544 }
15545
15546 /* CIntFromPy */
15547 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
15548 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15549 #pragma GCC diagnostic push
15550 #pragma GCC diagnostic ignored "-Wconversion"
15551 #endif
15552 const long neg_one = (long) -1, const_zero = (long) 0;
15553 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15554 #pragma GCC diagnostic pop
15555 #endif
15556 const int is_unsigned = neg_one > const_zero;
15557 #if PY_MAJOR_VERSION < 3
15558 if (likely(PyInt_Check(x))) {
15559 if (sizeof(long) < sizeof(long)) {
15560 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
15561 } else {
15562 long val = PyInt_AS_LONG(x);
15563 if (is_unsigned && unlikely(val < 0)) {
15564 goto raise_neg_overflow;
15565 }
15566 return (long) val;
15567 }
15568 } else
15569 #endif
15570 if (likely(PyLong_Check(x))) {
15571 if (is_unsigned) {
15572 #if CYTHON_USE_PYLONG_INTERNALS
15573 const digit* digits = ((PyLongObject*)x)->ob_digit;
15574 switch (Py_SIZE(x)) {
15575 case 0: return (long) 0;
15576 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
15577 case 2:
15578 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
15579 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15580 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15581 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
15582 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15583 }
15584 }
15585 break;
15586 case 3:
15587 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
15588 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15589 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15590 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
15591 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15592 }
15593 }
15594 break;
15595 case 4:
15596 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
15597 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15598 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15599 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
15600 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15601 }
15602 }
15603 break;
15604 }
15605 #endif
15606 #if CYTHON_COMPILING_IN_CPYTHON
15607 if (unlikely(Py_SIZE(x) < 0)) {
15608 goto raise_neg_overflow;
15609 }
15610 #else
15611 {
15612 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15613 if (unlikely(result < 0))
15614 return (long) -1;
15615 if (unlikely(result == 1))
15616 goto raise_neg_overflow;
15617 }
15618 #endif
15619 if (sizeof(long) <= sizeof(unsigned long)) {
15620 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
15621 #ifdef HAVE_LONG_LONG
15622 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
15623 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15624 #endif
15625 }
15626 } else {
15627 #if CYTHON_USE_PYLONG_INTERNALS
15628 const digit* digits = ((PyLongObject*)x)->ob_digit;
15629 switch (Py_SIZE(x)) {
15630 case 0: return (long) 0;
15631 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
15632 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
15633 case -2:
15634 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
15635 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15636 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15637 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15638 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15639 }
15640 }
15641 break;
15642 case 2:
15643 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
15644 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15645 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15646 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15647 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15648 }
15649 }
15650 break;
15651 case -3:
15652 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15653 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15654 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15655 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15656 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15657 }
15658 }
15659 break;
15660 case 3:
15661 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
15662 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15663 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15664 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15665 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15666 }
15667 }
15668 break;
15669 case -4:
15670 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15671 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15672 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15673 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15674 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15675 }
15676 }
15677 break;
15678 case 4:
15679 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
15680 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15681 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15682 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15683 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15684 }
15685 }
15686 break;
15687 }
15688 #endif
15689 if (sizeof(long) <= sizeof(long)) {
15690 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
15691 #ifdef HAVE_LONG_LONG
15692 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
15693 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
15694 #endif
15695 }
15696 }
15697 {
15698 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15699 PyErr_SetString(PyExc_RuntimeError,
15700 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15701 #else
15702 long val;
15703 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15704 #if PY_MAJOR_VERSION < 3
15705 if (likely(v) && !PyLong_Check(v)) {
15706 PyObject *tmp = v;
15707 v = PyNumber_Long(tmp);
15708 Py_DECREF(tmp);
15709 }
15710 #endif
15711 if (likely(v)) {
15712 int one = 1; int is_little = (int)*(unsigned char *)&one;
15713 unsigned char *bytes = (unsigned char *)&val;
15714 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15715 bytes, sizeof(val),
15716 is_little, !is_unsigned);
15717 Py_DECREF(v);
15718 if (likely(!ret))
15719 return val;
15720 }
15721 #endif
15722 return (long) -1;
15723 }
15724 } else {
15725 long val;
15726 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15727 if (!tmp) return (long) -1;
15728 val = __Pyx_PyInt_As_long(tmp);
15729 Py_DECREF(tmp);
15730 return val;
15731 }
15732 raise_overflow:
15733 PyErr_SetString(PyExc_OverflowError,
15734 "value too large to convert to long");
15735 return (long) -1;
15736 raise_neg_overflow:
15737 PyErr_SetString(PyExc_OverflowError,
15738 "can't convert negative value to long");
15739 return (long) -1;
15740 }
15741
15742 /* CIntFromPy */
15743 static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *x) {
15744 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15745 #pragma GCC diagnostic push
15746 #pragma GCC diagnostic ignored "-Wconversion"
15747 #endif
15748 const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
15749 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15750 #pragma GCC diagnostic pop
15751 #endif
15752 const int is_unsigned = neg_one > const_zero;
15753 #if PY_MAJOR_VERSION < 3
15754 if (likely(PyInt_Check(x))) {
15755 if (sizeof(unsigned long) < sizeof(long)) {
15756 __PYX_VERIFY_RETURN_INT(unsigned long, long, PyInt_AS_LONG(x))
15757 } else {
15758 long val = PyInt_AS_LONG(x);
15759 if (is_unsigned && unlikely(val < 0)) {
15760 goto raise_neg_overflow;
15761 }
15762 return (unsigned long) val;
15763 }
15764 } else
15765 #endif
15766 if (likely(PyLong_Check(x))) {
15767 if (is_unsigned) {
15768 #if CYTHON_USE_PYLONG_INTERNALS
15769 const digit* digits = ((PyLongObject*)x)->ob_digit;
15770 switch (Py_SIZE(x)) {
15771 case 0: return (unsigned long) 0;
15772 case 1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, digits[0])
15773 case 2:
15774 if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) {
15775 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15776 __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15777 } else if (8 * sizeof(unsigned long) >= 2 * PyLong_SHIFT) {
15778 return (unsigned long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15779 }
15780 }
15781 break;
15782 case 3:
15783 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15784 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15785 __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15786 } else if (8 * sizeof(unsigned long) >= 3 * PyLong_SHIFT) {
15787 return (unsigned long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15788 }
15789 }
15790 break;
15791 case 4:
15792 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15793 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15794 __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15795 } else if (8 * sizeof(unsigned long) >= 4 * PyLong_SHIFT) {
15796 return (unsigned long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15797 }
15798 }
15799 break;
15800 }
15801 #endif
15802 #if CYTHON_COMPILING_IN_CPYTHON
15803 if (unlikely(Py_SIZE(x) < 0)) {
15804 goto raise_neg_overflow;
15805 }
15806 #else
15807 {
15808 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15809 if (unlikely(result < 0))
15810 return (unsigned long) -1;
15811 if (unlikely(result == 1))
15812 goto raise_neg_overflow;
15813 }
15814 #endif
15815 if (sizeof(unsigned long) <= sizeof(unsigned long)) {
15816 __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned long, PyLong_AsUnsignedLong(x))
15817 #ifdef HAVE_LONG_LONG
15818 } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
15819 __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15820 #endif
15821 }
15822 } else {
15823 #if CYTHON_USE_PYLONG_INTERNALS
15824 const digit* digits = ((PyLongObject*)x)->ob_digit;
15825 switch (Py_SIZE(x)) {
15826 case 0: return (unsigned long) 0;
15827 case -1: __PYX_VERIFY_RETURN_INT(unsigned long, sdigit, (sdigit) (-(sdigit)digits[0]))
15828 case 1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, +digits[0])
15829 case -2:
15830 if (8 * sizeof(unsigned long) - 1 > 1 * PyLong_SHIFT) {
15831 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15832 __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15833 } else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
15834 return (unsigned long) (((unsigned long)-1)*(((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
15835 }
15836 }
15837 break;
15838 case 2:
15839 if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) {
15840 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15841 __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15842 } else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
15843 return (unsigned long) ((((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
15844 }
15845 }
15846 break;
15847 case -3:
15848 if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
15849 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15850 __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15851 } else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
15852 return (unsigned long) (((unsigned long)-1)*(((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
15853 }
15854 }
15855 break;
15856 case 3:
15857 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15858 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15859 __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15860 } else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
15861 return (unsigned long) ((((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
15862 }
15863 }
15864 break;
15865 case -4:
15866 if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
15867 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15868 __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15869 } else if (8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT) {
15870 return (unsigned long) (((unsigned long)-1)*(((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
15871 }
15872 }
15873 break;
15874 case 4:
15875 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15876 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15877 __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15878 } else if (8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT) {
15879 return (unsigned long) ((((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
15880 }
15881 }
15882 break;
15883 }
15884 #endif
15885 if (sizeof(unsigned long) <= sizeof(long)) {
15886 __PYX_VERIFY_RETURN_INT_EXC(unsigned long, long, PyLong_AsLong(x))
15887 #ifdef HAVE_LONG_LONG
15888 } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
15889 __PYX_VERIFY_RETURN_INT_EXC(unsigned long, PY_LONG_LONG, PyLong_AsLongLong(x))
15890 #endif
15891 }
15892 }
15893 {
15894 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15895 PyErr_SetString(PyExc_RuntimeError,
15896 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15897 #else
15898 unsigned long val;
15899 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15900 #if PY_MAJOR_VERSION < 3
15901 if (likely(v) && !PyLong_Check(v)) {
15902 PyObject *tmp = v;
15903 v = PyNumber_Long(tmp);
15904 Py_DECREF(tmp);
15905 }
15906 #endif
15907 if (likely(v)) {
15908 int one = 1; int is_little = (int)*(unsigned char *)&one;
15909 unsigned char *bytes = (unsigned char *)&val;
15910 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15911 bytes, sizeof(val),
15912 is_little, !is_unsigned);
15913 Py_DECREF(v);
15914 if (likely(!ret))
15915 return val;
15916 }
15917 #endif
15918 return (unsigned long) -1;
15919 }
15920 } else {
15921 unsigned long val;
15922 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15923 if (!tmp) return (unsigned long) -1;
15924 val = __Pyx_PyInt_As_unsigned_long(tmp);
15925 Py_DECREF(tmp);
15926 return val;
15927 }
15928 raise_overflow:
15929 PyErr_SetString(PyExc_OverflowError,
15930 "value too large to convert to unsigned long");
15931 return (unsigned long) -1;
15932 raise_neg_overflow:
15933 PyErr_SetString(PyExc_OverflowError,
15934 "can't convert negative value to unsigned long");
15935 return (unsigned long) -1;
15936 }
15937
15938 /* CIntFromPy */
15939 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
15940 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15941 #pragma GCC diagnostic push
15942 #pragma GCC diagnostic ignored "-Wconversion"
15943 #endif
15944 const char neg_one = (char) -1, const_zero = (char) 0;
15945 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15946 #pragma GCC diagnostic pop
15947 #endif
15948 const int is_unsigned = neg_one > const_zero;
15949 #if PY_MAJOR_VERSION < 3
15950 if (likely(PyInt_Check(x))) {
15951 if (sizeof(char) < sizeof(long)) {
15952 __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
15953 } else {
15954 long val = PyInt_AS_LONG(x);
15955 if (is_unsigned && unlikely(val < 0)) {
15956 goto raise_neg_overflow;
15957 }
15958 return (char) val;
15959 }
15960 } else
15961 #endif
15962 if (likely(PyLong_Check(x))) {
15963 if (is_unsigned) {
15964 #if CYTHON_USE_PYLONG_INTERNALS
15965 const digit* digits = ((PyLongObject*)x)->ob_digit;
15966 switch (Py_SIZE(x)) {
15967 case 0: return (char) 0;
15968 case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
15969 case 2:
15970 if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
15971 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15972 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15973 } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
15974 return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
15975 }
15976 }
15977 break;
15978 case 3:
15979 if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
15980 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15981 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15982 } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
15983 return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
15984 }
15985 }
15986 break;
15987 case 4:
15988 if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
15989 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15990 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15991 } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
15992 return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
15993 }
15994 }
15995 break;
15996 }
15997 #endif
15998 #if CYTHON_COMPILING_IN_CPYTHON
15999 if (unlikely(Py_SIZE(x) < 0)) {
16000 goto raise_neg_overflow;
16001 }
16002 #else
16003 {
16004 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16005 if (unlikely(result < 0))
16006 return (char) -1;
16007 if (unlikely(result == 1))
16008 goto raise_neg_overflow;
16009 }
16010 #endif
16011 if (sizeof(char) <= sizeof(unsigned long)) {
16012 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
16013 #ifdef HAVE_LONG_LONG
16014 } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
16015 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
16016 #endif
16017 }
16018 } else {
16019 #if CYTHON_USE_PYLONG_INTERNALS
16020 const digit* digits = ((PyLongObject*)x)->ob_digit;
16021 switch (Py_SIZE(x)) {
16022 case 0: return (char) 0;
16023 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
16024 case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0])
16025 case -2:
16026 if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
16027 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16028 __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16029 } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
16030 return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
16031 }
16032 }
16033 break;
16034 case 2:
16035 if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
16036 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16037 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16038 } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
16039 return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
16040 }
16041 }
16042 break;
16043 case -3:
16044 if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
16045 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16046 __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16047 } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
16048 return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
16049 }
16050 }
16051 break;
16052 case 3:
16053 if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
16054 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16055 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16056 } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
16057 return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
16058 }
16059 }
16060 break;
16061 case -4:
16062 if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
16063 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16064 __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16065 } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
16066 return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
16067 }
16068 }
16069 break;
16070 case 4:
16071 if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
16072 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16073 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16074 } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
16075 return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
16076 }
16077 }
16078 break;
16079 }
16080 #endif
16081 if (sizeof(char) <= sizeof(long)) {
16082 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
16083 #ifdef HAVE_LONG_LONG
16084 } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
16085 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
16086 #endif
16087 }
16088 }
16089 {
16090 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
16091 PyErr_SetString(PyExc_RuntimeError,
16092 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
16093 #else
16094 char val;
16095 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
16096 #if PY_MAJOR_VERSION < 3
16097 if (likely(v) && !PyLong_Check(v)) {
16098 PyObject *tmp = v;
16099 v = PyNumber_Long(tmp);
16100 Py_DECREF(tmp);
16101 }
16102 #endif
16103 if (likely(v)) {
16104 int one = 1; int is_little = (int)*(unsigned char *)&one;
16105 unsigned char *bytes = (unsigned char *)&val;
16106 int ret = _PyLong_AsByteArray((PyLongObject *)v,
16107 bytes, sizeof(val),
16108 is_little, !is_unsigned);
16109 Py_DECREF(v);
16110 if (likely(!ret))
16111 return val;
16112 }
16113 #endif
16114 return (char) -1;
16115 }
16116 } else {
16117 char val;
16118 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
16119 if (!tmp) return (char) -1;
16120 val = __Pyx_PyInt_As_char(tmp);
16121 Py_DECREF(tmp);
16122 return val;
16123 }
16124 raise_overflow:
16125 PyErr_SetString(PyExc_OverflowError,
16126 "value too large to convert to char");
16127 return (char) -1;
16128 raise_neg_overflow:
16129 PyErr_SetString(PyExc_OverflowError,
16130 "can't convert negative value to char");
16131 return (char) -1;
16132 }
16133
16134 /* CIntToPy */
16135 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) {
16136 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
16137 #pragma GCC diagnostic push
16138 #pragma GCC diagnostic ignored "-Wconversion"
16139 #endif
16140 const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
16141 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
16142 #pragma GCC diagnostic pop
16143 #endif
16144 const int is_unsigned = neg_one > const_zero;
16145 if (is_unsigned) {
16146 if (sizeof(uint64_t) < sizeof(long)) {
16147 return PyInt_FromLong((long) value);
16148 } else if (sizeof(uint64_t) <= sizeof(unsigned long)) {
16149 return PyLong_FromUnsignedLong((unsigned long) value);
16150 #ifdef HAVE_LONG_LONG
16151 } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
16152 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
16153 #endif
16154 }
16155 } else {
16156 if (sizeof(uint64_t) <= sizeof(long)) {
16157 return PyInt_FromLong((long) value);
16158 #ifdef HAVE_LONG_LONG
16159 } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
16160 return PyLong_FromLongLong((PY_LONG_LONG) value);
16161 #endif
16162 }
16163 }
16164 {
16165 int one = 1; int little = (int)*(unsigned char *)&one;
16166 unsigned char *bytes = (unsigned char *)&value;
16167 return _PyLong_FromByteArray(bytes, sizeof(uint64_t),
16168 little, !is_unsigned);
16169 }
16170 }
16171
16172 /* CIntToPy */
16173 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
16174 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
16175 #pragma GCC diagnostic push
16176 #pragma GCC diagnostic ignored "-Wconversion"
16177 #endif
16178 const long neg_one = (long) -1, const_zero = (long) 0;
16179 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
16180 #pragma GCC diagnostic pop
16181 #endif
16182 const int is_unsigned = neg_one > const_zero;
16183 if (is_unsigned) {
16184 if (sizeof(long) < sizeof(long)) {
16185 return PyInt_FromLong((long) value);
16186 } else if (sizeof(long) <= sizeof(unsigned long)) {
16187 return PyLong_FromUnsignedLong((unsigned long) value);
16188 #ifdef HAVE_LONG_LONG
16189 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
16190 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
16191 #endif
16192 }
16193 } else {
16194 if (sizeof(long) <= sizeof(long)) {
16195 return PyInt_FromLong((long) value);
16196 #ifdef HAVE_LONG_LONG
16197 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
16198 return PyLong_FromLongLong((PY_LONG_LONG) value);
16199 #endif
16200 }
16201 }
16202 {
16203 int one = 1; int little = (int)*(unsigned char *)&one;
16204 unsigned char *bytes = (unsigned char *)&value;
16205 return _PyLong_FromByteArray(bytes, sizeof(long),
16206 little, !is_unsigned);
16207 }
16208 }
16209
16210 /* FastTypeChecks */
16211 #if CYTHON_COMPILING_IN_CPYTHON
16212 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
16213 while (a) {
16214 a = a->tp_base;
16215 if (a == b)
16216 return 1;
16217 }
16218 return b == &PyBaseObject_Type;
16219 }
16220 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
16221 PyObject *mro;
16222 if (a == b) return 1;
16223 mro = a->tp_mro;
16224 if (likely(mro)) {
16225 Py_ssize_t i, n;
16226 n = PyTuple_GET_SIZE(mro);
16227 for (i = 0; i < n; i++) {
16228 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
16229 return 1;
16230 }
16231 return 0;
16232 }
16233 return __Pyx_InBases(a, b);
16234 }
16235 #if PY_MAJOR_VERSION == 2
16236 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
16237 PyObject *exception, *value, *tb;
16238 int res;
16239 __Pyx_PyThreadState_declare
16240 __Pyx_PyThreadState_assign
16241 __Pyx_ErrFetch(&exception, &value, &tb);
16242 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
16243 if (unlikely(res == -1)) {
16244 PyErr_WriteUnraisable(err);
16245 res = 0;
16246 }
16247 if (!res) {
16248 res = PyObject_IsSubclass(err, exc_type2);
16249 if (unlikely(res == -1)) {
16250 PyErr_WriteUnraisable(err);
16251 res = 0;
16252 }
16253 }
16254 __Pyx_ErrRestore(exception, value, tb);
16255 return res;
16256 }
16257 #else
16258 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
16259 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
16260 if (!res) {
16261 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
16262 }
16263 return res;
16264 }
16265 #endif
16266 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
16267 Py_ssize_t i, n;
16268 assert(PyExceptionClass_Check(exc_type));
16269 n = PyTuple_GET_SIZE(tuple);
16270 #if PY_MAJOR_VERSION >= 3
16271 for (i=0; i<n; i++) {
16272 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
16273 }
16274 #endif
16275 for (i=0; i<n; i++) {
16276 PyObject *t = PyTuple_GET_ITEM(tuple, i);
16277 #if PY_MAJOR_VERSION < 3
16278 if (likely(exc_type == t)) return 1;
16279 #endif
16280 if (likely(PyExceptionClass_Check(t))) {
16281 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
16282 } else {
16283 }
16284 }
16285 return 0;
16286 }
16287 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
16288 if (likely(err == exc_type)) return 1;
16289 if (likely(PyExceptionClass_Check(err))) {
16290 if (likely(PyExceptionClass_Check(exc_type))) {
16291 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
16292 } else if (likely(PyTuple_Check(exc_type))) {
16293 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
16294 } else {
16295 }
16296 }
16297 return PyErr_GivenExceptionMatches(err, exc_type);
16298 }
16299 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
16300 assert(PyExceptionClass_Check(exc_type1));
16301 assert(PyExceptionClass_Check(exc_type2));
16302 if (likely(err == exc_type1 || err == exc_type2)) return 1;
16303 if (likely(PyExceptionClass_Check(err))) {
16304 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
16305 }
16306 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
16307 }
16308 #endif
16309
16310 /* CheckBinaryVersion */
16311 static int __Pyx_check_binary_version(void) {
16312 char ctversion[4], rtversion[4];
16313 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
16314 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
16315 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
16316 char message[200];
16317 PyOS_snprintf(message, sizeof(message),
16318 "compiletime version %s of module '%.100s' "
16319 "does not match runtime version %s",
16320 ctversion, __Pyx_MODULE_NAME, rtversion);
16321 return PyErr_WarnEx(NULL, message, 1);
16322 }
16323 return 0;
16324 }
16325
16326 /* InitStrings */
16327 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
16328 while (t->p) {
16329 #if PY_MAJOR_VERSION < 3
16330 if (t->is_unicode) {
16331 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
16332 } else if (t->intern) {
16333 *t->p = PyString_InternFromString(t->s);
16334 } else {
16335 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
16336 }
16337 #else
16338 if (t->is_unicode | t->is_str) {
16339 if (t->intern) {
16340 *t->p = PyUnicode_InternFromString(t->s);
16341 } else if (t->encoding) {
16342 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
16343 } else {
16344 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
16345 }
16346 } else {
16347 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
16348 }
16349 #endif
16350 if (!*t->p)
16351 return -1;
16352 if (PyObject_Hash(*t->p) == -1)
16353 return -1;
16354 ++t;
16355 }
16356 return 0;
16357 }
16358
16359 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
16360 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
16361 }
16362 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
16363 Py_ssize_t ignore;
16364 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
16365 }
16366 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
16367 #if !CYTHON_PEP393_ENABLED
16368 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
16369 char* defenc_c;
16370 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
16371 if (!defenc) return NULL;
16372 defenc_c = PyBytes_AS_STRING(defenc);
16373 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
16374 {
16375 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
16376 char* c;
16377 for (c = defenc_c; c < end; c++) {
16378 if ((unsigned char) (*c) >= 128) {
16379 PyUnicode_AsASCIIString(o);
16380 return NULL;
16381 }
16382 }
16383 }
16384 #endif
16385 *length = PyBytes_GET_SIZE(defenc);
16386 return defenc_c;
16387 }
16388 #else
16389 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
16390 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
16391 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
16392 if (likely(PyUnicode_IS_ASCII(o))) {
16393 *length = PyUnicode_GET_LENGTH(o);
16394 return PyUnicode_AsUTF8(o);
16395 } else {
16396 PyUnicode_AsASCIIString(o);
16397 return NULL;
16398 }
16399 #else
16400 return PyUnicode_AsUTF8AndSize(o, length);
16401 #endif
16402 }
16403 #endif
16404 #endif
16405 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
16406 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
16407 if (
16408 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
16409 __Pyx_sys_getdefaultencoding_not_ascii &&
16410 #endif
16411 PyUnicode_Check(o)) {
16412 return __Pyx_PyUnicode_AsStringAndSize(o, length);
16413 } else
16414 #endif
16415 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
16416 if (PyByteArray_Check(o)) {
16417 *length = PyByteArray_GET_SIZE(o);
16418 return PyByteArray_AS_STRING(o);
16419 } else
16420 #endif
16421 {
16422 char* result;
16423 int r = PyBytes_AsStringAndSize(o, &result, length);
16424 if (unlikely(r < 0)) {
16425 return NULL;
16426 } else {
16427 return result;
16428 }
16429 }
16430 }
16431 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
16432 int is_true = x == Py_True;
16433 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
16434 else return PyObject_IsTrue(x);
16435 }
16436 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
16437 int retval;
16438 if (unlikely(!x)) return -1;
16439 retval = __Pyx_PyObject_IsTrue(x);
16440 Py_DECREF(x);
16441 return retval;
16442 }
16443 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
16444 #if PY_MAJOR_VERSION >= 3
16445 if (PyLong_Check(result)) {
16446 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
16447 "__int__ returned non-int (type %.200s). "
16448 "The ability to return an instance of a strict subclass of int "
16449 "is deprecated, and may be removed in a future version of Python.",
16450 Py_TYPE(result)->tp_name)) {
16451 Py_DECREF(result);
16452 return NULL;
16453 }
16454 return result;
16455 }
16456 #endif
16457 PyErr_Format(PyExc_TypeError,
16458 "__%.4s__ returned non-%.4s (type %.200s)",
16459 type_name, type_name, Py_TYPE(result)->tp_name);
16460 Py_DECREF(result);
16461 return NULL;
16462 }
16463 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
16464 #if CYTHON_USE_TYPE_SLOTS
16465 PyNumberMethods *m;
16466 #endif
16467 const char *name = NULL;
16468 PyObject *res = NULL;
16469 #if PY_MAJOR_VERSION < 3
16470 if (likely(PyInt_Check(x) || PyLong_Check(x)))
16471 #else
16472 if (likely(PyLong_Check(x)))
16473 #endif
16474 return __Pyx_NewRef(x);
16475 #if CYTHON_USE_TYPE_SLOTS
16476 m = Py_TYPE(x)->tp_as_number;
16477 #if PY_MAJOR_VERSION < 3
16478 if (m && m->nb_int) {
16479 name = "int";
16480 res = m->nb_int(x);
16481 }
16482 else if (m && m->nb_long) {
16483 name = "long";
16484 res = m->nb_long(x);
16485 }
16486 #else
16487 if (likely(m && m->nb_int)) {
16488 name = "int";
16489 res = m->nb_int(x);
16490 }
16491 #endif
16492 #else
16493 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
16494 res = PyNumber_Int(x);
16495 }
16496 #endif
16497 if (likely(res)) {
16498 #if PY_MAJOR_VERSION < 3
16499 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
16500 #else
16501 if (unlikely(!PyLong_CheckExact(res))) {
16502 #endif
16503 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
16504 }
16505 }
16506 else if (!PyErr_Occurred()) {
16507 PyErr_SetString(PyExc_TypeError,
16508 "an integer is required");
16509 }
16510 return res;
16511 }
16512 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
16513 Py_ssize_t ival;
16514 PyObject *x;
16515 #if PY_MAJOR_VERSION < 3
16516 if (likely(PyInt_CheckExact(b))) {
16517 if (sizeof(Py_ssize_t) >= sizeof(long))
16518 return PyInt_AS_LONG(b);
16519 else
16520 return PyInt_AsSsize_t(b);
16521 }
16522 #endif
16523 if (likely(PyLong_CheckExact(b))) {
16524 #if CYTHON_USE_PYLONG_INTERNALS
16525 const digit* digits = ((PyLongObject*)b)->ob_digit;
16526 const Py_ssize_t size = Py_SIZE(b);
16527 if (likely(__Pyx_sst_abs(size) <= 1)) {
16528 ival = likely(size) ? digits[0] : 0;
16529 if (size == -1) ival = -ival;
16530 return ival;
16531 } else {
16532 switch (size) {
16533 case 2:
16534 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
16535 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16536 }
16537 break;
16538 case -2:
16539 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
16540 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16541 }
16542 break;
16543 case 3:
16544 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
16545 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16546 }
16547 break;
16548 case -3:
16549 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
16550 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16551 }
16552 break;
16553 case 4:
16554 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
16555 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16556 }
16557 break;
16558 case -4:
16559 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
16560 return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16561 }
16562 break;
16563 }
16564 }
16565 #endif
16566 return PyLong_AsSsize_t(b);
16567 }
16568 x = PyNumber_Index(b);
16569 if (!x) return -1;
16570 ival = PyInt_AsSsize_t(x);
16571 Py_DECREF(x);
16572 return ival;
16573 }
16574 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
16575 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
16576 }
16577 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
16578 return PyInt_FromSize_t(ival);
16579 }
16580
16581
16582 #endif /* Py_PYTHON_H */
22 from cpython cimport *
33 cdef extern from "Python.h":
44 ctypedef struct PyObject
5 cdef int PyObject_AsReadBuffer(object o, const void** buff, Py_ssize_t* buf_len) except -1
65 object PyMemoryView_GetContiguous(object obj, int buffertype, char order)
76
87 from libc.stdlib cimport *
98 from libc.string cimport *
109 from libc.limits cimport *
11 ctypedef unsigned long long uint64_t
10 from libc.stdint cimport uint64_t
1211
1312 from .exceptions import (
1413 BufferFull,
211210
212211
213212 cdef class Unpacker(object):
214 """
215 MessagePack Packer
216
217 Usage::
218
219 packer = Packer()
220 astream.write(packer.pack(a))
221 astream.write(packer.pack(b))
222
223 Packer's constructor has some keyword arguments:
224
225 :param callable default:
226 Convert user type to builtin type that Packer supports.
227 See also simplejson's document.
228
229 :param bool use_single_float:
230 Use single precision float type for float. (default: False)
231
232 :param bool autoreset:
233 Reset buffer after each pack and return its content as `bytes`. (default: True).
234 If set this to false, use `bytes()` to get content and `.reset()` to clear buffer.
235
236 :param bool use_bin_type:
237 Use bin type introduced in msgpack spec 2.0 for bytes.
238 It also enables str8 type for unicode. (default: True)
239
240 :param bool strict_types:
241 If set to true, types will be checked to be exact. Derived classes
242 from serializable types will not be serialized and will be
243 treated as unsupported type and forwarded to default.
244 Additionally tuples will not be serialized as lists.
245 This is useful when trying to implement accurate serialization
246 for python types.
247
248 :param bool datetime:
249 If set to true, datetime with tzinfo is packed into Timestamp type.
250 Note that the tzinfo is stripped in the timestamp.
251 You can get UTC datetime with `timestamp=3` option of the Unpacker.
252 (Python 2 is not supported).
213 """Streaming unpacker.
214
215 Arguments:
216
217 :param file_like:
218 File-like object having `.read(n)` method.
219 If specified, unpacker reads serialized data from it and :meth:`feed()` is not usable.
220
221 :param int read_size:
222 Used as `file_like.read(read_size)`. (default: `min(16*1024, max_buffer_size)`)
223
224 :param bool use_list:
225 If true, unpack msgpack array to Python list.
226 Otherwise, unpack to Python tuple. (default: True)
227
228 :param bool raw:
229 If true, unpack msgpack raw to Python bytes.
230 Otherwise, unpack to Python str by decoding with UTF-8 encoding (default).
231
232 :param int timestamp:
233 Control how timestamp type is unpacked:
234
235 0 - Timestamp
236 1 - float (Seconds from the EPOCH)
237 2 - int (Nanoseconds from the EPOCH)
238 3 - datetime.datetime (UTC). Python 2 is not supported.
239
240 :param bool strict_map_key:
241 If true (default), only str or bytes are accepted for map (dict) keys.
242
243 :param callable object_hook:
244 When specified, it should be callable.
245 Unpacker calls it with a dict argument after unpacking msgpack map.
246 (See also simplejson)
247
248 :param callable object_pairs_hook:
249 When specified, it should be callable.
250 Unpacker calls it with a list of key-value pairs after unpacking msgpack map.
251 (See also simplejson)
253252
254253 :param str unicode_errors:
255 The error handler for encoding unicode. (default: 'strict')
256 DO NOT USE THIS!! This option is kept for very specific usage.
254 The error handler for decoding unicode. (default: 'strict')
255 This option should be used only when you have msgpack data which
256 contains invalid UTF-8 string.
257
258 :param int max_buffer_size:
259 Limits size of data waiting unpacked. 0 means 2**32-1.
260 The default value is 100*1024*1024 (100MiB).
261 Raises `BufferFull` exception when it is insufficient.
262 You should set this parameter when unpacking data from untrusted source.
263
264 :param int max_str_len:
265 Deprecated, use *max_buffer_size* instead.
266 Limits max length of str. (default: max_buffer_size)
267
268 :param int max_bin_len:
269 Deprecated, use *max_buffer_size* instead.
270 Limits max length of bin. (default: max_buffer_size)
271
272 :param int max_array_len:
273 Limits max length of array.
274 (default: max_buffer_size)
275
276 :param int max_map_len:
277 Limits max length of map.
278 (default: max_buffer_size//2)
279
280 :param int max_ext_len:
281 Deprecated, use *max_buffer_size* instead.
282 Limits max size of ext type. (default: max_buffer_size)
257283
258284 Example of streaming deserialize from file-like object::
259285
00 """Fallback pure Python implementation of msgpack"""
1
21 from datetime import datetime as _DateTime
32 import sys
43 import struct
147146 else:
148147 _unpack_from = struct.unpack_from
149148
149 _NO_FORMAT_USED = ""
150 _MSGPACK_HEADERS = {
151 0xC4: (1, _NO_FORMAT_USED, TYPE_BIN),
152 0xC5: (2, ">H", TYPE_BIN),
153 0xC6: (4, ">I", TYPE_BIN),
154 0xC7: (2, "Bb", TYPE_EXT),
155 0xC8: (3, ">Hb", TYPE_EXT),
156 0xC9: (5, ">Ib", TYPE_EXT),
157 0xCA: (4, ">f"),
158 0xCB: (8, ">d"),
159 0xCC: (1, _NO_FORMAT_USED),
160 0xCD: (2, ">H"),
161 0xCE: (4, ">I"),
162 0xCF: (8, ">Q"),
163 0xD0: (1, "b"),
164 0xD1: (2, ">h"),
165 0xD2: (4, ">i"),
166 0xD3: (8, ">q"),
167 0xD4: (1, "b1s", TYPE_EXT),
168 0xD5: (2, "b2s", TYPE_EXT),
169 0xD6: (4, "b4s", TYPE_EXT),
170 0xD7: (8, "b8s", TYPE_EXT),
171 0xD8: (16, "b16s", TYPE_EXT),
172 0xD9: (1, _NO_FORMAT_USED, TYPE_RAW),
173 0xDA: (2, ">H", TYPE_RAW),
174 0xDB: (4, ">I", TYPE_RAW),
175 0xDC: (2, ">H", TYPE_ARRAY),
176 0xDD: (4, ">I", TYPE_ARRAY),
177 0xDE: (2, ">H", TYPE_MAP),
178 0xDF: (4, ">I", TYPE_MAP),
179 }
180
150181
151182 class Unpacker(object):
152183 """Streaming unpacker.
228259
229260 Example of streaming deserialize from socket::
230261
231 unpacker = Unpacker(max_buffer_size)
262 unpacker = Unpacker()
232263 while True:
233264 buf = sock.recv(1024**2)
234265 if not buf:
353384 self._buffer.extend(view)
354385
355386 def _consume(self):
356 """ Gets rid of the used parts of the buffer. """
387 """Gets rid of the used parts of the buffer."""
357388 self._stream_offset += self._buff_i - self._buf_checkpoint
358389 self._buf_checkpoint = self._buff_i
359390
408439 self._buff_i = 0 # rollback
409440 raise OutOfData
410441
411 def _read_header(self, execute=EX_CONSTRUCT):
442 def _read_header(self):
412443 typ = TYPE_IMMEDIATE
413444 n = 0
414445 obj = None
423454 n = b & 0b00011111
424455 typ = TYPE_RAW
425456 if n > self._max_str_len:
426 raise ValueError("%s exceeds max_str_len(%s)", n, self._max_str_len)
457 raise ValueError("%s exceeds max_str_len(%s)" % (n, self._max_str_len))
427458 obj = self._read(n)
428459 elif b & 0b11110000 == 0b10010000:
429460 n = b & 0b00001111
430461 typ = TYPE_ARRAY
431462 if n > self._max_array_len:
432 raise ValueError("%s exceeds max_array_len(%s)", n, self._max_array_len)
463 raise ValueError(
464 "%s exceeds max_array_len(%s)" % (n, self._max_array_len)
465 )
433466 elif b & 0b11110000 == 0b10000000:
434467 n = b & 0b00001111
435468 typ = TYPE_MAP
436469 if n > self._max_map_len:
437 raise ValueError("%s exceeds max_map_len(%s)", n, self._max_map_len)
470 raise ValueError("%s exceeds max_map_len(%s)" % (n, self._max_map_len))
438471 elif b == 0xC0:
439472 obj = None
440473 elif b == 0xC2:
441474 obj = False
442475 elif b == 0xC3:
443476 obj = True
444 elif b == 0xC4:
445 typ = TYPE_BIN
446 self._reserve(1)
447 n = self._buffer[self._buff_i]
448 self._buff_i += 1
477 elif 0xC4 <= b <= 0xC6:
478 size, fmt, typ = _MSGPACK_HEADERS[b]
479 self._reserve(size)
480 if len(fmt) > 0:
481 n = _unpack_from(fmt, self._buffer, self._buff_i)[0]
482 else:
483 n = self._buffer[self._buff_i]
484 self._buff_i += size
449485 if n > self._max_bin_len:
450486 raise ValueError("%s exceeds max_bin_len(%s)" % (n, self._max_bin_len))
451487 obj = self._read(n)
452 elif b == 0xC5:
453 typ = TYPE_BIN
454 self._reserve(2)
455 n = _unpack_from(">H", self._buffer, self._buff_i)[0]
456 self._buff_i += 2
457 if n > self._max_bin_len:
458 raise ValueError("%s exceeds max_bin_len(%s)" % (n, self._max_bin_len))
459 obj = self._read(n)
460 elif b == 0xC6:
461 typ = TYPE_BIN
462 self._reserve(4)
463 n = _unpack_from(">I", self._buffer, self._buff_i)[0]
464 self._buff_i += 4
465 if n > self._max_bin_len:
466 raise ValueError("%s exceeds max_bin_len(%s)" % (n, self._max_bin_len))
467 obj = self._read(n)
468 elif b == 0xC7: # ext 8
469 typ = TYPE_EXT
470 self._reserve(2)
471 L, n = _unpack_from("Bb", self._buffer, self._buff_i)
472 self._buff_i += 2
488 elif 0xC7 <= b <= 0xC9:
489 size, fmt, typ = _MSGPACK_HEADERS[b]
490 self._reserve(size)
491 L, n = _unpack_from(fmt, self._buffer, self._buff_i)
492 self._buff_i += size
473493 if L > self._max_ext_len:
474494 raise ValueError("%s exceeds max_ext_len(%s)" % (L, self._max_ext_len))
475495 obj = self._read(L)
476 elif b == 0xC8: # ext 16
477 typ = TYPE_EXT
478 self._reserve(3)
479 L, n = _unpack_from(">Hb", self._buffer, self._buff_i)
480 self._buff_i += 3
481 if L > self._max_ext_len:
482 raise ValueError("%s exceeds max_ext_len(%s)" % (L, self._max_ext_len))
483 obj = self._read(L)
484 elif b == 0xC9: # ext 32
485 typ = TYPE_EXT
486 self._reserve(5)
487 L, n = _unpack_from(">Ib", self._buffer, self._buff_i)
488 self._buff_i += 5
489 if L > self._max_ext_len:
490 raise ValueError("%s exceeds max_ext_len(%s)" % (L, self._max_ext_len))
491 obj = self._read(L)
492 elif b == 0xCA:
493 self._reserve(4)
494 obj = _unpack_from(">f", self._buffer, self._buff_i)[0]
495 self._buff_i += 4
496 elif b == 0xCB:
497 self._reserve(8)
498 obj = _unpack_from(">d", self._buffer, self._buff_i)[0]
499 self._buff_i += 8
500 elif b == 0xCC:
501 self._reserve(1)
502 obj = self._buffer[self._buff_i]
503 self._buff_i += 1
504 elif b == 0xCD:
505 self._reserve(2)
506 obj = _unpack_from(">H", self._buffer, self._buff_i)[0]
507 self._buff_i += 2
508 elif b == 0xCE:
509 self._reserve(4)
510 obj = _unpack_from(">I", self._buffer, self._buff_i)[0]
511 self._buff_i += 4
512 elif b == 0xCF:
513 self._reserve(8)
514 obj = _unpack_from(">Q", self._buffer, self._buff_i)[0]
515 self._buff_i += 8
516 elif b == 0xD0:
517 self._reserve(1)
518 obj = _unpack_from("b", self._buffer, self._buff_i)[0]
519 self._buff_i += 1
520 elif b == 0xD1:
521 self._reserve(2)
522 obj = _unpack_from(">h", self._buffer, self._buff_i)[0]
523 self._buff_i += 2
524 elif b == 0xD2:
525 self._reserve(4)
526 obj = _unpack_from(">i", self._buffer, self._buff_i)[0]
527 self._buff_i += 4
528 elif b == 0xD3:
529 self._reserve(8)
530 obj = _unpack_from(">q", self._buffer, self._buff_i)[0]
531 self._buff_i += 8
532 elif b == 0xD4: # fixext 1
533 typ = TYPE_EXT
534 if self._max_ext_len < 1:
535 raise ValueError("%s exceeds max_ext_len(%s)" % (1, self._max_ext_len))
536 self._reserve(2)
537 n, obj = _unpack_from("b1s", self._buffer, self._buff_i)
538 self._buff_i += 2
539 elif b == 0xD5: # fixext 2
540 typ = TYPE_EXT
541 if self._max_ext_len < 2:
542 raise ValueError("%s exceeds max_ext_len(%s)" % (2, self._max_ext_len))
543 self._reserve(3)
544 n, obj = _unpack_from("b2s", self._buffer, self._buff_i)
545 self._buff_i += 3
546 elif b == 0xD6: # fixext 4
547 typ = TYPE_EXT
548 if self._max_ext_len < 4:
549 raise ValueError("%s exceeds max_ext_len(%s)" % (4, self._max_ext_len))
550 self._reserve(5)
551 n, obj = _unpack_from("b4s", self._buffer, self._buff_i)
552 self._buff_i += 5
553 elif b == 0xD7: # fixext 8
554 typ = TYPE_EXT
555 if self._max_ext_len < 8:
556 raise ValueError("%s exceeds max_ext_len(%s)" % (8, self._max_ext_len))
557 self._reserve(9)
558 n, obj = _unpack_from("b8s", self._buffer, self._buff_i)
559 self._buff_i += 9
560 elif b == 0xD8: # fixext 16
561 typ = TYPE_EXT
562 if self._max_ext_len < 16:
563 raise ValueError("%s exceeds max_ext_len(%s)" % (16, self._max_ext_len))
564 self._reserve(17)
565 n, obj = _unpack_from("b16s", self._buffer, self._buff_i)
566 self._buff_i += 17
567 elif b == 0xD9:
568 typ = TYPE_RAW
569 self._reserve(1)
570 n = self._buffer[self._buff_i]
571 self._buff_i += 1
496 elif 0xCA <= b <= 0xD3:
497 size, fmt = _MSGPACK_HEADERS[b]
498 self._reserve(size)
499 if len(fmt) > 0:
500 obj = _unpack_from(fmt, self._buffer, self._buff_i)[0]
501 else:
502 obj = self._buffer[self._buff_i]
503 self._buff_i += size
504 elif 0xD4 <= b <= 0xD8:
505 size, fmt, typ = _MSGPACK_HEADERS[b]
506 if self._max_ext_len < size:
507 raise ValueError(
508 "%s exceeds max_ext_len(%s)" % (size, self._max_ext_len)
509 )
510 self._reserve(size + 1)
511 n, obj = _unpack_from(fmt, self._buffer, self._buff_i)
512 self._buff_i += size + 1
513 elif 0xD9 <= b <= 0xDB:
514 size, fmt, typ = _MSGPACK_HEADERS[b]
515 self._reserve(size)
516 if len(fmt) > 0:
517 (n,) = _unpack_from(fmt, self._buffer, self._buff_i)
518 else:
519 n = self._buffer[self._buff_i]
520 self._buff_i += size
572521 if n > self._max_str_len:
573 raise ValueError("%s exceeds max_str_len(%s)", n, self._max_str_len)
522 raise ValueError("%s exceeds max_str_len(%s)" % (n, self._max_str_len))
574523 obj = self._read(n)
575 elif b == 0xDA:
576 typ = TYPE_RAW
577 self._reserve(2)
578 (n,) = _unpack_from(">H", self._buffer, self._buff_i)
579 self._buff_i += 2
580 if n > self._max_str_len:
581 raise ValueError("%s exceeds max_str_len(%s)", n, self._max_str_len)
582 obj = self._read(n)
583 elif b == 0xDB:
584 typ = TYPE_RAW
585 self._reserve(4)
586 (n,) = _unpack_from(">I", self._buffer, self._buff_i)
587 self._buff_i += 4
588 if n > self._max_str_len:
589 raise ValueError("%s exceeds max_str_len(%s)", n, self._max_str_len)
590 obj = self._read(n)
591 elif b == 0xDC:
592 typ = TYPE_ARRAY
593 self._reserve(2)
594 (n,) = _unpack_from(">H", self._buffer, self._buff_i)
595 self._buff_i += 2
524 elif 0xDC <= b <= 0xDD:
525 size, fmt, typ = _MSGPACK_HEADERS[b]
526 self._reserve(size)
527 (n,) = _unpack_from(fmt, self._buffer, self._buff_i)
528 self._buff_i += size
596529 if n > self._max_array_len:
597 raise ValueError("%s exceeds max_array_len(%s)", n, self._max_array_len)
598 elif b == 0xDD:
599 typ = TYPE_ARRAY
600 self._reserve(4)
601 (n,) = _unpack_from(">I", self._buffer, self._buff_i)
602 self._buff_i += 4
603 if n > self._max_array_len:
604 raise ValueError("%s exceeds max_array_len(%s)", n, self._max_array_len)
605 elif b == 0xDE:
606 self._reserve(2)
607 (n,) = _unpack_from(">H", self._buffer, self._buff_i)
608 self._buff_i += 2
530 raise ValueError(
531 "%s exceeds max_array_len(%s)" % (n, self._max_array_len)
532 )
533 elif 0xDE <= b <= 0xDF:
534 size, fmt, typ = _MSGPACK_HEADERS[b]
535 self._reserve(size)
536 (n,) = _unpack_from(fmt, self._buffer, self._buff_i)
537 self._buff_i += size
609538 if n > self._max_map_len:
610 raise ValueError("%s exceeds max_map_len(%s)", n, self._max_map_len)
611 typ = TYPE_MAP
612 elif b == 0xDF:
613 self._reserve(4)
614 (n,) = _unpack_from(">I", self._buffer, self._buff_i)
615 self._buff_i += 4
616 if n > self._max_map_len:
617 raise ValueError("%s exceeds max_map_len(%s)", n, self._max_map_len)
618 typ = TYPE_MAP
539 raise ValueError("%s exceeds max_map_len(%s)" % (n, self._max_map_len))
619540 else:
620541 raise FormatError("Unknown header: 0x%x" % b)
621542 return typ, n, obj
622543
623544 def _unpack(self, execute=EX_CONSTRUCT):
624 typ, n, obj = self._read_header(execute)
545 typ, n, obj = self._read_header()
625546
626547 if execute == EX_READ_ARRAY_HEADER:
627548 if typ != TYPE_ARRAY:
192192 static inline int unpack_callback_map_item(unpack_user* u, unsigned int current, msgpack_unpack_object* c, msgpack_unpack_object k, msgpack_unpack_object v)
193193 {
194194 if (u->strict_map_key && !PyUnicode_CheckExact(k) && !PyBytes_CheckExact(k)) {
195 PyErr_Format(PyExc_ValueError, "%.100s is not allowed for map key", Py_TYPE(k)->tp_name);
195 PyErr_Format(PyExc_ValueError, "%.100s is not allowed for map key when strict_map_key=True", Py_TYPE(k)->tp_name);
196196 return -1;
197197 }
198198 if (PyUnicode_CheckExact(k)) {
+0
-1
requirements.txt less more
0 Cython~=0.29.13
8787 macros = [("__LITTLE_ENDIAN__", "1")]
8888
8989 ext_modules = []
90 if not PYPY and not PY2:
90 if not PYPY and not PY2 and not os.environ.get("MSGPACK_PUREPYTHON"):
9191 ext_modules.append(
9292 Extension(
9393 "msgpack._cmsgpack",
8989 assert obj == unp
9090 assert pos == unpacker.tell()
9191 assert unpacker.read_bytes(n) == raw
92
93
94 if __name__ == "__main__":
95 test_unpack_array_header_from_file()
96 test_unpacker_hook_refcnt()
97 test_unpacker_ext_hook()
98 test_unpacker_tell()
+0
-43
tox.ini less more
0 [tox]
1 envlist =
2 py27-pure,
3 {py35,py36,py37,py38}-{c,pure},
4 {pypy,pypy3}-pure,
5 py27-x86,
6 py34-x86,
7
8 [variants:pure]
9 setenv=
10 MSGPACK_PUREPYTHON=x
11
12 [testenv]
13 deps=
14 pytest
15
16 changedir=test
17 commands=
18 c,x86: python -c 'from msgpack import _cmsgpack'
19 c,x86: py.test
20 pure: py.test
21
22 [testenv:py27-x86]
23 basepython=python2.7-x86
24 deps=
25 pytest
26
27 changedir=test
28 commands=
29 python -c 'import sys; print(hex(sys.maxsize))'
30 python -c 'from msgpack import _cmsgpack'
31 py.test
32
33 [testenv:py34-x86]
34 basepython=python3.4-x86
35 deps=
36 pytest
37
38 changedir=test
39 commands=
40 python -c 'import sys; print(hex(sys.maxsize))'
41 python -c 'from msgpack import _cmsgpack'
42 py.test