You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11710 lines
455 KiB

4 years ago
  1. /* Generated by Cython 0.29.1 */
  2. /* BEGIN: Cython Metadata
  3. {
  4. "distutils": {
  5. "depends": [
  6. "multidict/_multidict_iter.h",
  7. "multidict/_multidict_views.h",
  8. "multidict/_pair_list.h"
  9. ],
  10. "extra_compile_args": [
  11. "-O2",
  12. "-std=c99",
  13. "-Wall",
  14. "-Wsign-compare",
  15. "-Wconversion",
  16. "-fno-strict-aliasing"
  17. ],
  18. "include_dirs": [
  19. "./multidict"
  20. ],
  21. "name": "multidict._multidict",
  22. "sources": [
  23. "multidict/_multidict.pyx",
  24. "multidict/_pair_list.c",
  25. "multidict/_multidict_iter.c",
  26. "multidict/_multidict_views.c"
  27. ]
  28. },
  29. "module_name": "multidict._multidict"
  30. }
  31. END: Cython Metadata */
  32. #define PY_SSIZE_T_CLEAN
  33. #include "Python.h"
  34. #ifndef Py_PYTHON_H
  35. #error Python headers needed to compile C extensions, please install development version of Python.
  36. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
  37. #error Cython requires Python 2.6+ or Python 3.3+.
  38. #else
  39. #define CYTHON_ABI "0_29_1"
  40. #define CYTHON_HEX_VERSION 0x001D01F0
  41. #define CYTHON_FUTURE_DIVISION 0
  42. #include <stddef.h>
  43. #ifndef offsetof
  44. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  45. #endif
  46. #if !defined(WIN32) && !defined(MS_WINDOWS)
  47. #ifndef __stdcall
  48. #define __stdcall
  49. #endif
  50. #ifndef __cdecl
  51. #define __cdecl
  52. #endif
  53. #ifndef __fastcall
  54. #define __fastcall
  55. #endif
  56. #endif
  57. #ifndef DL_IMPORT
  58. #define DL_IMPORT(t) t
  59. #endif
  60. #ifndef DL_EXPORT
  61. #define DL_EXPORT(t) t
  62. #endif
  63. #define __PYX_COMMA ,
  64. #ifndef HAVE_LONG_LONG
  65. #if PY_VERSION_HEX >= 0x02070000
  66. #define HAVE_LONG_LONG
  67. #endif
  68. #endif
  69. #ifndef PY_LONG_LONG
  70. #define PY_LONG_LONG LONG_LONG
  71. #endif
  72. #ifndef Py_HUGE_VAL
  73. #define Py_HUGE_VAL HUGE_VAL
  74. #endif
  75. #ifdef PYPY_VERSION
  76. #define CYTHON_COMPILING_IN_PYPY 1
  77. #define CYTHON_COMPILING_IN_PYSTON 0
  78. #define CYTHON_COMPILING_IN_CPYTHON 0
  79. #undef CYTHON_USE_TYPE_SLOTS
  80. #define CYTHON_USE_TYPE_SLOTS 0
  81. #undef CYTHON_USE_PYTYPE_LOOKUP
  82. #define CYTHON_USE_PYTYPE_LOOKUP 0
  83. #if PY_VERSION_HEX < 0x03050000
  84. #undef CYTHON_USE_ASYNC_SLOTS
  85. #define CYTHON_USE_ASYNC_SLOTS 0
  86. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  87. #define CYTHON_USE_ASYNC_SLOTS 1
  88. #endif
  89. #undef CYTHON_USE_PYLIST_INTERNALS
  90. #define CYTHON_USE_PYLIST_INTERNALS 0
  91. #undef CYTHON_USE_UNICODE_INTERNALS
  92. #define CYTHON_USE_UNICODE_INTERNALS 0
  93. #undef CYTHON_USE_UNICODE_WRITER
  94. #define CYTHON_USE_UNICODE_WRITER 0
  95. #undef CYTHON_USE_PYLONG_INTERNALS
  96. #define CYTHON_USE_PYLONG_INTERNALS 0
  97. #undef CYTHON_AVOID_BORROWED_REFS
  98. #define CYTHON_AVOID_BORROWED_REFS 1
  99. #undef CYTHON_ASSUME_SAFE_MACROS
  100. #define CYTHON_ASSUME_SAFE_MACROS 0
  101. #undef CYTHON_UNPACK_METHODS
  102. #define CYTHON_UNPACK_METHODS 0
  103. #undef CYTHON_FAST_THREAD_STATE
  104. #define CYTHON_FAST_THREAD_STATE 0
  105. #undef CYTHON_FAST_PYCALL
  106. #define CYTHON_FAST_PYCALL 0
  107. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  108. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  109. #undef CYTHON_USE_TP_FINALIZE
  110. #define CYTHON_USE_TP_FINALIZE 0
  111. #undef CYTHON_USE_DICT_VERSIONS
  112. #define CYTHON_USE_DICT_VERSIONS 0
  113. #undef CYTHON_USE_EXC_INFO_STACK
  114. #define CYTHON_USE_EXC_INFO_STACK 0
  115. #elif defined(PYSTON_VERSION)
  116. #define CYTHON_COMPILING_IN_PYPY 0
  117. #define CYTHON_COMPILING_IN_PYSTON 1
  118. #define CYTHON_COMPILING_IN_CPYTHON 0
  119. #ifndef CYTHON_USE_TYPE_SLOTS
  120. #define CYTHON_USE_TYPE_SLOTS 1
  121. #endif
  122. #undef CYTHON_USE_PYTYPE_LOOKUP
  123. #define CYTHON_USE_PYTYPE_LOOKUP 0
  124. #undef CYTHON_USE_ASYNC_SLOTS
  125. #define CYTHON_USE_ASYNC_SLOTS 0
  126. #undef CYTHON_USE_PYLIST_INTERNALS
  127. #define CYTHON_USE_PYLIST_INTERNALS 0
  128. #ifndef CYTHON_USE_UNICODE_INTERNALS
  129. #define CYTHON_USE_UNICODE_INTERNALS 1
  130. #endif
  131. #undef CYTHON_USE_UNICODE_WRITER
  132. #define CYTHON_USE_UNICODE_WRITER 0
  133. #undef CYTHON_USE_PYLONG_INTERNALS
  134. #define CYTHON_USE_PYLONG_INTERNALS 0
  135. #ifndef CYTHON_AVOID_BORROWED_REFS
  136. #define CYTHON_AVOID_BORROWED_REFS 0
  137. #endif
  138. #ifndef CYTHON_ASSUME_SAFE_MACROS
  139. #define CYTHON_ASSUME_SAFE_MACROS 1
  140. #endif
  141. #ifndef CYTHON_UNPACK_METHODS
  142. #define CYTHON_UNPACK_METHODS 1
  143. #endif
  144. #undef CYTHON_FAST_THREAD_STATE
  145. #define CYTHON_FAST_THREAD_STATE 0
  146. #undef CYTHON_FAST_PYCALL
  147. #define CYTHON_FAST_PYCALL 0
  148. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  149. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  150. #undef CYTHON_USE_TP_FINALIZE
  151. #define CYTHON_USE_TP_FINALIZE 0
  152. #undef CYTHON_USE_DICT_VERSIONS
  153. #define CYTHON_USE_DICT_VERSIONS 0
  154. #undef CYTHON_USE_EXC_INFO_STACK
  155. #define CYTHON_USE_EXC_INFO_STACK 0
  156. #else
  157. #define CYTHON_COMPILING_IN_PYPY 0
  158. #define CYTHON_COMPILING_IN_PYSTON 0
  159. #define CYTHON_COMPILING_IN_CPYTHON 1
  160. #ifndef CYTHON_USE_TYPE_SLOTS
  161. #define CYTHON_USE_TYPE_SLOTS 1
  162. #endif
  163. #if PY_VERSION_HEX < 0x02070000
  164. #undef CYTHON_USE_PYTYPE_LOOKUP
  165. #define CYTHON_USE_PYTYPE_LOOKUP 0
  166. #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
  167. #define CYTHON_USE_PYTYPE_LOOKUP 1
  168. #endif
  169. #if PY_MAJOR_VERSION < 3
  170. #undef CYTHON_USE_ASYNC_SLOTS
  171. #define CYTHON_USE_ASYNC_SLOTS 0
  172. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  173. #define CYTHON_USE_ASYNC_SLOTS 1
  174. #endif
  175. #if PY_VERSION_HEX < 0x02070000
  176. #undef CYTHON_USE_PYLONG_INTERNALS
  177. #define CYTHON_USE_PYLONG_INTERNALS 0
  178. #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
  179. #define CYTHON_USE_PYLONG_INTERNALS 1
  180. #endif
  181. #ifndef CYTHON_USE_PYLIST_INTERNALS
  182. #define CYTHON_USE_PYLIST_INTERNALS 1
  183. #endif
  184. #ifndef CYTHON_USE_UNICODE_INTERNALS
  185. #define CYTHON_USE_UNICODE_INTERNALS 1
  186. #endif
  187. #if PY_VERSION_HEX < 0x030300F0
  188. #undef CYTHON_USE_UNICODE_WRITER
  189. #define CYTHON_USE_UNICODE_WRITER 0
  190. #elif !defined(CYTHON_USE_UNICODE_WRITER)
  191. #define CYTHON_USE_UNICODE_WRITER 1
  192. #endif
  193. #ifndef CYTHON_AVOID_BORROWED_REFS
  194. #define CYTHON_AVOID_BORROWED_REFS 0
  195. #endif
  196. #ifndef CYTHON_ASSUME_SAFE_MACROS
  197. #define CYTHON_ASSUME_SAFE_MACROS 1
  198. #endif
  199. #ifndef CYTHON_UNPACK_METHODS
  200. #define CYTHON_UNPACK_METHODS 1
  201. #endif
  202. #ifndef CYTHON_FAST_THREAD_STATE
  203. #define CYTHON_FAST_THREAD_STATE 1
  204. #endif
  205. #ifndef CYTHON_FAST_PYCALL
  206. #define CYTHON_FAST_PYCALL 1
  207. #endif
  208. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  209. #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  210. #endif
  211. #ifndef CYTHON_USE_TP_FINALIZE
  212. #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  213. #endif
  214. #ifndef CYTHON_USE_DICT_VERSIONS
  215. #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  216. #endif
  217. #ifndef CYTHON_USE_EXC_INFO_STACK
  218. #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  219. #endif
  220. #endif
  221. #if !defined(CYTHON_FAST_PYCCALL)
  222. #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
  223. #endif
  224. #if CYTHON_USE_PYLONG_INTERNALS
  225. #include "longintrepr.h"
  226. #undef SHIFT
  227. #undef BASE
  228. #undef MASK
  229. #ifdef SIZEOF_VOID_P
  230. enum { __pyx_check_sizeof_voidp = 1/(SIZEOF_VOID_P == sizeof(void*)) };
  231. #endif
  232. #endif
  233. #ifndef __has_attribute
  234. #define __has_attribute(x) 0
  235. #endif
  236. #ifndef __has_cpp_attribute
  237. #define __has_cpp_attribute(x) 0
  238. #endif
  239. #ifndef CYTHON_RESTRICT
  240. #if defined(__GNUC__)
  241. #define CYTHON_RESTRICT __restrict__
  242. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  243. #define CYTHON_RESTRICT __restrict
  244. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  245. #define CYTHON_RESTRICT restrict
  246. #else
  247. #define CYTHON_RESTRICT
  248. #endif
  249. #endif
  250. #ifndef CYTHON_UNUSED
  251. # if defined(__GNUC__)
  252. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  253. # define CYTHON_UNUSED __attribute__ ((__unused__))
  254. # else
  255. # define CYTHON_UNUSED
  256. # endif
  257. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  258. # define CYTHON_UNUSED __attribute__ ((__unused__))
  259. # else
  260. # define CYTHON_UNUSED
  261. # endif
  262. #endif
  263. #ifndef CYTHON_MAYBE_UNUSED_VAR
  264. # if defined(__cplusplus)
  265. template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
  266. # else
  267. # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
  268. # endif
  269. #endif
  270. #ifndef CYTHON_NCP_UNUSED
  271. # if CYTHON_COMPILING_IN_CPYTHON
  272. # define CYTHON_NCP_UNUSED
  273. # else
  274. # define CYTHON_NCP_UNUSED CYTHON_UNUSED
  275. # endif
  276. #endif
  277. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  278. #ifdef _MSC_VER
  279. #ifndef _MSC_STDINT_H_
  280. #if _MSC_VER < 1300
  281. typedef unsigned char uint8_t;
  282. typedef unsigned int uint32_t;
  283. #else
  284. typedef unsigned __int8 uint8_t;
  285. typedef unsigned __int32 uint32_t;
  286. #endif
  287. #endif
  288. #else
  289. #include <stdint.h>
  290. #endif
  291. #ifndef CYTHON_FALLTHROUGH
  292. #if defined(__cplusplus) && __cplusplus >= 201103L
  293. #if __has_cpp_attribute(fallthrough)
  294. #define CYTHON_FALLTHROUGH [[fallthrough]]
  295. #elif __has_cpp_attribute(clang::fallthrough)
  296. #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
  297. #elif __has_cpp_attribute(gnu::fallthrough)
  298. #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
  299. #endif
  300. #endif
  301. #ifndef CYTHON_FALLTHROUGH
  302. #if __has_attribute(fallthrough)
  303. #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
  304. #else
  305. #define CYTHON_FALLTHROUGH
  306. #endif
  307. #endif
  308. #if defined(__clang__ ) && defined(__apple_build_version__)
  309. #if __apple_build_version__ < 7000000
  310. #undef CYTHON_FALLTHROUGH
  311. #define CYTHON_FALLTHROUGH
  312. #endif
  313. #endif
  314. #endif
  315. #ifndef CYTHON_INLINE
  316. #if defined(__clang__)
  317. #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  318. #elif defined(__GNUC__)
  319. #define CYTHON_INLINE __inline__
  320. #elif defined(_MSC_VER)
  321. #define CYTHON_INLINE __inline
  322. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  323. #define CYTHON_INLINE inline
  324. #else
  325. #define CYTHON_INLINE
  326. #endif
  327. #endif
  328. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  329. #define Py_OptimizeFlag 0
  330. #endif
  331. #define __PYX_BUILD_PY_SSIZE_T "n"
  332. #define CYTHON_FORMAT_SSIZE_T "z"
  333. #if PY_MAJOR_VERSION < 3
  334. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  335. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  336. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  337. #define __Pyx_DefaultClassType PyClass_Type
  338. #else
  339. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  340. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  341. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  342. #define __Pyx_DefaultClassType PyType_Type
  343. #endif
  344. #ifndef Py_TPFLAGS_CHECKTYPES
  345. #define Py_TPFLAGS_CHECKTYPES 0
  346. #endif
  347. #ifndef Py_TPFLAGS_HAVE_INDEX
  348. #define Py_TPFLAGS_HAVE_INDEX 0
  349. #endif
  350. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  351. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  352. #endif
  353. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  354. #define Py_TPFLAGS_HAVE_FINALIZE 0
  355. #endif
  356. #ifndef METH_STACKLESS
  357. #define METH_STACKLESS 0
  358. #endif
  359. #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  360. #ifndef METH_FASTCALL
  361. #define METH_FASTCALL 0x80
  362. #endif
  363. typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  364. typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
  365. Py_ssize_t nargs, PyObject *kwnames);
  366. #else
  367. #define __Pyx_PyCFunctionFast _PyCFunctionFast
  368. #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  369. #endif
  370. #if CYTHON_FAST_PYCCALL
  371. #define __Pyx_PyFastCFunction_Check(func)\
  372. ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
  373. #else
  374. #define __Pyx_PyFastCFunction_Check(func) 0
  375. #endif
  376. #if CYTHON_USE_DICT_VERSIONS
  377. #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
  378. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  379. (version_var) = __PYX_GET_DICT_VERSION(dict);\
  380. (cache_var) = (value);
  381. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  382. static PY_UINT64_T __pyx_dict_version = 0;\
  383. static PyObject *__pyx_dict_cached_value = NULL;\
  384. if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  385. (VAR) = __pyx_dict_cached_value;\
  386. } else {\
  387. (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  388. __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  389. }\
  390. }
  391. #else
  392. #define __PYX_GET_DICT_VERSION(dict) (0)
  393. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  394. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
  395. #endif
  396. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  397. #define PyObject_Malloc(s) PyMem_Malloc(s)
  398. #define PyObject_Free(p) PyMem_Free(p)
  399. #define PyObject_Realloc(p) PyMem_Realloc(p)
  400. #endif
  401. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  402. #define PyMem_RawMalloc(n) PyMem_Malloc(n)
  403. #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
  404. #define PyMem_RawFree(p) PyMem_Free(p)
  405. #endif
  406. #if CYTHON_COMPILING_IN_PYSTON
  407. #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
  408. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
  409. #else
  410. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  411. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
  412. #endif
  413. #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  414. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  415. #elif PY_VERSION_HEX >= 0x03060000
  416. #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
  417. #elif PY_VERSION_HEX >= 0x03000000
  418. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  419. #else
  420. #define __Pyx_PyThreadState_Current _PyThreadState_Current
  421. #endif
  422. #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
  423. #include "pythread.h"
  424. #define Py_tss_NEEDS_INIT 0
  425. typedef int Py_tss_t;
  426. static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  427. *key = PyThread_create_key();
  428. return 0; // PyThread_create_key reports success always
  429. }
  430. static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  431. Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  432. *key = Py_tss_NEEDS_INIT;
  433. return key;
  434. }
  435. static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  436. PyObject_Free(key);
  437. }
  438. static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  439. return *key != Py_tss_NEEDS_INIT;
  440. }
  441. static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  442. PyThread_delete_key(*key);
  443. *key = Py_tss_NEEDS_INIT;
  444. }
  445. static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  446. return PyThread_set_key_value(*key, value);
  447. }
  448. static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  449. return PyThread_get_key_value(*key);
  450. }
  451. #endif // TSS (Thread Specific Storage) API
  452. #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
  453. #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
  454. #else
  455. #define __Pyx_PyDict_NewPresized(n) PyDict_New()
  456. #endif
  457. #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  458. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  459. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  460. #else
  461. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  462. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  463. #endif
  464. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
  465. #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
  466. #else
  467. #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
  468. #endif
  469. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  470. #define CYTHON_PEP393_ENABLED 1
  471. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
  472. 0 : _PyUnicode_Ready((PyObject *)(op)))
  473. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  474. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  475. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
  476. #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
  477. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  478. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  479. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
  480. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  481. #else
  482. #define CYTHON_PEP393_ENABLED 0
  483. #define PyUnicode_1BYTE_KIND 1
  484. #define PyUnicode_2BYTE_KIND 2
  485. #define PyUnicode_4BYTE_KIND 4
  486. #define __Pyx_PyUnicode_READY(op) (0)
  487. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  488. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  489. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  490. #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
  491. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  492. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  493. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  494. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
  495. #endif
  496. #if CYTHON_COMPILING_IN_PYPY
  497. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  498. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  499. #else
  500. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  501. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  502. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  503. #endif
  504. #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  505. #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
  506. #endif
  507. #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  508. #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
  509. #endif
  510. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  511. #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
  512. #endif
  513. #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))
  514. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  515. #if PY_MAJOR_VERSION >= 3
  516. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  517. #else
  518. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  519. #endif
  520. #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  521. #define PyObject_ASCII(o) PyObject_Repr(o)
  522. #endif
  523. #if PY_MAJOR_VERSION >= 3
  524. #define PyBaseString_Type PyUnicode_Type
  525. #define PyStringObject PyUnicodeObject
  526. #define PyString_Type PyUnicode_Type
  527. #define PyString_Check PyUnicode_Check
  528. #define PyString_CheckExact PyUnicode_CheckExact
  529. #define PyObject_Unicode PyObject_Str
  530. #endif
  531. #if PY_MAJOR_VERSION >= 3
  532. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  533. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  534. #else
  535. #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  536. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  537. #endif
  538. #ifndef PySet_CheckExact
  539. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  540. #endif
  541. #if CYTHON_ASSUME_SAFE_MACROS
  542. #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
  543. #else
  544. #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
  545. #endif
  546. #if PY_MAJOR_VERSION >= 3
  547. #define PyIntObject PyLongObject
  548. #define PyInt_Type PyLong_Type
  549. #define PyInt_Check(op) PyLong_Check(op)
  550. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  551. #define PyInt_FromString PyLong_FromString
  552. #define PyInt_FromUnicode PyLong_FromUnicode
  553. #define PyInt_FromLong PyLong_FromLong
  554. #define PyInt_FromSize_t PyLong_FromSize_t
  555. #define PyInt_FromSsize_t PyLong_FromSsize_t
  556. #define PyInt_AsLong PyLong_AsLong
  557. #define PyInt_AS_LONG PyLong_AS_LONG
  558. #define PyInt_AsSsize_t PyLong_AsSsize_t
  559. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  560. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  561. #define PyNumber_Int PyNumber_Long
  562. #endif
  563. #if PY_MAJOR_VERSION >= 3
  564. #define PyBoolObject PyLongObject
  565. #endif
  566. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  567. #ifndef PyUnicode_InternFromString
  568. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  569. #endif
  570. #endif
  571. #if PY_VERSION_HEX < 0x030200A4
  572. typedef long Py_hash_t;
  573. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  574. #define __Pyx_PyInt_AsHash_t PyInt_AsLong
  575. #else
  576. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  577. #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
  578. #endif
  579. #if PY_MAJOR_VERSION >= 3
  580. #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
  581. #else
  582. #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
  583. #endif
  584. #if CYTHON_USE_ASYNC_SLOTS
  585. #if PY_VERSION_HEX >= 0x030500B1
  586. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  587. #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  588. #else
  589. #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  590. #endif
  591. #else
  592. #define __Pyx_PyType_AsAsync(obj) NULL
  593. #endif
  594. #ifndef __Pyx_PyAsyncMethodsStruct
  595. typedef struct {
  596. unaryfunc am_await;
  597. unaryfunc am_aiter;
  598. unaryfunc am_anext;
  599. } __Pyx_PyAsyncMethodsStruct;
  600. #endif
  601. #if defined(WIN32) || defined(MS_WINDOWS)
  602. #define _USE_MATH_DEFINES
  603. #endif
  604. #include <math.h>
  605. #ifdef NAN
  606. #define __PYX_NAN() ((float) NAN)
  607. #else
  608. static CYTHON_INLINE float __PYX_NAN() {
  609. float value;
  610. memset(&value, 0xFF, sizeof(value));
  611. return value;
  612. }
  613. #endif
  614. #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
  615. #define __Pyx_truncl trunc
  616. #else
  617. #define __Pyx_truncl truncl
  618. #endif
  619. #define __PYX_ERR(f_index, lineno, Ln_error) \
  620. { \
  621. __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
  622. }
  623. #ifndef __PYX_EXTERN_C
  624. #ifdef __cplusplus
  625. #define __PYX_EXTERN_C extern "C"
  626. #else
  627. #define __PYX_EXTERN_C extern
  628. #endif
  629. #endif
  630. #define __PYX_HAVE__multidict___multidict
  631. #define __PYX_HAVE_API__multidict___multidict
  632. /* Early includes */
  633. #include <string.h>
  634. #include <stdio.h>
  635. #include "_multidict_iter.h"
  636. #include "_multidict_views.h"
  637. #include <stdint.h>
  638. #include "_pair_list.h"
  639. #ifdef _OPENMP
  640. #include <omp.h>
  641. #endif /* _OPENMP */
  642. #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
  643. #define CYTHON_WITHOUT_ASSERTIONS
  644. #endif
  645. typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
  646. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  647. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  648. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
  649. #define __PYX_DEFAULT_STRING_ENCODING ""
  650. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  651. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  652. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  653. #define __Pyx_long_cast(x) ((long)x)
  654. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  655. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  656. (sizeof(type) > sizeof(Py_ssize_t) &&\
  657. likely(v < (type)PY_SSIZE_T_MAX ||\
  658. v == (type)PY_SSIZE_T_MAX) &&\
  659. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  660. v == (type)PY_SSIZE_T_MIN))) ||\
  661. (sizeof(type) == sizeof(Py_ssize_t) &&\
  662. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  663. v == (type)PY_SSIZE_T_MAX))) )
  664. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  665. return (size_t) i < (size_t) limit;
  666. }
  667. #if defined (__cplusplus) && __cplusplus >= 201103L
  668. #include <cstdlib>
  669. #define __Pyx_sst_abs(value) std::abs(value)
  670. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  671. #define __Pyx_sst_abs(value) abs(value)
  672. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  673. #define __Pyx_sst_abs(value) labs(value)
  674. #elif defined (_MSC_VER)
  675. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  676. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  677. #define __Pyx_sst_abs(value) llabs(value)
  678. #elif defined (__GNUC__)
  679. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  680. #else
  681. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  682. #endif
  683. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  684. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  685. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  686. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  687. #define __Pyx_PyBytes_FromString PyBytes_FromString
  688. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  689. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  690. #if PY_MAJOR_VERSION < 3
  691. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  692. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  693. #else
  694. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  695. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  696. #endif
  697. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  698. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  699. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  700. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  701. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  702. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  703. #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
  704. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
  705. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
  706. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  707. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  708. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  709. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  710. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  711. #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
  712. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  713. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
  714. const Py_UNICODE *u_end = u;
  715. while (*u_end++) ;
  716. return (size_t)(u_end - u - 1);
  717. }
  718. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  719. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  720. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  721. #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
  722. #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
  723. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  724. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  725. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  726. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
  727. #define __Pyx_PySequence_Tuple(obj)\
  728. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  729. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  730. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  731. #if CYTHON_ASSUME_SAFE_MACROS
  732. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  733. #else
  734. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  735. #endif
  736. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  737. #if PY_MAJOR_VERSION >= 3
  738. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  739. #else
  740. #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
  741. #endif
  742. #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
  743. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  744. static int __Pyx_sys_getdefaultencoding_not_ascii;
  745. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  746. PyObject* sys;
  747. PyObject* default_encoding = NULL;
  748. PyObject* ascii_chars_u = NULL;
  749. PyObject* ascii_chars_b = NULL;
  750. const char* default_encoding_c;
  751. sys = PyImport_ImportModule("sys");
  752. if (!sys) goto bad;
  753. default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  754. Py_DECREF(sys);
  755. if (!default_encoding) goto bad;
  756. default_encoding_c = PyBytes_AsString(default_encoding);
  757. if (!default_encoding_c) goto bad;
  758. if (strcmp(default_encoding_c, "ascii") == 0) {
  759. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  760. } else {
  761. char ascii_chars[128];
  762. int c;
  763. for (c = 0; c < 128; c++) {
  764. ascii_chars[c] = c;
  765. }
  766. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  767. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  768. if (!ascii_chars_u) goto bad;
  769. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  770. if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  771. PyErr_Format(
  772. PyExc_ValueError,
  773. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  774. default_encoding_c);
  775. goto bad;
  776. }
  777. Py_DECREF(ascii_chars_u);
  778. Py_DECREF(ascii_chars_b);
  779. }
  780. Py_DECREF(default_encoding);
  781. return 0;
  782. bad:
  783. Py_XDECREF(default_encoding);
  784. Py_XDECREF(ascii_chars_u);
  785. Py_XDECREF(ascii_chars_b);
  786. return -1;
  787. }
  788. #endif
  789. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  790. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  791. #else
  792. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  793. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  794. static char* __PYX_DEFAULT_STRING_ENCODING;
  795. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  796. PyObject* sys;
  797. PyObject* default_encoding = NULL;
  798. char* default_encoding_c;
  799. sys = PyImport_ImportModule("sys");
  800. if (!sys) goto bad;
  801. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  802. Py_DECREF(sys);
  803. if (!default_encoding) goto bad;
  804. default_encoding_c = PyBytes_AsString(default_encoding);
  805. if (!default_encoding_c) goto bad;
  806. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
  807. if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  808. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  809. Py_DECREF(default_encoding);
  810. return 0;
  811. bad:
  812. Py_XDECREF(default_encoding);
  813. return -1;
  814. }
  815. #endif
  816. #endif
  817. /* Test for GCC > 2.95 */
  818. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  819. #define likely(x) __builtin_expect(!!(x), 1)
  820. #define unlikely(x) __builtin_expect(!!(x), 0)
  821. #else /* !__GNUC__ or GCC < 2.95 */
  822. #define likely(x) (x)
  823. #define unlikely(x) (x)
  824. #endif /* __GNUC__ */
  825. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  826. static PyObject *__pyx_m = NULL;
  827. static PyObject *__pyx_d;
  828. static PyObject *__pyx_b;
  829. static PyObject *__pyx_cython_runtime = NULL;
  830. static PyObject *__pyx_empty_tuple;
  831. static PyObject *__pyx_empty_bytes;
  832. static PyObject *__pyx_empty_unicode;
  833. static int __pyx_lineno;
  834. static int __pyx_clineno = 0;
  835. static const char * __pyx_cfilenm= __FILE__;
  836. static const char *__pyx_filename;
  837. static const char *__pyx_f[] = {
  838. "multidict/_multidict.pyx",
  839. "stringsource",
  840. "type.pxd",
  841. };
  842. /*--- Type declarations ---*/
  843. struct __pyx_obj_9multidict_10_multidict__Base;
  844. struct __pyx_obj_9multidict_10_multidict_MultiDictProxy;
  845. struct __pyx_obj_9multidict_10_multidict_CIMultiDictProxy;
  846. struct __pyx_obj_9multidict_10_multidict_MultiDict;
  847. struct __pyx_obj_9multidict_10_multidict_CIMultiDict;
  848. /* "multidict/_multidict.pyx":29
  849. *
  850. *
  851. * cdef class _Base: # <<<<<<<<<<<<<<
  852. *
  853. * cdef object _impl
  854. */
  855. struct __pyx_obj_9multidict_10_multidict__Base {
  856. PyObject_HEAD
  857. struct __pyx_vtabstruct_9multidict_10_multidict__Base *__pyx_vtab;
  858. PyObject *_impl;
  859. };
  860. /* "multidict/_multidict.pyx":137
  861. *
  862. *
  863. * cdef class MultiDictProxy(_Base): # <<<<<<<<<<<<<<
  864. * _proxy_classes = (MultiDict, MultiDictProxy)
  865. * _base_class = MultiDict
  866. */
  867. struct __pyx_obj_9multidict_10_multidict_MultiDictProxy {
  868. struct __pyx_obj_9multidict_10_multidict__Base __pyx_base;
  869. };
  870. /* "multidict/_multidict.pyx":164
  871. *
  872. *
  873. * cdef class CIMultiDictProxy(MultiDictProxy): # <<<<<<<<<<<<<<
  874. * _proxy_classes = (CIMultiDict, CIMultiDictProxy)
  875. * _base_class = CIMultiDict
  876. */
  877. struct __pyx_obj_9multidict_10_multidict_CIMultiDictProxy {
  878. struct __pyx_obj_9multidict_10_multidict_MultiDictProxy __pyx_base;
  879. };
  880. /* "multidict/_multidict.pyx":185
  881. *
  882. *
  883. * cdef class MultiDict(_Base): # <<<<<<<<<<<<<<
  884. * """An ordered dictionary that can have multiple values for each key."""
  885. *
  886. */
  887. struct __pyx_obj_9multidict_10_multidict_MultiDict {
  888. struct __pyx_obj_9multidict_10_multidict__Base __pyx_base;
  889. };
  890. /* "multidict/_multidict.pyx":341
  891. *
  892. *
  893. * cdef class CIMultiDict(MultiDict): # <<<<<<<<<<<<<<
  894. * """An ordered dictionary that can have multiple values for each key."""
  895. *
  896. */
  897. struct __pyx_obj_9multidict_10_multidict_CIMultiDict {
  898. struct __pyx_obj_9multidict_10_multidict_MultiDict __pyx_base;
  899. };
  900. /* "multidict/_multidict.pyx":29
  901. *
  902. *
  903. * cdef class _Base: # <<<<<<<<<<<<<<
  904. *
  905. * cdef object _impl
  906. */
  907. struct __pyx_vtabstruct_9multidict_10_multidict__Base {
  908. PyObject *(*_getone)(struct __pyx_obj_9multidict_10_multidict__Base *, PyObject *, PyObject *);
  909. PyObject *(*_contains)(struct __pyx_obj_9multidict_10_multidict__Base *, PyObject *);
  910. PyObject *(*keys)(struct __pyx_obj_9multidict_10_multidict__Base *, int __pyx_skip_dispatch);
  911. };
  912. static struct __pyx_vtabstruct_9multidict_10_multidict__Base *__pyx_vtabptr_9multidict_10_multidict__Base;
  913. /* "multidict/_multidict.pyx":137
  914. *
  915. *
  916. * cdef class MultiDictProxy(_Base): # <<<<<<<<<<<<<<
  917. * _proxy_classes = (MultiDict, MultiDictProxy)
  918. * _base_class = MultiDict
  919. */
  920. struct __pyx_vtabstruct_9multidict_10_multidict_MultiDictProxy {
  921. struct __pyx_vtabstruct_9multidict_10_multidict__Base __pyx_base;
  922. };
  923. static struct __pyx_vtabstruct_9multidict_10_multidict_MultiDictProxy *__pyx_vtabptr_9multidict_10_multidict_MultiDictProxy;
  924. /* "multidict/_multidict.pyx":164
  925. *
  926. *
  927. * cdef class CIMultiDictProxy(MultiDictProxy): # <<<<<<<<<<<<<<
  928. * _proxy_classes = (CIMultiDict, CIMultiDictProxy)
  929. * _base_class = CIMultiDict
  930. */
  931. struct __pyx_vtabstruct_9multidict_10_multidict_CIMultiDictProxy {
  932. struct __pyx_vtabstruct_9multidict_10_multidict_MultiDictProxy __pyx_base;
  933. };
  934. static struct __pyx_vtabstruct_9multidict_10_multidict_CIMultiDictProxy *__pyx_vtabptr_9multidict_10_multidict_CIMultiDictProxy;
  935. /* "multidict/_multidict.pyx":185
  936. *
  937. *
  938. * cdef class MultiDict(_Base): # <<<<<<<<<<<<<<
  939. * """An ordered dictionary that can have multiple values for each key."""
  940. *
  941. */
  942. struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict {
  943. struct __pyx_vtabstruct_9multidict_10_multidict__Base __pyx_base;
  944. PyObject *(*_extend)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *, PyObject *, PyObject *, int);
  945. PyObject *(*_update_items)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *);
  946. PyObject *(*_append_items)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *);
  947. PyObject *(*_append_items_seq)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *, PyObject *);
  948. PyObject *(*_add)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *, PyObject *);
  949. PyObject *(*_replace)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *, PyObject *);
  950. };
  951. static struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *__pyx_vtabptr_9multidict_10_multidict_MultiDict;
  952. /* "multidict/_multidict.pyx":341
  953. *
  954. *
  955. * cdef class CIMultiDict(MultiDict): # <<<<<<<<<<<<<<
  956. * """An ordered dictionary that can have multiple values for each key."""
  957. *
  958. */
  959. struct __pyx_vtabstruct_9multidict_10_multidict_CIMultiDict {
  960. struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict __pyx_base;
  961. };
  962. static struct __pyx_vtabstruct_9multidict_10_multidict_CIMultiDict *__pyx_vtabptr_9multidict_10_multidict_CIMultiDict;
  963. /* --- Runtime support code (head) --- */
  964. /* Refnanny.proto */
  965. #ifndef CYTHON_REFNANNY
  966. #define CYTHON_REFNANNY 0
  967. #endif
  968. #if CYTHON_REFNANNY
  969. typedef struct {
  970. void (*INCREF)(void*, PyObject*, int);
  971. void (*DECREF)(void*, PyObject*, int);
  972. void (*GOTREF)(void*, PyObject*, int);
  973. void (*GIVEREF)(void*, PyObject*, int);
  974. void* (*SetupContext)(const char*, int, const char*);
  975. void (*FinishContext)(void**);
  976. } __Pyx_RefNannyAPIStruct;
  977. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  978. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  979. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  980. #ifdef WITH_THREAD
  981. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  982. if (acquire_gil) {\
  983. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  984. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  985. PyGILState_Release(__pyx_gilstate_save);\
  986. } else {\
  987. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  988. }
  989. #else
  990. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  991. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  992. #endif
  993. #define __Pyx_RefNannyFinishContext()\
  994. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  995. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  996. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  997. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  998. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  999. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  1000. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  1001. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  1002. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  1003. #else
  1004. #define __Pyx_RefNannyDeclarations
  1005. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1006. #define __Pyx_RefNannyFinishContext()
  1007. #define __Pyx_INCREF(r) Py_INCREF(r)
  1008. #define __Pyx_DECREF(r) Py_DECREF(r)
  1009. #define __Pyx_GOTREF(r)
  1010. #define __Pyx_GIVEREF(r)
  1011. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1012. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1013. #define __Pyx_XGOTREF(r)
  1014. #define __Pyx_XGIVEREF(r)
  1015. #endif
  1016. #define __Pyx_XDECREF_SET(r, v) do {\
  1017. PyObject *tmp = (PyObject *) r;\
  1018. r = v; __Pyx_XDECREF(tmp);\
  1019. } while (0)
  1020. #define __Pyx_DECREF_SET(r, v) do {\
  1021. PyObject *tmp = (PyObject *) r;\
  1022. r = v; __Pyx_DECREF(tmp);\
  1023. } while (0)
  1024. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1025. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1026. /* PyObjectGetAttrStr.proto */
  1027. #if CYTHON_USE_TYPE_SLOTS
  1028. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1029. #else
  1030. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1031. #endif
  1032. /* GetBuiltinName.proto */
  1033. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1034. /* ArgTypeTest.proto */
  1035. #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
  1036. ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
  1037. __Pyx__ArgTypeTest(obj, type, name, exact))
  1038. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
  1039. /* RaiseDoubleKeywords.proto */
  1040. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1041. /* ParseKeywords.proto */
  1042. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
  1043. PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
  1044. const char* function_name);
  1045. /* RaiseArgTupleInvalid.proto */
  1046. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1047. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1048. /* GetTopmostException.proto */
  1049. #if CYTHON_USE_EXC_INFO_STACK
  1050. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  1051. #endif
  1052. /* PyThreadStateGet.proto */
  1053. #if CYTHON_FAST_THREAD_STATE
  1054. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1055. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1056. #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
  1057. #else
  1058. #define __Pyx_PyThreadState_declare
  1059. #define __Pyx_PyThreadState_assign
  1060. #define __Pyx_PyErr_Occurred() PyErr_Occurred()
  1061. #endif
  1062. /* SaveResetException.proto */
  1063. #if CYTHON_FAST_THREAD_STATE
  1064. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  1065. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1066. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  1067. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1068. #else
  1069. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  1070. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  1071. #endif
  1072. /* PyErrExceptionMatches.proto */
  1073. #if CYTHON_FAST_THREAD_STATE
  1074. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1075. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1076. #else
  1077. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1078. #endif
  1079. /* GetException.proto */
  1080. #if CYTHON_FAST_THREAD_STATE
  1081. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  1082. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1083. #else
  1084. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  1085. #endif
  1086. /* PyErrFetchRestore.proto */
  1087. #if CYTHON_FAST_THREAD_STATE
  1088. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1089. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1090. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1091. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1092. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1093. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1094. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1095. #if CYTHON_COMPILING_IN_CPYTHON
  1096. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1097. #else
  1098. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1099. #endif
  1100. #else
  1101. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1102. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1103. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1104. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1105. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1106. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1107. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1108. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1109. #endif
  1110. /* PyFunctionFastCall.proto */
  1111. #if CYTHON_FAST_PYCALL
  1112. #define __Pyx_PyFunction_FastCall(func, args, nargs)\
  1113. __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
  1114. #if 1 || PY_VERSION_HEX < 0x030600B1
  1115. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
  1116. #else
  1117. #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
  1118. #endif
  1119. #define __Pyx_BUILD_ASSERT_EXPR(cond)\
  1120. (sizeof(char [1 - 2*!(cond)]) - 1)
  1121. #ifndef Py_MEMBER_SIZE
  1122. #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
  1123. #endif
  1124. static size_t __pyx_pyframe_localsplus_offset = 0;
  1125. #include "frameobject.h"
  1126. #define __Pxy_PyFrame_Initialize_Offsets()\
  1127. ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
  1128. (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  1129. #define __Pyx_PyFrame_GetLocalsplus(frame)\
  1130. (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
  1131. #endif
  1132. /* PyObjectCall.proto */
  1133. #if CYTHON_COMPILING_IN_CPYTHON
  1134. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1135. #else
  1136. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1137. #endif
  1138. /* PyObjectCallMethO.proto */
  1139. #if CYTHON_COMPILING_IN_CPYTHON
  1140. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1141. #endif
  1142. /* PyObjectCallNoArg.proto */
  1143. #if CYTHON_COMPILING_IN_CPYTHON
  1144. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
  1145. #else
  1146. #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
  1147. #endif
  1148. /* PyCFunctionFastCall.proto */
  1149. #if CYTHON_FAST_PYCCALL
  1150. static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
  1151. #else
  1152. #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
  1153. #endif
  1154. /* PyObjectCallOneArg.proto */
  1155. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1156. /* RaiseTooManyValuesToUnpack.proto */
  1157. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  1158. /* RaiseNeedMoreValuesToUnpack.proto */
  1159. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  1160. /* IterFinish.proto */
  1161. static CYTHON_INLINE int __Pyx_IterFinish(void);
  1162. /* UnpackItemEndCheck.proto */
  1163. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
  1164. /* ListAppend.proto */
  1165. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1166. static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  1167. PyListObject* L = (PyListObject*) list;
  1168. Py_ssize_t len = Py_SIZE(list);
  1169. if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
  1170. Py_INCREF(x);
  1171. PyList_SET_ITEM(list, len, x);
  1172. Py_SIZE(list) = len+1;
  1173. return 0;
  1174. }
  1175. return PyList_Append(list, x);
  1176. }
  1177. #else
  1178. #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
  1179. #endif
  1180. /* StringJoin.proto */
  1181. #if PY_MAJOR_VERSION < 3
  1182. #define __Pyx_PyString_Join __Pyx_PyBytes_Join
  1183. #define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
  1184. #else
  1185. #define __Pyx_PyString_Join PyUnicode_Join
  1186. #define __Pyx_PyBaseString_Join PyUnicode_Join
  1187. #endif
  1188. #if CYTHON_COMPILING_IN_CPYTHON
  1189. #if PY_MAJOR_VERSION < 3
  1190. #define __Pyx_PyBytes_Join _PyString_Join
  1191. #else
  1192. #define __Pyx_PyBytes_Join _PyBytes_Join
  1193. #endif
  1194. #else
  1195. static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
  1196. #endif
  1197. /* GetModuleGlobalName.proto */
  1198. #if CYTHON_USE_DICT_VERSIONS
  1199. #define __Pyx_GetModuleGlobalName(var, name) {\
  1200. static PY_UINT64_T __pyx_dict_version = 0;\
  1201. static PyObject *__pyx_dict_cached_value = NULL;\
  1202. (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
  1203. (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  1204. __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1205. }
  1206. #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
  1207. PY_UINT64_T __pyx_dict_version;\
  1208. PyObject *__pyx_dict_cached_value;\
  1209. (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1210. }
  1211. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  1212. #else
  1213. #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1214. #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1215. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  1216. #endif
  1217. /* GetAttr.proto */
  1218. static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
  1219. /* GetAttr3.proto */
  1220. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
  1221. /* RaiseException.proto */
  1222. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  1223. /* ExtTypeTest.proto */
  1224. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
  1225. /* PyObjectCall2Args.proto */
  1226. static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
  1227. /* KeywordStringCheck.proto */
  1228. static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
  1229. /* GetItemInt.proto */
  1230. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1231. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1232. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
  1233. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  1234. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  1235. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1236. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1237. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1238. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  1239. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  1240. int wraparound, int boundscheck);
  1241. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1242. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1243. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1244. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  1245. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  1246. int wraparound, int boundscheck);
  1247. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  1248. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  1249. int is_list, int wraparound, int boundscheck);
  1250. /* HasAttr.proto */
  1251. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
  1252. /* py_dict_items.proto */
  1253. static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
  1254. /* UnpackUnboundCMethod.proto */
  1255. typedef struct {
  1256. PyObject *type;
  1257. PyObject **method_name;
  1258. PyCFunction func;
  1259. PyObject *method;
  1260. int flag;
  1261. } __Pyx_CachedCFunction;
  1262. /* CallUnboundCMethod0.proto */
  1263. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
  1264. #if CYTHON_COMPILING_IN_CPYTHON
  1265. #define __Pyx_CallUnboundCMethod0(cfunc, self)\
  1266. (likely((cfunc)->func) ?\
  1267. (likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\
  1268. (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
  1269. (PY_VERSION_HEX >= 0x030700A0 ?\
  1270. (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
  1271. (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
  1272. (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
  1273. (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
  1274. (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
  1275. ((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) :\
  1276. __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
  1277. __Pyx__CallUnboundCMethod0(cfunc, self))
  1278. #else
  1279. #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
  1280. #endif
  1281. /* Import.proto */
  1282. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  1283. /* ImportFrom.proto */
  1284. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
  1285. /* PyObject_GenericGetAttrNoDict.proto */
  1286. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  1287. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
  1288. #else
  1289. #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
  1290. #endif
  1291. /* PyObject_GenericGetAttr.proto */
  1292. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  1293. static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
  1294. #else
  1295. #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
  1296. #endif
  1297. /* SetVTable.proto */
  1298. static int __Pyx_SetVtable(PyObject *dict, void *vtable);
  1299. /* SetupReduce.proto */
  1300. static int __Pyx_setup_reduce(PyObject* type_obj);
  1301. /* TypeImport.proto */
  1302. #ifndef __PYX_HAVE_RT_ImportType_proto
  1303. #define __PYX_HAVE_RT_ImportType_proto
  1304. enum __Pyx_ImportType_CheckSize {
  1305. __Pyx_ImportType_CheckSize_Error = 0,
  1306. __Pyx_ImportType_CheckSize_Warn = 1,
  1307. __Pyx_ImportType_CheckSize_Ignore = 2
  1308. };
  1309. static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
  1310. #endif
  1311. /* GetNameInClass.proto */
  1312. #define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name)
  1313. static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);
  1314. /* CLineInTraceback.proto */
  1315. #ifdef CYTHON_CLINE_IN_TRACEBACK
  1316. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  1317. #else
  1318. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  1319. #endif
  1320. /* CodeObjectCache.proto */
  1321. typedef struct {
  1322. PyCodeObject* code_object;
  1323. int code_line;
  1324. } __Pyx_CodeObjectCacheEntry;
  1325. struct __Pyx_CodeObjectCache {
  1326. int count;
  1327. int max_count;
  1328. __Pyx_CodeObjectCacheEntry* entries;
  1329. };
  1330. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  1331. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  1332. static PyCodeObject *__pyx_find_code_object(int code_line);
  1333. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  1334. /* AddTraceback.proto */
  1335. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  1336. int py_line, const char *filename);
  1337. /* CIntToPy.proto */
  1338. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value);
  1339. /* CIntToPy.proto */
  1340. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  1341. /* CIntToPy.proto */
  1342. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  1343. /* CIntFromPy.proto */
  1344. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  1345. /* CIntFromPy.proto */
  1346. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  1347. /* FastTypeChecks.proto */
  1348. #if CYTHON_COMPILING_IN_CPYTHON
  1349. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  1350. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  1351. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  1352. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  1353. #else
  1354. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  1355. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  1356. #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
  1357. #endif
  1358. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  1359. /* CheckBinaryVersion.proto */
  1360. static int __Pyx_check_binary_version(void);
  1361. /* InitStrings.proto */
  1362. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  1363. static PyObject *__pyx_f_9multidict_10_multidict_5_Base__getone(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto*/
  1364. static PyObject *__pyx_f_9multidict_10_multidict_5_Base__contains(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key); /* proto*/
  1365. static PyObject *__pyx_f_9multidict_10_multidict_5_Base_keys(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
  1366. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__extend(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, PyObject *__pyx_v_name, int __pyx_v_do_add); /* proto*/
  1367. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__update_items(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_impl); /* proto*/
  1368. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__append_items(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_impl); /* proto*/
  1369. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__append_items_seq(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_arg, PyObject *__pyx_v_name); /* proto*/
  1370. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__add(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto*/
  1371. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__replace(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto*/
  1372. /* Module declarations from 'libc.string' */
  1373. /* Module declarations from 'libc.stdio' */
  1374. /* Module declarations from '__builtin__' */
  1375. /* Module declarations from 'cpython.type' */
  1376. static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
  1377. /* Module declarations from 'cpython' */
  1378. /* Module declarations from 'cpython.object' */
  1379. /* Module declarations from 'multidict._multidict_iter' */
  1380. /* Module declarations from 'multidict._multidict_views' */
  1381. /* Module declarations from 'libc.stdint' */
  1382. /* Module declarations from 'multidict._pair_list' */
  1383. /* Module declarations from 'multidict._multidict' */
  1384. static PyTypeObject *__pyx_ptype_9multidict_10_multidict__Base = 0;
  1385. static PyTypeObject *__pyx_ptype_9multidict_10_multidict_MultiDictProxy = 0;
  1386. static PyTypeObject *__pyx_ptype_9multidict_10_multidict_CIMultiDictProxy = 0;
  1387. static PyTypeObject *__pyx_ptype_9multidict_10_multidict_MultiDict = 0;
  1388. static PyTypeObject *__pyx_ptype_9multidict_10_multidict_CIMultiDict = 0;
  1389. static PyObject *__pyx_v_9multidict_10_multidict__marker = 0;
  1390. static PyObject *__pyx_v_9multidict_10_multidict__istr = 0;
  1391. static PyObject *__pyx_f_9multidict_10_multidict___pyx_unpickle__Base__set_state(struct __pyx_obj_9multidict_10_multidict__Base *, PyObject *); /*proto*/
  1392. #define __Pyx_MODULE_NAME "multidict._multidict"
  1393. extern int __pyx_module_is_main_multidict___multidict;
  1394. int __pyx_module_is_main_multidict___multidict = 0;
  1395. /* Implementation of 'multidict._multidict' */
  1396. static PyObject *__pyx_builtin_object;
  1397. static PyObject *__pyx_builtin_KeyError;
  1398. static PyObject *__pyx_builtin_NotImplemented;
  1399. static PyObject *__pyx_builtin_TypeError;
  1400. static const char __pyx_k_r[] = "'{}': {!r}";
  1401. static const char __pyx_k__3[] = ", ";
  1402. static const char __pyx_k__4[] = "<{}({})>";
  1403. static const char __pyx_k_md[] = "md";
  1404. static const char __pyx_k_or[] = " or ";
  1405. static const char __pyx_k_Set[] = "Set";
  1406. static const char __pyx_k_abc[] = "abc";
  1407. static const char __pyx_k_arg[] = "arg";
  1408. static const char __pyx_k_key[] = "key";
  1409. static const char __pyx_k_new[] = "__new__";
  1410. static const char __pyx_k_pop[] = "pop";
  1411. static const char __pyx_k_sys[] = "sys";
  1412. static const char __pyx_k_Base[] = "_Base";
  1413. static const char __pyx_k_copy[] = "copy";
  1414. static const char __pyx_k_dict[] = "__dict__";
  1415. static const char __pyx_k_istr[] = "_istr";
  1416. static const char __pyx_k_join[] = "join";
  1417. static const char __pyx_k_keys[] = "keys";
  1418. static const char __pyx_k_main[] = "__main__";
  1419. static const char __pyx_k_name[] = "__name__";
  1420. static const char __pyx_k_test[] = "__test__";
  1421. static const char __pyx_k_abc_2[] = "_abc";
  1422. static const char __pyx_k_class[] = "__class__";
  1423. static const char __pyx_k_items[] = "items";
  1424. static const char __pyx_k_upstr[] = "upstr";
  1425. static const char __pyx_k_value[] = "value";
  1426. static const char __pyx_k_extend[] = "extend";
  1427. static const char __pyx_k_format[] = "format";
  1428. static const char __pyx_k_import[] = "__import__";
  1429. static const char __pyx_k_istr_2[] = "istr";
  1430. static const char __pyx_k_object[] = "object";
  1431. static const char __pyx_k_pickle[] = "pickle";
  1432. static const char __pyx_k_popone[] = "popone";
  1433. static const char __pyx_k_reduce[] = "__reduce__";
  1434. static const char __pyx_k_update[] = "update";
  1435. static const char __pyx_k_Mapping[] = "Mapping";
  1436. static const char __pyx_k_default[] = "default";
  1437. static const char __pyx_k_Iterable[] = "Iterable";
  1438. static const char __pyx_k_KeyError[] = "KeyError";
  1439. static const char __pyx_k_getstate[] = "__getstate__";
  1440. static const char __pyx_k_pyx_type[] = "__pyx_type";
  1441. static const char __pyx_k_register[] = "register";
  1442. static const char __pyx_k_setstate[] = "__setstate__";
  1443. static const char __pyx_k_MultiDict[] = "MultiDict";
  1444. static const char __pyx_k_TypeError[] = "TypeError";
  1445. static const char __pyx_k_pyx_state[] = "__pyx_state";
  1446. static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
  1447. static const char __pyx_k_base_class[] = "_base_class";
  1448. static const char __pyx_k_getversion[] = "getversion";
  1449. static const char __pyx_k_pyx_result[] = "__pyx_result";
  1450. static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
  1451. static const char __pyx_k_CIMultiDict[] = "CIMultiDict";
  1452. static const char __pyx_k_PickleError[] = "PickleError";
  1453. static const char __pyx_k_collections[] = "collections";
  1454. static const char __pyx_k_MultiMapping[] = "MultiMapping";
  1455. static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
  1456. static const char __pyx_k_stringsource[] = "stringsource";
  1457. static const char __pyx_k_proxy_classes[] = "_proxy_classes";
  1458. static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
  1459. static const char __pyx_k_MultiDictProxy[] = "MultiDictProxy";
  1460. static const char __pyx_k_NotImplemented[] = "NotImplemented";
  1461. static const char __pyx_k_collections_abc[] = "collections.abc";
  1462. static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
  1463. static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
  1464. static const char __pyx_k_CIMultiDictProxy[] = "CIMultiDictProxy";
  1465. static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
  1466. static const char __pyx_k_pyx_unpickle__Base[] = "__pyx_unpickle__Base";
  1467. static const char __pyx_k_MutableMultiMapping[] = "MutableMultiMapping";
  1468. static const char __pyx_k_can_t_pickle_objects[] = "can't pickle {} objects";
  1469. static const char __pyx_k_multidict__multidict[] = "multidict._multidict";
  1470. static const char __pyx_k_multidict__multidict_pyx[] = "multidict/_multidict.pyx";
  1471. static const char __pyx_k_ctor_requires_instance_not[] = "ctor requires {} instance, not {}";
  1472. static const char __pyx_k_MultiDict_keys_should_be_either[] = "MultiDict keys should be either str or subclasses of str";
  1473. static const char __pyx_k_takes_at_most_1_positional_argu[] = "{} takes at most 1 positional argument ({} given)";
  1474. static const char __pyx_k_takes_either_dict_or_list_of_ke[] = "{} takes either dict or list of (key, value) tuples";
  1475. static const char __pyx_k_Incompatible_checksums_s_vs_0x4d[] = "Incompatible checksums (%s vs 0x4d872fe = (_impl))";
  1476. static PyObject *__pyx_n_s_Base;
  1477. static PyObject *__pyx_n_s_CIMultiDict;
  1478. static PyObject *__pyx_n_s_CIMultiDictProxy;
  1479. static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x4d;
  1480. static PyObject *__pyx_n_s_Iterable;
  1481. static PyObject *__pyx_n_s_KeyError;
  1482. static PyObject *__pyx_n_s_Mapping;
  1483. static PyObject *__pyx_n_s_MultiDict;
  1484. static PyObject *__pyx_n_s_MultiDictProxy;
  1485. static PyObject *__pyx_kp_s_MultiDict_keys_should_be_either;
  1486. static PyObject *__pyx_n_s_MultiMapping;
  1487. static PyObject *__pyx_n_s_MutableMultiMapping;
  1488. static PyObject *__pyx_n_s_NotImplemented;
  1489. static PyObject *__pyx_n_s_PickleError;
  1490. static PyObject *__pyx_n_s_Set;
  1491. static PyObject *__pyx_n_s_TypeError;
  1492. static PyObject *__pyx_kp_s__3;
  1493. static PyObject *__pyx_kp_s__4;
  1494. static PyObject *__pyx_n_s_abc;
  1495. static PyObject *__pyx_n_s_abc_2;
  1496. static PyObject *__pyx_n_s_arg;
  1497. static PyObject *__pyx_n_s_base_class;
  1498. static PyObject *__pyx_kp_s_can_t_pickle_objects;
  1499. static PyObject *__pyx_n_s_class;
  1500. static PyObject *__pyx_n_s_cline_in_traceback;
  1501. static PyObject *__pyx_n_s_collections;
  1502. static PyObject *__pyx_n_s_collections_abc;
  1503. static PyObject *__pyx_n_s_copy;
  1504. static PyObject *__pyx_kp_s_ctor_requires_instance_not;
  1505. static PyObject *__pyx_n_s_default;
  1506. static PyObject *__pyx_n_s_dict;
  1507. static PyObject *__pyx_n_s_extend;
  1508. static PyObject *__pyx_n_s_format;
  1509. static PyObject *__pyx_n_s_getstate;
  1510. static PyObject *__pyx_n_s_getversion;
  1511. static PyObject *__pyx_n_s_import;
  1512. static PyObject *__pyx_n_s_istr;
  1513. static PyObject *__pyx_n_s_istr_2;
  1514. static PyObject *__pyx_n_s_items;
  1515. static PyObject *__pyx_n_s_join;
  1516. static PyObject *__pyx_n_s_key;
  1517. static PyObject *__pyx_n_s_keys;
  1518. static PyObject *__pyx_n_s_main;
  1519. static PyObject *__pyx_n_s_md;
  1520. static PyObject *__pyx_n_s_multidict__multidict;
  1521. static PyObject *__pyx_kp_s_multidict__multidict_pyx;
  1522. static PyObject *__pyx_n_s_name;
  1523. static PyObject *__pyx_n_s_new;
  1524. static PyObject *__pyx_n_s_object;
  1525. static PyObject *__pyx_kp_s_or;
  1526. static PyObject *__pyx_n_s_pickle;
  1527. static PyObject *__pyx_n_s_pop;
  1528. static PyObject *__pyx_n_s_popone;
  1529. static PyObject *__pyx_n_s_proxy_classes;
  1530. static PyObject *__pyx_n_s_pyx_PickleError;
  1531. static PyObject *__pyx_n_s_pyx_checksum;
  1532. static PyObject *__pyx_n_s_pyx_result;
  1533. static PyObject *__pyx_n_s_pyx_state;
  1534. static PyObject *__pyx_n_s_pyx_type;
  1535. static PyObject *__pyx_n_s_pyx_unpickle__Base;
  1536. static PyObject *__pyx_n_s_pyx_vtable;
  1537. static PyObject *__pyx_kp_s_r;
  1538. static PyObject *__pyx_n_s_reduce;
  1539. static PyObject *__pyx_n_s_reduce_cython;
  1540. static PyObject *__pyx_n_s_reduce_ex;
  1541. static PyObject *__pyx_n_s_register;
  1542. static PyObject *__pyx_n_s_setstate;
  1543. static PyObject *__pyx_n_s_setstate_cython;
  1544. static PyObject *__pyx_kp_s_stringsource;
  1545. static PyObject *__pyx_n_s_sys;
  1546. static PyObject *__pyx_kp_s_takes_at_most_1_positional_argu;
  1547. static PyObject *__pyx_kp_s_takes_either_dict_or_list_of_ke;
  1548. static PyObject *__pyx_n_s_test;
  1549. static PyObject *__pyx_n_s_update;
  1550. static PyObject *__pyx_n_s_upstr;
  1551. static PyObject *__pyx_n_s_value;
  1552. static PyObject *__pyx_pf_9multidict_10_multidict_getversion(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_md); /* proto */
  1553. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_impl(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self); /* proto */
  1554. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_2getall(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
  1555. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_4getone(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
  1556. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_6__getitem__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
  1557. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_8get(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
  1558. static int __pyx_pf_9multidict_10_multidict_5_Base_10__contains__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
  1559. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_12__iter__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self); /* proto */
  1560. static Py_ssize_t __pyx_pf_9multidict_10_multidict_5_Base_14__len__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self); /* proto */
  1561. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_16keys(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self); /* proto */
  1562. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_18items(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self); /* proto */
  1563. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_20values(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self); /* proto */
  1564. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_22__repr__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self); /* proto */
  1565. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_24__eq__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_arg); /* proto */
  1566. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_26__reduce_cython__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self); /* proto */
  1567. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_28__setstate_cython__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
  1568. static int __pyx_pf_9multidict_10_multidict_14MultiDictProxy___init__(struct __pyx_obj_9multidict_10_multidict_MultiDictProxy *__pyx_v_self, PyObject *__pyx_v_arg); /* proto */
  1569. static PyObject *__pyx_pf_9multidict_10_multidict_14MultiDictProxy_2__reduce__(struct __pyx_obj_9multidict_10_multidict_MultiDictProxy *__pyx_v_self); /* proto */
  1570. static PyObject *__pyx_pf_9multidict_10_multidict_14MultiDictProxy_4copy(struct __pyx_obj_9multidict_10_multidict_MultiDictProxy *__pyx_v_self); /* proto */
  1571. static int __pyx_pf_9multidict_10_multidict_9MultiDict___init__(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
  1572. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_2__reduce__(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self); /* proto */
  1573. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_4add(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
  1574. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_6copy(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self); /* proto */
  1575. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_8extend(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
  1576. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_10clear(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self); /* proto */
  1577. static int __pyx_pf_9multidict_10_multidict_9MultiDict_12__setitem__(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
  1578. static int __pyx_pf_9multidict_10_multidict_9MultiDict_14__delitem__(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
  1579. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_16setdefault(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
  1580. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_18popone(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
  1581. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_20popall(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
  1582. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_22popitem(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self); /* proto */
  1583. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_24update(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
  1584. static int __pyx_pf_9multidict_10_multidict_11CIMultiDict___init__(struct __pyx_obj_9multidict_10_multidict_CIMultiDict *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
  1585. static PyObject *__pyx_pf_9multidict_10_multidict_11CIMultiDict_2__reduce__(struct __pyx_obj_9multidict_10_multidict_CIMultiDict *__pyx_v_self); /* proto */
  1586. static PyObject *__pyx_pf_9multidict_10_multidict_11CIMultiDict_4copy(struct __pyx_obj_9multidict_10_multidict_CIMultiDict *__pyx_v_self); /* proto */
  1587. static PyObject *__pyx_pf_9multidict_10_multidict_2__pyx_unpickle__Base(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
  1588. static PyObject *__pyx_tp_new_9multidict_10_multidict__Base(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  1589. static PyObject *__pyx_tp_new_9multidict_10_multidict_MultiDictProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  1590. static PyObject *__pyx_tp_new_9multidict_10_multidict_CIMultiDictProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  1591. static PyObject *__pyx_tp_new_9multidict_10_multidict_MultiDict(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  1592. static PyObject *__pyx_tp_new_9multidict_10_multidict_CIMultiDict(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  1593. static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0};
  1594. static PyObject *__pyx_int_81294078;
  1595. static PyObject *__pyx_k_;
  1596. static PyObject *__pyx_k__2;
  1597. static PyObject *__pyx_k__6;
  1598. static PyObject *__pyx_k__7;
  1599. static PyObject *__pyx_tuple__5;
  1600. static PyObject *__pyx_tuple__8;
  1601. static PyObject *__pyx_tuple__10;
  1602. static PyObject *__pyx_codeobj__9;
  1603. static PyObject *__pyx_codeobj__11;
  1604. /* Late includes */
  1605. /* "multidict/_multidict.pyx":25
  1606. * multidict_views_init()
  1607. *
  1608. * def getversion(_Base md): # <<<<<<<<<<<<<<
  1609. * return pair_list_version(md._impl)
  1610. *
  1611. */
  1612. /* Python wrapper */
  1613. static PyObject *__pyx_pw_9multidict_10_multidict_1getversion(PyObject *__pyx_self, PyObject *__pyx_v_md); /*proto*/
  1614. static PyMethodDef __pyx_mdef_9multidict_10_multidict_1getversion = {"getversion", (PyCFunction)__pyx_pw_9multidict_10_multidict_1getversion, METH_O, 0};
  1615. static PyObject *__pyx_pw_9multidict_10_multidict_1getversion(PyObject *__pyx_self, PyObject *__pyx_v_md) {
  1616. PyObject *__pyx_r = 0;
  1617. __Pyx_RefNannyDeclarations
  1618. __Pyx_RefNannySetupContext("getversion (wrapper)", 0);
  1619. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_md), __pyx_ptype_9multidict_10_multidict__Base, 1, "md", 0))) __PYX_ERR(0, 25, __pyx_L1_error)
  1620. __pyx_r = __pyx_pf_9multidict_10_multidict_getversion(__pyx_self, ((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_md));
  1621. /* function exit code */
  1622. goto __pyx_L0;
  1623. __pyx_L1_error:;
  1624. __pyx_r = NULL;
  1625. __pyx_L0:;
  1626. __Pyx_RefNannyFinishContext();
  1627. return __pyx_r;
  1628. }
  1629. static PyObject *__pyx_pf_9multidict_10_multidict_getversion(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_md) {
  1630. PyObject *__pyx_r = NULL;
  1631. __Pyx_RefNannyDeclarations
  1632. PyObject *__pyx_t_1 = NULL;
  1633. PyObject *__pyx_t_2 = NULL;
  1634. __Pyx_RefNannySetupContext("getversion", 0);
  1635. /* "multidict/_multidict.pyx":26
  1636. *
  1637. * def getversion(_Base md):
  1638. * return pair_list_version(md._impl) # <<<<<<<<<<<<<<
  1639. *
  1640. *
  1641. */
  1642. __Pyx_XDECREF(__pyx_r);
  1643. __pyx_t_1 = __pyx_v_md->_impl;
  1644. __Pyx_INCREF(__pyx_t_1);
  1645. __pyx_t_2 = __Pyx_PyInt_From_uint64_t(pair_list_version(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
  1646. __Pyx_GOTREF(__pyx_t_2);
  1647. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1648. __pyx_r = __pyx_t_2;
  1649. __pyx_t_2 = 0;
  1650. goto __pyx_L0;
  1651. /* "multidict/_multidict.pyx":25
  1652. * multidict_views_init()
  1653. *
  1654. * def getversion(_Base md): # <<<<<<<<<<<<<<
  1655. * return pair_list_version(md._impl)
  1656. *
  1657. */
  1658. /* function exit code */
  1659. __pyx_L1_error:;
  1660. __Pyx_XDECREF(__pyx_t_1);
  1661. __Pyx_XDECREF(__pyx_t_2);
  1662. __Pyx_AddTraceback("multidict._multidict.getversion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1663. __pyx_r = NULL;
  1664. __pyx_L0:;
  1665. __Pyx_XGIVEREF(__pyx_r);
  1666. __Pyx_RefNannyFinishContext();
  1667. return __pyx_r;
  1668. }
  1669. /* "multidict/_multidict.pyx":33
  1670. * cdef object _impl
  1671. *
  1672. * def impl(self): # <<<<<<<<<<<<<<
  1673. * return self._impl
  1674. *
  1675. */
  1676. /* Python wrapper */
  1677. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_1impl(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  1678. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_1impl(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  1679. PyObject *__pyx_r = 0;
  1680. __Pyx_RefNannyDeclarations
  1681. __Pyx_RefNannySetupContext("impl (wrapper)", 0);
  1682. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_impl(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self));
  1683. /* function exit code */
  1684. __Pyx_RefNannyFinishContext();
  1685. return __pyx_r;
  1686. }
  1687. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_impl(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self) {
  1688. PyObject *__pyx_r = NULL;
  1689. __Pyx_RefNannyDeclarations
  1690. __Pyx_RefNannySetupContext("impl", 0);
  1691. /* "multidict/_multidict.pyx":34
  1692. *
  1693. * def impl(self):
  1694. * return self._impl # <<<<<<<<<<<<<<
  1695. *
  1696. * def getall(self, key, default=_marker):
  1697. */
  1698. __Pyx_XDECREF(__pyx_r);
  1699. __Pyx_INCREF(__pyx_v_self->_impl);
  1700. __pyx_r = __pyx_v_self->_impl;
  1701. goto __pyx_L0;
  1702. /* "multidict/_multidict.pyx":33
  1703. * cdef object _impl
  1704. *
  1705. * def impl(self): # <<<<<<<<<<<<<<
  1706. * return self._impl
  1707. *
  1708. */
  1709. /* function exit code */
  1710. __pyx_L0:;
  1711. __Pyx_XGIVEREF(__pyx_r);
  1712. __Pyx_RefNannyFinishContext();
  1713. return __pyx_r;
  1714. }
  1715. /* "multidict/_multidict.pyx":36
  1716. * return self._impl
  1717. *
  1718. * def getall(self, key, default=_marker): # <<<<<<<<<<<<<<
  1719. * """Return a list of all values matching the key."""
  1720. * try:
  1721. */
  1722. /* Python wrapper */
  1723. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_3getall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1724. static char __pyx_doc_9multidict_10_multidict_5_Base_2getall[] = "Return a list of all values matching the key.";
  1725. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_3getall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  1726. PyObject *__pyx_v_key = 0;
  1727. PyObject *__pyx_v_default = 0;
  1728. PyObject *__pyx_r = 0;
  1729. __Pyx_RefNannyDeclarations
  1730. __Pyx_RefNannySetupContext("getall (wrapper)", 0);
  1731. {
  1732. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
  1733. PyObject* values[2] = {0,0};
  1734. values[1] = __pyx_k_;
  1735. if (unlikely(__pyx_kwds)) {
  1736. Py_ssize_t kw_args;
  1737. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  1738. switch (pos_args) {
  1739. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1740. CYTHON_FALLTHROUGH;
  1741. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1742. CYTHON_FALLTHROUGH;
  1743. case 0: break;
  1744. default: goto __pyx_L5_argtuple_error;
  1745. }
  1746. kw_args = PyDict_Size(__pyx_kwds);
  1747. switch (pos_args) {
  1748. case 0:
  1749. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
  1750. else goto __pyx_L5_argtuple_error;
  1751. CYTHON_FALLTHROUGH;
  1752. case 1:
  1753. if (kw_args > 0) {
  1754. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
  1755. if (value) { values[1] = value; kw_args--; }
  1756. }
  1757. }
  1758. if (unlikely(kw_args > 0)) {
  1759. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getall") < 0)) __PYX_ERR(0, 36, __pyx_L3_error)
  1760. }
  1761. } else {
  1762. switch (PyTuple_GET_SIZE(__pyx_args)) {
  1763. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1764. CYTHON_FALLTHROUGH;
  1765. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1766. break;
  1767. default: goto __pyx_L5_argtuple_error;
  1768. }
  1769. }
  1770. __pyx_v_key = values[0];
  1771. __pyx_v_default = values[1];
  1772. }
  1773. goto __pyx_L4_argument_unpacking_done;
  1774. __pyx_L5_argtuple_error:;
  1775. __Pyx_RaiseArgtupleInvalid("getall", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 36, __pyx_L3_error)
  1776. __pyx_L3_error:;
  1777. __Pyx_AddTraceback("multidict._multidict._Base.getall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1778. __Pyx_RefNannyFinishContext();
  1779. return NULL;
  1780. __pyx_L4_argument_unpacking_done:;
  1781. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_2getall(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self), __pyx_v_key, __pyx_v_default);
  1782. /* function exit code */
  1783. __Pyx_RefNannyFinishContext();
  1784. return __pyx_r;
  1785. }
  1786. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_2getall(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  1787. PyObject *__pyx_r = NULL;
  1788. __Pyx_RefNannyDeclarations
  1789. PyObject *__pyx_t_1 = NULL;
  1790. PyObject *__pyx_t_2 = NULL;
  1791. PyObject *__pyx_t_3 = NULL;
  1792. PyObject *__pyx_t_4 = NULL;
  1793. PyObject *__pyx_t_5 = NULL;
  1794. int __pyx_t_6;
  1795. PyObject *__pyx_t_7 = NULL;
  1796. int __pyx_t_8;
  1797. int __pyx_t_9;
  1798. __Pyx_RefNannySetupContext("getall", 0);
  1799. /* "multidict/_multidict.pyx":38
  1800. * def getall(self, key, default=_marker):
  1801. * """Return a list of all values matching the key."""
  1802. * try: # <<<<<<<<<<<<<<
  1803. * return pair_list_get_all(self._impl, key)
  1804. * except KeyError:
  1805. */
  1806. {
  1807. __Pyx_PyThreadState_declare
  1808. __Pyx_PyThreadState_assign
  1809. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  1810. __Pyx_XGOTREF(__pyx_t_1);
  1811. __Pyx_XGOTREF(__pyx_t_2);
  1812. __Pyx_XGOTREF(__pyx_t_3);
  1813. /*try:*/ {
  1814. /* "multidict/_multidict.pyx":39
  1815. * """Return a list of all values matching the key."""
  1816. * try:
  1817. * return pair_list_get_all(self._impl, key) # <<<<<<<<<<<<<<
  1818. * except KeyError:
  1819. * if default is not _marker:
  1820. */
  1821. __Pyx_XDECREF(__pyx_r);
  1822. __pyx_t_4 = __pyx_v_self->_impl;
  1823. __Pyx_INCREF(__pyx_t_4);
  1824. __pyx_t_5 = pair_list_get_all(__pyx_t_4, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L3_error)
  1825. __Pyx_GOTREF(__pyx_t_5);
  1826. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1827. __pyx_r = __pyx_t_5;
  1828. __pyx_t_5 = 0;
  1829. goto __pyx_L7_try_return;
  1830. /* "multidict/_multidict.pyx":38
  1831. * def getall(self, key, default=_marker):
  1832. * """Return a list of all values matching the key."""
  1833. * try: # <<<<<<<<<<<<<<
  1834. * return pair_list_get_all(self._impl, key)
  1835. * except KeyError:
  1836. */
  1837. }
  1838. __pyx_L3_error:;
  1839. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  1840. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  1841. /* "multidict/_multidict.pyx":40
  1842. * try:
  1843. * return pair_list_get_all(self._impl, key)
  1844. * except KeyError: # <<<<<<<<<<<<<<
  1845. * if default is not _marker:
  1846. * return default
  1847. */
  1848. __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
  1849. if (__pyx_t_6) {
  1850. __Pyx_AddTraceback("multidict._multidict._Base.getall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1851. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 40, __pyx_L5_except_error)
  1852. __Pyx_GOTREF(__pyx_t_5);
  1853. __Pyx_GOTREF(__pyx_t_4);
  1854. __Pyx_GOTREF(__pyx_t_7);
  1855. /* "multidict/_multidict.pyx":41
  1856. * return pair_list_get_all(self._impl, key)
  1857. * except KeyError:
  1858. * if default is not _marker: # <<<<<<<<<<<<<<
  1859. * return default
  1860. * else:
  1861. */
  1862. __pyx_t_8 = (__pyx_v_default != __pyx_v_9multidict_10_multidict__marker);
  1863. __pyx_t_9 = (__pyx_t_8 != 0);
  1864. if (likely(__pyx_t_9)) {
  1865. /* "multidict/_multidict.pyx":42
  1866. * except KeyError:
  1867. * if default is not _marker:
  1868. * return default # <<<<<<<<<<<<<<
  1869. * else:
  1870. * raise
  1871. */
  1872. __Pyx_XDECREF(__pyx_r);
  1873. __Pyx_INCREF(__pyx_v_default);
  1874. __pyx_r = __pyx_v_default;
  1875. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1876. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1877. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1878. goto __pyx_L6_except_return;
  1879. /* "multidict/_multidict.pyx":41
  1880. * return pair_list_get_all(self._impl, key)
  1881. * except KeyError:
  1882. * if default is not _marker: # <<<<<<<<<<<<<<
  1883. * return default
  1884. * else:
  1885. */
  1886. }
  1887. /* "multidict/_multidict.pyx":44
  1888. * return default
  1889. * else:
  1890. * raise # <<<<<<<<<<<<<<
  1891. *
  1892. * def getone(self, key, default=_marker):
  1893. */
  1894. /*else*/ {
  1895. __Pyx_GIVEREF(__pyx_t_5);
  1896. __Pyx_GIVEREF(__pyx_t_4);
  1897. __Pyx_XGIVEREF(__pyx_t_7);
  1898. __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_4, __pyx_t_7);
  1899. __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0;
  1900. __PYX_ERR(0, 44, __pyx_L5_except_error)
  1901. }
  1902. }
  1903. goto __pyx_L5_except_error;
  1904. __pyx_L5_except_error:;
  1905. /* "multidict/_multidict.pyx":38
  1906. * def getall(self, key, default=_marker):
  1907. * """Return a list of all values matching the key."""
  1908. * try: # <<<<<<<<<<<<<<
  1909. * return pair_list_get_all(self._impl, key)
  1910. * except KeyError:
  1911. */
  1912. __Pyx_XGIVEREF(__pyx_t_1);
  1913. __Pyx_XGIVEREF(__pyx_t_2);
  1914. __Pyx_XGIVEREF(__pyx_t_3);
  1915. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  1916. goto __pyx_L1_error;
  1917. __pyx_L7_try_return:;
  1918. __Pyx_XGIVEREF(__pyx_t_1);
  1919. __Pyx_XGIVEREF(__pyx_t_2);
  1920. __Pyx_XGIVEREF(__pyx_t_3);
  1921. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  1922. goto __pyx_L0;
  1923. __pyx_L6_except_return:;
  1924. __Pyx_XGIVEREF(__pyx_t_1);
  1925. __Pyx_XGIVEREF(__pyx_t_2);
  1926. __Pyx_XGIVEREF(__pyx_t_3);
  1927. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  1928. goto __pyx_L0;
  1929. }
  1930. /* "multidict/_multidict.pyx":36
  1931. * return self._impl
  1932. *
  1933. * def getall(self, key, default=_marker): # <<<<<<<<<<<<<<
  1934. * """Return a list of all values matching the key."""
  1935. * try:
  1936. */
  1937. /* function exit code */
  1938. __pyx_L1_error:;
  1939. __Pyx_XDECREF(__pyx_t_4);
  1940. __Pyx_XDECREF(__pyx_t_5);
  1941. __Pyx_XDECREF(__pyx_t_7);
  1942. __Pyx_AddTraceback("multidict._multidict._Base.getall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1943. __pyx_r = NULL;
  1944. __pyx_L0:;
  1945. __Pyx_XGIVEREF(__pyx_r);
  1946. __Pyx_RefNannyFinishContext();
  1947. return __pyx_r;
  1948. }
  1949. /* "multidict/_multidict.pyx":46
  1950. * raise
  1951. *
  1952. * def getone(self, key, default=_marker): # <<<<<<<<<<<<<<
  1953. * """Get first value matching the key."""
  1954. * return self._getone(key, default)
  1955. */
  1956. /* Python wrapper */
  1957. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_5getone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1958. static char __pyx_doc_9multidict_10_multidict_5_Base_4getone[] = "Get first value matching the key.";
  1959. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_5getone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  1960. PyObject *__pyx_v_key = 0;
  1961. PyObject *__pyx_v_default = 0;
  1962. PyObject *__pyx_r = 0;
  1963. __Pyx_RefNannyDeclarations
  1964. __Pyx_RefNannySetupContext("getone (wrapper)", 0);
  1965. {
  1966. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
  1967. PyObject* values[2] = {0,0};
  1968. values[1] = __pyx_k__2;
  1969. if (unlikely(__pyx_kwds)) {
  1970. Py_ssize_t kw_args;
  1971. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  1972. switch (pos_args) {
  1973. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1974. CYTHON_FALLTHROUGH;
  1975. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1976. CYTHON_FALLTHROUGH;
  1977. case 0: break;
  1978. default: goto __pyx_L5_argtuple_error;
  1979. }
  1980. kw_args = PyDict_Size(__pyx_kwds);
  1981. switch (pos_args) {
  1982. case 0:
  1983. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
  1984. else goto __pyx_L5_argtuple_error;
  1985. CYTHON_FALLTHROUGH;
  1986. case 1:
  1987. if (kw_args > 0) {
  1988. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
  1989. if (value) { values[1] = value; kw_args--; }
  1990. }
  1991. }
  1992. if (unlikely(kw_args > 0)) {
  1993. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getone") < 0)) __PYX_ERR(0, 46, __pyx_L3_error)
  1994. }
  1995. } else {
  1996. switch (PyTuple_GET_SIZE(__pyx_args)) {
  1997. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1998. CYTHON_FALLTHROUGH;
  1999. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2000. break;
  2001. default: goto __pyx_L5_argtuple_error;
  2002. }
  2003. }
  2004. __pyx_v_key = values[0];
  2005. __pyx_v_default = values[1];
  2006. }
  2007. goto __pyx_L4_argument_unpacking_done;
  2008. __pyx_L5_argtuple_error:;
  2009. __Pyx_RaiseArgtupleInvalid("getone", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 46, __pyx_L3_error)
  2010. __pyx_L3_error:;
  2011. __Pyx_AddTraceback("multidict._multidict._Base.getone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2012. __Pyx_RefNannyFinishContext();
  2013. return NULL;
  2014. __pyx_L4_argument_unpacking_done:;
  2015. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_4getone(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self), __pyx_v_key, __pyx_v_default);
  2016. /* function exit code */
  2017. __Pyx_RefNannyFinishContext();
  2018. return __pyx_r;
  2019. }
  2020. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_4getone(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  2021. PyObject *__pyx_r = NULL;
  2022. __Pyx_RefNannyDeclarations
  2023. PyObject *__pyx_t_1 = NULL;
  2024. __Pyx_RefNannySetupContext("getone", 0);
  2025. /* "multidict/_multidict.pyx":48
  2026. * def getone(self, key, default=_marker):
  2027. * """Get first value matching the key."""
  2028. * return self._getone(key, default) # <<<<<<<<<<<<<<
  2029. *
  2030. * cdef _getone(self, key, default):
  2031. */
  2032. __Pyx_XDECREF(__pyx_r);
  2033. __pyx_t_1 = ((struct __pyx_vtabstruct_9multidict_10_multidict__Base *)__pyx_v_self->__pyx_vtab)->_getone(__pyx_v_self, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
  2034. __Pyx_GOTREF(__pyx_t_1);
  2035. __pyx_r = __pyx_t_1;
  2036. __pyx_t_1 = 0;
  2037. goto __pyx_L0;
  2038. /* "multidict/_multidict.pyx":46
  2039. * raise
  2040. *
  2041. * def getone(self, key, default=_marker): # <<<<<<<<<<<<<<
  2042. * """Get first value matching the key."""
  2043. * return self._getone(key, default)
  2044. */
  2045. /* function exit code */
  2046. __pyx_L1_error:;
  2047. __Pyx_XDECREF(__pyx_t_1);
  2048. __Pyx_AddTraceback("multidict._multidict._Base.getone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2049. __pyx_r = NULL;
  2050. __pyx_L0:;
  2051. __Pyx_XGIVEREF(__pyx_r);
  2052. __Pyx_RefNannyFinishContext();
  2053. return __pyx_r;
  2054. }
  2055. /* "multidict/_multidict.pyx":50
  2056. * return self._getone(key, default)
  2057. *
  2058. * cdef _getone(self, key, default): # <<<<<<<<<<<<<<
  2059. * try:
  2060. * return pair_list_get_one(self._impl, key)
  2061. */
  2062. static PyObject *__pyx_f_9multidict_10_multidict_5_Base__getone(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  2063. PyObject *__pyx_r = NULL;
  2064. __Pyx_RefNannyDeclarations
  2065. PyObject *__pyx_t_1 = NULL;
  2066. PyObject *__pyx_t_2 = NULL;
  2067. PyObject *__pyx_t_3 = NULL;
  2068. PyObject *__pyx_t_4 = NULL;
  2069. PyObject *__pyx_t_5 = NULL;
  2070. int __pyx_t_6;
  2071. PyObject *__pyx_t_7 = NULL;
  2072. int __pyx_t_8;
  2073. int __pyx_t_9;
  2074. __Pyx_RefNannySetupContext("_getone", 0);
  2075. /* "multidict/_multidict.pyx":51
  2076. *
  2077. * cdef _getone(self, key, default):
  2078. * try: # <<<<<<<<<<<<<<
  2079. * return pair_list_get_one(self._impl, key)
  2080. * except KeyError:
  2081. */
  2082. {
  2083. __Pyx_PyThreadState_declare
  2084. __Pyx_PyThreadState_assign
  2085. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  2086. __Pyx_XGOTREF(__pyx_t_1);
  2087. __Pyx_XGOTREF(__pyx_t_2);
  2088. __Pyx_XGOTREF(__pyx_t_3);
  2089. /*try:*/ {
  2090. /* "multidict/_multidict.pyx":52
  2091. * cdef _getone(self, key, default):
  2092. * try:
  2093. * return pair_list_get_one(self._impl, key) # <<<<<<<<<<<<<<
  2094. * except KeyError:
  2095. * if default is not _marker:
  2096. */
  2097. __Pyx_XDECREF(__pyx_r);
  2098. __pyx_t_4 = __pyx_v_self->_impl;
  2099. __Pyx_INCREF(__pyx_t_4);
  2100. __pyx_t_5 = pair_list_get_one(__pyx_t_4, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 52, __pyx_L3_error)
  2101. __Pyx_GOTREF(__pyx_t_5);
  2102. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2103. __pyx_r = __pyx_t_5;
  2104. __pyx_t_5 = 0;
  2105. goto __pyx_L7_try_return;
  2106. /* "multidict/_multidict.pyx":51
  2107. *
  2108. * cdef _getone(self, key, default):
  2109. * try: # <<<<<<<<<<<<<<
  2110. * return pair_list_get_one(self._impl, key)
  2111. * except KeyError:
  2112. */
  2113. }
  2114. __pyx_L3_error:;
  2115. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  2116. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  2117. /* "multidict/_multidict.pyx":53
  2118. * try:
  2119. * return pair_list_get_one(self._impl, key)
  2120. * except KeyError: # <<<<<<<<<<<<<<
  2121. * if default is not _marker:
  2122. * return default
  2123. */
  2124. __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
  2125. if (__pyx_t_6) {
  2126. __Pyx_AddTraceback("multidict._multidict._Base._getone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2127. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 53, __pyx_L5_except_error)
  2128. __Pyx_GOTREF(__pyx_t_5);
  2129. __Pyx_GOTREF(__pyx_t_4);
  2130. __Pyx_GOTREF(__pyx_t_7);
  2131. /* "multidict/_multidict.pyx":54
  2132. * return pair_list_get_one(self._impl, key)
  2133. * except KeyError:
  2134. * if default is not _marker: # <<<<<<<<<<<<<<
  2135. * return default
  2136. * else:
  2137. */
  2138. __pyx_t_8 = (__pyx_v_default != __pyx_v_9multidict_10_multidict__marker);
  2139. __pyx_t_9 = (__pyx_t_8 != 0);
  2140. if (likely(__pyx_t_9)) {
  2141. /* "multidict/_multidict.pyx":55
  2142. * except KeyError:
  2143. * if default is not _marker:
  2144. * return default # <<<<<<<<<<<<<<
  2145. * else:
  2146. * raise
  2147. */
  2148. __Pyx_XDECREF(__pyx_r);
  2149. __Pyx_INCREF(__pyx_v_default);
  2150. __pyx_r = __pyx_v_default;
  2151. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2152. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2153. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2154. goto __pyx_L6_except_return;
  2155. /* "multidict/_multidict.pyx":54
  2156. * return pair_list_get_one(self._impl, key)
  2157. * except KeyError:
  2158. * if default is not _marker: # <<<<<<<<<<<<<<
  2159. * return default
  2160. * else:
  2161. */
  2162. }
  2163. /* "multidict/_multidict.pyx":57
  2164. * return default
  2165. * else:
  2166. * raise # <<<<<<<<<<<<<<
  2167. *
  2168. * # Mapping interface #
  2169. */
  2170. /*else*/ {
  2171. __Pyx_GIVEREF(__pyx_t_5);
  2172. __Pyx_GIVEREF(__pyx_t_4);
  2173. __Pyx_XGIVEREF(__pyx_t_7);
  2174. __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_4, __pyx_t_7);
  2175. __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0;
  2176. __PYX_ERR(0, 57, __pyx_L5_except_error)
  2177. }
  2178. }
  2179. goto __pyx_L5_except_error;
  2180. __pyx_L5_except_error:;
  2181. /* "multidict/_multidict.pyx":51
  2182. *
  2183. * cdef _getone(self, key, default):
  2184. * try: # <<<<<<<<<<<<<<
  2185. * return pair_list_get_one(self._impl, key)
  2186. * except KeyError:
  2187. */
  2188. __Pyx_XGIVEREF(__pyx_t_1);
  2189. __Pyx_XGIVEREF(__pyx_t_2);
  2190. __Pyx_XGIVEREF(__pyx_t_3);
  2191. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  2192. goto __pyx_L1_error;
  2193. __pyx_L7_try_return:;
  2194. __Pyx_XGIVEREF(__pyx_t_1);
  2195. __Pyx_XGIVEREF(__pyx_t_2);
  2196. __Pyx_XGIVEREF(__pyx_t_3);
  2197. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  2198. goto __pyx_L0;
  2199. __pyx_L6_except_return:;
  2200. __Pyx_XGIVEREF(__pyx_t_1);
  2201. __Pyx_XGIVEREF(__pyx_t_2);
  2202. __Pyx_XGIVEREF(__pyx_t_3);
  2203. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  2204. goto __pyx_L0;
  2205. }
  2206. /* "multidict/_multidict.pyx":50
  2207. * return self._getone(key, default)
  2208. *
  2209. * cdef _getone(self, key, default): # <<<<<<<<<<<<<<
  2210. * try:
  2211. * return pair_list_get_one(self._impl, key)
  2212. */
  2213. /* function exit code */
  2214. __pyx_L1_error:;
  2215. __Pyx_XDECREF(__pyx_t_4);
  2216. __Pyx_XDECREF(__pyx_t_5);
  2217. __Pyx_XDECREF(__pyx_t_7);
  2218. __Pyx_AddTraceback("multidict._multidict._Base._getone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2219. __pyx_r = 0;
  2220. __pyx_L0:;
  2221. __Pyx_XGIVEREF(__pyx_r);
  2222. __Pyx_RefNannyFinishContext();
  2223. return __pyx_r;
  2224. }
  2225. /* "multidict/_multidict.pyx":61
  2226. * # Mapping interface #
  2227. *
  2228. * def __getitem__(self, key): # <<<<<<<<<<<<<<
  2229. * return self._getone(key, _marker)
  2230. *
  2231. */
  2232. /* Python wrapper */
  2233. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
  2234. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  2235. PyObject *__pyx_r = 0;
  2236. __Pyx_RefNannyDeclarations
  2237. __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  2238. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_6__getitem__(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self), ((PyObject *)__pyx_v_key));
  2239. /* function exit code */
  2240. __Pyx_RefNannyFinishContext();
  2241. return __pyx_r;
  2242. }
  2243. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_6__getitem__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key) {
  2244. PyObject *__pyx_r = NULL;
  2245. __Pyx_RefNannyDeclarations
  2246. PyObject *__pyx_t_1 = NULL;
  2247. PyObject *__pyx_t_2 = NULL;
  2248. __Pyx_RefNannySetupContext("__getitem__", 0);
  2249. /* "multidict/_multidict.pyx":62
  2250. *
  2251. * def __getitem__(self, key):
  2252. * return self._getone(key, _marker) # <<<<<<<<<<<<<<
  2253. *
  2254. * def get(self, key, default=None):
  2255. */
  2256. __Pyx_XDECREF(__pyx_r);
  2257. __pyx_t_1 = __pyx_v_9multidict_10_multidict__marker;
  2258. __Pyx_INCREF(__pyx_t_1);
  2259. __pyx_t_2 = ((struct __pyx_vtabstruct_9multidict_10_multidict__Base *)__pyx_v_self->__pyx_vtab)->_getone(__pyx_v_self, __pyx_v_key, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
  2260. __Pyx_GOTREF(__pyx_t_2);
  2261. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2262. __pyx_r = __pyx_t_2;
  2263. __pyx_t_2 = 0;
  2264. goto __pyx_L0;
  2265. /* "multidict/_multidict.pyx":61
  2266. * # Mapping interface #
  2267. *
  2268. * def __getitem__(self, key): # <<<<<<<<<<<<<<
  2269. * return self._getone(key, _marker)
  2270. *
  2271. */
  2272. /* function exit code */
  2273. __pyx_L1_error:;
  2274. __Pyx_XDECREF(__pyx_t_1);
  2275. __Pyx_XDECREF(__pyx_t_2);
  2276. __Pyx_AddTraceback("multidict._multidict._Base.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2277. __pyx_r = NULL;
  2278. __pyx_L0:;
  2279. __Pyx_XGIVEREF(__pyx_r);
  2280. __Pyx_RefNannyFinishContext();
  2281. return __pyx_r;
  2282. }
  2283. /* "multidict/_multidict.pyx":64
  2284. * return self._getone(key, _marker)
  2285. *
  2286. * def get(self, key, default=None): # <<<<<<<<<<<<<<
  2287. * """Get first value matching the key.
  2288. *
  2289. */
  2290. /* Python wrapper */
  2291. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_9get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2292. static char __pyx_doc_9multidict_10_multidict_5_Base_8get[] = "Get first value matching the key.\n\n The method is alias for .getone().\n ";
  2293. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_9get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2294. PyObject *__pyx_v_key = 0;
  2295. PyObject *__pyx_v_default = 0;
  2296. PyObject *__pyx_r = 0;
  2297. __Pyx_RefNannyDeclarations
  2298. __Pyx_RefNannySetupContext("get (wrapper)", 0);
  2299. {
  2300. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
  2301. PyObject* values[2] = {0,0};
  2302. values[1] = ((PyObject *)Py_None);
  2303. if (unlikely(__pyx_kwds)) {
  2304. Py_ssize_t kw_args;
  2305. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  2306. switch (pos_args) {
  2307. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2308. CYTHON_FALLTHROUGH;
  2309. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2310. CYTHON_FALLTHROUGH;
  2311. case 0: break;
  2312. default: goto __pyx_L5_argtuple_error;
  2313. }
  2314. kw_args = PyDict_Size(__pyx_kwds);
  2315. switch (pos_args) {
  2316. case 0:
  2317. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
  2318. else goto __pyx_L5_argtuple_error;
  2319. CYTHON_FALLTHROUGH;
  2320. case 1:
  2321. if (kw_args > 0) {
  2322. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
  2323. if (value) { values[1] = value; kw_args--; }
  2324. }
  2325. }
  2326. if (unlikely(kw_args > 0)) {
  2327. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 64, __pyx_L3_error)
  2328. }
  2329. } else {
  2330. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2331. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2332. CYTHON_FALLTHROUGH;
  2333. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2334. break;
  2335. default: goto __pyx_L5_argtuple_error;
  2336. }
  2337. }
  2338. __pyx_v_key = values[0];
  2339. __pyx_v_default = values[1];
  2340. }
  2341. goto __pyx_L4_argument_unpacking_done;
  2342. __pyx_L5_argtuple_error:;
  2343. __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 64, __pyx_L3_error)
  2344. __pyx_L3_error:;
  2345. __Pyx_AddTraceback("multidict._multidict._Base.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2346. __Pyx_RefNannyFinishContext();
  2347. return NULL;
  2348. __pyx_L4_argument_unpacking_done:;
  2349. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_8get(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self), __pyx_v_key, __pyx_v_default);
  2350. /* function exit code */
  2351. __Pyx_RefNannyFinishContext();
  2352. return __pyx_r;
  2353. }
  2354. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_8get(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  2355. PyObject *__pyx_r = NULL;
  2356. __Pyx_RefNannyDeclarations
  2357. PyObject *__pyx_t_1 = NULL;
  2358. __Pyx_RefNannySetupContext("get", 0);
  2359. /* "multidict/_multidict.pyx":69
  2360. * The method is alias for .getone().
  2361. * """
  2362. * return self._getone(key, default) # <<<<<<<<<<<<<<
  2363. *
  2364. * def __contains__(self, key):
  2365. */
  2366. __Pyx_XDECREF(__pyx_r);
  2367. __pyx_t_1 = ((struct __pyx_vtabstruct_9multidict_10_multidict__Base *)__pyx_v_self->__pyx_vtab)->_getone(__pyx_v_self, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
  2368. __Pyx_GOTREF(__pyx_t_1);
  2369. __pyx_r = __pyx_t_1;
  2370. __pyx_t_1 = 0;
  2371. goto __pyx_L0;
  2372. /* "multidict/_multidict.pyx":64
  2373. * return self._getone(key, _marker)
  2374. *
  2375. * def get(self, key, default=None): # <<<<<<<<<<<<<<
  2376. * """Get first value matching the key.
  2377. *
  2378. */
  2379. /* function exit code */
  2380. __pyx_L1_error:;
  2381. __Pyx_XDECREF(__pyx_t_1);
  2382. __Pyx_AddTraceback("multidict._multidict._Base.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2383. __pyx_r = NULL;
  2384. __pyx_L0:;
  2385. __Pyx_XGIVEREF(__pyx_r);
  2386. __Pyx_RefNannyFinishContext();
  2387. return __pyx_r;
  2388. }
  2389. /* "multidict/_multidict.pyx":71
  2390. * return self._getone(key, default)
  2391. *
  2392. * def __contains__(self, key): # <<<<<<<<<<<<<<
  2393. * return self._contains(key)
  2394. *
  2395. */
  2396. /* Python wrapper */
  2397. static int __pyx_pw_9multidict_10_multidict_5_Base_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
  2398. static int __pyx_pw_9multidict_10_multidict_5_Base_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  2399. int __pyx_r;
  2400. __Pyx_RefNannyDeclarations
  2401. __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  2402. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_10__contains__(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self), ((PyObject *)__pyx_v_key));
  2403. /* function exit code */
  2404. __Pyx_RefNannyFinishContext();
  2405. return __pyx_r;
  2406. }
  2407. static int __pyx_pf_9multidict_10_multidict_5_Base_10__contains__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key) {
  2408. int __pyx_r;
  2409. __Pyx_RefNannyDeclarations
  2410. PyObject *__pyx_t_1 = NULL;
  2411. int __pyx_t_2;
  2412. __Pyx_RefNannySetupContext("__contains__", 0);
  2413. /* "multidict/_multidict.pyx":72
  2414. *
  2415. * def __contains__(self, key):
  2416. * return self._contains(key) # <<<<<<<<<<<<<<
  2417. *
  2418. * cdef _contains(self, key):
  2419. */
  2420. __pyx_t_1 = ((struct __pyx_vtabstruct_9multidict_10_multidict__Base *)__pyx_v_self->__pyx_vtab)->_contains(__pyx_v_self, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
  2421. __Pyx_GOTREF(__pyx_t_1);
  2422. __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error)
  2423. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2424. __pyx_r = __pyx_t_2;
  2425. goto __pyx_L0;
  2426. /* "multidict/_multidict.pyx":71
  2427. * return self._getone(key, default)
  2428. *
  2429. * def __contains__(self, key): # <<<<<<<<<<<<<<
  2430. * return self._contains(key)
  2431. *
  2432. */
  2433. /* function exit code */
  2434. __pyx_L1_error:;
  2435. __Pyx_XDECREF(__pyx_t_1);
  2436. __Pyx_AddTraceback("multidict._multidict._Base.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2437. __pyx_r = -1;
  2438. __pyx_L0:;
  2439. __Pyx_RefNannyFinishContext();
  2440. return __pyx_r;
  2441. }
  2442. /* "multidict/_multidict.pyx":74
  2443. * return self._contains(key)
  2444. *
  2445. * cdef _contains(self, key): # <<<<<<<<<<<<<<
  2446. * return pair_list_contains(self._impl, key)
  2447. *
  2448. */
  2449. static PyObject *__pyx_f_9multidict_10_multidict_5_Base__contains(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_key) {
  2450. PyObject *__pyx_r = NULL;
  2451. __Pyx_RefNannyDeclarations
  2452. PyObject *__pyx_t_1 = NULL;
  2453. int __pyx_t_2;
  2454. __Pyx_RefNannySetupContext("_contains", 0);
  2455. /* "multidict/_multidict.pyx":75
  2456. *
  2457. * cdef _contains(self, key):
  2458. * return pair_list_contains(self._impl, key) # <<<<<<<<<<<<<<
  2459. *
  2460. * def __iter__(self):
  2461. */
  2462. __Pyx_XDECREF(__pyx_r);
  2463. __pyx_t_1 = __pyx_v_self->_impl;
  2464. __Pyx_INCREF(__pyx_t_1);
  2465. __pyx_t_2 = pair_list_contains(__pyx_t_1, __pyx_v_key); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 75, __pyx_L1_error)
  2466. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2467. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
  2468. __Pyx_GOTREF(__pyx_t_1);
  2469. __pyx_r = __pyx_t_1;
  2470. __pyx_t_1 = 0;
  2471. goto __pyx_L0;
  2472. /* "multidict/_multidict.pyx":74
  2473. * return self._contains(key)
  2474. *
  2475. * cdef _contains(self, key): # <<<<<<<<<<<<<<
  2476. * return pair_list_contains(self._impl, key)
  2477. *
  2478. */
  2479. /* function exit code */
  2480. __pyx_L1_error:;
  2481. __Pyx_XDECREF(__pyx_t_1);
  2482. __Pyx_AddTraceback("multidict._multidict._Base._contains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2483. __pyx_r = 0;
  2484. __pyx_L0:;
  2485. __Pyx_XGIVEREF(__pyx_r);
  2486. __Pyx_RefNannyFinishContext();
  2487. return __pyx_r;
  2488. }
  2489. /* "multidict/_multidict.pyx":77
  2490. * return pair_list_contains(self._impl, key)
  2491. *
  2492. * def __iter__(self): # <<<<<<<<<<<<<<
  2493. * return iter(self.keys())
  2494. *
  2495. */
  2496. /* Python wrapper */
  2497. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_13__iter__(PyObject *__pyx_v_self); /*proto*/
  2498. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_13__iter__(PyObject *__pyx_v_self) {
  2499. PyObject *__pyx_r = 0;
  2500. __Pyx_RefNannyDeclarations
  2501. __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  2502. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_12__iter__(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self));
  2503. /* function exit code */
  2504. __Pyx_RefNannyFinishContext();
  2505. return __pyx_r;
  2506. }
  2507. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_12__iter__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self) {
  2508. PyObject *__pyx_r = NULL;
  2509. __Pyx_RefNannyDeclarations
  2510. PyObject *__pyx_t_1 = NULL;
  2511. PyObject *__pyx_t_2 = NULL;
  2512. __Pyx_RefNannySetupContext("__iter__", 0);
  2513. /* "multidict/_multidict.pyx":78
  2514. *
  2515. * def __iter__(self):
  2516. * return iter(self.keys()) # <<<<<<<<<<<<<<
  2517. *
  2518. * def __len__(self):
  2519. */
  2520. __Pyx_XDECREF(__pyx_r);
  2521. __pyx_t_1 = ((struct __pyx_vtabstruct_9multidict_10_multidict__Base *)__pyx_v_self->__pyx_vtab)->keys(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
  2522. __Pyx_GOTREF(__pyx_t_1);
  2523. __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
  2524. __Pyx_GOTREF(__pyx_t_2);
  2525. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2526. __pyx_r = __pyx_t_2;
  2527. __pyx_t_2 = 0;
  2528. goto __pyx_L0;
  2529. /* "multidict/_multidict.pyx":77
  2530. * return pair_list_contains(self._impl, key)
  2531. *
  2532. * def __iter__(self): # <<<<<<<<<<<<<<
  2533. * return iter(self.keys())
  2534. *
  2535. */
  2536. /* function exit code */
  2537. __pyx_L1_error:;
  2538. __Pyx_XDECREF(__pyx_t_1);
  2539. __Pyx_XDECREF(__pyx_t_2);
  2540. __Pyx_AddTraceback("multidict._multidict._Base.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2541. __pyx_r = NULL;
  2542. __pyx_L0:;
  2543. __Pyx_XGIVEREF(__pyx_r);
  2544. __Pyx_RefNannyFinishContext();
  2545. return __pyx_r;
  2546. }
  2547. /* "multidict/_multidict.pyx":80
  2548. * return iter(self.keys())
  2549. *
  2550. * def __len__(self): # <<<<<<<<<<<<<<
  2551. * return pair_list_len(self._impl)
  2552. *
  2553. */
  2554. /* Python wrapper */
  2555. static Py_ssize_t __pyx_pw_9multidict_10_multidict_5_Base_15__len__(PyObject *__pyx_v_self); /*proto*/
  2556. static Py_ssize_t __pyx_pw_9multidict_10_multidict_5_Base_15__len__(PyObject *__pyx_v_self) {
  2557. Py_ssize_t __pyx_r;
  2558. __Pyx_RefNannyDeclarations
  2559. __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  2560. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_14__len__(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self));
  2561. /* function exit code */
  2562. __Pyx_RefNannyFinishContext();
  2563. return __pyx_r;
  2564. }
  2565. static Py_ssize_t __pyx_pf_9multidict_10_multidict_5_Base_14__len__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self) {
  2566. Py_ssize_t __pyx_r;
  2567. __Pyx_RefNannyDeclarations
  2568. PyObject *__pyx_t_1 = NULL;
  2569. int __pyx_t_2;
  2570. __Pyx_RefNannySetupContext("__len__", 0);
  2571. /* "multidict/_multidict.pyx":81
  2572. *
  2573. * def __len__(self):
  2574. * return pair_list_len(self._impl) # <<<<<<<<<<<<<<
  2575. *
  2576. * cpdef keys(self):
  2577. */
  2578. __pyx_t_1 = __pyx_v_self->_impl;
  2579. __Pyx_INCREF(__pyx_t_1);
  2580. __pyx_t_2 = pair_list_len(__pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 81, __pyx_L1_error)
  2581. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2582. __pyx_r = __pyx_t_2;
  2583. goto __pyx_L0;
  2584. /* "multidict/_multidict.pyx":80
  2585. * return iter(self.keys())
  2586. *
  2587. * def __len__(self): # <<<<<<<<<<<<<<
  2588. * return pair_list_len(self._impl)
  2589. *
  2590. */
  2591. /* function exit code */
  2592. __pyx_L1_error:;
  2593. __Pyx_XDECREF(__pyx_t_1);
  2594. __Pyx_AddTraceback("multidict._multidict._Base.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2595. __pyx_r = -1;
  2596. __pyx_L0:;
  2597. __Pyx_RefNannyFinishContext();
  2598. return __pyx_r;
  2599. }
  2600. /* "multidict/_multidict.pyx":83
  2601. * return pair_list_len(self._impl)
  2602. *
  2603. * cpdef keys(self): # <<<<<<<<<<<<<<
  2604. * """Return a new view of the dictionary's keys."""
  2605. * return multidict_keysview_new(self)
  2606. */
  2607. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_17keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  2608. static PyObject *__pyx_f_9multidict_10_multidict_5_Base_keys(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, int __pyx_skip_dispatch) {
  2609. PyObject *__pyx_r = NULL;
  2610. __Pyx_RefNannyDeclarations
  2611. PyObject *__pyx_t_1 = NULL;
  2612. PyObject *__pyx_t_2 = NULL;
  2613. PyObject *__pyx_t_3 = NULL;
  2614. PyObject *__pyx_t_4 = NULL;
  2615. __Pyx_RefNannySetupContext("keys", 0);
  2616. /* Check if called by wrapper */
  2617. if (unlikely(__pyx_skip_dispatch)) ;
  2618. /* Check if overridden in Python */
  2619. 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)))) {
  2620. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
  2621. static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0;
  2622. if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))))));
  2623. else {
  2624. PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
  2625. #endif
  2626. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
  2627. __Pyx_GOTREF(__pyx_t_1);
  2628. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9multidict_10_multidict_5_Base_17keys)) {
  2629. __Pyx_XDECREF(__pyx_r);
  2630. __Pyx_INCREF(__pyx_t_1);
  2631. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  2632. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  2633. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  2634. if (likely(__pyx_t_4)) {
  2635. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  2636. __Pyx_INCREF(__pyx_t_4);
  2637. __Pyx_INCREF(function);
  2638. __Pyx_DECREF_SET(__pyx_t_3, function);
  2639. }
  2640. }
  2641. __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  2642. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  2643. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
  2644. __Pyx_GOTREF(__pyx_t_2);
  2645. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2646. __pyx_r = __pyx_t_2;
  2647. __pyx_t_2 = 0;
  2648. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2649. goto __pyx_L0;
  2650. }
  2651. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
  2652. tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
  2653. obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0;
  2654. if (unlikely(type_dict_guard != tp_dict_version)) {
  2655. tp_dict_version = obj_dict_version = 0;
  2656. }
  2657. #endif
  2658. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2659. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
  2660. }
  2661. #endif
  2662. }
  2663. /* "multidict/_multidict.pyx":85
  2664. * cpdef keys(self):
  2665. * """Return a new view of the dictionary's keys."""
  2666. * return multidict_keysview_new(self) # <<<<<<<<<<<<<<
  2667. *
  2668. * def items(self):
  2669. */
  2670. __Pyx_XDECREF(__pyx_r);
  2671. __pyx_t_1 = multidict_keysview_new(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
  2672. __Pyx_GOTREF(__pyx_t_1);
  2673. __pyx_r = __pyx_t_1;
  2674. __pyx_t_1 = 0;
  2675. goto __pyx_L0;
  2676. /* "multidict/_multidict.pyx":83
  2677. * return pair_list_len(self._impl)
  2678. *
  2679. * cpdef keys(self): # <<<<<<<<<<<<<<
  2680. * """Return a new view of the dictionary's keys."""
  2681. * return multidict_keysview_new(self)
  2682. */
  2683. /* function exit code */
  2684. __pyx_L1_error:;
  2685. __Pyx_XDECREF(__pyx_t_1);
  2686. __Pyx_XDECREF(__pyx_t_2);
  2687. __Pyx_XDECREF(__pyx_t_3);
  2688. __Pyx_XDECREF(__pyx_t_4);
  2689. __Pyx_AddTraceback("multidict._multidict._Base.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2690. __pyx_r = 0;
  2691. __pyx_L0:;
  2692. __Pyx_XGIVEREF(__pyx_r);
  2693. __Pyx_RefNannyFinishContext();
  2694. return __pyx_r;
  2695. }
  2696. /* Python wrapper */
  2697. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_17keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  2698. static char __pyx_doc_9multidict_10_multidict_5_Base_16keys[] = "Return a new view of the dictionary's keys.";
  2699. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_17keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  2700. PyObject *__pyx_r = 0;
  2701. __Pyx_RefNannyDeclarations
  2702. __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  2703. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_16keys(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self));
  2704. /* function exit code */
  2705. __Pyx_RefNannyFinishContext();
  2706. return __pyx_r;
  2707. }
  2708. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_16keys(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self) {
  2709. PyObject *__pyx_r = NULL;
  2710. __Pyx_RefNannyDeclarations
  2711. PyObject *__pyx_t_1 = NULL;
  2712. __Pyx_RefNannySetupContext("keys", 0);
  2713. __Pyx_XDECREF(__pyx_r);
  2714. __pyx_t_1 = __pyx_f_9multidict_10_multidict_5_Base_keys(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
  2715. __Pyx_GOTREF(__pyx_t_1);
  2716. __pyx_r = __pyx_t_1;
  2717. __pyx_t_1 = 0;
  2718. goto __pyx_L0;
  2719. /* function exit code */
  2720. __pyx_L1_error:;
  2721. __Pyx_XDECREF(__pyx_t_1);
  2722. __Pyx_AddTraceback("multidict._multidict._Base.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2723. __pyx_r = NULL;
  2724. __pyx_L0:;
  2725. __Pyx_XGIVEREF(__pyx_r);
  2726. __Pyx_RefNannyFinishContext();
  2727. return __pyx_r;
  2728. }
  2729. /* "multidict/_multidict.pyx":87
  2730. * return multidict_keysview_new(self)
  2731. *
  2732. * def items(self): # <<<<<<<<<<<<<<
  2733. * """Return a new view of the dictionary's items *(key, value) pairs)."""
  2734. * return multidict_itemsview_new(self)
  2735. */
  2736. /* Python wrapper */
  2737. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_19items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  2738. static char __pyx_doc_9multidict_10_multidict_5_Base_18items[] = "Return a new view of the dictionary's items *(key, value) pairs).";
  2739. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_19items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  2740. PyObject *__pyx_r = 0;
  2741. __Pyx_RefNannyDeclarations
  2742. __Pyx_RefNannySetupContext("items (wrapper)", 0);
  2743. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_18items(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self));
  2744. /* function exit code */
  2745. __Pyx_RefNannyFinishContext();
  2746. return __pyx_r;
  2747. }
  2748. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_18items(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self) {
  2749. PyObject *__pyx_r = NULL;
  2750. __Pyx_RefNannyDeclarations
  2751. PyObject *__pyx_t_1 = NULL;
  2752. __Pyx_RefNannySetupContext("items", 0);
  2753. /* "multidict/_multidict.pyx":89
  2754. * def items(self):
  2755. * """Return a new view of the dictionary's items *(key, value) pairs)."""
  2756. * return multidict_itemsview_new(self) # <<<<<<<<<<<<<<
  2757. *
  2758. * def values(self):
  2759. */
  2760. __Pyx_XDECREF(__pyx_r);
  2761. __pyx_t_1 = multidict_itemsview_new(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
  2762. __Pyx_GOTREF(__pyx_t_1);
  2763. __pyx_r = __pyx_t_1;
  2764. __pyx_t_1 = 0;
  2765. goto __pyx_L0;
  2766. /* "multidict/_multidict.pyx":87
  2767. * return multidict_keysview_new(self)
  2768. *
  2769. * def items(self): # <<<<<<<<<<<<<<
  2770. * """Return a new view of the dictionary's items *(key, value) pairs)."""
  2771. * return multidict_itemsview_new(self)
  2772. */
  2773. /* function exit code */
  2774. __pyx_L1_error:;
  2775. __Pyx_XDECREF(__pyx_t_1);
  2776. __Pyx_AddTraceback("multidict._multidict._Base.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2777. __pyx_r = NULL;
  2778. __pyx_L0:;
  2779. __Pyx_XGIVEREF(__pyx_r);
  2780. __Pyx_RefNannyFinishContext();
  2781. return __pyx_r;
  2782. }
  2783. /* "multidict/_multidict.pyx":91
  2784. * return multidict_itemsview_new(self)
  2785. *
  2786. * def values(self): # <<<<<<<<<<<<<<
  2787. * """Return a new view of the dictionary's values."""
  2788. * return multidict_valuesview_new(self)
  2789. */
  2790. /* Python wrapper */
  2791. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_21values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  2792. static char __pyx_doc_9multidict_10_multidict_5_Base_20values[] = "Return a new view of the dictionary's values.";
  2793. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_21values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  2794. PyObject *__pyx_r = 0;
  2795. __Pyx_RefNannyDeclarations
  2796. __Pyx_RefNannySetupContext("values (wrapper)", 0);
  2797. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_20values(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self));
  2798. /* function exit code */
  2799. __Pyx_RefNannyFinishContext();
  2800. return __pyx_r;
  2801. }
  2802. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_20values(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self) {
  2803. PyObject *__pyx_r = NULL;
  2804. __Pyx_RefNannyDeclarations
  2805. PyObject *__pyx_t_1 = NULL;
  2806. __Pyx_RefNannySetupContext("values", 0);
  2807. /* "multidict/_multidict.pyx":93
  2808. * def values(self):
  2809. * """Return a new view of the dictionary's values."""
  2810. * return multidict_valuesview_new(self) # <<<<<<<<<<<<<<
  2811. *
  2812. * def __repr__(self):
  2813. */
  2814. __Pyx_XDECREF(__pyx_r);
  2815. __pyx_t_1 = multidict_valuesview_new(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
  2816. __Pyx_GOTREF(__pyx_t_1);
  2817. __pyx_r = __pyx_t_1;
  2818. __pyx_t_1 = 0;
  2819. goto __pyx_L0;
  2820. /* "multidict/_multidict.pyx":91
  2821. * return multidict_itemsview_new(self)
  2822. *
  2823. * def values(self): # <<<<<<<<<<<<<<
  2824. * """Return a new view of the dictionary's values."""
  2825. * return multidict_valuesview_new(self)
  2826. */
  2827. /* function exit code */
  2828. __pyx_L1_error:;
  2829. __Pyx_XDECREF(__pyx_t_1);
  2830. __Pyx_AddTraceback("multidict._multidict._Base.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2831. __pyx_r = NULL;
  2832. __pyx_L0:;
  2833. __Pyx_XGIVEREF(__pyx_r);
  2834. __Pyx_RefNannyFinishContext();
  2835. return __pyx_r;
  2836. }
  2837. /* "multidict/_multidict.pyx":95
  2838. * return multidict_valuesview_new(self)
  2839. *
  2840. * def __repr__(self): # <<<<<<<<<<<<<<
  2841. * lst = []
  2842. * for k, v in self.items():
  2843. */
  2844. /* Python wrapper */
  2845. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_23__repr__(PyObject *__pyx_v_self); /*proto*/
  2846. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_23__repr__(PyObject *__pyx_v_self) {
  2847. PyObject *__pyx_r = 0;
  2848. __Pyx_RefNannyDeclarations
  2849. __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  2850. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_22__repr__(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self));
  2851. /* function exit code */
  2852. __Pyx_RefNannyFinishContext();
  2853. return __pyx_r;
  2854. }
  2855. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_22__repr__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self) {
  2856. PyObject *__pyx_v_lst = NULL;
  2857. PyObject *__pyx_v_k = NULL;
  2858. PyObject *__pyx_v_v = NULL;
  2859. PyObject *__pyx_v_body = NULL;
  2860. PyObject *__pyx_r = NULL;
  2861. __Pyx_RefNannyDeclarations
  2862. PyObject *__pyx_t_1 = NULL;
  2863. PyObject *__pyx_t_2 = NULL;
  2864. PyObject *__pyx_t_3 = NULL;
  2865. Py_ssize_t __pyx_t_4;
  2866. PyObject *(*__pyx_t_5)(PyObject *);
  2867. PyObject *__pyx_t_6 = NULL;
  2868. PyObject *__pyx_t_7 = NULL;
  2869. PyObject *(*__pyx_t_8)(PyObject *);
  2870. int __pyx_t_9;
  2871. int __pyx_t_10;
  2872. __Pyx_RefNannySetupContext("__repr__", 0);
  2873. /* "multidict/_multidict.pyx":96
  2874. *
  2875. * def __repr__(self):
  2876. * lst = [] # <<<<<<<<<<<<<<
  2877. * for k, v in self.items():
  2878. * lst.append("'{}': {!r}".format(k, v))
  2879. */
  2880. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
  2881. __Pyx_GOTREF(__pyx_t_1);
  2882. __pyx_v_lst = ((PyObject*)__pyx_t_1);
  2883. __pyx_t_1 = 0;
  2884. /* "multidict/_multidict.pyx":97
  2885. * def __repr__(self):
  2886. * lst = []
  2887. * for k, v in self.items(): # <<<<<<<<<<<<<<
  2888. * lst.append("'{}': {!r}".format(k, v))
  2889. * body = ', '.join(lst)
  2890. */
  2891. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
  2892. __Pyx_GOTREF(__pyx_t_2);
  2893. __pyx_t_3 = NULL;
  2894. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  2895. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  2896. if (likely(__pyx_t_3)) {
  2897. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  2898. __Pyx_INCREF(__pyx_t_3);
  2899. __Pyx_INCREF(function);
  2900. __Pyx_DECREF_SET(__pyx_t_2, function);
  2901. }
  2902. }
  2903. __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  2904. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  2905. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
  2906. __Pyx_GOTREF(__pyx_t_1);
  2907. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2908. if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
  2909. __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
  2910. __pyx_t_5 = NULL;
  2911. } else {
  2912. __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
  2913. __Pyx_GOTREF(__pyx_t_2);
  2914. __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
  2915. }
  2916. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2917. for (;;) {
  2918. if (likely(!__pyx_t_5)) {
  2919. if (likely(PyList_CheckExact(__pyx_t_2))) {
  2920. if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
  2921. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  2922. __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 97, __pyx_L1_error)
  2923. #else
  2924. __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
  2925. __Pyx_GOTREF(__pyx_t_1);
  2926. #endif
  2927. } else {
  2928. if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
  2929. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  2930. __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 97, __pyx_L1_error)
  2931. #else
  2932. __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
  2933. __Pyx_GOTREF(__pyx_t_1);
  2934. #endif
  2935. }
  2936. } else {
  2937. __pyx_t_1 = __pyx_t_5(__pyx_t_2);
  2938. if (unlikely(!__pyx_t_1)) {
  2939. PyObject* exc_type = PyErr_Occurred();
  2940. if (exc_type) {
  2941. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  2942. else __PYX_ERR(0, 97, __pyx_L1_error)
  2943. }
  2944. break;
  2945. }
  2946. __Pyx_GOTREF(__pyx_t_1);
  2947. }
  2948. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  2949. PyObject* sequence = __pyx_t_1;
  2950. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  2951. if (unlikely(size != 2)) {
  2952. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  2953. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  2954. __PYX_ERR(0, 97, __pyx_L1_error)
  2955. }
  2956. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  2957. if (likely(PyTuple_CheckExact(sequence))) {
  2958. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  2959. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
  2960. } else {
  2961. __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
  2962. __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
  2963. }
  2964. __Pyx_INCREF(__pyx_t_3);
  2965. __Pyx_INCREF(__pyx_t_6);
  2966. #else
  2967. __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error)
  2968. __Pyx_GOTREF(__pyx_t_3);
  2969. __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error)
  2970. __Pyx_GOTREF(__pyx_t_6);
  2971. #endif
  2972. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2973. } else {
  2974. Py_ssize_t index = -1;
  2975. __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error)
  2976. __Pyx_GOTREF(__pyx_t_7);
  2977. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2978. __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
  2979. index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
  2980. __Pyx_GOTREF(__pyx_t_3);
  2981. index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
  2982. __Pyx_GOTREF(__pyx_t_6);
  2983. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
  2984. __pyx_t_8 = NULL;
  2985. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2986. goto __pyx_L6_unpacking_done;
  2987. __pyx_L5_unpacking_failed:;
  2988. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2989. __pyx_t_8 = NULL;
  2990. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  2991. __PYX_ERR(0, 97, __pyx_L1_error)
  2992. __pyx_L6_unpacking_done:;
  2993. }
  2994. __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3);
  2995. __pyx_t_3 = 0;
  2996. __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
  2997. __pyx_t_6 = 0;
  2998. /* "multidict/_multidict.pyx":98
  2999. * lst = []
  3000. * for k, v in self.items():
  3001. * lst.append("'{}': {!r}".format(k, v)) # <<<<<<<<<<<<<<
  3002. * body = ', '.join(lst)
  3003. * return '<{}({})>'.format(self.__class__.__name__, body)
  3004. */
  3005. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_r, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error)
  3006. __Pyx_GOTREF(__pyx_t_6);
  3007. __pyx_t_3 = NULL;
  3008. __pyx_t_9 = 0;
  3009. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
  3010. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
  3011. if (likely(__pyx_t_3)) {
  3012. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  3013. __Pyx_INCREF(__pyx_t_3);
  3014. __Pyx_INCREF(function);
  3015. __Pyx_DECREF_SET(__pyx_t_6, function);
  3016. __pyx_t_9 = 1;
  3017. }
  3018. }
  3019. #if CYTHON_FAST_PYCALL
  3020. if (PyFunction_Check(__pyx_t_6)) {
  3021. PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_k, __pyx_v_v};
  3022. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
  3023. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  3024. __Pyx_GOTREF(__pyx_t_1);
  3025. } else
  3026. #endif
  3027. #if CYTHON_FAST_PYCCALL
  3028. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  3029. PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_k, __pyx_v_v};
  3030. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
  3031. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  3032. __Pyx_GOTREF(__pyx_t_1);
  3033. } else
  3034. #endif
  3035. {
  3036. __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L1_error)
  3037. __Pyx_GOTREF(__pyx_t_7);
  3038. if (__pyx_t_3) {
  3039. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
  3040. }
  3041. __Pyx_INCREF(__pyx_v_k);
  3042. __Pyx_GIVEREF(__pyx_v_k);
  3043. PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_v_k);
  3044. __Pyx_INCREF(__pyx_v_v);
  3045. __Pyx_GIVEREF(__pyx_v_v);
  3046. PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_v_v);
  3047. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
  3048. __Pyx_GOTREF(__pyx_t_1);
  3049. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3050. }
  3051. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3052. __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_lst, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 98, __pyx_L1_error)
  3053. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3054. /* "multidict/_multidict.pyx":97
  3055. * def __repr__(self):
  3056. * lst = []
  3057. * for k, v in self.items(): # <<<<<<<<<<<<<<
  3058. * lst.append("'{}': {!r}".format(k, v))
  3059. * body = ', '.join(lst)
  3060. */
  3061. }
  3062. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3063. /* "multidict/_multidict.pyx":99
  3064. * for k, v in self.items():
  3065. * lst.append("'{}': {!r}".format(k, v))
  3066. * body = ', '.join(lst) # <<<<<<<<<<<<<<
  3067. * return '<{}({})>'.format(self.__class__.__name__, body)
  3068. *
  3069. */
  3070. __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__3, __pyx_v_lst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
  3071. __Pyx_GOTREF(__pyx_t_2);
  3072. __pyx_v_body = ((PyObject*)__pyx_t_2);
  3073. __pyx_t_2 = 0;
  3074. /* "multidict/_multidict.pyx":100
  3075. * lst.append("'{}': {!r}".format(k, v))
  3076. * body = ', '.join(lst)
  3077. * return '<{}({})>'.format(self.__class__.__name__, body) # <<<<<<<<<<<<<<
  3078. *
  3079. * def __eq__(self, arg):
  3080. */
  3081. __Pyx_XDECREF(__pyx_r);
  3082. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s__4, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
  3083. __Pyx_GOTREF(__pyx_t_1);
  3084. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 100, __pyx_L1_error)
  3085. __Pyx_GOTREF(__pyx_t_6);
  3086. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 100, __pyx_L1_error)
  3087. __Pyx_GOTREF(__pyx_t_7);
  3088. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3089. __pyx_t_6 = NULL;
  3090. __pyx_t_9 = 0;
  3091. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
  3092. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
  3093. if (likely(__pyx_t_6)) {
  3094. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  3095. __Pyx_INCREF(__pyx_t_6);
  3096. __Pyx_INCREF(function);
  3097. __Pyx_DECREF_SET(__pyx_t_1, function);
  3098. __pyx_t_9 = 1;
  3099. }
  3100. }
  3101. #if CYTHON_FAST_PYCALL
  3102. if (PyFunction_Check(__pyx_t_1)) {
  3103. PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_7, __pyx_v_body};
  3104. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
  3105. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  3106. __Pyx_GOTREF(__pyx_t_2);
  3107. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3108. } else
  3109. #endif
  3110. #if CYTHON_FAST_PYCCALL
  3111. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  3112. PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_7, __pyx_v_body};
  3113. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
  3114. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  3115. __Pyx_GOTREF(__pyx_t_2);
  3116. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3117. } else
  3118. #endif
  3119. {
  3120. __pyx_t_3 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __pyx_L1_error)
  3121. __Pyx_GOTREF(__pyx_t_3);
  3122. if (__pyx_t_6) {
  3123. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
  3124. }
  3125. __Pyx_GIVEREF(__pyx_t_7);
  3126. PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_t_7);
  3127. __Pyx_INCREF(__pyx_v_body);
  3128. __Pyx_GIVEREF(__pyx_v_body);
  3129. PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_v_body);
  3130. __pyx_t_7 = 0;
  3131. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
  3132. __Pyx_GOTREF(__pyx_t_2);
  3133. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3134. }
  3135. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3136. __pyx_r = __pyx_t_2;
  3137. __pyx_t_2 = 0;
  3138. goto __pyx_L0;
  3139. /* "multidict/_multidict.pyx":95
  3140. * return multidict_valuesview_new(self)
  3141. *
  3142. * def __repr__(self): # <<<<<<<<<<<<<<
  3143. * lst = []
  3144. * for k, v in self.items():
  3145. */
  3146. /* function exit code */
  3147. __pyx_L1_error:;
  3148. __Pyx_XDECREF(__pyx_t_1);
  3149. __Pyx_XDECREF(__pyx_t_2);
  3150. __Pyx_XDECREF(__pyx_t_3);
  3151. __Pyx_XDECREF(__pyx_t_6);
  3152. __Pyx_XDECREF(__pyx_t_7);
  3153. __Pyx_AddTraceback("multidict._multidict._Base.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3154. __pyx_r = NULL;
  3155. __pyx_L0:;
  3156. __Pyx_XDECREF(__pyx_v_lst);
  3157. __Pyx_XDECREF(__pyx_v_k);
  3158. __Pyx_XDECREF(__pyx_v_v);
  3159. __Pyx_XDECREF(__pyx_v_body);
  3160. __Pyx_XGIVEREF(__pyx_r);
  3161. __Pyx_RefNannyFinishContext();
  3162. return __pyx_r;
  3163. }
  3164. /* "multidict/_multidict.pyx":102
  3165. * return '<{}({})>'.format(self.__class__.__name__, body)
  3166. *
  3167. * def __eq__(self, arg): # <<<<<<<<<<<<<<
  3168. * cdef Py_ssize_t pos1
  3169. * cdef PyObject *identity1
  3170. */
  3171. /* Python wrapper */
  3172. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_25__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_arg); /*proto*/
  3173. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_25__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_arg) {
  3174. PyObject *__pyx_r = 0;
  3175. __Pyx_RefNannyDeclarations
  3176. __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  3177. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_24__eq__(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self), ((PyObject *)__pyx_v_arg));
  3178. /* function exit code */
  3179. __Pyx_RefNannyFinishContext();
  3180. return __pyx_r;
  3181. }
  3182. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_24__eq__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v_arg) {
  3183. Py_ssize_t __pyx_v_pos1;
  3184. PyObject *__pyx_v_identity1;
  3185. PyObject *__pyx_v_value1;
  3186. Py_hash_t __pyx_v_h1;
  3187. Py_ssize_t __pyx_v_pos2;
  3188. PyObject *__pyx_v_identity2;
  3189. PyObject *__pyx_v_value2;
  3190. Py_hash_t __pyx_v_h2;
  3191. struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_other = 0;
  3192. PyObject *__pyx_r = NULL;
  3193. __Pyx_RefNannyDeclarations
  3194. int __pyx_t_1;
  3195. int __pyx_t_2;
  3196. PyObject *__pyx_t_3 = NULL;
  3197. int __pyx_t_4;
  3198. int __pyx_t_5;
  3199. PyObject *__pyx_t_6 = NULL;
  3200. __Pyx_RefNannySetupContext("__eq__", 0);
  3201. /* "multidict/_multidict.pyx":115
  3202. * cdef _Base other
  3203. *
  3204. * if isinstance(arg, _Base): # <<<<<<<<<<<<<<
  3205. * other = <_Base>arg
  3206. * if pair_list_len(self._impl) != pair_list_len(other._impl):
  3207. */
  3208. __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_ptype_9multidict_10_multidict__Base);
  3209. __pyx_t_2 = (__pyx_t_1 != 0);
  3210. if (__pyx_t_2) {
  3211. /* "multidict/_multidict.pyx":116
  3212. *
  3213. * if isinstance(arg, _Base):
  3214. * other = <_Base>arg # <<<<<<<<<<<<<<
  3215. * if pair_list_len(self._impl) != pair_list_len(other._impl):
  3216. * return False
  3217. */
  3218. __pyx_t_3 = __pyx_v_arg;
  3219. __Pyx_INCREF(__pyx_t_3);
  3220. __pyx_v_other = ((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_t_3);
  3221. __pyx_t_3 = 0;
  3222. /* "multidict/_multidict.pyx":117
  3223. * if isinstance(arg, _Base):
  3224. * other = <_Base>arg
  3225. * if pair_list_len(self._impl) != pair_list_len(other._impl): # <<<<<<<<<<<<<<
  3226. * return False
  3227. * pos1 = pos2 = 0
  3228. */
  3229. __pyx_t_3 = __pyx_v_self->_impl;
  3230. __Pyx_INCREF(__pyx_t_3);
  3231. __pyx_t_4 = pair_list_len(__pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 117, __pyx_L1_error)
  3232. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3233. __pyx_t_3 = __pyx_v_other->_impl;
  3234. __Pyx_INCREF(__pyx_t_3);
  3235. __pyx_t_5 = pair_list_len(__pyx_t_3); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 117, __pyx_L1_error)
  3236. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3237. __pyx_t_2 = ((__pyx_t_4 != __pyx_t_5) != 0);
  3238. if (__pyx_t_2) {
  3239. /* "multidict/_multidict.pyx":118
  3240. * other = <_Base>arg
  3241. * if pair_list_len(self._impl) != pair_list_len(other._impl):
  3242. * return False # <<<<<<<<<<<<<<
  3243. * pos1 = pos2 = 0
  3244. * while (_pair_list_next(self._impl, &pos1, &identity1,
  3245. */
  3246. __Pyx_XDECREF(__pyx_r);
  3247. __Pyx_INCREF(Py_False);
  3248. __pyx_r = Py_False;
  3249. goto __pyx_L0;
  3250. /* "multidict/_multidict.pyx":117
  3251. * if isinstance(arg, _Base):
  3252. * other = <_Base>arg
  3253. * if pair_list_len(self._impl) != pair_list_len(other._impl): # <<<<<<<<<<<<<<
  3254. * return False
  3255. * pos1 = pos2 = 0
  3256. */
  3257. }
  3258. /* "multidict/_multidict.pyx":119
  3259. * if pair_list_len(self._impl) != pair_list_len(other._impl):
  3260. * return False
  3261. * pos1 = pos2 = 0 # <<<<<<<<<<<<<<
  3262. * while (_pair_list_next(self._impl, &pos1, &identity1,
  3263. * NULL, &value1, &h1) and
  3264. */
  3265. __pyx_v_pos1 = 0;
  3266. __pyx_v_pos2 = 0;
  3267. /* "multidict/_multidict.pyx":120
  3268. * return False
  3269. * pos1 = pos2 = 0
  3270. * while (_pair_list_next(self._impl, &pos1, &identity1, # <<<<<<<<<<<<<<
  3271. * NULL, &value1, &h1) and
  3272. * _pair_list_next(other._impl, &pos2, &identity2,
  3273. */
  3274. while (1) {
  3275. /* "multidict/_multidict.pyx":121
  3276. * pos1 = pos2 = 0
  3277. * while (_pair_list_next(self._impl, &pos1, &identity1,
  3278. * NULL, &value1, &h1) and # <<<<<<<<<<<<<<
  3279. * _pair_list_next(other._impl, &pos2, &identity2,
  3280. * NULL, &value2, &h2)):
  3281. */
  3282. __pyx_t_3 = __pyx_v_self->_impl;
  3283. __Pyx_INCREF(__pyx_t_3);
  3284. /* "multidict/_multidict.pyx":120
  3285. * return False
  3286. * pos1 = pos2 = 0
  3287. * while (_pair_list_next(self._impl, &pos1, &identity1, # <<<<<<<<<<<<<<
  3288. * NULL, &value1, &h1) and
  3289. * _pair_list_next(other._impl, &pos2, &identity2,
  3290. */
  3291. __pyx_t_5 = _pair_list_next(__pyx_t_3, (&__pyx_v_pos1), (&__pyx_v_identity1), NULL, (&__pyx_v_value1), (&__pyx_v_h1)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 120, __pyx_L1_error)
  3292. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3293. __pyx_t_1 = (__pyx_t_5 != 0);
  3294. if (__pyx_t_1) {
  3295. } else {
  3296. __pyx_t_2 = __pyx_t_1;
  3297. goto __pyx_L7_bool_binop_done;
  3298. }
  3299. /* "multidict/_multidict.pyx":122
  3300. * while (_pair_list_next(self._impl, &pos1, &identity1,
  3301. * NULL, &value1, &h1) and
  3302. * _pair_list_next(other._impl, &pos2, &identity2, # <<<<<<<<<<<<<<
  3303. * NULL, &value2, &h2)):
  3304. * if h1 != h2:
  3305. */
  3306. __pyx_t_3 = __pyx_v_other->_impl;
  3307. __Pyx_INCREF(__pyx_t_3);
  3308. /* "multidict/_multidict.pyx":123
  3309. * NULL, &value1, &h1) and
  3310. * _pair_list_next(other._impl, &pos2, &identity2,
  3311. * NULL, &value2, &h2)): # <<<<<<<<<<<<<<
  3312. * if h1 != h2:
  3313. * return False
  3314. */
  3315. __pyx_t_5 = _pair_list_next(__pyx_t_3, (&__pyx_v_pos2), (&__pyx_v_identity2), NULL, (&__pyx_v_value2), (&__pyx_v_h2)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 122, __pyx_L1_error)
  3316. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3317. /* "multidict/_multidict.pyx":122
  3318. * while (_pair_list_next(self._impl, &pos1, &identity1,
  3319. * NULL, &value1, &h1) and
  3320. * _pair_list_next(other._impl, &pos2, &identity2, # <<<<<<<<<<<<<<
  3321. * NULL, &value2, &h2)):
  3322. * if h1 != h2:
  3323. */
  3324. __pyx_t_1 = (__pyx_t_5 != 0);
  3325. __pyx_t_2 = __pyx_t_1;
  3326. __pyx_L7_bool_binop_done:;
  3327. if (!__pyx_t_2) break;
  3328. /* "multidict/_multidict.pyx":124
  3329. * _pair_list_next(other._impl, &pos2, &identity2,
  3330. * NULL, &value2, &h2)):
  3331. * if h1 != h2: # <<<<<<<<<<<<<<
  3332. * return False
  3333. * if PyObject_RichCompare(<object>identity1, <object>identity2, Py_NE):
  3334. */
  3335. __pyx_t_2 = ((__pyx_v_h1 != __pyx_v_h2) != 0);
  3336. if (__pyx_t_2) {
  3337. /* "multidict/_multidict.pyx":125
  3338. * NULL, &value2, &h2)):
  3339. * if h1 != h2:
  3340. * return False # <<<<<<<<<<<<<<
  3341. * if PyObject_RichCompare(<object>identity1, <object>identity2, Py_NE):
  3342. * return False
  3343. */
  3344. __Pyx_XDECREF(__pyx_r);
  3345. __Pyx_INCREF(Py_False);
  3346. __pyx_r = Py_False;
  3347. goto __pyx_L0;
  3348. /* "multidict/_multidict.pyx":124
  3349. * _pair_list_next(other._impl, &pos2, &identity2,
  3350. * NULL, &value2, &h2)):
  3351. * if h1 != h2: # <<<<<<<<<<<<<<
  3352. * return False
  3353. * if PyObject_RichCompare(<object>identity1, <object>identity2, Py_NE):
  3354. */
  3355. }
  3356. /* "multidict/_multidict.pyx":126
  3357. * if h1 != h2:
  3358. * return False
  3359. * if PyObject_RichCompare(<object>identity1, <object>identity2, Py_NE): # <<<<<<<<<<<<<<
  3360. * return False
  3361. * if PyObject_RichCompare(<object>value1, <object>value2, Py_NE):
  3362. */
  3363. __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_identity1), ((PyObject *)__pyx_v_identity2), Py_NE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
  3364. __Pyx_GOTREF(__pyx_t_3);
  3365. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 126, __pyx_L1_error)
  3366. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3367. if (__pyx_t_2) {
  3368. /* "multidict/_multidict.pyx":127
  3369. * return False
  3370. * if PyObject_RichCompare(<object>identity1, <object>identity2, Py_NE):
  3371. * return False # <<<<<<<<<<<<<<
  3372. * if PyObject_RichCompare(<object>value1, <object>value2, Py_NE):
  3373. * return False
  3374. */
  3375. __Pyx_XDECREF(__pyx_r);
  3376. __Pyx_INCREF(Py_False);
  3377. __pyx_r = Py_False;
  3378. goto __pyx_L0;
  3379. /* "multidict/_multidict.pyx":126
  3380. * if h1 != h2:
  3381. * return False
  3382. * if PyObject_RichCompare(<object>identity1, <object>identity2, Py_NE): # <<<<<<<<<<<<<<
  3383. * return False
  3384. * if PyObject_RichCompare(<object>value1, <object>value2, Py_NE):
  3385. */
  3386. }
  3387. /* "multidict/_multidict.pyx":128
  3388. * if PyObject_RichCompare(<object>identity1, <object>identity2, Py_NE):
  3389. * return False
  3390. * if PyObject_RichCompare(<object>value1, <object>value2, Py_NE): # <<<<<<<<<<<<<<
  3391. * return False
  3392. * return True
  3393. */
  3394. __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_value1), ((PyObject *)__pyx_v_value2), Py_NE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error)
  3395. __Pyx_GOTREF(__pyx_t_3);
  3396. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 128, __pyx_L1_error)
  3397. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3398. if (__pyx_t_2) {
  3399. /* "multidict/_multidict.pyx":129
  3400. * return False
  3401. * if PyObject_RichCompare(<object>value1, <object>value2, Py_NE):
  3402. * return False # <<<<<<<<<<<<<<
  3403. * return True
  3404. * elif isinstance(arg, abc.Mapping):
  3405. */
  3406. __Pyx_XDECREF(__pyx_r);
  3407. __Pyx_INCREF(Py_False);
  3408. __pyx_r = Py_False;
  3409. goto __pyx_L0;
  3410. /* "multidict/_multidict.pyx":128
  3411. * if PyObject_RichCompare(<object>identity1, <object>identity2, Py_NE):
  3412. * return False
  3413. * if PyObject_RichCompare(<object>value1, <object>value2, Py_NE): # <<<<<<<<<<<<<<
  3414. * return False
  3415. * return True
  3416. */
  3417. }
  3418. }
  3419. /* "multidict/_multidict.pyx":130
  3420. * if PyObject_RichCompare(<object>value1, <object>value2, Py_NE):
  3421. * return False
  3422. * return True # <<<<<<<<<<<<<<
  3423. * elif isinstance(arg, abc.Mapping):
  3424. * return bool(pair_list_eq_to_mapping(self._impl, arg))
  3425. */
  3426. __Pyx_XDECREF(__pyx_r);
  3427. __Pyx_INCREF(Py_True);
  3428. __pyx_r = Py_True;
  3429. goto __pyx_L0;
  3430. /* "multidict/_multidict.pyx":115
  3431. * cdef _Base other
  3432. *
  3433. * if isinstance(arg, _Base): # <<<<<<<<<<<<<<
  3434. * other = <_Base>arg
  3435. * if pair_list_len(self._impl) != pair_list_len(other._impl):
  3436. */
  3437. }
  3438. /* "multidict/_multidict.pyx":131
  3439. * return False
  3440. * return True
  3441. * elif isinstance(arg, abc.Mapping): # <<<<<<<<<<<<<<
  3442. * return bool(pair_list_eq_to_mapping(self._impl, arg))
  3443. * else:
  3444. */
  3445. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_abc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error)
  3446. __Pyx_GOTREF(__pyx_t_3);
  3447. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Mapping); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 131, __pyx_L1_error)
  3448. __Pyx_GOTREF(__pyx_t_6);
  3449. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3450. __pyx_t_2 = PyObject_IsInstance(__pyx_v_arg, __pyx_t_6); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 131, __pyx_L1_error)
  3451. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3452. __pyx_t_1 = (__pyx_t_2 != 0);
  3453. if (__pyx_t_1) {
  3454. /* "multidict/_multidict.pyx":132
  3455. * return True
  3456. * elif isinstance(arg, abc.Mapping):
  3457. * return bool(pair_list_eq_to_mapping(self._impl, arg)) # <<<<<<<<<<<<<<
  3458. * else:
  3459. * return NotImplemented
  3460. */
  3461. __Pyx_XDECREF(__pyx_r);
  3462. __pyx_t_6 = __pyx_v_self->_impl;
  3463. __Pyx_INCREF(__pyx_t_6);
  3464. __pyx_t_5 = pair_list_eq_to_mapping(__pyx_t_6, __pyx_v_arg); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 132, __pyx_L1_error)
  3465. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3466. __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error)
  3467. __Pyx_GOTREF(__pyx_t_6);
  3468. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 132, __pyx_L1_error)
  3469. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3470. __pyx_t_6 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error)
  3471. __Pyx_GOTREF(__pyx_t_6);
  3472. __pyx_r = __pyx_t_6;
  3473. __pyx_t_6 = 0;
  3474. goto __pyx_L0;
  3475. /* "multidict/_multidict.pyx":131
  3476. * return False
  3477. * return True
  3478. * elif isinstance(arg, abc.Mapping): # <<<<<<<<<<<<<<
  3479. * return bool(pair_list_eq_to_mapping(self._impl, arg))
  3480. * else:
  3481. */
  3482. }
  3483. /* "multidict/_multidict.pyx":134
  3484. * return bool(pair_list_eq_to_mapping(self._impl, arg))
  3485. * else:
  3486. * return NotImplemented # <<<<<<<<<<<<<<
  3487. *
  3488. *
  3489. */
  3490. /*else*/ {
  3491. __Pyx_XDECREF(__pyx_r);
  3492. __Pyx_INCREF(__pyx_builtin_NotImplemented);
  3493. __pyx_r = __pyx_builtin_NotImplemented;
  3494. goto __pyx_L0;
  3495. }
  3496. /* "multidict/_multidict.pyx":102
  3497. * return '<{}({})>'.format(self.__class__.__name__, body)
  3498. *
  3499. * def __eq__(self, arg): # <<<<<<<<<<<<<<
  3500. * cdef Py_ssize_t pos1
  3501. * cdef PyObject *identity1
  3502. */
  3503. /* function exit code */
  3504. __pyx_L1_error:;
  3505. __Pyx_XDECREF(__pyx_t_3);
  3506. __Pyx_XDECREF(__pyx_t_6);
  3507. __Pyx_AddTraceback("multidict._multidict._Base.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3508. __pyx_r = NULL;
  3509. __pyx_L0:;
  3510. __Pyx_XDECREF((PyObject *)__pyx_v_other);
  3511. __Pyx_XGIVEREF(__pyx_r);
  3512. __Pyx_RefNannyFinishContext();
  3513. return __pyx_r;
  3514. }
  3515. /* "(tree fragment)":1
  3516. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  3517. * cdef tuple state
  3518. * cdef object _dict
  3519. */
  3520. /* Python wrapper */
  3521. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_27__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  3522. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_27__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  3523. PyObject *__pyx_r = 0;
  3524. __Pyx_RefNannyDeclarations
  3525. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  3526. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_26__reduce_cython__(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self));
  3527. /* function exit code */
  3528. __Pyx_RefNannyFinishContext();
  3529. return __pyx_r;
  3530. }
  3531. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_26__reduce_cython__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self) {
  3532. PyObject *__pyx_v_state = 0;
  3533. PyObject *__pyx_v__dict = 0;
  3534. int __pyx_v_use_setstate;
  3535. PyObject *__pyx_r = NULL;
  3536. __Pyx_RefNannyDeclarations
  3537. PyObject *__pyx_t_1 = NULL;
  3538. int __pyx_t_2;
  3539. int __pyx_t_3;
  3540. PyObject *__pyx_t_4 = NULL;
  3541. PyObject *__pyx_t_5 = NULL;
  3542. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  3543. /* "(tree fragment)":5
  3544. * cdef object _dict
  3545. * cdef bint use_setstate
  3546. * state = (self._impl,) # <<<<<<<<<<<<<<
  3547. * _dict = getattr(self, '__dict__', None)
  3548. * if _dict is not None:
  3549. */
  3550. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  3551. __Pyx_GOTREF(__pyx_t_1);
  3552. __Pyx_INCREF(__pyx_v_self->_impl);
  3553. __Pyx_GIVEREF(__pyx_v_self->_impl);
  3554. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_impl);
  3555. __pyx_v_state = ((PyObject*)__pyx_t_1);
  3556. __pyx_t_1 = 0;
  3557. /* "(tree fragment)":6
  3558. * cdef bint use_setstate
  3559. * state = (self._impl,)
  3560. * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
  3561. * if _dict is not None:
  3562. * state += (_dict,)
  3563. */
  3564. __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  3565. __Pyx_GOTREF(__pyx_t_1);
  3566. __pyx_v__dict = __pyx_t_1;
  3567. __pyx_t_1 = 0;
  3568. /* "(tree fragment)":7
  3569. * state = (self._impl,)
  3570. * _dict = getattr(self, '__dict__', None)
  3571. * if _dict is not None: # <<<<<<<<<<<<<<
  3572. * state += (_dict,)
  3573. * use_setstate = True
  3574. */
  3575. __pyx_t_2 = (__pyx_v__dict != Py_None);
  3576. __pyx_t_3 = (__pyx_t_2 != 0);
  3577. if (__pyx_t_3) {
  3578. /* "(tree fragment)":8
  3579. * _dict = getattr(self, '__dict__', None)
  3580. * if _dict is not None:
  3581. * state += (_dict,) # <<<<<<<<<<<<<<
  3582. * use_setstate = True
  3583. * else:
  3584. */
  3585. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
  3586. __Pyx_GOTREF(__pyx_t_1);
  3587. __Pyx_INCREF(__pyx_v__dict);
  3588. __Pyx_GIVEREF(__pyx_v__dict);
  3589. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
  3590. __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
  3591. __Pyx_GOTREF(__pyx_t_4);
  3592. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3593. __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
  3594. __pyx_t_4 = 0;
  3595. /* "(tree fragment)":9
  3596. * if _dict is not None:
  3597. * state += (_dict,)
  3598. * use_setstate = True # <<<<<<<<<<<<<<
  3599. * else:
  3600. * use_setstate = self._impl is not None
  3601. */
  3602. __pyx_v_use_setstate = 1;
  3603. /* "(tree fragment)":7
  3604. * state = (self._impl,)
  3605. * _dict = getattr(self, '__dict__', None)
  3606. * if _dict is not None: # <<<<<<<<<<<<<<
  3607. * state += (_dict,)
  3608. * use_setstate = True
  3609. */
  3610. goto __pyx_L3;
  3611. }
  3612. /* "(tree fragment)":11
  3613. * use_setstate = True
  3614. * else:
  3615. * use_setstate = self._impl is not None # <<<<<<<<<<<<<<
  3616. * if use_setstate:
  3617. * return __pyx_unpickle__Base, (type(self), 0x4d872fe, None), state
  3618. */
  3619. /*else*/ {
  3620. __pyx_t_3 = (__pyx_v_self->_impl != Py_None);
  3621. __pyx_v_use_setstate = __pyx_t_3;
  3622. }
  3623. __pyx_L3:;
  3624. /* "(tree fragment)":12
  3625. * else:
  3626. * use_setstate = self._impl is not None
  3627. * if use_setstate: # <<<<<<<<<<<<<<
  3628. * return __pyx_unpickle__Base, (type(self), 0x4d872fe, None), state
  3629. * else:
  3630. */
  3631. __pyx_t_3 = (__pyx_v_use_setstate != 0);
  3632. if (__pyx_t_3) {
  3633. /* "(tree fragment)":13
  3634. * use_setstate = self._impl is not None
  3635. * if use_setstate:
  3636. * return __pyx_unpickle__Base, (type(self), 0x4d872fe, None), state # <<<<<<<<<<<<<<
  3637. * else:
  3638. * return __pyx_unpickle__Base, (type(self), 0x4d872fe, state)
  3639. */
  3640. __Pyx_XDECREF(__pyx_r);
  3641. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle__Base); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
  3642. __Pyx_GOTREF(__pyx_t_4);
  3643. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
  3644. __Pyx_GOTREF(__pyx_t_1);
  3645. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  3646. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  3647. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  3648. __Pyx_INCREF(__pyx_int_81294078);
  3649. __Pyx_GIVEREF(__pyx_int_81294078);
  3650. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_81294078);
  3651. __Pyx_INCREF(Py_None);
  3652. __Pyx_GIVEREF(Py_None);
  3653. PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  3654. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
  3655. __Pyx_GOTREF(__pyx_t_5);
  3656. __Pyx_GIVEREF(__pyx_t_4);
  3657. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  3658. __Pyx_GIVEREF(__pyx_t_1);
  3659. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  3660. __Pyx_INCREF(__pyx_v_state);
  3661. __Pyx_GIVEREF(__pyx_v_state);
  3662. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
  3663. __pyx_t_4 = 0;
  3664. __pyx_t_1 = 0;
  3665. __pyx_r = __pyx_t_5;
  3666. __pyx_t_5 = 0;
  3667. goto __pyx_L0;
  3668. /* "(tree fragment)":12
  3669. * else:
  3670. * use_setstate = self._impl is not None
  3671. * if use_setstate: # <<<<<<<<<<<<<<
  3672. * return __pyx_unpickle__Base, (type(self), 0x4d872fe, None), state
  3673. * else:
  3674. */
  3675. }
  3676. /* "(tree fragment)":15
  3677. * return __pyx_unpickle__Base, (type(self), 0x4d872fe, None), state
  3678. * else:
  3679. * return __pyx_unpickle__Base, (type(self), 0x4d872fe, state) # <<<<<<<<<<<<<<
  3680. * def __setstate_cython__(self, __pyx_state):
  3681. * __pyx_unpickle__Base__set_state(self, __pyx_state)
  3682. */
  3683. /*else*/ {
  3684. __Pyx_XDECREF(__pyx_r);
  3685. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle__Base); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
  3686. __Pyx_GOTREF(__pyx_t_5);
  3687. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
  3688. __Pyx_GOTREF(__pyx_t_1);
  3689. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  3690. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  3691. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  3692. __Pyx_INCREF(__pyx_int_81294078);
  3693. __Pyx_GIVEREF(__pyx_int_81294078);
  3694. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_81294078);
  3695. __Pyx_INCREF(__pyx_v_state);
  3696. __Pyx_GIVEREF(__pyx_v_state);
  3697. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
  3698. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
  3699. __Pyx_GOTREF(__pyx_t_4);
  3700. __Pyx_GIVEREF(__pyx_t_5);
  3701. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  3702. __Pyx_GIVEREF(__pyx_t_1);
  3703. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  3704. __pyx_t_5 = 0;
  3705. __pyx_t_1 = 0;
  3706. __pyx_r = __pyx_t_4;
  3707. __pyx_t_4 = 0;
  3708. goto __pyx_L0;
  3709. }
  3710. /* "(tree fragment)":1
  3711. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  3712. * cdef tuple state
  3713. * cdef object _dict
  3714. */
  3715. /* function exit code */
  3716. __pyx_L1_error:;
  3717. __Pyx_XDECREF(__pyx_t_1);
  3718. __Pyx_XDECREF(__pyx_t_4);
  3719. __Pyx_XDECREF(__pyx_t_5);
  3720. __Pyx_AddTraceback("multidict._multidict._Base.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3721. __pyx_r = NULL;
  3722. __pyx_L0:;
  3723. __Pyx_XDECREF(__pyx_v_state);
  3724. __Pyx_XDECREF(__pyx_v__dict);
  3725. __Pyx_XGIVEREF(__pyx_r);
  3726. __Pyx_RefNannyFinishContext();
  3727. return __pyx_r;
  3728. }
  3729. /* "(tree fragment)":16
  3730. * else:
  3731. * return __pyx_unpickle__Base, (type(self), 0x4d872fe, state)
  3732. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  3733. * __pyx_unpickle__Base__set_state(self, __pyx_state)
  3734. */
  3735. /* Python wrapper */
  3736. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_29__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  3737. static PyObject *__pyx_pw_9multidict_10_multidict_5_Base_29__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  3738. PyObject *__pyx_r = 0;
  3739. __Pyx_RefNannyDeclarations
  3740. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  3741. __pyx_r = __pyx_pf_9multidict_10_multidict_5_Base_28__setstate_cython__(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  3742. /* function exit code */
  3743. __Pyx_RefNannyFinishContext();
  3744. return __pyx_r;
  3745. }
  3746. static PyObject *__pyx_pf_9multidict_10_multidict_5_Base_28__setstate_cython__(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  3747. PyObject *__pyx_r = NULL;
  3748. __Pyx_RefNannyDeclarations
  3749. PyObject *__pyx_t_1 = NULL;
  3750. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  3751. /* "(tree fragment)":17
  3752. * return __pyx_unpickle__Base, (type(self), 0x4d872fe, state)
  3753. * def __setstate_cython__(self, __pyx_state):
  3754. * __pyx_unpickle__Base__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
  3755. */
  3756. if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  3757. __pyx_t_1 = __pyx_f_9multidict_10_multidict___pyx_unpickle__Base__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  3758. __Pyx_GOTREF(__pyx_t_1);
  3759. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3760. /* "(tree fragment)":16
  3761. * else:
  3762. * return __pyx_unpickle__Base, (type(self), 0x4d872fe, state)
  3763. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  3764. * __pyx_unpickle__Base__set_state(self, __pyx_state)
  3765. */
  3766. /* function exit code */
  3767. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  3768. goto __pyx_L0;
  3769. __pyx_L1_error:;
  3770. __Pyx_XDECREF(__pyx_t_1);
  3771. __Pyx_AddTraceback("multidict._multidict._Base.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3772. __pyx_r = NULL;
  3773. __pyx_L0:;
  3774. __Pyx_XGIVEREF(__pyx_r);
  3775. __Pyx_RefNannyFinishContext();
  3776. return __pyx_r;
  3777. }
  3778. /* "multidict/_multidict.pyx":141
  3779. * _base_class = MultiDict
  3780. *
  3781. * def __init__(self, arg): # <<<<<<<<<<<<<<
  3782. * cdef _Base base
  3783. * if not isinstance(arg, self._proxy_classes):
  3784. */
  3785. /* Python wrapper */
  3786. static int __pyx_pw_9multidict_10_multidict_14MultiDictProxy_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3787. static int __pyx_pw_9multidict_10_multidict_14MultiDictProxy_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3788. PyObject *__pyx_v_arg = 0;
  3789. int __pyx_r;
  3790. __Pyx_RefNannyDeclarations
  3791. __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  3792. {
  3793. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arg,0};
  3794. PyObject* values[1] = {0};
  3795. if (unlikely(__pyx_kwds)) {
  3796. Py_ssize_t kw_args;
  3797. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  3798. switch (pos_args) {
  3799. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3800. CYTHON_FALLTHROUGH;
  3801. case 0: break;
  3802. default: goto __pyx_L5_argtuple_error;
  3803. }
  3804. kw_args = PyDict_Size(__pyx_kwds);
  3805. switch (pos_args) {
  3806. case 0:
  3807. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arg)) != 0)) kw_args--;
  3808. else goto __pyx_L5_argtuple_error;
  3809. }
  3810. if (unlikely(kw_args > 0)) {
  3811. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 141, __pyx_L3_error)
  3812. }
  3813. } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
  3814. goto __pyx_L5_argtuple_error;
  3815. } else {
  3816. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3817. }
  3818. __pyx_v_arg = values[0];
  3819. }
  3820. goto __pyx_L4_argument_unpacking_done;
  3821. __pyx_L5_argtuple_error:;
  3822. __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 141, __pyx_L3_error)
  3823. __pyx_L3_error:;
  3824. __Pyx_AddTraceback("multidict._multidict.MultiDictProxy.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3825. __Pyx_RefNannyFinishContext();
  3826. return -1;
  3827. __pyx_L4_argument_unpacking_done:;
  3828. __pyx_r = __pyx_pf_9multidict_10_multidict_14MultiDictProxy___init__(((struct __pyx_obj_9multidict_10_multidict_MultiDictProxy *)__pyx_v_self), __pyx_v_arg);
  3829. /* function exit code */
  3830. __Pyx_RefNannyFinishContext();
  3831. return __pyx_r;
  3832. }
  3833. static int __pyx_pf_9multidict_10_multidict_14MultiDictProxy___init__(struct __pyx_obj_9multidict_10_multidict_MultiDictProxy *__pyx_v_self, PyObject *__pyx_v_arg) {
  3834. struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v_base = 0;
  3835. int __pyx_r;
  3836. __Pyx_RefNannyDeclarations
  3837. PyObject *__pyx_t_1 = NULL;
  3838. int __pyx_t_2;
  3839. int __pyx_t_3;
  3840. PyObject *__pyx_t_4 = NULL;
  3841. PyObject *__pyx_t_5 = NULL;
  3842. PyObject *__pyx_t_6 = NULL;
  3843. int __pyx_t_7;
  3844. PyObject *__pyx_t_8 = NULL;
  3845. __Pyx_RefNannySetupContext("__init__", 0);
  3846. /* "multidict/_multidict.pyx":143
  3847. * def __init__(self, arg):
  3848. * cdef _Base base
  3849. * if not isinstance(arg, self._proxy_classes): # <<<<<<<<<<<<<<
  3850. * raise TypeError(
  3851. * 'ctor requires {} instance'
  3852. */
  3853. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_proxy_classes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
  3854. __Pyx_GOTREF(__pyx_t_1);
  3855. __pyx_t_2 = PyObject_IsInstance(__pyx_v_arg, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 143, __pyx_L1_error)
  3856. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3857. __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  3858. if (unlikely(__pyx_t_3)) {
  3859. /* "multidict/_multidict.pyx":146
  3860. * raise TypeError(
  3861. * 'ctor requires {} instance'
  3862. * ', not {}'.format( # <<<<<<<<<<<<<<
  3863. * ' or '.join(self._proxy_classes),
  3864. * type(arg)))
  3865. */
  3866. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_ctor_requires_instance_not, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 146, __pyx_L1_error)
  3867. __Pyx_GOTREF(__pyx_t_4);
  3868. /* "multidict/_multidict.pyx":147
  3869. * 'ctor requires {} instance'
  3870. * ', not {}'.format(
  3871. * ' or '.join(self._proxy_classes), # <<<<<<<<<<<<<<
  3872. * type(arg)))
  3873. *
  3874. */
  3875. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_proxy_classes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error)
  3876. __Pyx_GOTREF(__pyx_t_5);
  3877. __pyx_t_6 = __Pyx_PyString_Join(__pyx_kp_s_or, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 147, __pyx_L1_error)
  3878. __Pyx_GOTREF(__pyx_t_6);
  3879. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3880. /* "multidict/_multidict.pyx":148
  3881. * ', not {}'.format(
  3882. * ' or '.join(self._proxy_classes),
  3883. * type(arg))) # <<<<<<<<<<<<<<
  3884. *
  3885. * base = arg
  3886. */
  3887. __pyx_t_5 = NULL;
  3888. __pyx_t_7 = 0;
  3889. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
  3890. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
  3891. if (likely(__pyx_t_5)) {
  3892. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
  3893. __Pyx_INCREF(__pyx_t_5);
  3894. __Pyx_INCREF(function);
  3895. __Pyx_DECREF_SET(__pyx_t_4, function);
  3896. __pyx_t_7 = 1;
  3897. }
  3898. }
  3899. #if CYTHON_FAST_PYCALL
  3900. if (PyFunction_Check(__pyx_t_4)) {
  3901. PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_6, ((PyObject *)Py_TYPE(__pyx_v_arg))};
  3902. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
  3903. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  3904. __Pyx_GOTREF(__pyx_t_1);
  3905. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3906. } else
  3907. #endif
  3908. #if CYTHON_FAST_PYCCALL
  3909. if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
  3910. PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_6, ((PyObject *)Py_TYPE(__pyx_v_arg))};
  3911. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
  3912. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  3913. __Pyx_GOTREF(__pyx_t_1);
  3914. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3915. } else
  3916. #endif
  3917. {
  3918. __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 146, __pyx_L1_error)
  3919. __Pyx_GOTREF(__pyx_t_8);
  3920. if (__pyx_t_5) {
  3921. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
  3922. }
  3923. __Pyx_GIVEREF(__pyx_t_6);
  3924. PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_6);
  3925. __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_arg)));
  3926. __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_arg)));
  3927. PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, ((PyObject *)Py_TYPE(__pyx_v_arg)));
  3928. __pyx_t_6 = 0;
  3929. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
  3930. __Pyx_GOTREF(__pyx_t_1);
  3931. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3932. }
  3933. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3934. /* "multidict/_multidict.pyx":144
  3935. * cdef _Base base
  3936. * if not isinstance(arg, self._proxy_classes):
  3937. * raise TypeError( # <<<<<<<<<<<<<<
  3938. * 'ctor requires {} instance'
  3939. * ', not {}'.format(
  3940. */
  3941. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __pyx_L1_error)
  3942. __Pyx_GOTREF(__pyx_t_4);
  3943. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3944. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  3945. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3946. __PYX_ERR(0, 144, __pyx_L1_error)
  3947. /* "multidict/_multidict.pyx":143
  3948. * def __init__(self, arg):
  3949. * cdef _Base base
  3950. * if not isinstance(arg, self._proxy_classes): # <<<<<<<<<<<<<<
  3951. * raise TypeError(
  3952. * 'ctor requires {} instance'
  3953. */
  3954. }
  3955. /* "multidict/_multidict.pyx":150
  3956. * type(arg)))
  3957. *
  3958. * base = arg # <<<<<<<<<<<<<<
  3959. * self._impl = base._impl
  3960. *
  3961. */
  3962. if (!(likely(((__pyx_v_arg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_9multidict_10_multidict__Base))))) __PYX_ERR(0, 150, __pyx_L1_error)
  3963. __pyx_t_4 = __pyx_v_arg;
  3964. __Pyx_INCREF(__pyx_t_4);
  3965. __pyx_v_base = ((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_t_4);
  3966. __pyx_t_4 = 0;
  3967. /* "multidict/_multidict.pyx":151
  3968. *
  3969. * base = arg
  3970. * self._impl = base._impl # <<<<<<<<<<<<<<
  3971. *
  3972. * def __reduce__(self):
  3973. */
  3974. __pyx_t_4 = __pyx_v_base->_impl;
  3975. __Pyx_INCREF(__pyx_t_4);
  3976. __Pyx_GIVEREF(__pyx_t_4);
  3977. __Pyx_GOTREF(__pyx_v_self->__pyx_base._impl);
  3978. __Pyx_DECREF(__pyx_v_self->__pyx_base._impl);
  3979. __pyx_v_self->__pyx_base._impl = __pyx_t_4;
  3980. __pyx_t_4 = 0;
  3981. /* "multidict/_multidict.pyx":141
  3982. * _base_class = MultiDict
  3983. *
  3984. * def __init__(self, arg): # <<<<<<<<<<<<<<
  3985. * cdef _Base base
  3986. * if not isinstance(arg, self._proxy_classes):
  3987. */
  3988. /* function exit code */
  3989. __pyx_r = 0;
  3990. goto __pyx_L0;
  3991. __pyx_L1_error:;
  3992. __Pyx_XDECREF(__pyx_t_1);
  3993. __Pyx_XDECREF(__pyx_t_4);
  3994. __Pyx_XDECREF(__pyx_t_5);
  3995. __Pyx_XDECREF(__pyx_t_6);
  3996. __Pyx_XDECREF(__pyx_t_8);
  3997. __Pyx_AddTraceback("multidict._multidict.MultiDictProxy.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3998. __pyx_r = -1;
  3999. __pyx_L0:;
  4000. __Pyx_XDECREF((PyObject *)__pyx_v_base);
  4001. __Pyx_RefNannyFinishContext();
  4002. return __pyx_r;
  4003. }
  4004. /* "multidict/_multidict.pyx":153
  4005. * self._impl = base._impl
  4006. *
  4007. * def __reduce__(self): # <<<<<<<<<<<<<<
  4008. * raise TypeError("can't pickle {} objects"
  4009. * .format(self.__class__.__name__))
  4010. */
  4011. /* Python wrapper */
  4012. static PyObject *__pyx_pw_9multidict_10_multidict_14MultiDictProxy_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  4013. static PyObject *__pyx_pw_9multidict_10_multidict_14MultiDictProxy_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  4014. PyObject *__pyx_r = 0;
  4015. __Pyx_RefNannyDeclarations
  4016. __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  4017. __pyx_r = __pyx_pf_9multidict_10_multidict_14MultiDictProxy_2__reduce__(((struct __pyx_obj_9multidict_10_multidict_MultiDictProxy *)__pyx_v_self));
  4018. /* function exit code */
  4019. __Pyx_RefNannyFinishContext();
  4020. return __pyx_r;
  4021. }
  4022. static PyObject *__pyx_pf_9multidict_10_multidict_14MultiDictProxy_2__reduce__(struct __pyx_obj_9multidict_10_multidict_MultiDictProxy *__pyx_v_self) {
  4023. PyObject *__pyx_r = NULL;
  4024. __Pyx_RefNannyDeclarations
  4025. PyObject *__pyx_t_1 = NULL;
  4026. PyObject *__pyx_t_2 = NULL;
  4027. PyObject *__pyx_t_3 = NULL;
  4028. PyObject *__pyx_t_4 = NULL;
  4029. __Pyx_RefNannySetupContext("__reduce__", 0);
  4030. /* "multidict/_multidict.pyx":155
  4031. * def __reduce__(self):
  4032. * raise TypeError("can't pickle {} objects"
  4033. * .format(self.__class__.__name__)) # <<<<<<<<<<<<<<
  4034. *
  4035. * def copy(self):
  4036. */
  4037. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_can_t_pickle_objects, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
  4038. __Pyx_GOTREF(__pyx_t_2);
  4039. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error)
  4040. __Pyx_GOTREF(__pyx_t_3);
  4041. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 155, __pyx_L1_error)
  4042. __Pyx_GOTREF(__pyx_t_4);
  4043. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4044. __pyx_t_3 = NULL;
  4045. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  4046. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  4047. if (likely(__pyx_t_3)) {
  4048. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  4049. __Pyx_INCREF(__pyx_t_3);
  4050. __Pyx_INCREF(function);
  4051. __Pyx_DECREF_SET(__pyx_t_2, function);
  4052. }
  4053. }
  4054. __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  4055. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4056. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4057. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
  4058. __Pyx_GOTREF(__pyx_t_1);
  4059. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4060. /* "multidict/_multidict.pyx":154
  4061. *
  4062. * def __reduce__(self):
  4063. * raise TypeError("can't pickle {} objects" # <<<<<<<<<<<<<<
  4064. * .format(self.__class__.__name__))
  4065. *
  4066. */
  4067. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
  4068. __Pyx_GOTREF(__pyx_t_2);
  4069. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4070. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  4071. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4072. __PYX_ERR(0, 154, __pyx_L1_error)
  4073. /* "multidict/_multidict.pyx":153
  4074. * self._impl = base._impl
  4075. *
  4076. * def __reduce__(self): # <<<<<<<<<<<<<<
  4077. * raise TypeError("can't pickle {} objects"
  4078. * .format(self.__class__.__name__))
  4079. */
  4080. /* function exit code */
  4081. __pyx_L1_error:;
  4082. __Pyx_XDECREF(__pyx_t_1);
  4083. __Pyx_XDECREF(__pyx_t_2);
  4084. __Pyx_XDECREF(__pyx_t_3);
  4085. __Pyx_XDECREF(__pyx_t_4);
  4086. __Pyx_AddTraceback("multidict._multidict.MultiDictProxy.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4087. __pyx_r = NULL;
  4088. __Pyx_XGIVEREF(__pyx_r);
  4089. __Pyx_RefNannyFinishContext();
  4090. return __pyx_r;
  4091. }
  4092. /* "multidict/_multidict.pyx":157
  4093. * .format(self.__class__.__name__))
  4094. *
  4095. * def copy(self): # <<<<<<<<<<<<<<
  4096. * """Return a copy of itself."""
  4097. * return self._base_class(self)
  4098. */
  4099. /* Python wrapper */
  4100. static PyObject *__pyx_pw_9multidict_10_multidict_14MultiDictProxy_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  4101. static char __pyx_doc_9multidict_10_multidict_14MultiDictProxy_4copy[] = "Return a copy of itself.";
  4102. static PyObject *__pyx_pw_9multidict_10_multidict_14MultiDictProxy_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  4103. PyObject *__pyx_r = 0;
  4104. __Pyx_RefNannyDeclarations
  4105. __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  4106. __pyx_r = __pyx_pf_9multidict_10_multidict_14MultiDictProxy_4copy(((struct __pyx_obj_9multidict_10_multidict_MultiDictProxy *)__pyx_v_self));
  4107. /* function exit code */
  4108. __Pyx_RefNannyFinishContext();
  4109. return __pyx_r;
  4110. }
  4111. static PyObject *__pyx_pf_9multidict_10_multidict_14MultiDictProxy_4copy(struct __pyx_obj_9multidict_10_multidict_MultiDictProxy *__pyx_v_self) {
  4112. PyObject *__pyx_r = NULL;
  4113. __Pyx_RefNannyDeclarations
  4114. PyObject *__pyx_t_1 = NULL;
  4115. PyObject *__pyx_t_2 = NULL;
  4116. PyObject *__pyx_t_3 = NULL;
  4117. __Pyx_RefNannySetupContext("copy", 0);
  4118. /* "multidict/_multidict.pyx":159
  4119. * def copy(self):
  4120. * """Return a copy of itself."""
  4121. * return self._base_class(self) # <<<<<<<<<<<<<<
  4122. *
  4123. * MultiMapping.register(MultiDictProxy)
  4124. */
  4125. __Pyx_XDECREF(__pyx_r);
  4126. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
  4127. __Pyx_GOTREF(__pyx_t_2);
  4128. __pyx_t_3 = NULL;
  4129. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  4130. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  4131. if (likely(__pyx_t_3)) {
  4132. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  4133. __Pyx_INCREF(__pyx_t_3);
  4134. __Pyx_INCREF(function);
  4135. __Pyx_DECREF_SET(__pyx_t_2, function);
  4136. }
  4137. }
  4138. __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self));
  4139. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4140. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
  4141. __Pyx_GOTREF(__pyx_t_1);
  4142. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4143. __pyx_r = __pyx_t_1;
  4144. __pyx_t_1 = 0;
  4145. goto __pyx_L0;
  4146. /* "multidict/_multidict.pyx":157
  4147. * .format(self.__class__.__name__))
  4148. *
  4149. * def copy(self): # <<<<<<<<<<<<<<
  4150. * """Return a copy of itself."""
  4151. * return self._base_class(self)
  4152. */
  4153. /* function exit code */
  4154. __pyx_L1_error:;
  4155. __Pyx_XDECREF(__pyx_t_1);
  4156. __Pyx_XDECREF(__pyx_t_2);
  4157. __Pyx_XDECREF(__pyx_t_3);
  4158. __Pyx_AddTraceback("multidict._multidict.MultiDictProxy.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4159. __pyx_r = NULL;
  4160. __pyx_L0:;
  4161. __Pyx_XGIVEREF(__pyx_r);
  4162. __Pyx_RefNannyFinishContext();
  4163. return __pyx_r;
  4164. }
  4165. /* "multidict/_multidict.pyx":172
  4166. *
  4167. *
  4168. * cdef str _str(key): # <<<<<<<<<<<<<<
  4169. * typ = type(key)
  4170. * if typ is str:
  4171. */
  4172. static PyObject *__pyx_f_9multidict_10_multidict__str(PyObject *__pyx_v_key) {
  4173. PyTypeObject *__pyx_v_typ = NULL;
  4174. PyObject *__pyx_r = NULL;
  4175. __Pyx_RefNannyDeclarations
  4176. int __pyx_t_1;
  4177. int __pyx_t_2;
  4178. PyObject *__pyx_t_3 = NULL;
  4179. __Pyx_RefNannySetupContext("_str", 0);
  4180. /* "multidict/_multidict.pyx":173
  4181. *
  4182. * cdef str _str(key):
  4183. * typ = type(key) # <<<<<<<<<<<<<<
  4184. * if typ is str:
  4185. * return <str>key
  4186. */
  4187. __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_key)));
  4188. __pyx_v_typ = ((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_key)));
  4189. /* "multidict/_multidict.pyx":174
  4190. * cdef str _str(key):
  4191. * typ = type(key)
  4192. * if typ is str: # <<<<<<<<<<<<<<
  4193. * return <str>key
  4194. * if typ is _istr:
  4195. */
  4196. __pyx_t_1 = (__pyx_v_typ == (&PyString_Type));
  4197. __pyx_t_2 = (__pyx_t_1 != 0);
  4198. if (__pyx_t_2) {
  4199. /* "multidict/_multidict.pyx":175
  4200. * typ = type(key)
  4201. * if typ is str:
  4202. * return <str>key # <<<<<<<<<<<<<<
  4203. * if typ is _istr:
  4204. * return PyObject_Str(key)
  4205. */
  4206. __Pyx_XDECREF(__pyx_r);
  4207. __Pyx_INCREF(((PyObject*)__pyx_v_key));
  4208. __pyx_r = ((PyObject*)__pyx_v_key);
  4209. goto __pyx_L0;
  4210. /* "multidict/_multidict.pyx":174
  4211. * cdef str _str(key):
  4212. * typ = type(key)
  4213. * if typ is str: # <<<<<<<<<<<<<<
  4214. * return <str>key
  4215. * if typ is _istr:
  4216. */
  4217. }
  4218. /* "multidict/_multidict.pyx":176
  4219. * if typ is str:
  4220. * return <str>key
  4221. * if typ is _istr: # <<<<<<<<<<<<<<
  4222. * return PyObject_Str(key)
  4223. * elif issubclass(typ, str):
  4224. */
  4225. __pyx_t_2 = (__pyx_v_typ == ((PyTypeObject*)__pyx_v_9multidict_10_multidict__istr));
  4226. __pyx_t_1 = (__pyx_t_2 != 0);
  4227. if (__pyx_t_1) {
  4228. /* "multidict/_multidict.pyx":177
  4229. * return <str>key
  4230. * if typ is _istr:
  4231. * return PyObject_Str(key) # <<<<<<<<<<<<<<
  4232. * elif issubclass(typ, str):
  4233. * return str(key)
  4234. */
  4235. __Pyx_XDECREF(__pyx_r);
  4236. __pyx_t_3 = PyObject_Str(__pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error)
  4237. __Pyx_GOTREF(__pyx_t_3);
  4238. if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 177, __pyx_L1_error)
  4239. __pyx_r = ((PyObject*)__pyx_t_3);
  4240. __pyx_t_3 = 0;
  4241. goto __pyx_L0;
  4242. /* "multidict/_multidict.pyx":176
  4243. * if typ is str:
  4244. * return <str>key
  4245. * if typ is _istr: # <<<<<<<<<<<<<<
  4246. * return PyObject_Str(key)
  4247. * elif issubclass(typ, str):
  4248. */
  4249. }
  4250. /* "multidict/_multidict.pyx":178
  4251. * if typ is _istr:
  4252. * return PyObject_Str(key)
  4253. * elif issubclass(typ, str): # <<<<<<<<<<<<<<
  4254. * return str(key)
  4255. * else:
  4256. */
  4257. __pyx_t_1 = PyObject_IsSubclass(((PyObject *)__pyx_v_typ), ((PyObject *)(&PyString_Type))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 178, __pyx_L1_error)
  4258. __pyx_t_2 = (__pyx_t_1 != 0);
  4259. if (likely(__pyx_t_2)) {
  4260. /* "multidict/_multidict.pyx":179
  4261. * return PyObject_Str(key)
  4262. * elif issubclass(typ, str):
  4263. * return str(key) # <<<<<<<<<<<<<<
  4264. * else:
  4265. * raise TypeError("MultiDict keys should be either str "
  4266. */
  4267. __Pyx_XDECREF(__pyx_r);
  4268. __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error)
  4269. __Pyx_GOTREF(__pyx_t_3);
  4270. if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 179, __pyx_L1_error)
  4271. __pyx_r = ((PyObject*)__pyx_t_3);
  4272. __pyx_t_3 = 0;
  4273. goto __pyx_L0;
  4274. /* "multidict/_multidict.pyx":178
  4275. * if typ is _istr:
  4276. * return PyObject_Str(key)
  4277. * elif issubclass(typ, str): # <<<<<<<<<<<<<<
  4278. * return str(key)
  4279. * else:
  4280. */
  4281. }
  4282. /* "multidict/_multidict.pyx":181
  4283. * return str(key)
  4284. * else:
  4285. * raise TypeError("MultiDict keys should be either str " # <<<<<<<<<<<<<<
  4286. * "or subclasses of str")
  4287. *
  4288. */
  4289. /*else*/ {
  4290. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
  4291. __Pyx_GOTREF(__pyx_t_3);
  4292. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  4293. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4294. __PYX_ERR(0, 181, __pyx_L1_error)
  4295. }
  4296. /* "multidict/_multidict.pyx":172
  4297. *
  4298. *
  4299. * cdef str _str(key): # <<<<<<<<<<<<<<
  4300. * typ = type(key)
  4301. * if typ is str:
  4302. */
  4303. /* function exit code */
  4304. __pyx_L1_error:;
  4305. __Pyx_XDECREF(__pyx_t_3);
  4306. __Pyx_AddTraceback("multidict._multidict._str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4307. __pyx_r = 0;
  4308. __pyx_L0:;
  4309. __Pyx_XDECREF(__pyx_v_typ);
  4310. __Pyx_XGIVEREF(__pyx_r);
  4311. __Pyx_RefNannyFinishContext();
  4312. return __pyx_r;
  4313. }
  4314. /* "multidict/_multidict.pyx":188
  4315. * """An ordered dictionary that can have multiple values for each key."""
  4316. *
  4317. * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<<
  4318. * self._impl = pair_list_new()
  4319. * self._extend(args, kwargs, 'MultiDict', True)
  4320. */
  4321. /* Python wrapper */
  4322. static int __pyx_pw_9multidict_10_multidict_9MultiDict_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  4323. static int __pyx_pw_9multidict_10_multidict_9MultiDict_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  4324. PyObject *__pyx_v_args = 0;
  4325. PyObject *__pyx_v_kwargs = 0;
  4326. int __pyx_r;
  4327. __Pyx_RefNannyDeclarations
  4328. __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  4329. if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1;
  4330. __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  4331. __Pyx_GOTREF(__pyx_v_kwargs);
  4332. __Pyx_INCREF(__pyx_args);
  4333. __pyx_v_args = __pyx_args;
  4334. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict___init__(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
  4335. /* function exit code */
  4336. __Pyx_XDECREF(__pyx_v_args);
  4337. __Pyx_XDECREF(__pyx_v_kwargs);
  4338. __Pyx_RefNannyFinishContext();
  4339. return __pyx_r;
  4340. }
  4341. static int __pyx_pf_9multidict_10_multidict_9MultiDict___init__(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  4342. int __pyx_r;
  4343. __Pyx_RefNannyDeclarations
  4344. PyObject *__pyx_t_1 = NULL;
  4345. __Pyx_RefNannySetupContext("__init__", 0);
  4346. /* "multidict/_multidict.pyx":189
  4347. *
  4348. * def __init__(self, *args, **kwargs):
  4349. * self._impl = pair_list_new() # <<<<<<<<<<<<<<
  4350. * self._extend(args, kwargs, 'MultiDict', True)
  4351. *
  4352. */
  4353. __pyx_t_1 = pair_list_new(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
  4354. __Pyx_GOTREF(__pyx_t_1);
  4355. __Pyx_GIVEREF(__pyx_t_1);
  4356. __Pyx_GOTREF(__pyx_v_self->__pyx_base._impl);
  4357. __Pyx_DECREF(__pyx_v_self->__pyx_base._impl);
  4358. __pyx_v_self->__pyx_base._impl = __pyx_t_1;
  4359. __pyx_t_1 = 0;
  4360. /* "multidict/_multidict.pyx":190
  4361. * def __init__(self, *args, **kwargs):
  4362. * self._impl = pair_list_new()
  4363. * self._extend(args, kwargs, 'MultiDict', True) # <<<<<<<<<<<<<<
  4364. *
  4365. * def __reduce__(self):
  4366. */
  4367. __pyx_t_1 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_self->__pyx_base.__pyx_vtab)->_extend(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, __pyx_n_s_MultiDict, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
  4368. __Pyx_GOTREF(__pyx_t_1);
  4369. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4370. /* "multidict/_multidict.pyx":188
  4371. * """An ordered dictionary that can have multiple values for each key."""
  4372. *
  4373. * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<<
  4374. * self._impl = pair_list_new()
  4375. * self._extend(args, kwargs, 'MultiDict', True)
  4376. */
  4377. /* function exit code */
  4378. __pyx_r = 0;
  4379. goto __pyx_L0;
  4380. __pyx_L1_error:;
  4381. __Pyx_XDECREF(__pyx_t_1);
  4382. __Pyx_AddTraceback("multidict._multidict.MultiDict.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4383. __pyx_r = -1;
  4384. __pyx_L0:;
  4385. __Pyx_RefNannyFinishContext();
  4386. return __pyx_r;
  4387. }
  4388. /* "multidict/_multidict.pyx":192
  4389. * self._extend(args, kwargs, 'MultiDict', True)
  4390. *
  4391. * def __reduce__(self): # <<<<<<<<<<<<<<
  4392. * return (
  4393. * self.__class__,
  4394. */
  4395. /* Python wrapper */
  4396. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  4397. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  4398. PyObject *__pyx_r = 0;
  4399. __Pyx_RefNannyDeclarations
  4400. __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  4401. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_2__reduce__(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self));
  4402. /* function exit code */
  4403. __Pyx_RefNannyFinishContext();
  4404. return __pyx_r;
  4405. }
  4406. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_2__reduce__(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self) {
  4407. PyObject *__pyx_r = NULL;
  4408. __Pyx_RefNannyDeclarations
  4409. PyObject *__pyx_t_1 = NULL;
  4410. PyObject *__pyx_t_2 = NULL;
  4411. PyObject *__pyx_t_3 = NULL;
  4412. PyObject *__pyx_t_4 = NULL;
  4413. __Pyx_RefNannySetupContext("__reduce__", 0);
  4414. /* "multidict/_multidict.pyx":193
  4415. *
  4416. * def __reduce__(self):
  4417. * return ( # <<<<<<<<<<<<<<
  4418. * self.__class__,
  4419. * (list(self.items()),)
  4420. */
  4421. __Pyx_XDECREF(__pyx_r);
  4422. /* "multidict/_multidict.pyx":194
  4423. * def __reduce__(self):
  4424. * return (
  4425. * self.__class__, # <<<<<<<<<<<<<<
  4426. * (list(self.items()),)
  4427. * )
  4428. */
  4429. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error)
  4430. __Pyx_GOTREF(__pyx_t_1);
  4431. /* "multidict/_multidict.pyx":195
  4432. * return (
  4433. * self.__class__,
  4434. * (list(self.items()),) # <<<<<<<<<<<<<<
  4435. * )
  4436. *
  4437. */
  4438. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error)
  4439. __Pyx_GOTREF(__pyx_t_3);
  4440. __pyx_t_4 = NULL;
  4441. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  4442. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  4443. if (likely(__pyx_t_4)) {
  4444. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  4445. __Pyx_INCREF(__pyx_t_4);
  4446. __Pyx_INCREF(function);
  4447. __Pyx_DECREF_SET(__pyx_t_3, function);
  4448. }
  4449. }
  4450. __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  4451. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  4452. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
  4453. __Pyx_GOTREF(__pyx_t_2);
  4454. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4455. __pyx_t_3 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error)
  4456. __Pyx_GOTREF(__pyx_t_3);
  4457. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4458. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
  4459. __Pyx_GOTREF(__pyx_t_2);
  4460. __Pyx_GIVEREF(__pyx_t_3);
  4461. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  4462. __pyx_t_3 = 0;
  4463. /* "multidict/_multidict.pyx":194
  4464. * def __reduce__(self):
  4465. * return (
  4466. * self.__class__, # <<<<<<<<<<<<<<
  4467. * (list(self.items()),)
  4468. * )
  4469. */
  4470. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error)
  4471. __Pyx_GOTREF(__pyx_t_3);
  4472. __Pyx_GIVEREF(__pyx_t_1);
  4473. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  4474. __Pyx_GIVEREF(__pyx_t_2);
  4475. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  4476. __pyx_t_1 = 0;
  4477. __pyx_t_2 = 0;
  4478. __pyx_r = __pyx_t_3;
  4479. __pyx_t_3 = 0;
  4480. goto __pyx_L0;
  4481. /* "multidict/_multidict.pyx":192
  4482. * self._extend(args, kwargs, 'MultiDict', True)
  4483. *
  4484. * def __reduce__(self): # <<<<<<<<<<<<<<
  4485. * return (
  4486. * self.__class__,
  4487. */
  4488. /* function exit code */
  4489. __pyx_L1_error:;
  4490. __Pyx_XDECREF(__pyx_t_1);
  4491. __Pyx_XDECREF(__pyx_t_2);
  4492. __Pyx_XDECREF(__pyx_t_3);
  4493. __Pyx_XDECREF(__pyx_t_4);
  4494. __Pyx_AddTraceback("multidict._multidict.MultiDict.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4495. __pyx_r = NULL;
  4496. __pyx_L0:;
  4497. __Pyx_XGIVEREF(__pyx_r);
  4498. __Pyx_RefNannyFinishContext();
  4499. return __pyx_r;
  4500. }
  4501. /* "multidict/_multidict.pyx":198
  4502. * )
  4503. *
  4504. * cdef _extend(self, tuple args, dict kwargs, name, bint do_add): # <<<<<<<<<<<<<<
  4505. * cdef object key
  4506. * cdef object value
  4507. */
  4508. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__extend(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, PyObject *__pyx_v_name, int __pyx_v_do_add) {
  4509. PyObject *__pyx_v_arg = 0;
  4510. PyObject *__pyx_r = NULL;
  4511. __Pyx_RefNannyDeclarations
  4512. Py_ssize_t __pyx_t_1;
  4513. int __pyx_t_2;
  4514. PyObject *__pyx_t_3 = NULL;
  4515. PyObject *__pyx_t_4 = NULL;
  4516. PyObject *__pyx_t_5 = NULL;
  4517. PyObject *__pyx_t_6 = NULL;
  4518. int __pyx_t_7;
  4519. PyObject *__pyx_t_8 = NULL;
  4520. int __pyx_t_9;
  4521. int __pyx_t_10;
  4522. __Pyx_RefNannySetupContext("_extend", 0);
  4523. /* "multidict/_multidict.pyx":204
  4524. * cdef object i
  4525. *
  4526. * if len(args) > 1: # <<<<<<<<<<<<<<
  4527. * raise TypeError("{} takes at most 1 positional argument"
  4528. * " ({} given)".format(name, len(args)))
  4529. */
  4530. if (unlikely(__pyx_v_args == Py_None)) {
  4531. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  4532. __PYX_ERR(0, 204, __pyx_L1_error)
  4533. }
  4534. __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 204, __pyx_L1_error)
  4535. __pyx_t_2 = ((__pyx_t_1 > 1) != 0);
  4536. if (unlikely(__pyx_t_2)) {
  4537. /* "multidict/_multidict.pyx":206
  4538. * if len(args) > 1:
  4539. * raise TypeError("{} takes at most 1 positional argument"
  4540. * " ({} given)".format(name, len(args))) # <<<<<<<<<<<<<<
  4541. *
  4542. * if args:
  4543. */
  4544. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_takes_at_most_1_positional_argu, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error)
  4545. __Pyx_GOTREF(__pyx_t_4);
  4546. if (unlikely(__pyx_v_args == Py_None)) {
  4547. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  4548. __PYX_ERR(0, 206, __pyx_L1_error)
  4549. }
  4550. __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 206, __pyx_L1_error)
  4551. __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __pyx_L1_error)
  4552. __Pyx_GOTREF(__pyx_t_5);
  4553. __pyx_t_6 = NULL;
  4554. __pyx_t_7 = 0;
  4555. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
  4556. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
  4557. if (likely(__pyx_t_6)) {
  4558. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
  4559. __Pyx_INCREF(__pyx_t_6);
  4560. __Pyx_INCREF(function);
  4561. __Pyx_DECREF_SET(__pyx_t_4, function);
  4562. __pyx_t_7 = 1;
  4563. }
  4564. }
  4565. #if CYTHON_FAST_PYCALL
  4566. if (PyFunction_Check(__pyx_t_4)) {
  4567. PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_name, __pyx_t_5};
  4568. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error)
  4569. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  4570. __Pyx_GOTREF(__pyx_t_3);
  4571. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4572. } else
  4573. #endif
  4574. #if CYTHON_FAST_PYCCALL
  4575. if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
  4576. PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_name, __pyx_t_5};
  4577. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error)
  4578. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  4579. __Pyx_GOTREF(__pyx_t_3);
  4580. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4581. } else
  4582. #endif
  4583. {
  4584. __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 206, __pyx_L1_error)
  4585. __Pyx_GOTREF(__pyx_t_8);
  4586. if (__pyx_t_6) {
  4587. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  4588. }
  4589. __Pyx_INCREF(__pyx_v_name);
  4590. __Pyx_GIVEREF(__pyx_v_name);
  4591. PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_name);
  4592. __Pyx_GIVEREF(__pyx_t_5);
  4593. PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
  4594. __pyx_t_5 = 0;
  4595. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error)
  4596. __Pyx_GOTREF(__pyx_t_3);
  4597. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4598. }
  4599. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4600. /* "multidict/_multidict.pyx":205
  4601. *
  4602. * if len(args) > 1:
  4603. * raise TypeError("{} takes at most 1 positional argument" # <<<<<<<<<<<<<<
  4604. * " ({} given)".format(name, len(args)))
  4605. *
  4606. */
  4607. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error)
  4608. __Pyx_GOTREF(__pyx_t_4);
  4609. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4610. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  4611. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4612. __PYX_ERR(0, 205, __pyx_L1_error)
  4613. /* "multidict/_multidict.pyx":204
  4614. * cdef object i
  4615. *
  4616. * if len(args) > 1: # <<<<<<<<<<<<<<
  4617. * raise TypeError("{} takes at most 1 positional argument"
  4618. * " ({} given)".format(name, len(args)))
  4619. */
  4620. }
  4621. /* "multidict/_multidict.pyx":208
  4622. * " ({} given)".format(name, len(args)))
  4623. *
  4624. * if args: # <<<<<<<<<<<<<<
  4625. * arg = args[0]
  4626. * if isinstance(arg, _Base) and not kwargs:
  4627. */
  4628. __pyx_t_2 = (__pyx_v_args != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_args) != 0);
  4629. if (__pyx_t_2) {
  4630. /* "multidict/_multidict.pyx":209
  4631. *
  4632. * if args:
  4633. * arg = args[0] # <<<<<<<<<<<<<<
  4634. * if isinstance(arg, _Base) and not kwargs:
  4635. * if do_add:
  4636. */
  4637. if (unlikely(__pyx_v_args == Py_None)) {
  4638. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  4639. __PYX_ERR(0, 209, __pyx_L1_error)
  4640. }
  4641. __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error)
  4642. __Pyx_GOTREF(__pyx_t_4);
  4643. __pyx_v_arg = __pyx_t_4;
  4644. __pyx_t_4 = 0;
  4645. /* "multidict/_multidict.pyx":210
  4646. * if args:
  4647. * arg = args[0]
  4648. * if isinstance(arg, _Base) and not kwargs: # <<<<<<<<<<<<<<
  4649. * if do_add:
  4650. * self._append_items((<_Base>arg)._impl)
  4651. */
  4652. __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_ptype_9multidict_10_multidict__Base);
  4653. __pyx_t_10 = (__pyx_t_9 != 0);
  4654. if (__pyx_t_10) {
  4655. } else {
  4656. __pyx_t_2 = __pyx_t_10;
  4657. goto __pyx_L6_bool_binop_done;
  4658. }
  4659. __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
  4660. __pyx_t_9 = ((!__pyx_t_10) != 0);
  4661. __pyx_t_2 = __pyx_t_9;
  4662. __pyx_L6_bool_binop_done:;
  4663. if (__pyx_t_2) {
  4664. /* "multidict/_multidict.pyx":211
  4665. * arg = args[0]
  4666. * if isinstance(arg, _Base) and not kwargs:
  4667. * if do_add: # <<<<<<<<<<<<<<
  4668. * self._append_items((<_Base>arg)._impl)
  4669. * else:
  4670. */
  4671. __pyx_t_2 = (__pyx_v_do_add != 0);
  4672. if (__pyx_t_2) {
  4673. /* "multidict/_multidict.pyx":212
  4674. * if isinstance(arg, _Base) and not kwargs:
  4675. * if do_add:
  4676. * self._append_items((<_Base>arg)._impl) # <<<<<<<<<<<<<<
  4677. * else:
  4678. * self._update_items((<_Base>arg)._impl)
  4679. */
  4680. __pyx_t_4 = ((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_arg)->_impl;
  4681. __Pyx_INCREF(__pyx_t_4);
  4682. __pyx_t_3 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_self->__pyx_base.__pyx_vtab)->_append_items(__pyx_v_self, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
  4683. __Pyx_GOTREF(__pyx_t_3);
  4684. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4685. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4686. /* "multidict/_multidict.pyx":211
  4687. * arg = args[0]
  4688. * if isinstance(arg, _Base) and not kwargs:
  4689. * if do_add: # <<<<<<<<<<<<<<
  4690. * self._append_items((<_Base>arg)._impl)
  4691. * else:
  4692. */
  4693. goto __pyx_L8;
  4694. }
  4695. /* "multidict/_multidict.pyx":214
  4696. * self._append_items((<_Base>arg)._impl)
  4697. * else:
  4698. * self._update_items((<_Base>arg)._impl) # <<<<<<<<<<<<<<
  4699. * else:
  4700. * if hasattr(arg, 'items'):
  4701. */
  4702. /*else*/ {
  4703. __pyx_t_3 = ((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v_arg)->_impl;
  4704. __Pyx_INCREF(__pyx_t_3);
  4705. __pyx_t_4 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_self->__pyx_base.__pyx_vtab)->_update_items(__pyx_v_self, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __pyx_L1_error)
  4706. __Pyx_GOTREF(__pyx_t_4);
  4707. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4708. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4709. }
  4710. __pyx_L8:;
  4711. /* "multidict/_multidict.pyx":210
  4712. * if args:
  4713. * arg = args[0]
  4714. * if isinstance(arg, _Base) and not kwargs: # <<<<<<<<<<<<<<
  4715. * if do_add:
  4716. * self._append_items((<_Base>arg)._impl)
  4717. */
  4718. goto __pyx_L5;
  4719. }
  4720. /* "multidict/_multidict.pyx":216
  4721. * self._update_items((<_Base>arg)._impl)
  4722. * else:
  4723. * if hasattr(arg, 'items'): # <<<<<<<<<<<<<<
  4724. * arg = arg.items()
  4725. * if kwargs:
  4726. */
  4727. /*else*/ {
  4728. __pyx_t_2 = __Pyx_HasAttr(__pyx_v_arg, __pyx_n_s_items); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 216, __pyx_L1_error)
  4729. __pyx_t_9 = (__pyx_t_2 != 0);
  4730. if (__pyx_t_9) {
  4731. /* "multidict/_multidict.pyx":217
  4732. * else:
  4733. * if hasattr(arg, 'items'):
  4734. * arg = arg.items() # <<<<<<<<<<<<<<
  4735. * if kwargs:
  4736. * arg = list(arg)
  4737. */
  4738. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error)
  4739. __Pyx_GOTREF(__pyx_t_3);
  4740. __pyx_t_8 = NULL;
  4741. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  4742. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
  4743. if (likely(__pyx_t_8)) {
  4744. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  4745. __Pyx_INCREF(__pyx_t_8);
  4746. __Pyx_INCREF(function);
  4747. __Pyx_DECREF_SET(__pyx_t_3, function);
  4748. }
  4749. }
  4750. __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  4751. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  4752. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error)
  4753. __Pyx_GOTREF(__pyx_t_4);
  4754. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4755. __Pyx_DECREF_SET(__pyx_v_arg, __pyx_t_4);
  4756. __pyx_t_4 = 0;
  4757. /* "multidict/_multidict.pyx":216
  4758. * self._update_items((<_Base>arg)._impl)
  4759. * else:
  4760. * if hasattr(arg, 'items'): # <<<<<<<<<<<<<<
  4761. * arg = arg.items()
  4762. * if kwargs:
  4763. */
  4764. }
  4765. /* "multidict/_multidict.pyx":218
  4766. * if hasattr(arg, 'items'):
  4767. * arg = arg.items()
  4768. * if kwargs: # <<<<<<<<<<<<<<
  4769. * arg = list(arg)
  4770. * arg.extend(list(kwargs.items()))
  4771. */
  4772. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 218, __pyx_L1_error)
  4773. if (__pyx_t_9) {
  4774. /* "multidict/_multidict.pyx":219
  4775. * arg = arg.items()
  4776. * if kwargs:
  4777. * arg = list(arg) # <<<<<<<<<<<<<<
  4778. * arg.extend(list(kwargs.items()))
  4779. * if do_add:
  4780. */
  4781. __pyx_t_4 = PySequence_List(__pyx_v_arg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 219, __pyx_L1_error)
  4782. __Pyx_GOTREF(__pyx_t_4);
  4783. __Pyx_DECREF_SET(__pyx_v_arg, __pyx_t_4);
  4784. __pyx_t_4 = 0;
  4785. /* "multidict/_multidict.pyx":220
  4786. * if kwargs:
  4787. * arg = list(arg)
  4788. * arg.extend(list(kwargs.items())) # <<<<<<<<<<<<<<
  4789. * if do_add:
  4790. * self._append_items_seq(arg, name)
  4791. */
  4792. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error)
  4793. __Pyx_GOTREF(__pyx_t_3);
  4794. if (unlikely(__pyx_v_kwargs == Py_None)) {
  4795. PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
  4796. __PYX_ERR(0, 220, __pyx_L1_error)
  4797. }
  4798. __pyx_t_8 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 220, __pyx_L1_error)
  4799. __Pyx_GOTREF(__pyx_t_8);
  4800. __pyx_t_5 = PySequence_List(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error)
  4801. __Pyx_GOTREF(__pyx_t_5);
  4802. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4803. __pyx_t_8 = NULL;
  4804. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  4805. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
  4806. if (likely(__pyx_t_8)) {
  4807. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  4808. __Pyx_INCREF(__pyx_t_8);
  4809. __Pyx_INCREF(function);
  4810. __Pyx_DECREF_SET(__pyx_t_3, function);
  4811. }
  4812. }
  4813. __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
  4814. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  4815. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4816. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error)
  4817. __Pyx_GOTREF(__pyx_t_4);
  4818. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4819. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4820. /* "multidict/_multidict.pyx":218
  4821. * if hasattr(arg, 'items'):
  4822. * arg = arg.items()
  4823. * if kwargs: # <<<<<<<<<<<<<<
  4824. * arg = list(arg)
  4825. * arg.extend(list(kwargs.items()))
  4826. */
  4827. }
  4828. /* "multidict/_multidict.pyx":221
  4829. * arg = list(arg)
  4830. * arg.extend(list(kwargs.items()))
  4831. * if do_add: # <<<<<<<<<<<<<<
  4832. * self._append_items_seq(arg, name)
  4833. * else:
  4834. */
  4835. __pyx_t_9 = (__pyx_v_do_add != 0);
  4836. if (__pyx_t_9) {
  4837. /* "multidict/_multidict.pyx":222
  4838. * arg.extend(list(kwargs.items()))
  4839. * if do_add:
  4840. * self._append_items_seq(arg, name) # <<<<<<<<<<<<<<
  4841. * else:
  4842. * pair_list_update_from_seq(self._impl, arg)
  4843. */
  4844. __pyx_t_4 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_self->__pyx_base.__pyx_vtab)->_append_items_seq(__pyx_v_self, __pyx_v_arg, __pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error)
  4845. __Pyx_GOTREF(__pyx_t_4);
  4846. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4847. /* "multidict/_multidict.pyx":221
  4848. * arg = list(arg)
  4849. * arg.extend(list(kwargs.items()))
  4850. * if do_add: # <<<<<<<<<<<<<<
  4851. * self._append_items_seq(arg, name)
  4852. * else:
  4853. */
  4854. goto __pyx_L11;
  4855. }
  4856. /* "multidict/_multidict.pyx":224
  4857. * self._append_items_seq(arg, name)
  4858. * else:
  4859. * pair_list_update_from_seq(self._impl, arg) # <<<<<<<<<<<<<<
  4860. * else:
  4861. * arg = list(kwargs.items())
  4862. */
  4863. /*else*/ {
  4864. __pyx_t_4 = __pyx_v_self->__pyx_base._impl;
  4865. __Pyx_INCREF(__pyx_t_4);
  4866. __pyx_t_7 = pair_list_update_from_seq(__pyx_t_4, __pyx_v_arg); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 224, __pyx_L1_error)
  4867. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4868. }
  4869. __pyx_L11:;
  4870. }
  4871. __pyx_L5:;
  4872. /* "multidict/_multidict.pyx":208
  4873. * " ({} given)".format(name, len(args)))
  4874. *
  4875. * if args: # <<<<<<<<<<<<<<
  4876. * arg = args[0]
  4877. * if isinstance(arg, _Base) and not kwargs:
  4878. */
  4879. goto __pyx_L4;
  4880. }
  4881. /* "multidict/_multidict.pyx":226
  4882. * pair_list_update_from_seq(self._impl, arg)
  4883. * else:
  4884. * arg = list(kwargs.items()) # <<<<<<<<<<<<<<
  4885. * if do_add:
  4886. * self._append_items_seq(arg, name)
  4887. */
  4888. /*else*/ {
  4889. if (unlikely(__pyx_v_kwargs == Py_None)) {
  4890. PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
  4891. __PYX_ERR(0, 226, __pyx_L1_error)
  4892. }
  4893. __pyx_t_4 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
  4894. __Pyx_GOTREF(__pyx_t_4);
  4895. __pyx_t_3 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error)
  4896. __Pyx_GOTREF(__pyx_t_3);
  4897. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4898. __pyx_v_arg = __pyx_t_3;
  4899. __pyx_t_3 = 0;
  4900. /* "multidict/_multidict.pyx":227
  4901. * else:
  4902. * arg = list(kwargs.items())
  4903. * if do_add: # <<<<<<<<<<<<<<
  4904. * self._append_items_seq(arg, name)
  4905. * else:
  4906. */
  4907. __pyx_t_9 = (__pyx_v_do_add != 0);
  4908. if (__pyx_t_9) {
  4909. /* "multidict/_multidict.pyx":228
  4910. * arg = list(kwargs.items())
  4911. * if do_add:
  4912. * self._append_items_seq(arg, name) # <<<<<<<<<<<<<<
  4913. * else:
  4914. * pair_list_update_from_seq(self._impl, arg)
  4915. */
  4916. __pyx_t_3 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_self->__pyx_base.__pyx_vtab)->_append_items_seq(__pyx_v_self, __pyx_v_arg, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error)
  4917. __Pyx_GOTREF(__pyx_t_3);
  4918. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4919. /* "multidict/_multidict.pyx":227
  4920. * else:
  4921. * arg = list(kwargs.items())
  4922. * if do_add: # <<<<<<<<<<<<<<
  4923. * self._append_items_seq(arg, name)
  4924. * else:
  4925. */
  4926. goto __pyx_L12;
  4927. }
  4928. /* "multidict/_multidict.pyx":230
  4929. * self._append_items_seq(arg, name)
  4930. * else:
  4931. * pair_list_update_from_seq(self._impl, arg) # <<<<<<<<<<<<<<
  4932. *
  4933. * cdef object _update_items(self, object impl):
  4934. */
  4935. /*else*/ {
  4936. __pyx_t_3 = __pyx_v_self->__pyx_base._impl;
  4937. __Pyx_INCREF(__pyx_t_3);
  4938. __pyx_t_7 = pair_list_update_from_seq(__pyx_t_3, __pyx_v_arg); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 230, __pyx_L1_error)
  4939. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4940. }
  4941. __pyx_L12:;
  4942. }
  4943. __pyx_L4:;
  4944. /* "multidict/_multidict.pyx":198
  4945. * )
  4946. *
  4947. * cdef _extend(self, tuple args, dict kwargs, name, bint do_add): # <<<<<<<<<<<<<<
  4948. * cdef object key
  4949. * cdef object value
  4950. */
  4951. /* function exit code */
  4952. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  4953. goto __pyx_L0;
  4954. __pyx_L1_error:;
  4955. __Pyx_XDECREF(__pyx_t_3);
  4956. __Pyx_XDECREF(__pyx_t_4);
  4957. __Pyx_XDECREF(__pyx_t_5);
  4958. __Pyx_XDECREF(__pyx_t_6);
  4959. __Pyx_XDECREF(__pyx_t_8);
  4960. __Pyx_AddTraceback("multidict._multidict.MultiDict._extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4961. __pyx_r = 0;
  4962. __pyx_L0:;
  4963. __Pyx_XDECREF(__pyx_v_arg);
  4964. __Pyx_XGIVEREF(__pyx_r);
  4965. __Pyx_RefNannyFinishContext();
  4966. return __pyx_r;
  4967. }
  4968. /* "multidict/_multidict.pyx":232
  4969. * pair_list_update_from_seq(self._impl, arg)
  4970. *
  4971. * cdef object _update_items(self, object impl): # <<<<<<<<<<<<<<
  4972. * pair_list_update(self._impl, impl)
  4973. *
  4974. */
  4975. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__update_items(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_impl) {
  4976. PyObject *__pyx_r = NULL;
  4977. __Pyx_RefNannyDeclarations
  4978. PyObject *__pyx_t_1 = NULL;
  4979. int __pyx_t_2;
  4980. __Pyx_RefNannySetupContext("_update_items", 0);
  4981. /* "multidict/_multidict.pyx":233
  4982. *
  4983. * cdef object _update_items(self, object impl):
  4984. * pair_list_update(self._impl, impl) # <<<<<<<<<<<<<<
  4985. *
  4986. * cdef object _append_items(self, object impl):
  4987. */
  4988. __pyx_t_1 = __pyx_v_self->__pyx_base._impl;
  4989. __Pyx_INCREF(__pyx_t_1);
  4990. __pyx_t_2 = pair_list_update(__pyx_t_1, __pyx_v_impl); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 233, __pyx_L1_error)
  4991. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4992. /* "multidict/_multidict.pyx":232
  4993. * pair_list_update_from_seq(self._impl, arg)
  4994. *
  4995. * cdef object _update_items(self, object impl): # <<<<<<<<<<<<<<
  4996. * pair_list_update(self._impl, impl)
  4997. *
  4998. */
  4999. /* function exit code */
  5000. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5001. goto __pyx_L0;
  5002. __pyx_L1_error:;
  5003. __Pyx_XDECREF(__pyx_t_1);
  5004. __Pyx_AddTraceback("multidict._multidict.MultiDict._update_items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5005. __pyx_r = 0;
  5006. __pyx_L0:;
  5007. __Pyx_XGIVEREF(__pyx_r);
  5008. __Pyx_RefNannyFinishContext();
  5009. return __pyx_r;
  5010. }
  5011. /* "multidict/_multidict.pyx":235
  5012. * pair_list_update(self._impl, impl)
  5013. *
  5014. * cdef object _append_items(self, object impl): # <<<<<<<<<<<<<<
  5015. * cdef PyObject *key
  5016. * cdef PyObject *val
  5017. */
  5018. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__append_items(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_impl) {
  5019. PyObject *__pyx_v_key;
  5020. PyObject *__pyx_v_val;
  5021. Py_ssize_t __pyx_v_pos;
  5022. PyObject *__pyx_r = NULL;
  5023. __Pyx_RefNannyDeclarations
  5024. int __pyx_t_1;
  5025. int __pyx_t_2;
  5026. PyObject *__pyx_t_3 = NULL;
  5027. __Pyx_RefNannySetupContext("_append_items", 0);
  5028. /* "multidict/_multidict.pyx":239
  5029. * cdef PyObject *val
  5030. * cdef Py_ssize_t pos
  5031. * pos = 0 # <<<<<<<<<<<<<<
  5032. * while _pair_list_next(impl, &pos, NULL, &key, &val, NULL):
  5033. * self._add(<object>key, <object>val)
  5034. */
  5035. __pyx_v_pos = 0;
  5036. /* "multidict/_multidict.pyx":240
  5037. * cdef Py_ssize_t pos
  5038. * pos = 0
  5039. * while _pair_list_next(impl, &pos, NULL, &key, &val, NULL): # <<<<<<<<<<<<<<
  5040. * self._add(<object>key, <object>val)
  5041. *
  5042. */
  5043. while (1) {
  5044. __pyx_t_1 = _pair_list_next(__pyx_v_impl, (&__pyx_v_pos), NULL, (&__pyx_v_key), (&__pyx_v_val), NULL); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 240, __pyx_L1_error)
  5045. __pyx_t_2 = (__pyx_t_1 != 0);
  5046. if (!__pyx_t_2) break;
  5047. /* "multidict/_multidict.pyx":241
  5048. * pos = 0
  5049. * while _pair_list_next(impl, &pos, NULL, &key, &val, NULL):
  5050. * self._add(<object>key, <object>val) # <<<<<<<<<<<<<<
  5051. *
  5052. * cdef object _append_items_seq(self, object arg, object name):
  5053. */
  5054. __pyx_t_3 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_self->__pyx_base.__pyx_vtab)->_add(__pyx_v_self, ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_val)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error)
  5055. __Pyx_GOTREF(__pyx_t_3);
  5056. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5057. }
  5058. /* "multidict/_multidict.pyx":235
  5059. * pair_list_update(self._impl, impl)
  5060. *
  5061. * cdef object _append_items(self, object impl): # <<<<<<<<<<<<<<
  5062. * cdef PyObject *key
  5063. * cdef PyObject *val
  5064. */
  5065. /* function exit code */
  5066. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5067. goto __pyx_L0;
  5068. __pyx_L1_error:;
  5069. __Pyx_XDECREF(__pyx_t_3);
  5070. __Pyx_AddTraceback("multidict._multidict.MultiDict._append_items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5071. __pyx_r = 0;
  5072. __pyx_L0:;
  5073. __Pyx_XGIVEREF(__pyx_r);
  5074. __Pyx_RefNannyFinishContext();
  5075. return __pyx_r;
  5076. }
  5077. /* "multidict/_multidict.pyx":243
  5078. * self._add(<object>key, <object>val)
  5079. *
  5080. * cdef object _append_items_seq(self, object arg, object name): # <<<<<<<<<<<<<<
  5081. * cdef object i
  5082. * cdef object key
  5083. */
  5084. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__append_items_seq(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_arg, PyObject *__pyx_v_name) {
  5085. PyObject *__pyx_v_i = 0;
  5086. PyObject *__pyx_v_key = 0;
  5087. PyObject *__pyx_v_value = 0;
  5088. PyObject *__pyx_r = NULL;
  5089. __Pyx_RefNannyDeclarations
  5090. PyObject *__pyx_t_1 = NULL;
  5091. Py_ssize_t __pyx_t_2;
  5092. PyObject *(*__pyx_t_3)(PyObject *);
  5093. PyObject *__pyx_t_4 = NULL;
  5094. Py_ssize_t __pyx_t_5;
  5095. int __pyx_t_6;
  5096. PyObject *__pyx_t_7 = NULL;
  5097. PyObject *__pyx_t_8 = NULL;
  5098. __Pyx_RefNannySetupContext("_append_items_seq", 0);
  5099. /* "multidict/_multidict.pyx":247
  5100. * cdef object key
  5101. * cdef object value
  5102. * for i in arg: # <<<<<<<<<<<<<<
  5103. * if not len(i) == 2:
  5104. * raise TypeError(
  5105. */
  5106. if (likely(PyList_CheckExact(__pyx_v_arg)) || PyTuple_CheckExact(__pyx_v_arg)) {
  5107. __pyx_t_1 = __pyx_v_arg; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  5108. __pyx_t_3 = NULL;
  5109. } else {
  5110. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
  5111. __Pyx_GOTREF(__pyx_t_1);
  5112. __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error)
  5113. }
  5114. for (;;) {
  5115. if (likely(!__pyx_t_3)) {
  5116. if (likely(PyList_CheckExact(__pyx_t_1))) {
  5117. if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
  5118. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5119. __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
  5120. #else
  5121. __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error)
  5122. __Pyx_GOTREF(__pyx_t_4);
  5123. #endif
  5124. } else {
  5125. if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  5126. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5127. __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
  5128. #else
  5129. __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error)
  5130. __Pyx_GOTREF(__pyx_t_4);
  5131. #endif
  5132. }
  5133. } else {
  5134. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  5135. if (unlikely(!__pyx_t_4)) {
  5136. PyObject* exc_type = PyErr_Occurred();
  5137. if (exc_type) {
  5138. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  5139. else __PYX_ERR(0, 247, __pyx_L1_error)
  5140. }
  5141. break;
  5142. }
  5143. __Pyx_GOTREF(__pyx_t_4);
  5144. }
  5145. __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
  5146. __pyx_t_4 = 0;
  5147. /* "multidict/_multidict.pyx":248
  5148. * cdef object value
  5149. * for i in arg:
  5150. * if not len(i) == 2: # <<<<<<<<<<<<<<
  5151. * raise TypeError(
  5152. * "{} takes either dict or list of (key, value) "
  5153. */
  5154. __pyx_t_5 = PyObject_Length(__pyx_v_i); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 248, __pyx_L1_error)
  5155. __pyx_t_6 = ((!((__pyx_t_5 == 2) != 0)) != 0);
  5156. if (unlikely(__pyx_t_6)) {
  5157. /* "multidict/_multidict.pyx":251
  5158. * raise TypeError(
  5159. * "{} takes either dict or list of (key, value) "
  5160. * "tuples".format(name)) # <<<<<<<<<<<<<<
  5161. * key = i[0]
  5162. * value = i[1]
  5163. */
  5164. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_takes_either_dict_or_list_of_ke, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error)
  5165. __Pyx_GOTREF(__pyx_t_7);
  5166. __pyx_t_8 = NULL;
  5167. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
  5168. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
  5169. if (likely(__pyx_t_8)) {
  5170. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  5171. __Pyx_INCREF(__pyx_t_8);
  5172. __Pyx_INCREF(function);
  5173. __Pyx_DECREF_SET(__pyx_t_7, function);
  5174. }
  5175. }
  5176. __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_name);
  5177. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  5178. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
  5179. __Pyx_GOTREF(__pyx_t_4);
  5180. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5181. /* "multidict/_multidict.pyx":249
  5182. * for i in arg:
  5183. * if not len(i) == 2:
  5184. * raise TypeError( # <<<<<<<<<<<<<<
  5185. * "{} takes either dict or list of (key, value) "
  5186. * "tuples".format(name))
  5187. */
  5188. __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __pyx_L1_error)
  5189. __Pyx_GOTREF(__pyx_t_7);
  5190. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5191. __Pyx_Raise(__pyx_t_7, 0, 0, 0);
  5192. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5193. __PYX_ERR(0, 249, __pyx_L1_error)
  5194. /* "multidict/_multidict.pyx":248
  5195. * cdef object value
  5196. * for i in arg:
  5197. * if not len(i) == 2: # <<<<<<<<<<<<<<
  5198. * raise TypeError(
  5199. * "{} takes either dict or list of (key, value) "
  5200. */
  5201. }
  5202. /* "multidict/_multidict.pyx":252
  5203. * "{} takes either dict or list of (key, value) "
  5204. * "tuples".format(name))
  5205. * key = i[0] # <<<<<<<<<<<<<<
  5206. * value = i[1]
  5207. * self._add(key, value)
  5208. */
  5209. __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_i, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error)
  5210. __Pyx_GOTREF(__pyx_t_7);
  5211. __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_7);
  5212. __pyx_t_7 = 0;
  5213. /* "multidict/_multidict.pyx":253
  5214. * "tuples".format(name))
  5215. * key = i[0]
  5216. * value = i[1] # <<<<<<<<<<<<<<
  5217. * self._add(key, value)
  5218. *
  5219. */
  5220. __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_i, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L1_error)
  5221. __Pyx_GOTREF(__pyx_t_7);
  5222. __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7);
  5223. __pyx_t_7 = 0;
  5224. /* "multidict/_multidict.pyx":254
  5225. * key = i[0]
  5226. * value = i[1]
  5227. * self._add(key, value) # <<<<<<<<<<<<<<
  5228. *
  5229. * cdef _add(self, key, value):
  5230. */
  5231. __pyx_t_7 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_self->__pyx_base.__pyx_vtab)->_add(__pyx_v_self, __pyx_v_key, __pyx_v_value); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error)
  5232. __Pyx_GOTREF(__pyx_t_7);
  5233. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5234. /* "multidict/_multidict.pyx":247
  5235. * cdef object key
  5236. * cdef object value
  5237. * for i in arg: # <<<<<<<<<<<<<<
  5238. * if not len(i) == 2:
  5239. * raise TypeError(
  5240. */
  5241. }
  5242. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5243. /* "multidict/_multidict.pyx":243
  5244. * self._add(<object>key, <object>val)
  5245. *
  5246. * cdef object _append_items_seq(self, object arg, object name): # <<<<<<<<<<<<<<
  5247. * cdef object i
  5248. * cdef object key
  5249. */
  5250. /* function exit code */
  5251. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5252. goto __pyx_L0;
  5253. __pyx_L1_error:;
  5254. __Pyx_XDECREF(__pyx_t_1);
  5255. __Pyx_XDECREF(__pyx_t_4);
  5256. __Pyx_XDECREF(__pyx_t_7);
  5257. __Pyx_XDECREF(__pyx_t_8);
  5258. __Pyx_AddTraceback("multidict._multidict.MultiDict._append_items_seq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5259. __pyx_r = 0;
  5260. __pyx_L0:;
  5261. __Pyx_XDECREF(__pyx_v_i);
  5262. __Pyx_XDECREF(__pyx_v_key);
  5263. __Pyx_XDECREF(__pyx_v_value);
  5264. __Pyx_XGIVEREF(__pyx_r);
  5265. __Pyx_RefNannyFinishContext();
  5266. return __pyx_r;
  5267. }
  5268. /* "multidict/_multidict.pyx":256
  5269. * self._add(key, value)
  5270. *
  5271. * cdef _add(self, key, value): # <<<<<<<<<<<<<<
  5272. * pair_list_add(self._impl, key, value);
  5273. *
  5274. */
  5275. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__add(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  5276. PyObject *__pyx_r = NULL;
  5277. __Pyx_RefNannyDeclarations
  5278. PyObject *__pyx_t_1 = NULL;
  5279. int __pyx_t_2;
  5280. __Pyx_RefNannySetupContext("_add", 0);
  5281. /* "multidict/_multidict.pyx":257
  5282. *
  5283. * cdef _add(self, key, value):
  5284. * pair_list_add(self._impl, key, value); # <<<<<<<<<<<<<<
  5285. *
  5286. * cdef _replace(self, key, value):
  5287. */
  5288. __pyx_t_1 = __pyx_v_self->__pyx_base._impl;
  5289. __Pyx_INCREF(__pyx_t_1);
  5290. __pyx_t_2 = pair_list_add(__pyx_t_1, __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 257, __pyx_L1_error)
  5291. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5292. /* "multidict/_multidict.pyx":256
  5293. * self._add(key, value)
  5294. *
  5295. * cdef _add(self, key, value): # <<<<<<<<<<<<<<
  5296. * pair_list_add(self._impl, key, value);
  5297. *
  5298. */
  5299. /* function exit code */
  5300. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5301. goto __pyx_L0;
  5302. __pyx_L1_error:;
  5303. __Pyx_XDECREF(__pyx_t_1);
  5304. __Pyx_AddTraceback("multidict._multidict.MultiDict._add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5305. __pyx_r = 0;
  5306. __pyx_L0:;
  5307. __Pyx_XGIVEREF(__pyx_r);
  5308. __Pyx_RefNannyFinishContext();
  5309. return __pyx_r;
  5310. }
  5311. /* "multidict/_multidict.pyx":259
  5312. * pair_list_add(self._impl, key, value);
  5313. *
  5314. * cdef _replace(self, key, value): # <<<<<<<<<<<<<<
  5315. * pair_list_replace(self._impl, key, value)
  5316. *
  5317. */
  5318. static PyObject *__pyx_f_9multidict_10_multidict_9MultiDict__replace(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  5319. PyObject *__pyx_r = NULL;
  5320. __Pyx_RefNannyDeclarations
  5321. PyObject *__pyx_t_1 = NULL;
  5322. int __pyx_t_2;
  5323. __Pyx_RefNannySetupContext("_replace", 0);
  5324. /* "multidict/_multidict.pyx":260
  5325. *
  5326. * cdef _replace(self, key, value):
  5327. * pair_list_replace(self._impl, key, value) # <<<<<<<<<<<<<<
  5328. *
  5329. * def add(self, key, value):
  5330. */
  5331. __pyx_t_1 = __pyx_v_self->__pyx_base._impl;
  5332. __Pyx_INCREF(__pyx_t_1);
  5333. __pyx_t_2 = pair_list_replace(__pyx_t_1, __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 260, __pyx_L1_error)
  5334. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5335. /* "multidict/_multidict.pyx":259
  5336. * pair_list_add(self._impl, key, value);
  5337. *
  5338. * cdef _replace(self, key, value): # <<<<<<<<<<<<<<
  5339. * pair_list_replace(self._impl, key, value)
  5340. *
  5341. */
  5342. /* function exit code */
  5343. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5344. goto __pyx_L0;
  5345. __pyx_L1_error:;
  5346. __Pyx_XDECREF(__pyx_t_1);
  5347. __Pyx_AddTraceback("multidict._multidict.MultiDict._replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5348. __pyx_r = 0;
  5349. __pyx_L0:;
  5350. __Pyx_XGIVEREF(__pyx_r);
  5351. __Pyx_RefNannyFinishContext();
  5352. return __pyx_r;
  5353. }
  5354. /* "multidict/_multidict.pyx":262
  5355. * pair_list_replace(self._impl, key, value)
  5356. *
  5357. * def add(self, key, value): # <<<<<<<<<<<<<<
  5358. * """Add the key and value, not overwriting any previous value."""
  5359. * self._add(key, value)
  5360. */
  5361. /* Python wrapper */
  5362. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_5add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5363. static char __pyx_doc_9multidict_10_multidict_9MultiDict_4add[] = "Add the key and value, not overwriting any previous value.";
  5364. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_5add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  5365. PyObject *__pyx_v_key = 0;
  5366. PyObject *__pyx_v_value = 0;
  5367. PyObject *__pyx_r = 0;
  5368. __Pyx_RefNannyDeclarations
  5369. __Pyx_RefNannySetupContext("add (wrapper)", 0);
  5370. {
  5371. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0};
  5372. PyObject* values[2] = {0,0};
  5373. if (unlikely(__pyx_kwds)) {
  5374. Py_ssize_t kw_args;
  5375. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  5376. switch (pos_args) {
  5377. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5378. CYTHON_FALLTHROUGH;
  5379. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5380. CYTHON_FALLTHROUGH;
  5381. case 0: break;
  5382. default: goto __pyx_L5_argtuple_error;
  5383. }
  5384. kw_args = PyDict_Size(__pyx_kwds);
  5385. switch (pos_args) {
  5386. case 0:
  5387. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
  5388. else goto __pyx_L5_argtuple_error;
  5389. CYTHON_FALLTHROUGH;
  5390. case 1:
  5391. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
  5392. else {
  5393. __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, 1); __PYX_ERR(0, 262, __pyx_L3_error)
  5394. }
  5395. }
  5396. if (unlikely(kw_args > 0)) {
  5397. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(0, 262, __pyx_L3_error)
  5398. }
  5399. } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
  5400. goto __pyx_L5_argtuple_error;
  5401. } else {
  5402. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5403. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5404. }
  5405. __pyx_v_key = values[0];
  5406. __pyx_v_value = values[1];
  5407. }
  5408. goto __pyx_L4_argument_unpacking_done;
  5409. __pyx_L5_argtuple_error:;
  5410. __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 262, __pyx_L3_error)
  5411. __pyx_L3_error:;
  5412. __Pyx_AddTraceback("multidict._multidict.MultiDict.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5413. __Pyx_RefNannyFinishContext();
  5414. return NULL;
  5415. __pyx_L4_argument_unpacking_done:;
  5416. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_4add(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self), __pyx_v_key, __pyx_v_value);
  5417. /* function exit code */
  5418. __Pyx_RefNannyFinishContext();
  5419. return __pyx_r;
  5420. }
  5421. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_4add(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  5422. PyObject *__pyx_r = NULL;
  5423. __Pyx_RefNannyDeclarations
  5424. PyObject *__pyx_t_1 = NULL;
  5425. __Pyx_RefNannySetupContext("add", 0);
  5426. /* "multidict/_multidict.pyx":264
  5427. * def add(self, key, value):
  5428. * """Add the key and value, not overwriting any previous value."""
  5429. * self._add(key, value) # <<<<<<<<<<<<<<
  5430. *
  5431. * def copy(self):
  5432. */
  5433. __pyx_t_1 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_self->__pyx_base.__pyx_vtab)->_add(__pyx_v_self, __pyx_v_key, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
  5434. __Pyx_GOTREF(__pyx_t_1);
  5435. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5436. /* "multidict/_multidict.pyx":262
  5437. * pair_list_replace(self._impl, key, value)
  5438. *
  5439. * def add(self, key, value): # <<<<<<<<<<<<<<
  5440. * """Add the key and value, not overwriting any previous value."""
  5441. * self._add(key, value)
  5442. */
  5443. /* function exit code */
  5444. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5445. goto __pyx_L0;
  5446. __pyx_L1_error:;
  5447. __Pyx_XDECREF(__pyx_t_1);
  5448. __Pyx_AddTraceback("multidict._multidict.MultiDict.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5449. __pyx_r = NULL;
  5450. __pyx_L0:;
  5451. __Pyx_XGIVEREF(__pyx_r);
  5452. __Pyx_RefNannyFinishContext();
  5453. return __pyx_r;
  5454. }
  5455. /* "multidict/_multidict.pyx":266
  5456. * self._add(key, value)
  5457. *
  5458. * def copy(self): # <<<<<<<<<<<<<<
  5459. * """Return a copy of itself."""
  5460. * ret = MultiDict()
  5461. */
  5462. /* Python wrapper */
  5463. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_7copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  5464. static char __pyx_doc_9multidict_10_multidict_9MultiDict_6copy[] = "Return a copy of itself.";
  5465. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_7copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  5466. PyObject *__pyx_r = 0;
  5467. __Pyx_RefNannyDeclarations
  5468. __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  5469. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_6copy(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self));
  5470. /* function exit code */
  5471. __Pyx_RefNannyFinishContext();
  5472. return __pyx_r;
  5473. }
  5474. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_6copy(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self) {
  5475. struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_ret = NULL;
  5476. PyObject *__pyx_r = NULL;
  5477. __Pyx_RefNannyDeclarations
  5478. PyObject *__pyx_t_1 = NULL;
  5479. PyObject *__pyx_t_2 = NULL;
  5480. PyObject *__pyx_t_3 = NULL;
  5481. __Pyx_RefNannySetupContext("copy", 0);
  5482. /* "multidict/_multidict.pyx":268
  5483. * def copy(self):
  5484. * """Return a copy of itself."""
  5485. * ret = MultiDict() # <<<<<<<<<<<<<<
  5486. * ret._extend((list(self.items()),), {}, 'copy', True)
  5487. * return ret
  5488. */
  5489. __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDict)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
  5490. __Pyx_GOTREF(__pyx_t_1);
  5491. __pyx_v_ret = ((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_t_1);
  5492. __pyx_t_1 = 0;
  5493. /* "multidict/_multidict.pyx":269
  5494. * """Return a copy of itself."""
  5495. * ret = MultiDict()
  5496. * ret._extend((list(self.items()),), {}, 'copy', True) # <<<<<<<<<<<<<<
  5497. * return ret
  5498. *
  5499. */
  5500. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
  5501. __Pyx_GOTREF(__pyx_t_2);
  5502. __pyx_t_3 = NULL;
  5503. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  5504. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  5505. if (likely(__pyx_t_3)) {
  5506. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  5507. __Pyx_INCREF(__pyx_t_3);
  5508. __Pyx_INCREF(function);
  5509. __Pyx_DECREF_SET(__pyx_t_2, function);
  5510. }
  5511. }
  5512. __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  5513. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  5514. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
  5515. __Pyx_GOTREF(__pyx_t_1);
  5516. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5517. __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
  5518. __Pyx_GOTREF(__pyx_t_2);
  5519. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5520. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
  5521. __Pyx_GOTREF(__pyx_t_1);
  5522. __Pyx_GIVEREF(__pyx_t_2);
  5523. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  5524. __pyx_t_2 = 0;
  5525. __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
  5526. __Pyx_GOTREF(__pyx_t_2);
  5527. __pyx_t_3 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_ret->__pyx_base.__pyx_vtab)->_extend(__pyx_v_ret, ((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_2), __pyx_n_s_copy, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error)
  5528. __Pyx_GOTREF(__pyx_t_3);
  5529. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5530. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5531. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5532. /* "multidict/_multidict.pyx":270
  5533. * ret = MultiDict()
  5534. * ret._extend((list(self.items()),), {}, 'copy', True)
  5535. * return ret # <<<<<<<<<<<<<<
  5536. *
  5537. * def extend(self, *args, **kwargs):
  5538. */
  5539. __Pyx_XDECREF(__pyx_r);
  5540. __Pyx_INCREF(((PyObject *)__pyx_v_ret));
  5541. __pyx_r = ((PyObject *)__pyx_v_ret);
  5542. goto __pyx_L0;
  5543. /* "multidict/_multidict.pyx":266
  5544. * self._add(key, value)
  5545. *
  5546. * def copy(self): # <<<<<<<<<<<<<<
  5547. * """Return a copy of itself."""
  5548. * ret = MultiDict()
  5549. */
  5550. /* function exit code */
  5551. __pyx_L1_error:;
  5552. __Pyx_XDECREF(__pyx_t_1);
  5553. __Pyx_XDECREF(__pyx_t_2);
  5554. __Pyx_XDECREF(__pyx_t_3);
  5555. __Pyx_AddTraceback("multidict._multidict.MultiDict.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5556. __pyx_r = NULL;
  5557. __pyx_L0:;
  5558. __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  5559. __Pyx_XGIVEREF(__pyx_r);
  5560. __Pyx_RefNannyFinishContext();
  5561. return __pyx_r;
  5562. }
  5563. /* "multidict/_multidict.pyx":272
  5564. * return ret
  5565. *
  5566. * def extend(self, *args, **kwargs): # <<<<<<<<<<<<<<
  5567. * """Extend current MultiDict with more values.
  5568. *
  5569. */
  5570. /* Python wrapper */
  5571. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_9extend(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5572. static char __pyx_doc_9multidict_10_multidict_9MultiDict_8extend[] = "Extend current MultiDict with more values.\n\n This method must be used instead of update.\n ";
  5573. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_9extend(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  5574. PyObject *__pyx_v_args = 0;
  5575. PyObject *__pyx_v_kwargs = 0;
  5576. PyObject *__pyx_r = 0;
  5577. __Pyx_RefNannyDeclarations
  5578. __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  5579. if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "extend", 1))) return NULL;
  5580. __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  5581. __Pyx_GOTREF(__pyx_v_kwargs);
  5582. __Pyx_INCREF(__pyx_args);
  5583. __pyx_v_args = __pyx_args;
  5584. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_8extend(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
  5585. /* function exit code */
  5586. __Pyx_XDECREF(__pyx_v_args);
  5587. __Pyx_XDECREF(__pyx_v_kwargs);
  5588. __Pyx_RefNannyFinishContext();
  5589. return __pyx_r;
  5590. }
  5591. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_8extend(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  5592. PyObject *__pyx_r = NULL;
  5593. __Pyx_RefNannyDeclarations
  5594. PyObject *__pyx_t_1 = NULL;
  5595. __Pyx_RefNannySetupContext("extend", 0);
  5596. /* "multidict/_multidict.pyx":277
  5597. * This method must be used instead of update.
  5598. * """
  5599. * self._extend(args, kwargs, "extend", True) # <<<<<<<<<<<<<<
  5600. *
  5601. * def clear(self):
  5602. */
  5603. __pyx_t_1 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_self->__pyx_base.__pyx_vtab)->_extend(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, __pyx_n_s_extend, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error)
  5604. __Pyx_GOTREF(__pyx_t_1);
  5605. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5606. /* "multidict/_multidict.pyx":272
  5607. * return ret
  5608. *
  5609. * def extend(self, *args, **kwargs): # <<<<<<<<<<<<<<
  5610. * """Extend current MultiDict with more values.
  5611. *
  5612. */
  5613. /* function exit code */
  5614. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5615. goto __pyx_L0;
  5616. __pyx_L1_error:;
  5617. __Pyx_XDECREF(__pyx_t_1);
  5618. __Pyx_AddTraceback("multidict._multidict.MultiDict.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5619. __pyx_r = NULL;
  5620. __pyx_L0:;
  5621. __Pyx_XGIVEREF(__pyx_r);
  5622. __Pyx_RefNannyFinishContext();
  5623. return __pyx_r;
  5624. }
  5625. /* "multidict/_multidict.pyx":279
  5626. * self._extend(args, kwargs, "extend", True)
  5627. *
  5628. * def clear(self): # <<<<<<<<<<<<<<
  5629. * """Remove all items from MultiDict"""
  5630. * pair_list_clear(self._impl)
  5631. */
  5632. /* Python wrapper */
  5633. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_11clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  5634. static char __pyx_doc_9multidict_10_multidict_9MultiDict_10clear[] = "Remove all items from MultiDict";
  5635. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_11clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  5636. PyObject *__pyx_r = 0;
  5637. __Pyx_RefNannyDeclarations
  5638. __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  5639. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_10clear(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self));
  5640. /* function exit code */
  5641. __Pyx_RefNannyFinishContext();
  5642. return __pyx_r;
  5643. }
  5644. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_10clear(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self) {
  5645. PyObject *__pyx_r = NULL;
  5646. __Pyx_RefNannyDeclarations
  5647. PyObject *__pyx_t_1 = NULL;
  5648. int __pyx_t_2;
  5649. __Pyx_RefNannySetupContext("clear", 0);
  5650. /* "multidict/_multidict.pyx":281
  5651. * def clear(self):
  5652. * """Remove all items from MultiDict"""
  5653. * pair_list_clear(self._impl) # <<<<<<<<<<<<<<
  5654. *
  5655. * # MutableMapping interface #
  5656. */
  5657. __pyx_t_1 = __pyx_v_self->__pyx_base._impl;
  5658. __Pyx_INCREF(__pyx_t_1);
  5659. __pyx_t_2 = pair_list_clear(__pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 281, __pyx_L1_error)
  5660. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5661. /* "multidict/_multidict.pyx":279
  5662. * self._extend(args, kwargs, "extend", True)
  5663. *
  5664. * def clear(self): # <<<<<<<<<<<<<<
  5665. * """Remove all items from MultiDict"""
  5666. * pair_list_clear(self._impl)
  5667. */
  5668. /* function exit code */
  5669. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5670. goto __pyx_L0;
  5671. __pyx_L1_error:;
  5672. __Pyx_XDECREF(__pyx_t_1);
  5673. __Pyx_AddTraceback("multidict._multidict.MultiDict.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5674. __pyx_r = NULL;
  5675. __pyx_L0:;
  5676. __Pyx_XGIVEREF(__pyx_r);
  5677. __Pyx_RefNannyFinishContext();
  5678. return __pyx_r;
  5679. }
  5680. /* "multidict/_multidict.pyx":285
  5681. * # MutableMapping interface #
  5682. *
  5683. * def __setitem__(self, key, value): # <<<<<<<<<<<<<<
  5684. * self._replace(key, value)
  5685. *
  5686. */
  5687. /* Python wrapper */
  5688. static int __pyx_pw_9multidict_10_multidict_9MultiDict_13__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
  5689. static int __pyx_pw_9multidict_10_multidict_9MultiDict_13__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  5690. int __pyx_r;
  5691. __Pyx_RefNannyDeclarations
  5692. __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  5693. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_12__setitem__(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));
  5694. /* function exit code */
  5695. __Pyx_RefNannyFinishContext();
  5696. return __pyx_r;
  5697. }
  5698. static int __pyx_pf_9multidict_10_multidict_9MultiDict_12__setitem__(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  5699. int __pyx_r;
  5700. __Pyx_RefNannyDeclarations
  5701. PyObject *__pyx_t_1 = NULL;
  5702. __Pyx_RefNannySetupContext("__setitem__", 0);
  5703. /* "multidict/_multidict.pyx":286
  5704. *
  5705. * def __setitem__(self, key, value):
  5706. * self._replace(key, value) # <<<<<<<<<<<<<<
  5707. *
  5708. * def __delitem__(self, key):
  5709. */
  5710. __pyx_t_1 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_self->__pyx_base.__pyx_vtab)->_replace(__pyx_v_self, __pyx_v_key, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
  5711. __Pyx_GOTREF(__pyx_t_1);
  5712. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5713. /* "multidict/_multidict.pyx":285
  5714. * # MutableMapping interface #
  5715. *
  5716. * def __setitem__(self, key, value): # <<<<<<<<<<<<<<
  5717. * self._replace(key, value)
  5718. *
  5719. */
  5720. /* function exit code */
  5721. __pyx_r = 0;
  5722. goto __pyx_L0;
  5723. __pyx_L1_error:;
  5724. __Pyx_XDECREF(__pyx_t_1);
  5725. __Pyx_AddTraceback("multidict._multidict.MultiDict.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5726. __pyx_r = -1;
  5727. __pyx_L0:;
  5728. __Pyx_RefNannyFinishContext();
  5729. return __pyx_r;
  5730. }
  5731. /* "multidict/_multidict.pyx":288
  5732. * self._replace(key, value)
  5733. *
  5734. * def __delitem__(self, key): # <<<<<<<<<<<<<<
  5735. * pair_list_del(self._impl, key)
  5736. *
  5737. */
  5738. /* Python wrapper */
  5739. static int __pyx_pw_9multidict_10_multidict_9MultiDict_15__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
  5740. static int __pyx_pw_9multidict_10_multidict_9MultiDict_15__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  5741. int __pyx_r;
  5742. __Pyx_RefNannyDeclarations
  5743. __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  5744. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_14__delitem__(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self), ((PyObject *)__pyx_v_key));
  5745. /* function exit code */
  5746. __Pyx_RefNannyFinishContext();
  5747. return __pyx_r;
  5748. }
  5749. static int __pyx_pf_9multidict_10_multidict_9MultiDict_14__delitem__(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key) {
  5750. int __pyx_r;
  5751. __Pyx_RefNannyDeclarations
  5752. PyObject *__pyx_t_1 = NULL;
  5753. int __pyx_t_2;
  5754. __Pyx_RefNannySetupContext("__delitem__", 0);
  5755. /* "multidict/_multidict.pyx":289
  5756. *
  5757. * def __delitem__(self, key):
  5758. * pair_list_del(self._impl, key) # <<<<<<<<<<<<<<
  5759. *
  5760. * def setdefault(self, key, default=None):
  5761. */
  5762. __pyx_t_1 = __pyx_v_self->__pyx_base._impl;
  5763. __Pyx_INCREF(__pyx_t_1);
  5764. __pyx_t_2 = pair_list_del(__pyx_t_1, __pyx_v_key); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 289, __pyx_L1_error)
  5765. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5766. /* "multidict/_multidict.pyx":288
  5767. * self._replace(key, value)
  5768. *
  5769. * def __delitem__(self, key): # <<<<<<<<<<<<<<
  5770. * pair_list_del(self._impl, key)
  5771. *
  5772. */
  5773. /* function exit code */
  5774. __pyx_r = 0;
  5775. goto __pyx_L0;
  5776. __pyx_L1_error:;
  5777. __Pyx_XDECREF(__pyx_t_1);
  5778. __Pyx_AddTraceback("multidict._multidict.MultiDict.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5779. __pyx_r = -1;
  5780. __pyx_L0:;
  5781. __Pyx_RefNannyFinishContext();
  5782. return __pyx_r;
  5783. }
  5784. /* "multidict/_multidict.pyx":291
  5785. * pair_list_del(self._impl, key)
  5786. *
  5787. * def setdefault(self, key, default=None): # <<<<<<<<<<<<<<
  5788. * """Return value for key, set value to default if key is not present."""
  5789. * return pair_list_set_default(self._impl, key, default)
  5790. */
  5791. /* Python wrapper */
  5792. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_17setdefault(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5793. static char __pyx_doc_9multidict_10_multidict_9MultiDict_16setdefault[] = "Return value for key, set value to default if key is not present.";
  5794. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_17setdefault(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  5795. PyObject *__pyx_v_key = 0;
  5796. PyObject *__pyx_v_default = 0;
  5797. PyObject *__pyx_r = 0;
  5798. __Pyx_RefNannyDeclarations
  5799. __Pyx_RefNannySetupContext("setdefault (wrapper)", 0);
  5800. {
  5801. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
  5802. PyObject* values[2] = {0,0};
  5803. values[1] = ((PyObject *)Py_None);
  5804. if (unlikely(__pyx_kwds)) {
  5805. Py_ssize_t kw_args;
  5806. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  5807. switch (pos_args) {
  5808. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5809. CYTHON_FALLTHROUGH;
  5810. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5811. CYTHON_FALLTHROUGH;
  5812. case 0: break;
  5813. default: goto __pyx_L5_argtuple_error;
  5814. }
  5815. kw_args = PyDict_Size(__pyx_kwds);
  5816. switch (pos_args) {
  5817. case 0:
  5818. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
  5819. else goto __pyx_L5_argtuple_error;
  5820. CYTHON_FALLTHROUGH;
  5821. case 1:
  5822. if (kw_args > 0) {
  5823. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
  5824. if (value) { values[1] = value; kw_args--; }
  5825. }
  5826. }
  5827. if (unlikely(kw_args > 0)) {
  5828. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setdefault") < 0)) __PYX_ERR(0, 291, __pyx_L3_error)
  5829. }
  5830. } else {
  5831. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5832. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5833. CYTHON_FALLTHROUGH;
  5834. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5835. break;
  5836. default: goto __pyx_L5_argtuple_error;
  5837. }
  5838. }
  5839. __pyx_v_key = values[0];
  5840. __pyx_v_default = values[1];
  5841. }
  5842. goto __pyx_L4_argument_unpacking_done;
  5843. __pyx_L5_argtuple_error:;
  5844. __Pyx_RaiseArgtupleInvalid("setdefault", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 291, __pyx_L3_error)
  5845. __pyx_L3_error:;
  5846. __Pyx_AddTraceback("multidict._multidict.MultiDict.setdefault", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5847. __Pyx_RefNannyFinishContext();
  5848. return NULL;
  5849. __pyx_L4_argument_unpacking_done:;
  5850. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_16setdefault(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self), __pyx_v_key, __pyx_v_default);
  5851. /* function exit code */
  5852. __Pyx_RefNannyFinishContext();
  5853. return __pyx_r;
  5854. }
  5855. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_16setdefault(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  5856. PyObject *__pyx_r = NULL;
  5857. __Pyx_RefNannyDeclarations
  5858. PyObject *__pyx_t_1 = NULL;
  5859. PyObject *__pyx_t_2 = NULL;
  5860. __Pyx_RefNannySetupContext("setdefault", 0);
  5861. /* "multidict/_multidict.pyx":293
  5862. * def setdefault(self, key, default=None):
  5863. * """Return value for key, set value to default if key is not present."""
  5864. * return pair_list_set_default(self._impl, key, default) # <<<<<<<<<<<<<<
  5865. *
  5866. * def popone(self, key, default=_marker):
  5867. */
  5868. __Pyx_XDECREF(__pyx_r);
  5869. __pyx_t_1 = __pyx_v_self->__pyx_base._impl;
  5870. __Pyx_INCREF(__pyx_t_1);
  5871. __pyx_t_2 = pair_list_set_default(__pyx_t_1, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error)
  5872. __Pyx_GOTREF(__pyx_t_2);
  5873. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5874. __pyx_r = __pyx_t_2;
  5875. __pyx_t_2 = 0;
  5876. goto __pyx_L0;
  5877. /* "multidict/_multidict.pyx":291
  5878. * pair_list_del(self._impl, key)
  5879. *
  5880. * def setdefault(self, key, default=None): # <<<<<<<<<<<<<<
  5881. * """Return value for key, set value to default if key is not present."""
  5882. * return pair_list_set_default(self._impl, key, default)
  5883. */
  5884. /* function exit code */
  5885. __pyx_L1_error:;
  5886. __Pyx_XDECREF(__pyx_t_1);
  5887. __Pyx_XDECREF(__pyx_t_2);
  5888. __Pyx_AddTraceback("multidict._multidict.MultiDict.setdefault", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5889. __pyx_r = NULL;
  5890. __pyx_L0:;
  5891. __Pyx_XGIVEREF(__pyx_r);
  5892. __Pyx_RefNannyFinishContext();
  5893. return __pyx_r;
  5894. }
  5895. /* "multidict/_multidict.pyx":295
  5896. * return pair_list_set_default(self._impl, key, default)
  5897. *
  5898. * def popone(self, key, default=_marker): # <<<<<<<<<<<<<<
  5899. * """Remove the last occurrence of key and return the corresponding
  5900. * value.
  5901. */
  5902. /* Python wrapper */
  5903. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_19popone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5904. static char __pyx_doc_9multidict_10_multidict_9MultiDict_18popone[] = "Remove the last occurrence of key and return the corresponding\n value.\n\n If key is not found, default is returned if given, otherwise\n KeyError is raised.\n\n ";
  5905. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_19popone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  5906. PyObject *__pyx_v_key = 0;
  5907. PyObject *__pyx_v_default = 0;
  5908. PyObject *__pyx_r = 0;
  5909. __Pyx_RefNannyDeclarations
  5910. __Pyx_RefNannySetupContext("popone (wrapper)", 0);
  5911. {
  5912. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
  5913. PyObject* values[2] = {0,0};
  5914. values[1] = __pyx_k__6;
  5915. if (unlikely(__pyx_kwds)) {
  5916. Py_ssize_t kw_args;
  5917. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  5918. switch (pos_args) {
  5919. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5920. CYTHON_FALLTHROUGH;
  5921. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5922. CYTHON_FALLTHROUGH;
  5923. case 0: break;
  5924. default: goto __pyx_L5_argtuple_error;
  5925. }
  5926. kw_args = PyDict_Size(__pyx_kwds);
  5927. switch (pos_args) {
  5928. case 0:
  5929. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
  5930. else goto __pyx_L5_argtuple_error;
  5931. CYTHON_FALLTHROUGH;
  5932. case 1:
  5933. if (kw_args > 0) {
  5934. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
  5935. if (value) { values[1] = value; kw_args--; }
  5936. }
  5937. }
  5938. if (unlikely(kw_args > 0)) {
  5939. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "popone") < 0)) __PYX_ERR(0, 295, __pyx_L3_error)
  5940. }
  5941. } else {
  5942. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5943. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5944. CYTHON_FALLTHROUGH;
  5945. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5946. break;
  5947. default: goto __pyx_L5_argtuple_error;
  5948. }
  5949. }
  5950. __pyx_v_key = values[0];
  5951. __pyx_v_default = values[1];
  5952. }
  5953. goto __pyx_L4_argument_unpacking_done;
  5954. __pyx_L5_argtuple_error:;
  5955. __Pyx_RaiseArgtupleInvalid("popone", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 295, __pyx_L3_error)
  5956. __pyx_L3_error:;
  5957. __Pyx_AddTraceback("multidict._multidict.MultiDict.popone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5958. __Pyx_RefNannyFinishContext();
  5959. return NULL;
  5960. __pyx_L4_argument_unpacking_done:;
  5961. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_18popone(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self), __pyx_v_key, __pyx_v_default);
  5962. /* function exit code */
  5963. __Pyx_RefNannyFinishContext();
  5964. return __pyx_r;
  5965. }
  5966. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_18popone(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  5967. PyObject *__pyx_r = NULL;
  5968. __Pyx_RefNannyDeclarations
  5969. PyObject *__pyx_t_1 = NULL;
  5970. PyObject *__pyx_t_2 = NULL;
  5971. PyObject *__pyx_t_3 = NULL;
  5972. PyObject *__pyx_t_4 = NULL;
  5973. PyObject *__pyx_t_5 = NULL;
  5974. int __pyx_t_6;
  5975. PyObject *__pyx_t_7 = NULL;
  5976. int __pyx_t_8;
  5977. int __pyx_t_9;
  5978. __Pyx_RefNannySetupContext("popone", 0);
  5979. /* "multidict/_multidict.pyx":303
  5980. *
  5981. * """
  5982. * try: # <<<<<<<<<<<<<<
  5983. * return pair_list_pop_one(self._impl, key)
  5984. * except KeyError:
  5985. */
  5986. {
  5987. __Pyx_PyThreadState_declare
  5988. __Pyx_PyThreadState_assign
  5989. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  5990. __Pyx_XGOTREF(__pyx_t_1);
  5991. __Pyx_XGOTREF(__pyx_t_2);
  5992. __Pyx_XGOTREF(__pyx_t_3);
  5993. /*try:*/ {
  5994. /* "multidict/_multidict.pyx":304
  5995. * """
  5996. * try:
  5997. * return pair_list_pop_one(self._impl, key) # <<<<<<<<<<<<<<
  5998. * except KeyError:
  5999. * if default is _marker:
  6000. */
  6001. __Pyx_XDECREF(__pyx_r);
  6002. __pyx_t_4 = __pyx_v_self->__pyx_base._impl;
  6003. __Pyx_INCREF(__pyx_t_4);
  6004. __pyx_t_5 = pair_list_pop_one(__pyx_t_4, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 304, __pyx_L3_error)
  6005. __Pyx_GOTREF(__pyx_t_5);
  6006. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6007. __pyx_r = __pyx_t_5;
  6008. __pyx_t_5 = 0;
  6009. goto __pyx_L7_try_return;
  6010. /* "multidict/_multidict.pyx":303
  6011. *
  6012. * """
  6013. * try: # <<<<<<<<<<<<<<
  6014. * return pair_list_pop_one(self._impl, key)
  6015. * except KeyError:
  6016. */
  6017. }
  6018. __pyx_L3_error:;
  6019. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  6020. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  6021. /* "multidict/_multidict.pyx":305
  6022. * try:
  6023. * return pair_list_pop_one(self._impl, key)
  6024. * except KeyError: # <<<<<<<<<<<<<<
  6025. * if default is _marker:
  6026. * raise
  6027. */
  6028. __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
  6029. if (__pyx_t_6) {
  6030. __Pyx_AddTraceback("multidict._multidict.MultiDict.popone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6031. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 305, __pyx_L5_except_error)
  6032. __Pyx_GOTREF(__pyx_t_5);
  6033. __Pyx_GOTREF(__pyx_t_4);
  6034. __Pyx_GOTREF(__pyx_t_7);
  6035. /* "multidict/_multidict.pyx":306
  6036. * return pair_list_pop_one(self._impl, key)
  6037. * except KeyError:
  6038. * if default is _marker: # <<<<<<<<<<<<<<
  6039. * raise
  6040. * else:
  6041. */
  6042. __pyx_t_8 = (__pyx_v_default == __pyx_v_9multidict_10_multidict__marker);
  6043. __pyx_t_9 = (__pyx_t_8 != 0);
  6044. if (unlikely(__pyx_t_9)) {
  6045. /* "multidict/_multidict.pyx":307
  6046. * except KeyError:
  6047. * if default is _marker:
  6048. * raise # <<<<<<<<<<<<<<
  6049. * else:
  6050. * return default
  6051. */
  6052. __Pyx_GIVEREF(__pyx_t_5);
  6053. __Pyx_GIVEREF(__pyx_t_4);
  6054. __Pyx_XGIVEREF(__pyx_t_7);
  6055. __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_4, __pyx_t_7);
  6056. __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0;
  6057. __PYX_ERR(0, 307, __pyx_L5_except_error)
  6058. /* "multidict/_multidict.pyx":306
  6059. * return pair_list_pop_one(self._impl, key)
  6060. * except KeyError:
  6061. * if default is _marker: # <<<<<<<<<<<<<<
  6062. * raise
  6063. * else:
  6064. */
  6065. }
  6066. /* "multidict/_multidict.pyx":309
  6067. * raise
  6068. * else:
  6069. * return default # <<<<<<<<<<<<<<
  6070. *
  6071. * pop = popone
  6072. */
  6073. /*else*/ {
  6074. __Pyx_XDECREF(__pyx_r);
  6075. __Pyx_INCREF(__pyx_v_default);
  6076. __pyx_r = __pyx_v_default;
  6077. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6078. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6079. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6080. goto __pyx_L6_except_return;
  6081. }
  6082. }
  6083. goto __pyx_L5_except_error;
  6084. __pyx_L5_except_error:;
  6085. /* "multidict/_multidict.pyx":303
  6086. *
  6087. * """
  6088. * try: # <<<<<<<<<<<<<<
  6089. * return pair_list_pop_one(self._impl, key)
  6090. * except KeyError:
  6091. */
  6092. __Pyx_XGIVEREF(__pyx_t_1);
  6093. __Pyx_XGIVEREF(__pyx_t_2);
  6094. __Pyx_XGIVEREF(__pyx_t_3);
  6095. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6096. goto __pyx_L1_error;
  6097. __pyx_L7_try_return:;
  6098. __Pyx_XGIVEREF(__pyx_t_1);
  6099. __Pyx_XGIVEREF(__pyx_t_2);
  6100. __Pyx_XGIVEREF(__pyx_t_3);
  6101. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6102. goto __pyx_L0;
  6103. __pyx_L6_except_return:;
  6104. __Pyx_XGIVEREF(__pyx_t_1);
  6105. __Pyx_XGIVEREF(__pyx_t_2);
  6106. __Pyx_XGIVEREF(__pyx_t_3);
  6107. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6108. goto __pyx_L0;
  6109. }
  6110. /* "multidict/_multidict.pyx":295
  6111. * return pair_list_set_default(self._impl, key, default)
  6112. *
  6113. * def popone(self, key, default=_marker): # <<<<<<<<<<<<<<
  6114. * """Remove the last occurrence of key and return the corresponding
  6115. * value.
  6116. */
  6117. /* function exit code */
  6118. __pyx_L1_error:;
  6119. __Pyx_XDECREF(__pyx_t_4);
  6120. __Pyx_XDECREF(__pyx_t_5);
  6121. __Pyx_XDECREF(__pyx_t_7);
  6122. __Pyx_AddTraceback("multidict._multidict.MultiDict.popone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6123. __pyx_r = NULL;
  6124. __pyx_L0:;
  6125. __Pyx_XGIVEREF(__pyx_r);
  6126. __Pyx_RefNannyFinishContext();
  6127. return __pyx_r;
  6128. }
  6129. /* "multidict/_multidict.pyx":313
  6130. * pop = popone
  6131. *
  6132. * def popall(self, key, default=_marker): # <<<<<<<<<<<<<<
  6133. * """Remove all occurrences of key and return the list of corresponding
  6134. * values.
  6135. */
  6136. /* Python wrapper */
  6137. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_21popall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6138. static char __pyx_doc_9multidict_10_multidict_9MultiDict_20popall[] = "Remove all occurrences of key and return the list of corresponding\n values.\n\n If key is not found, default is returned if given, otherwise\n KeyError is raised.\n\n ";
  6139. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_21popall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6140. PyObject *__pyx_v_key = 0;
  6141. PyObject *__pyx_v_default = 0;
  6142. PyObject *__pyx_r = 0;
  6143. __Pyx_RefNannyDeclarations
  6144. __Pyx_RefNannySetupContext("popall (wrapper)", 0);
  6145. {
  6146. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
  6147. PyObject* values[2] = {0,0};
  6148. values[1] = __pyx_k__7;
  6149. if (unlikely(__pyx_kwds)) {
  6150. Py_ssize_t kw_args;
  6151. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  6152. switch (pos_args) {
  6153. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6154. CYTHON_FALLTHROUGH;
  6155. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6156. CYTHON_FALLTHROUGH;
  6157. case 0: break;
  6158. default: goto __pyx_L5_argtuple_error;
  6159. }
  6160. kw_args = PyDict_Size(__pyx_kwds);
  6161. switch (pos_args) {
  6162. case 0:
  6163. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
  6164. else goto __pyx_L5_argtuple_error;
  6165. CYTHON_FALLTHROUGH;
  6166. case 1:
  6167. if (kw_args > 0) {
  6168. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
  6169. if (value) { values[1] = value; kw_args--; }
  6170. }
  6171. }
  6172. if (unlikely(kw_args > 0)) {
  6173. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "popall") < 0)) __PYX_ERR(0, 313, __pyx_L3_error)
  6174. }
  6175. } else {
  6176. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6177. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6178. CYTHON_FALLTHROUGH;
  6179. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6180. break;
  6181. default: goto __pyx_L5_argtuple_error;
  6182. }
  6183. }
  6184. __pyx_v_key = values[0];
  6185. __pyx_v_default = values[1];
  6186. }
  6187. goto __pyx_L4_argument_unpacking_done;
  6188. __pyx_L5_argtuple_error:;
  6189. __Pyx_RaiseArgtupleInvalid("popall", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 313, __pyx_L3_error)
  6190. __pyx_L3_error:;
  6191. __Pyx_AddTraceback("multidict._multidict.MultiDict.popall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6192. __Pyx_RefNannyFinishContext();
  6193. return NULL;
  6194. __pyx_L4_argument_unpacking_done:;
  6195. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_20popall(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self), __pyx_v_key, __pyx_v_default);
  6196. /* function exit code */
  6197. __Pyx_RefNannyFinishContext();
  6198. return __pyx_r;
  6199. }
  6200. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_20popall(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  6201. PyObject *__pyx_r = NULL;
  6202. __Pyx_RefNannyDeclarations
  6203. PyObject *__pyx_t_1 = NULL;
  6204. PyObject *__pyx_t_2 = NULL;
  6205. PyObject *__pyx_t_3 = NULL;
  6206. PyObject *__pyx_t_4 = NULL;
  6207. PyObject *__pyx_t_5 = NULL;
  6208. int __pyx_t_6;
  6209. PyObject *__pyx_t_7 = NULL;
  6210. int __pyx_t_8;
  6211. int __pyx_t_9;
  6212. __Pyx_RefNannySetupContext("popall", 0);
  6213. /* "multidict/_multidict.pyx":321
  6214. *
  6215. * """
  6216. * try: # <<<<<<<<<<<<<<
  6217. * return pair_list_pop_all(self._impl, key)
  6218. * except KeyError:
  6219. */
  6220. {
  6221. __Pyx_PyThreadState_declare
  6222. __Pyx_PyThreadState_assign
  6223. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  6224. __Pyx_XGOTREF(__pyx_t_1);
  6225. __Pyx_XGOTREF(__pyx_t_2);
  6226. __Pyx_XGOTREF(__pyx_t_3);
  6227. /*try:*/ {
  6228. /* "multidict/_multidict.pyx":322
  6229. * """
  6230. * try:
  6231. * return pair_list_pop_all(self._impl, key) # <<<<<<<<<<<<<<
  6232. * except KeyError:
  6233. * if default is _marker:
  6234. */
  6235. __Pyx_XDECREF(__pyx_r);
  6236. __pyx_t_4 = __pyx_v_self->__pyx_base._impl;
  6237. __Pyx_INCREF(__pyx_t_4);
  6238. __pyx_t_5 = pair_list_pop_all(__pyx_t_4, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L3_error)
  6239. __Pyx_GOTREF(__pyx_t_5);
  6240. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6241. __pyx_r = __pyx_t_5;
  6242. __pyx_t_5 = 0;
  6243. goto __pyx_L7_try_return;
  6244. /* "multidict/_multidict.pyx":321
  6245. *
  6246. * """
  6247. * try: # <<<<<<<<<<<<<<
  6248. * return pair_list_pop_all(self._impl, key)
  6249. * except KeyError:
  6250. */
  6251. }
  6252. __pyx_L3_error:;
  6253. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  6254. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  6255. /* "multidict/_multidict.pyx":323
  6256. * try:
  6257. * return pair_list_pop_all(self._impl, key)
  6258. * except KeyError: # <<<<<<<<<<<<<<
  6259. * if default is _marker:
  6260. * raise
  6261. */
  6262. __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
  6263. if (__pyx_t_6) {
  6264. __Pyx_AddTraceback("multidict._multidict.MultiDict.popall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6265. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 323, __pyx_L5_except_error)
  6266. __Pyx_GOTREF(__pyx_t_5);
  6267. __Pyx_GOTREF(__pyx_t_4);
  6268. __Pyx_GOTREF(__pyx_t_7);
  6269. /* "multidict/_multidict.pyx":324
  6270. * return pair_list_pop_all(self._impl, key)
  6271. * except KeyError:
  6272. * if default is _marker: # <<<<<<<<<<<<<<
  6273. * raise
  6274. * else:
  6275. */
  6276. __pyx_t_8 = (__pyx_v_default == __pyx_v_9multidict_10_multidict__marker);
  6277. __pyx_t_9 = (__pyx_t_8 != 0);
  6278. if (unlikely(__pyx_t_9)) {
  6279. /* "multidict/_multidict.pyx":325
  6280. * except KeyError:
  6281. * if default is _marker:
  6282. * raise # <<<<<<<<<<<<<<
  6283. * else:
  6284. * return default
  6285. */
  6286. __Pyx_GIVEREF(__pyx_t_5);
  6287. __Pyx_GIVEREF(__pyx_t_4);
  6288. __Pyx_XGIVEREF(__pyx_t_7);
  6289. __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_4, __pyx_t_7);
  6290. __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0;
  6291. __PYX_ERR(0, 325, __pyx_L5_except_error)
  6292. /* "multidict/_multidict.pyx":324
  6293. * return pair_list_pop_all(self._impl, key)
  6294. * except KeyError:
  6295. * if default is _marker: # <<<<<<<<<<<<<<
  6296. * raise
  6297. * else:
  6298. */
  6299. }
  6300. /* "multidict/_multidict.pyx":327
  6301. * raise
  6302. * else:
  6303. * return default # <<<<<<<<<<<<<<
  6304. *
  6305. * def popitem(self):
  6306. */
  6307. /*else*/ {
  6308. __Pyx_XDECREF(__pyx_r);
  6309. __Pyx_INCREF(__pyx_v_default);
  6310. __pyx_r = __pyx_v_default;
  6311. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6312. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6313. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6314. goto __pyx_L6_except_return;
  6315. }
  6316. }
  6317. goto __pyx_L5_except_error;
  6318. __pyx_L5_except_error:;
  6319. /* "multidict/_multidict.pyx":321
  6320. *
  6321. * """
  6322. * try: # <<<<<<<<<<<<<<
  6323. * return pair_list_pop_all(self._impl, key)
  6324. * except KeyError:
  6325. */
  6326. __Pyx_XGIVEREF(__pyx_t_1);
  6327. __Pyx_XGIVEREF(__pyx_t_2);
  6328. __Pyx_XGIVEREF(__pyx_t_3);
  6329. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6330. goto __pyx_L1_error;
  6331. __pyx_L7_try_return:;
  6332. __Pyx_XGIVEREF(__pyx_t_1);
  6333. __Pyx_XGIVEREF(__pyx_t_2);
  6334. __Pyx_XGIVEREF(__pyx_t_3);
  6335. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6336. goto __pyx_L0;
  6337. __pyx_L6_except_return:;
  6338. __Pyx_XGIVEREF(__pyx_t_1);
  6339. __Pyx_XGIVEREF(__pyx_t_2);
  6340. __Pyx_XGIVEREF(__pyx_t_3);
  6341. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6342. goto __pyx_L0;
  6343. }
  6344. /* "multidict/_multidict.pyx":313
  6345. * pop = popone
  6346. *
  6347. * def popall(self, key, default=_marker): # <<<<<<<<<<<<<<
  6348. * """Remove all occurrences of key and return the list of corresponding
  6349. * values.
  6350. */
  6351. /* function exit code */
  6352. __pyx_L1_error:;
  6353. __Pyx_XDECREF(__pyx_t_4);
  6354. __Pyx_XDECREF(__pyx_t_5);
  6355. __Pyx_XDECREF(__pyx_t_7);
  6356. __Pyx_AddTraceback("multidict._multidict.MultiDict.popall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6357. __pyx_r = NULL;
  6358. __pyx_L0:;
  6359. __Pyx_XGIVEREF(__pyx_r);
  6360. __Pyx_RefNannyFinishContext();
  6361. return __pyx_r;
  6362. }
  6363. /* "multidict/_multidict.pyx":329
  6364. * return default
  6365. *
  6366. * def popitem(self): # <<<<<<<<<<<<<<
  6367. * """Remove and return an arbitrary (key, value) pair."""
  6368. * return pair_list_pop_item(self._impl)
  6369. */
  6370. /* Python wrapper */
  6371. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_23popitem(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  6372. static char __pyx_doc_9multidict_10_multidict_9MultiDict_22popitem[] = "Remove and return an arbitrary (key, value) pair.";
  6373. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_23popitem(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  6374. PyObject *__pyx_r = 0;
  6375. __Pyx_RefNannyDeclarations
  6376. __Pyx_RefNannySetupContext("popitem (wrapper)", 0);
  6377. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_22popitem(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self));
  6378. /* function exit code */
  6379. __Pyx_RefNannyFinishContext();
  6380. return __pyx_r;
  6381. }
  6382. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_22popitem(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self) {
  6383. PyObject *__pyx_r = NULL;
  6384. __Pyx_RefNannyDeclarations
  6385. PyObject *__pyx_t_1 = NULL;
  6386. PyObject *__pyx_t_2 = NULL;
  6387. __Pyx_RefNannySetupContext("popitem", 0);
  6388. /* "multidict/_multidict.pyx":331
  6389. * def popitem(self):
  6390. * """Remove and return an arbitrary (key, value) pair."""
  6391. * return pair_list_pop_item(self._impl) # <<<<<<<<<<<<<<
  6392. *
  6393. * def update(self, *args, **kwargs):
  6394. */
  6395. __Pyx_XDECREF(__pyx_r);
  6396. __pyx_t_1 = __pyx_v_self->__pyx_base._impl;
  6397. __Pyx_INCREF(__pyx_t_1);
  6398. __pyx_t_2 = pair_list_pop_item(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
  6399. __Pyx_GOTREF(__pyx_t_2);
  6400. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6401. __pyx_r = __pyx_t_2;
  6402. __pyx_t_2 = 0;
  6403. goto __pyx_L0;
  6404. /* "multidict/_multidict.pyx":329
  6405. * return default
  6406. *
  6407. * def popitem(self): # <<<<<<<<<<<<<<
  6408. * """Remove and return an arbitrary (key, value) pair."""
  6409. * return pair_list_pop_item(self._impl)
  6410. */
  6411. /* function exit code */
  6412. __pyx_L1_error:;
  6413. __Pyx_XDECREF(__pyx_t_1);
  6414. __Pyx_XDECREF(__pyx_t_2);
  6415. __Pyx_AddTraceback("multidict._multidict.MultiDict.popitem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6416. __pyx_r = NULL;
  6417. __pyx_L0:;
  6418. __Pyx_XGIVEREF(__pyx_r);
  6419. __Pyx_RefNannyFinishContext();
  6420. return __pyx_r;
  6421. }
  6422. /* "multidict/_multidict.pyx":333
  6423. * return pair_list_pop_item(self._impl)
  6424. *
  6425. * def update(self, *args, **kwargs): # <<<<<<<<<<<<<<
  6426. * """Update the dictionary from *other*, overwriting existing keys."""
  6427. * self._extend(args, kwargs, "update", False)
  6428. */
  6429. /* Python wrapper */
  6430. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_25update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6431. static char __pyx_doc_9multidict_10_multidict_9MultiDict_24update[] = "Update the dictionary from *other*, overwriting existing keys.";
  6432. static PyObject *__pyx_pw_9multidict_10_multidict_9MultiDict_25update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6433. PyObject *__pyx_v_args = 0;
  6434. PyObject *__pyx_v_kwargs = 0;
  6435. PyObject *__pyx_r = 0;
  6436. __Pyx_RefNannyDeclarations
  6437. __Pyx_RefNannySetupContext("update (wrapper)", 0);
  6438. if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "update", 1))) return NULL;
  6439. __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  6440. __Pyx_GOTREF(__pyx_v_kwargs);
  6441. __Pyx_INCREF(__pyx_args);
  6442. __pyx_v_args = __pyx_args;
  6443. __pyx_r = __pyx_pf_9multidict_10_multidict_9MultiDict_24update(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
  6444. /* function exit code */
  6445. __Pyx_XDECREF(__pyx_v_args);
  6446. __Pyx_XDECREF(__pyx_v_kwargs);
  6447. __Pyx_RefNannyFinishContext();
  6448. return __pyx_r;
  6449. }
  6450. static PyObject *__pyx_pf_9multidict_10_multidict_9MultiDict_24update(struct __pyx_obj_9multidict_10_multidict_MultiDict *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  6451. PyObject *__pyx_r = NULL;
  6452. __Pyx_RefNannyDeclarations
  6453. PyObject *__pyx_t_1 = NULL;
  6454. __Pyx_RefNannySetupContext("update", 0);
  6455. /* "multidict/_multidict.pyx":335
  6456. * def update(self, *args, **kwargs):
  6457. * """Update the dictionary from *other*, overwriting existing keys."""
  6458. * self._extend(args, kwargs, "update", False) # <<<<<<<<<<<<<<
  6459. *
  6460. *
  6461. */
  6462. __pyx_t_1 = ((struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict *)__pyx_v_self->__pyx_base.__pyx_vtab)->_extend(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, __pyx_n_s_update, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
  6463. __Pyx_GOTREF(__pyx_t_1);
  6464. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6465. /* "multidict/_multidict.pyx":333
  6466. * return pair_list_pop_item(self._impl)
  6467. *
  6468. * def update(self, *args, **kwargs): # <<<<<<<<<<<<<<
  6469. * """Update the dictionary from *other*, overwriting existing keys."""
  6470. * self._extend(args, kwargs, "update", False)
  6471. */
  6472. /* function exit code */
  6473. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6474. goto __pyx_L0;
  6475. __pyx_L1_error:;
  6476. __Pyx_XDECREF(__pyx_t_1);
  6477. __Pyx_AddTraceback("multidict._multidict.MultiDict.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6478. __pyx_r = NULL;
  6479. __pyx_L0:;
  6480. __Pyx_XGIVEREF(__pyx_r);
  6481. __Pyx_RefNannyFinishContext();
  6482. return __pyx_r;
  6483. }
  6484. /* "multidict/_multidict.pyx":344
  6485. * """An ordered dictionary that can have multiple values for each key."""
  6486. *
  6487. * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<<
  6488. * self._impl = ci_pair_list_new()
  6489. * self._extend(args, kwargs, 'CIMultiDict', True)
  6490. */
  6491. /* Python wrapper */
  6492. static int __pyx_pw_9multidict_10_multidict_11CIMultiDict_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6493. static int __pyx_pw_9multidict_10_multidict_11CIMultiDict_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6494. PyObject *__pyx_v_args = 0;
  6495. PyObject *__pyx_v_kwargs = 0;
  6496. int __pyx_r;
  6497. __Pyx_RefNannyDeclarations
  6498. __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  6499. if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1;
  6500. __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  6501. __Pyx_GOTREF(__pyx_v_kwargs);
  6502. __Pyx_INCREF(__pyx_args);
  6503. __pyx_v_args = __pyx_args;
  6504. __pyx_r = __pyx_pf_9multidict_10_multidict_11CIMultiDict___init__(((struct __pyx_obj_9multidict_10_multidict_CIMultiDict *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
  6505. /* function exit code */
  6506. __Pyx_XDECREF(__pyx_v_args);
  6507. __Pyx_XDECREF(__pyx_v_kwargs);
  6508. __Pyx_RefNannyFinishContext();
  6509. return __pyx_r;
  6510. }
  6511. static int __pyx_pf_9multidict_10_multidict_11CIMultiDict___init__(struct __pyx_obj_9multidict_10_multidict_CIMultiDict *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  6512. int __pyx_r;
  6513. __Pyx_RefNannyDeclarations
  6514. PyObject *__pyx_t_1 = NULL;
  6515. __Pyx_RefNannySetupContext("__init__", 0);
  6516. /* "multidict/_multidict.pyx":345
  6517. *
  6518. * def __init__(self, *args, **kwargs):
  6519. * self._impl = ci_pair_list_new() # <<<<<<<<<<<<<<
  6520. * self._extend(args, kwargs, 'CIMultiDict', True)
  6521. *
  6522. */
  6523. __pyx_t_1 = ci_pair_list_new(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L1_error)
  6524. __Pyx_GOTREF(__pyx_t_1);
  6525. __Pyx_GIVEREF(__pyx_t_1);
  6526. __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx_base._impl);
  6527. __Pyx_DECREF(__pyx_v_self->__pyx_base.__pyx_base._impl);
  6528. __pyx_v_self->__pyx_base.__pyx_base._impl = __pyx_t_1;
  6529. __pyx_t_1 = 0;
  6530. /* "multidict/_multidict.pyx":346
  6531. * def __init__(self, *args, **kwargs):
  6532. * self._impl = ci_pair_list_new()
  6533. * self._extend(args, kwargs, 'CIMultiDict', True) # <<<<<<<<<<<<<<
  6534. *
  6535. * def __reduce__(self):
  6536. */
  6537. __pyx_t_1 = ((struct __pyx_vtabstruct_9multidict_10_multidict_CIMultiDict *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base._extend(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs, __pyx_n_s_CIMultiDict, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
  6538. __Pyx_GOTREF(__pyx_t_1);
  6539. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6540. /* "multidict/_multidict.pyx":344
  6541. * """An ordered dictionary that can have multiple values for each key."""
  6542. *
  6543. * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<<
  6544. * self._impl = ci_pair_list_new()
  6545. * self._extend(args, kwargs, 'CIMultiDict', True)
  6546. */
  6547. /* function exit code */
  6548. __pyx_r = 0;
  6549. goto __pyx_L0;
  6550. __pyx_L1_error:;
  6551. __Pyx_XDECREF(__pyx_t_1);
  6552. __Pyx_AddTraceback("multidict._multidict.CIMultiDict.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6553. __pyx_r = -1;
  6554. __pyx_L0:;
  6555. __Pyx_RefNannyFinishContext();
  6556. return __pyx_r;
  6557. }
  6558. /* "multidict/_multidict.pyx":348
  6559. * self._extend(args, kwargs, 'CIMultiDict', True)
  6560. *
  6561. * def __reduce__(self): # <<<<<<<<<<<<<<
  6562. * return (
  6563. * self.__class__,
  6564. */
  6565. /* Python wrapper */
  6566. static PyObject *__pyx_pw_9multidict_10_multidict_11CIMultiDict_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  6567. static PyObject *__pyx_pw_9multidict_10_multidict_11CIMultiDict_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  6568. PyObject *__pyx_r = 0;
  6569. __Pyx_RefNannyDeclarations
  6570. __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  6571. __pyx_r = __pyx_pf_9multidict_10_multidict_11CIMultiDict_2__reduce__(((struct __pyx_obj_9multidict_10_multidict_CIMultiDict *)__pyx_v_self));
  6572. /* function exit code */
  6573. __Pyx_RefNannyFinishContext();
  6574. return __pyx_r;
  6575. }
  6576. static PyObject *__pyx_pf_9multidict_10_multidict_11CIMultiDict_2__reduce__(struct __pyx_obj_9multidict_10_multidict_CIMultiDict *__pyx_v_self) {
  6577. PyObject *__pyx_r = NULL;
  6578. __Pyx_RefNannyDeclarations
  6579. PyObject *__pyx_t_1 = NULL;
  6580. PyObject *__pyx_t_2 = NULL;
  6581. PyObject *__pyx_t_3 = NULL;
  6582. PyObject *__pyx_t_4 = NULL;
  6583. __Pyx_RefNannySetupContext("__reduce__", 0);
  6584. /* "multidict/_multidict.pyx":349
  6585. *
  6586. * def __reduce__(self):
  6587. * return ( # <<<<<<<<<<<<<<
  6588. * self.__class__,
  6589. * (list(self.items()),),
  6590. */
  6591. __Pyx_XDECREF(__pyx_r);
  6592. /* "multidict/_multidict.pyx":350
  6593. * def __reduce__(self):
  6594. * return (
  6595. * self.__class__, # <<<<<<<<<<<<<<
  6596. * (list(self.items()),),
  6597. * )
  6598. */
  6599. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
  6600. __Pyx_GOTREF(__pyx_t_1);
  6601. /* "multidict/_multidict.pyx":351
  6602. * return (
  6603. * self.__class__,
  6604. * (list(self.items()),), # <<<<<<<<<<<<<<
  6605. * )
  6606. *
  6607. */
  6608. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error)
  6609. __Pyx_GOTREF(__pyx_t_3);
  6610. __pyx_t_4 = NULL;
  6611. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  6612. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  6613. if (likely(__pyx_t_4)) {
  6614. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  6615. __Pyx_INCREF(__pyx_t_4);
  6616. __Pyx_INCREF(function);
  6617. __Pyx_DECREF_SET(__pyx_t_3, function);
  6618. }
  6619. }
  6620. __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  6621. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  6622. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error)
  6623. __Pyx_GOTREF(__pyx_t_2);
  6624. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6625. __pyx_t_3 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error)
  6626. __Pyx_GOTREF(__pyx_t_3);
  6627. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6628. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error)
  6629. __Pyx_GOTREF(__pyx_t_2);
  6630. __Pyx_GIVEREF(__pyx_t_3);
  6631. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  6632. __pyx_t_3 = 0;
  6633. /* "multidict/_multidict.pyx":350
  6634. * def __reduce__(self):
  6635. * return (
  6636. * self.__class__, # <<<<<<<<<<<<<<
  6637. * (list(self.items()),),
  6638. * )
  6639. */
  6640. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 350, __pyx_L1_error)
  6641. __Pyx_GOTREF(__pyx_t_3);
  6642. __Pyx_GIVEREF(__pyx_t_1);
  6643. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  6644. __Pyx_GIVEREF(__pyx_t_2);
  6645. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  6646. __pyx_t_1 = 0;
  6647. __pyx_t_2 = 0;
  6648. __pyx_r = __pyx_t_3;
  6649. __pyx_t_3 = 0;
  6650. goto __pyx_L0;
  6651. /* "multidict/_multidict.pyx":348
  6652. * self._extend(args, kwargs, 'CIMultiDict', True)
  6653. *
  6654. * def __reduce__(self): # <<<<<<<<<<<<<<
  6655. * return (
  6656. * self.__class__,
  6657. */
  6658. /* function exit code */
  6659. __pyx_L1_error:;
  6660. __Pyx_XDECREF(__pyx_t_1);
  6661. __Pyx_XDECREF(__pyx_t_2);
  6662. __Pyx_XDECREF(__pyx_t_3);
  6663. __Pyx_XDECREF(__pyx_t_4);
  6664. __Pyx_AddTraceback("multidict._multidict.CIMultiDict.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6665. __pyx_r = NULL;
  6666. __pyx_L0:;
  6667. __Pyx_XGIVEREF(__pyx_r);
  6668. __Pyx_RefNannyFinishContext();
  6669. return __pyx_r;
  6670. }
  6671. /* "multidict/_multidict.pyx":354
  6672. * )
  6673. *
  6674. * def copy(self): # <<<<<<<<<<<<<<
  6675. * """Return a copy of itself."""
  6676. * ret = CIMultiDict()
  6677. */
  6678. /* Python wrapper */
  6679. static PyObject *__pyx_pw_9multidict_10_multidict_11CIMultiDict_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  6680. static char __pyx_doc_9multidict_10_multidict_11CIMultiDict_4copy[] = "Return a copy of itself.";
  6681. static PyObject *__pyx_pw_9multidict_10_multidict_11CIMultiDict_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  6682. PyObject *__pyx_r = 0;
  6683. __Pyx_RefNannyDeclarations
  6684. __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  6685. __pyx_r = __pyx_pf_9multidict_10_multidict_11CIMultiDict_4copy(((struct __pyx_obj_9multidict_10_multidict_CIMultiDict *)__pyx_v_self));
  6686. /* function exit code */
  6687. __Pyx_RefNannyFinishContext();
  6688. return __pyx_r;
  6689. }
  6690. static PyObject *__pyx_pf_9multidict_10_multidict_11CIMultiDict_4copy(struct __pyx_obj_9multidict_10_multidict_CIMultiDict *__pyx_v_self) {
  6691. struct __pyx_obj_9multidict_10_multidict_CIMultiDict *__pyx_v_ret = NULL;
  6692. PyObject *__pyx_r = NULL;
  6693. __Pyx_RefNannyDeclarations
  6694. PyObject *__pyx_t_1 = NULL;
  6695. PyObject *__pyx_t_2 = NULL;
  6696. PyObject *__pyx_t_3 = NULL;
  6697. __Pyx_RefNannySetupContext("copy", 0);
  6698. /* "multidict/_multidict.pyx":356
  6699. * def copy(self):
  6700. * """Return a copy of itself."""
  6701. * ret = CIMultiDict() # <<<<<<<<<<<<<<
  6702. * ret._extend((list(self.items()),), {}, 'copy', True)
  6703. * return ret
  6704. */
  6705. __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDict)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error)
  6706. __Pyx_GOTREF(__pyx_t_1);
  6707. __pyx_v_ret = ((struct __pyx_obj_9multidict_10_multidict_CIMultiDict *)__pyx_t_1);
  6708. __pyx_t_1 = 0;
  6709. /* "multidict/_multidict.pyx":357
  6710. * """Return a copy of itself."""
  6711. * ret = CIMultiDict()
  6712. * ret._extend((list(self.items()),), {}, 'copy', True) # <<<<<<<<<<<<<<
  6713. * return ret
  6714. *
  6715. */
  6716. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error)
  6717. __Pyx_GOTREF(__pyx_t_2);
  6718. __pyx_t_3 = NULL;
  6719. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  6720. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  6721. if (likely(__pyx_t_3)) {
  6722. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  6723. __Pyx_INCREF(__pyx_t_3);
  6724. __Pyx_INCREF(function);
  6725. __Pyx_DECREF_SET(__pyx_t_2, function);
  6726. }
  6727. }
  6728. __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  6729. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6730. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
  6731. __Pyx_GOTREF(__pyx_t_1);
  6732. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6733. __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error)
  6734. __Pyx_GOTREF(__pyx_t_2);
  6735. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6736. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
  6737. __Pyx_GOTREF(__pyx_t_1);
  6738. __Pyx_GIVEREF(__pyx_t_2);
  6739. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  6740. __pyx_t_2 = 0;
  6741. __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error)
  6742. __Pyx_GOTREF(__pyx_t_2);
  6743. __pyx_t_3 = ((struct __pyx_vtabstruct_9multidict_10_multidict_CIMultiDict *)__pyx_v_ret->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base._extend(((struct __pyx_obj_9multidict_10_multidict_MultiDict *)__pyx_v_ret), ((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_2), __pyx_n_s_copy, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error)
  6744. __Pyx_GOTREF(__pyx_t_3);
  6745. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6746. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6747. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6748. /* "multidict/_multidict.pyx":358
  6749. * ret = CIMultiDict()
  6750. * ret._extend((list(self.items()),), {}, 'copy', True)
  6751. * return ret # <<<<<<<<<<<<<<
  6752. *
  6753. *
  6754. */
  6755. __Pyx_XDECREF(__pyx_r);
  6756. __Pyx_INCREF(((PyObject *)__pyx_v_ret));
  6757. __pyx_r = ((PyObject *)__pyx_v_ret);
  6758. goto __pyx_L0;
  6759. /* "multidict/_multidict.pyx":354
  6760. * )
  6761. *
  6762. * def copy(self): # <<<<<<<<<<<<<<
  6763. * """Return a copy of itself."""
  6764. * ret = CIMultiDict()
  6765. */
  6766. /* function exit code */
  6767. __pyx_L1_error:;
  6768. __Pyx_XDECREF(__pyx_t_1);
  6769. __Pyx_XDECREF(__pyx_t_2);
  6770. __Pyx_XDECREF(__pyx_t_3);
  6771. __Pyx_AddTraceback("multidict._multidict.CIMultiDict.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6772. __pyx_r = NULL;
  6773. __pyx_L0:;
  6774. __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  6775. __Pyx_XGIVEREF(__pyx_r);
  6776. __Pyx_RefNannyFinishContext();
  6777. return __pyx_r;
  6778. }
  6779. /* "(tree fragment)":1
  6780. * def __pyx_unpickle__Base(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  6781. * cdef object __pyx_PickleError
  6782. * cdef object __pyx_result
  6783. */
  6784. /* Python wrapper */
  6785. static PyObject *__pyx_pw_9multidict_10_multidict_3__pyx_unpickle__Base(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6786. static PyMethodDef __pyx_mdef_9multidict_10_multidict_3__pyx_unpickle__Base = {"__pyx_unpickle__Base", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9multidict_10_multidict_3__pyx_unpickle__Base, METH_VARARGS|METH_KEYWORDS, 0};
  6787. static PyObject *__pyx_pw_9multidict_10_multidict_3__pyx_unpickle__Base(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6788. PyObject *__pyx_v___pyx_type = 0;
  6789. long __pyx_v___pyx_checksum;
  6790. PyObject *__pyx_v___pyx_state = 0;
  6791. PyObject *__pyx_r = 0;
  6792. __Pyx_RefNannyDeclarations
  6793. __Pyx_RefNannySetupContext("__pyx_unpickle__Base (wrapper)", 0);
  6794. {
  6795. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
  6796. PyObject* values[3] = {0,0,0};
  6797. if (unlikely(__pyx_kwds)) {
  6798. Py_ssize_t kw_args;
  6799. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  6800. switch (pos_args) {
  6801. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  6802. CYTHON_FALLTHROUGH;
  6803. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6804. CYTHON_FALLTHROUGH;
  6805. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6806. CYTHON_FALLTHROUGH;
  6807. case 0: break;
  6808. default: goto __pyx_L5_argtuple_error;
  6809. }
  6810. kw_args = PyDict_Size(__pyx_kwds);
  6811. switch (pos_args) {
  6812. case 0:
  6813. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
  6814. else goto __pyx_L5_argtuple_error;
  6815. CYTHON_FALLTHROUGH;
  6816. case 1:
  6817. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
  6818. else {
  6819. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Base", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
  6820. }
  6821. CYTHON_FALLTHROUGH;
  6822. case 2:
  6823. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
  6824. else {
  6825. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Base", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
  6826. }
  6827. }
  6828. if (unlikely(kw_args > 0)) {
  6829. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle__Base") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
  6830. }
  6831. } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
  6832. goto __pyx_L5_argtuple_error;
  6833. } else {
  6834. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6835. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6836. values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  6837. }
  6838. __pyx_v___pyx_type = values[0];
  6839. __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
  6840. __pyx_v___pyx_state = values[2];
  6841. }
  6842. goto __pyx_L4_argument_unpacking_done;
  6843. __pyx_L5_argtuple_error:;
  6844. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Base", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  6845. __pyx_L3_error:;
  6846. __Pyx_AddTraceback("multidict._multidict.__pyx_unpickle__Base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6847. __Pyx_RefNannyFinishContext();
  6848. return NULL;
  6849. __pyx_L4_argument_unpacking_done:;
  6850. __pyx_r = __pyx_pf_9multidict_10_multidict_2__pyx_unpickle__Base(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
  6851. /* function exit code */
  6852. __Pyx_RefNannyFinishContext();
  6853. return __pyx_r;
  6854. }
  6855. static PyObject *__pyx_pf_9multidict_10_multidict_2__pyx_unpickle__Base(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  6856. PyObject *__pyx_v___pyx_PickleError = 0;
  6857. PyObject *__pyx_v___pyx_result = 0;
  6858. PyObject *__pyx_r = NULL;
  6859. __Pyx_RefNannyDeclarations
  6860. int __pyx_t_1;
  6861. PyObject *__pyx_t_2 = NULL;
  6862. PyObject *__pyx_t_3 = NULL;
  6863. PyObject *__pyx_t_4 = NULL;
  6864. PyObject *__pyx_t_5 = NULL;
  6865. int __pyx_t_6;
  6866. __Pyx_RefNannySetupContext("__pyx_unpickle__Base", 0);
  6867. /* "(tree fragment)":4
  6868. * cdef object __pyx_PickleError
  6869. * cdef object __pyx_result
  6870. * if __pyx_checksum != 0x4d872fe: # <<<<<<<<<<<<<<
  6871. * from pickle import PickleError as __pyx_PickleError
  6872. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4d872fe = (_impl))" % __pyx_checksum)
  6873. */
  6874. __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x4d872fe) != 0);
  6875. if (__pyx_t_1) {
  6876. /* "(tree fragment)":5
  6877. * cdef object __pyx_result
  6878. * if __pyx_checksum != 0x4d872fe:
  6879. * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
  6880. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4d872fe = (_impl))" % __pyx_checksum)
  6881. * __pyx_result = _Base.__new__(__pyx_type)
  6882. */
  6883. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  6884. __Pyx_GOTREF(__pyx_t_2);
  6885. __Pyx_INCREF(__pyx_n_s_PickleError);
  6886. __Pyx_GIVEREF(__pyx_n_s_PickleError);
  6887. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
  6888. __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  6889. __Pyx_GOTREF(__pyx_t_3);
  6890. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6891. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  6892. __Pyx_GOTREF(__pyx_t_2);
  6893. __Pyx_INCREF(__pyx_t_2);
  6894. __pyx_v___pyx_PickleError = __pyx_t_2;
  6895. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6896. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6897. /* "(tree fragment)":6
  6898. * if __pyx_checksum != 0x4d872fe:
  6899. * from pickle import PickleError as __pyx_PickleError
  6900. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4d872fe = (_impl))" % __pyx_checksum) # <<<<<<<<<<<<<<
  6901. * __pyx_result = _Base.__new__(__pyx_type)
  6902. * if __pyx_state is not None:
  6903. */
  6904. __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
  6905. __Pyx_GOTREF(__pyx_t_2);
  6906. __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x4d, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
  6907. __Pyx_GOTREF(__pyx_t_4);
  6908. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6909. __Pyx_INCREF(__pyx_v___pyx_PickleError);
  6910. __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
  6911. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  6912. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  6913. if (likely(__pyx_t_5)) {
  6914. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  6915. __Pyx_INCREF(__pyx_t_5);
  6916. __Pyx_INCREF(function);
  6917. __Pyx_DECREF_SET(__pyx_t_2, function);
  6918. }
  6919. }
  6920. __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  6921. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  6922. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6923. if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
  6924. __Pyx_GOTREF(__pyx_t_3);
  6925. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6926. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  6927. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6928. __PYX_ERR(1, 6, __pyx_L1_error)
  6929. /* "(tree fragment)":4
  6930. * cdef object __pyx_PickleError
  6931. * cdef object __pyx_result
  6932. * if __pyx_checksum != 0x4d872fe: # <<<<<<<<<<<<<<
  6933. * from pickle import PickleError as __pyx_PickleError
  6934. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4d872fe = (_impl))" % __pyx_checksum)
  6935. */
  6936. }
  6937. /* "(tree fragment)":7
  6938. * from pickle import PickleError as __pyx_PickleError
  6939. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4d872fe = (_impl))" % __pyx_checksum)
  6940. * __pyx_result = _Base.__new__(__pyx_type) # <<<<<<<<<<<<<<
  6941. * if __pyx_state is not None:
  6942. * __pyx_unpickle__Base__set_state(<_Base> __pyx_result, __pyx_state)
  6943. */
  6944. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_9multidict_10_multidict__Base), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  6945. __Pyx_GOTREF(__pyx_t_2);
  6946. __pyx_t_4 = NULL;
  6947. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  6948. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
  6949. if (likely(__pyx_t_4)) {
  6950. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  6951. __Pyx_INCREF(__pyx_t_4);
  6952. __Pyx_INCREF(function);
  6953. __Pyx_DECREF_SET(__pyx_t_2, function);
  6954. }
  6955. }
  6956. __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  6957. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  6958. if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  6959. __Pyx_GOTREF(__pyx_t_3);
  6960. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6961. __pyx_v___pyx_result = __pyx_t_3;
  6962. __pyx_t_3 = 0;
  6963. /* "(tree fragment)":8
  6964. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4d872fe = (_impl))" % __pyx_checksum)
  6965. * __pyx_result = _Base.__new__(__pyx_type)
  6966. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  6967. * __pyx_unpickle__Base__set_state(<_Base> __pyx_result, __pyx_state)
  6968. * return __pyx_result
  6969. */
  6970. __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  6971. __pyx_t_6 = (__pyx_t_1 != 0);
  6972. if (__pyx_t_6) {
  6973. /* "(tree fragment)":9
  6974. * __pyx_result = _Base.__new__(__pyx_type)
  6975. * if __pyx_state is not None:
  6976. * __pyx_unpickle__Base__set_state(<_Base> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
  6977. * return __pyx_result
  6978. * cdef __pyx_unpickle__Base__set_state(_Base __pyx_result, tuple __pyx_state):
  6979. */
  6980. if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
  6981. __pyx_t_3 = __pyx_f_9multidict_10_multidict___pyx_unpickle__Base__set_state(((struct __pyx_obj_9multidict_10_multidict__Base *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
  6982. __Pyx_GOTREF(__pyx_t_3);
  6983. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6984. /* "(tree fragment)":8
  6985. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4d872fe = (_impl))" % __pyx_checksum)
  6986. * __pyx_result = _Base.__new__(__pyx_type)
  6987. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  6988. * __pyx_unpickle__Base__set_state(<_Base> __pyx_result, __pyx_state)
  6989. * return __pyx_result
  6990. */
  6991. }
  6992. /* "(tree fragment)":10
  6993. * if __pyx_state is not None:
  6994. * __pyx_unpickle__Base__set_state(<_Base> __pyx_result, __pyx_state)
  6995. * return __pyx_result # <<<<<<<<<<<<<<
  6996. * cdef __pyx_unpickle__Base__set_state(_Base __pyx_result, tuple __pyx_state):
  6997. * __pyx_result._impl = __pyx_state[0]
  6998. */
  6999. __Pyx_XDECREF(__pyx_r);
  7000. __Pyx_INCREF(__pyx_v___pyx_result);
  7001. __pyx_r = __pyx_v___pyx_result;
  7002. goto __pyx_L0;
  7003. /* "(tree fragment)":1
  7004. * def __pyx_unpickle__Base(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  7005. * cdef object __pyx_PickleError
  7006. * cdef object __pyx_result
  7007. */
  7008. /* function exit code */
  7009. __pyx_L1_error:;
  7010. __Pyx_XDECREF(__pyx_t_2);
  7011. __Pyx_XDECREF(__pyx_t_3);
  7012. __Pyx_XDECREF(__pyx_t_4);
  7013. __Pyx_XDECREF(__pyx_t_5);
  7014. __Pyx_AddTraceback("multidict._multidict.__pyx_unpickle__Base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7015. __pyx_r = NULL;
  7016. __pyx_L0:;
  7017. __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  7018. __Pyx_XDECREF(__pyx_v___pyx_result);
  7019. __Pyx_XGIVEREF(__pyx_r);
  7020. __Pyx_RefNannyFinishContext();
  7021. return __pyx_r;
  7022. }
  7023. /* "(tree fragment)":11
  7024. * __pyx_unpickle__Base__set_state(<_Base> __pyx_result, __pyx_state)
  7025. * return __pyx_result
  7026. * cdef __pyx_unpickle__Base__set_state(_Base __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  7027. * __pyx_result._impl = __pyx_state[0]
  7028. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  7029. */
  7030. static PyObject *__pyx_f_9multidict_10_multidict___pyx_unpickle__Base__set_state(struct __pyx_obj_9multidict_10_multidict__Base *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  7031. PyObject *__pyx_r = NULL;
  7032. __Pyx_RefNannyDeclarations
  7033. PyObject *__pyx_t_1 = NULL;
  7034. int __pyx_t_2;
  7035. Py_ssize_t __pyx_t_3;
  7036. int __pyx_t_4;
  7037. int __pyx_t_5;
  7038. PyObject *__pyx_t_6 = NULL;
  7039. PyObject *__pyx_t_7 = NULL;
  7040. PyObject *__pyx_t_8 = NULL;
  7041. __Pyx_RefNannySetupContext("__pyx_unpickle__Base__set_state", 0);
  7042. /* "(tree fragment)":12
  7043. * return __pyx_result
  7044. * cdef __pyx_unpickle__Base__set_state(_Base __pyx_result, tuple __pyx_state):
  7045. * __pyx_result._impl = __pyx_state[0] # <<<<<<<<<<<<<<
  7046. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  7047. * __pyx_result.__dict__.update(__pyx_state[1])
  7048. */
  7049. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  7050. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  7051. __PYX_ERR(1, 12, __pyx_L1_error)
  7052. }
  7053. __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  7054. __Pyx_GOTREF(__pyx_t_1);
  7055. __Pyx_GIVEREF(__pyx_t_1);
  7056. __Pyx_GOTREF(__pyx_v___pyx_result->_impl);
  7057. __Pyx_DECREF(__pyx_v___pyx_result->_impl);
  7058. __pyx_v___pyx_result->_impl = __pyx_t_1;
  7059. __pyx_t_1 = 0;
  7060. /* "(tree fragment)":13
  7061. * cdef __pyx_unpickle__Base__set_state(_Base __pyx_result, tuple __pyx_state):
  7062. * __pyx_result._impl = __pyx_state[0]
  7063. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  7064. * __pyx_result.__dict__.update(__pyx_state[1])
  7065. */
  7066. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  7067. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  7068. __PYX_ERR(1, 13, __pyx_L1_error)
  7069. }
  7070. __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  7071. __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  7072. if (__pyx_t_4) {
  7073. } else {
  7074. __pyx_t_2 = __pyx_t_4;
  7075. goto __pyx_L4_bool_binop_done;
  7076. }
  7077. __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  7078. __pyx_t_5 = (__pyx_t_4 != 0);
  7079. __pyx_t_2 = __pyx_t_5;
  7080. __pyx_L4_bool_binop_done:;
  7081. if (__pyx_t_2) {
  7082. /* "(tree fragment)":14
  7083. * __pyx_result._impl = __pyx_state[0]
  7084. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  7085. * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
  7086. */
  7087. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
  7088. __Pyx_GOTREF(__pyx_t_6);
  7089. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
  7090. __Pyx_GOTREF(__pyx_t_7);
  7091. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7092. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  7093. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  7094. __PYX_ERR(1, 14, __pyx_L1_error)
  7095. }
  7096. __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
  7097. __Pyx_GOTREF(__pyx_t_6);
  7098. __pyx_t_8 = NULL;
  7099. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
  7100. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
  7101. if (likely(__pyx_t_8)) {
  7102. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  7103. __Pyx_INCREF(__pyx_t_8);
  7104. __Pyx_INCREF(function);
  7105. __Pyx_DECREF_SET(__pyx_t_7, function);
  7106. }
  7107. }
  7108. __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  7109. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  7110. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7111. if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
  7112. __Pyx_GOTREF(__pyx_t_1);
  7113. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7114. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7115. /* "(tree fragment)":13
  7116. * cdef __pyx_unpickle__Base__set_state(_Base __pyx_result, tuple __pyx_state):
  7117. * __pyx_result._impl = __pyx_state[0]
  7118. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  7119. * __pyx_result.__dict__.update(__pyx_state[1])
  7120. */
  7121. }
  7122. /* "(tree fragment)":11
  7123. * __pyx_unpickle__Base__set_state(<_Base> __pyx_result, __pyx_state)
  7124. * return __pyx_result
  7125. * cdef __pyx_unpickle__Base__set_state(_Base __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  7126. * __pyx_result._impl = __pyx_state[0]
  7127. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  7128. */
  7129. /* function exit code */
  7130. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  7131. goto __pyx_L0;
  7132. __pyx_L1_error:;
  7133. __Pyx_XDECREF(__pyx_t_1);
  7134. __Pyx_XDECREF(__pyx_t_6);
  7135. __Pyx_XDECREF(__pyx_t_7);
  7136. __Pyx_XDECREF(__pyx_t_8);
  7137. __Pyx_AddTraceback("multidict._multidict.__pyx_unpickle__Base__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7138. __pyx_r = 0;
  7139. __pyx_L0:;
  7140. __Pyx_XGIVEREF(__pyx_r);
  7141. __Pyx_RefNannyFinishContext();
  7142. return __pyx_r;
  7143. }
  7144. static struct __pyx_vtabstruct_9multidict_10_multidict__Base __pyx_vtable_9multidict_10_multidict__Base;
  7145. static PyObject *__pyx_tp_new_9multidict_10_multidict__Base(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  7146. struct __pyx_obj_9multidict_10_multidict__Base *p;
  7147. PyObject *o;
  7148. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  7149. o = (*t->tp_alloc)(t, 0);
  7150. } else {
  7151. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  7152. }
  7153. if (unlikely(!o)) return 0;
  7154. p = ((struct __pyx_obj_9multidict_10_multidict__Base *)o);
  7155. p->__pyx_vtab = __pyx_vtabptr_9multidict_10_multidict__Base;
  7156. p->_impl = Py_None; Py_INCREF(Py_None);
  7157. return o;
  7158. }
  7159. static void __pyx_tp_dealloc_9multidict_10_multidict__Base(PyObject *o) {
  7160. struct __pyx_obj_9multidict_10_multidict__Base *p = (struct __pyx_obj_9multidict_10_multidict__Base *)o;
  7161. #if CYTHON_USE_TP_FINALIZE
  7162. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  7163. if (PyObject_CallFinalizerFromDealloc(o)) return;
  7164. }
  7165. #endif
  7166. PyObject_GC_UnTrack(o);
  7167. Py_CLEAR(p->_impl);
  7168. (*Py_TYPE(o)->tp_free)(o);
  7169. }
  7170. static int __pyx_tp_traverse_9multidict_10_multidict__Base(PyObject *o, visitproc v, void *a) {
  7171. int e;
  7172. struct __pyx_obj_9multidict_10_multidict__Base *p = (struct __pyx_obj_9multidict_10_multidict__Base *)o;
  7173. if (p->_impl) {
  7174. e = (*v)(p->_impl, a); if (e) return e;
  7175. }
  7176. return 0;
  7177. }
  7178. static int __pyx_tp_clear_9multidict_10_multidict__Base(PyObject *o) {
  7179. PyObject* tmp;
  7180. struct __pyx_obj_9multidict_10_multidict__Base *p = (struct __pyx_obj_9multidict_10_multidict__Base *)o;
  7181. tmp = ((PyObject*)p->_impl);
  7182. p->_impl = Py_None; Py_INCREF(Py_None);
  7183. Py_XDECREF(tmp);
  7184. return 0;
  7185. }
  7186. static PyObject *__pyx_sq_item_9multidict_10_multidict__Base(PyObject *o, Py_ssize_t i) {
  7187. PyObject *r;
  7188. PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  7189. r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  7190. Py_DECREF(x);
  7191. return r;
  7192. }
  7193. static PyObject *__pyx_tp_richcompare_9multidict_10_multidict__Base(PyObject *o1, PyObject *o2, int op) {
  7194. switch (op) {
  7195. case Py_EQ: {
  7196. return __pyx_pw_9multidict_10_multidict_5_Base_25__eq__(o1, o2);
  7197. }
  7198. case Py_NE: {
  7199. PyObject *ret;
  7200. ret = __pyx_pw_9multidict_10_multidict_5_Base_25__eq__(o1, o2);
  7201. if (likely(ret && ret != Py_NotImplemented)) {
  7202. int b = __Pyx_PyObject_IsTrue(ret); Py_DECREF(ret);
  7203. if (unlikely(b < 0)) return NULL;
  7204. ret = (b) ? Py_False : Py_True;
  7205. Py_INCREF(ret);
  7206. }
  7207. return ret;
  7208. }
  7209. default: {
  7210. return __Pyx_NewRef(Py_NotImplemented);
  7211. }
  7212. }
  7213. }
  7214. static PyMethodDef __pyx_methods_9multidict_10_multidict__Base[] = {
  7215. {"impl", (PyCFunction)__pyx_pw_9multidict_10_multidict_5_Base_1impl, METH_NOARGS, 0},
  7216. {"getall", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9multidict_10_multidict_5_Base_3getall, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9multidict_10_multidict_5_Base_2getall},
  7217. {"getone", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9multidict_10_multidict_5_Base_5getone, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9multidict_10_multidict_5_Base_4getone},
  7218. {"get", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9multidict_10_multidict_5_Base_9get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9multidict_10_multidict_5_Base_8get},
  7219. {"keys", (PyCFunction)__pyx_pw_9multidict_10_multidict_5_Base_17keys, METH_NOARGS, __pyx_doc_9multidict_10_multidict_5_Base_16keys},
  7220. {"items", (PyCFunction)__pyx_pw_9multidict_10_multidict_5_Base_19items, METH_NOARGS, __pyx_doc_9multidict_10_multidict_5_Base_18items},
  7221. {"values", (PyCFunction)__pyx_pw_9multidict_10_multidict_5_Base_21values, METH_NOARGS, __pyx_doc_9multidict_10_multidict_5_Base_20values},
  7222. {"__reduce_cython__", (PyCFunction)__pyx_pw_9multidict_10_multidict_5_Base_27__reduce_cython__, METH_NOARGS, 0},
  7223. {"__setstate_cython__", (PyCFunction)__pyx_pw_9multidict_10_multidict_5_Base_29__setstate_cython__, METH_O, 0},
  7224. {0, 0, 0, 0}
  7225. };
  7226. static PySequenceMethods __pyx_tp_as_sequence__Base = {
  7227. __pyx_pw_9multidict_10_multidict_5_Base_15__len__, /*sq_length*/
  7228. 0, /*sq_concat*/
  7229. 0, /*sq_repeat*/
  7230. __pyx_sq_item_9multidict_10_multidict__Base, /*sq_item*/
  7231. 0, /*sq_slice*/
  7232. 0, /*sq_ass_item*/
  7233. 0, /*sq_ass_slice*/
  7234. __pyx_pw_9multidict_10_multidict_5_Base_11__contains__, /*sq_contains*/
  7235. 0, /*sq_inplace_concat*/
  7236. 0, /*sq_inplace_repeat*/
  7237. };
  7238. static PyMappingMethods __pyx_tp_as_mapping__Base = {
  7239. __pyx_pw_9multidict_10_multidict_5_Base_15__len__, /*mp_length*/
  7240. __pyx_pw_9multidict_10_multidict_5_Base_7__getitem__, /*mp_subscript*/
  7241. 0, /*mp_ass_subscript*/
  7242. };
  7243. static PyTypeObject __pyx_type_9multidict_10_multidict__Base = {
  7244. PyVarObject_HEAD_INIT(0, 0)
  7245. "multidict._multidict._Base", /*tp_name*/
  7246. sizeof(struct __pyx_obj_9multidict_10_multidict__Base), /*tp_basicsize*/
  7247. 0, /*tp_itemsize*/
  7248. __pyx_tp_dealloc_9multidict_10_multidict__Base, /*tp_dealloc*/
  7249. 0, /*tp_print*/
  7250. 0, /*tp_getattr*/
  7251. 0, /*tp_setattr*/
  7252. #if PY_MAJOR_VERSION < 3
  7253. 0, /*tp_compare*/
  7254. #endif
  7255. #if PY_MAJOR_VERSION >= 3
  7256. 0, /*tp_as_async*/
  7257. #endif
  7258. __pyx_pw_9multidict_10_multidict_5_Base_23__repr__, /*tp_repr*/
  7259. 0, /*tp_as_number*/
  7260. &__pyx_tp_as_sequence__Base, /*tp_as_sequence*/
  7261. &__pyx_tp_as_mapping__Base, /*tp_as_mapping*/
  7262. 0, /*tp_hash*/
  7263. 0, /*tp_call*/
  7264. 0, /*tp_str*/
  7265. 0, /*tp_getattro*/
  7266. 0, /*tp_setattro*/
  7267. 0, /*tp_as_buffer*/
  7268. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  7269. 0, /*tp_doc*/
  7270. __pyx_tp_traverse_9multidict_10_multidict__Base, /*tp_traverse*/
  7271. __pyx_tp_clear_9multidict_10_multidict__Base, /*tp_clear*/
  7272. __pyx_tp_richcompare_9multidict_10_multidict__Base, /*tp_richcompare*/
  7273. 0, /*tp_weaklistoffset*/
  7274. __pyx_pw_9multidict_10_multidict_5_Base_13__iter__, /*tp_iter*/
  7275. 0, /*tp_iternext*/
  7276. __pyx_methods_9multidict_10_multidict__Base, /*tp_methods*/
  7277. 0, /*tp_members*/
  7278. 0, /*tp_getset*/
  7279. 0, /*tp_base*/
  7280. 0, /*tp_dict*/
  7281. 0, /*tp_descr_get*/
  7282. 0, /*tp_descr_set*/
  7283. 0, /*tp_dictoffset*/
  7284. 0, /*tp_init*/
  7285. 0, /*tp_alloc*/
  7286. __pyx_tp_new_9multidict_10_multidict__Base, /*tp_new*/
  7287. 0, /*tp_free*/
  7288. 0, /*tp_is_gc*/
  7289. 0, /*tp_bases*/
  7290. 0, /*tp_mro*/
  7291. 0, /*tp_cache*/
  7292. 0, /*tp_subclasses*/
  7293. 0, /*tp_weaklist*/
  7294. 0, /*tp_del*/
  7295. 0, /*tp_version_tag*/
  7296. #if PY_VERSION_HEX >= 0x030400a1
  7297. 0, /*tp_finalize*/
  7298. #endif
  7299. };
  7300. static struct __pyx_vtabstruct_9multidict_10_multidict_MultiDictProxy __pyx_vtable_9multidict_10_multidict_MultiDictProxy;
  7301. static PyObject *__pyx_tp_new_9multidict_10_multidict_MultiDictProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  7302. struct __pyx_obj_9multidict_10_multidict_MultiDictProxy *p;
  7303. PyObject *o = __pyx_tp_new_9multidict_10_multidict__Base(t, a, k);
  7304. if (unlikely(!o)) return 0;
  7305. p = ((struct __pyx_obj_9multidict_10_multidict_MultiDictProxy *)o);
  7306. p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9multidict_10_multidict__Base*)__pyx_vtabptr_9multidict_10_multidict_MultiDictProxy;
  7307. return o;
  7308. }
  7309. static PyMethodDef __pyx_methods_9multidict_10_multidict_MultiDictProxy[] = {
  7310. {"__reduce__", (PyCFunction)__pyx_pw_9multidict_10_multidict_14MultiDictProxy_3__reduce__, METH_NOARGS, 0},
  7311. {"copy", (PyCFunction)__pyx_pw_9multidict_10_multidict_14MultiDictProxy_5copy, METH_NOARGS, __pyx_doc_9multidict_10_multidict_14MultiDictProxy_4copy},
  7312. {0, 0, 0, 0}
  7313. };
  7314. static PyTypeObject __pyx_type_9multidict_10_multidict_MultiDictProxy = {
  7315. PyVarObject_HEAD_INIT(0, 0)
  7316. "multidict._multidict.MultiDictProxy", /*tp_name*/
  7317. sizeof(struct __pyx_obj_9multidict_10_multidict_MultiDictProxy), /*tp_basicsize*/
  7318. 0, /*tp_itemsize*/
  7319. __pyx_tp_dealloc_9multidict_10_multidict__Base, /*tp_dealloc*/
  7320. 0, /*tp_print*/
  7321. 0, /*tp_getattr*/
  7322. 0, /*tp_setattr*/
  7323. #if PY_MAJOR_VERSION < 3
  7324. 0, /*tp_compare*/
  7325. #endif
  7326. #if PY_MAJOR_VERSION >= 3
  7327. 0, /*tp_as_async*/
  7328. #endif
  7329. #if CYTHON_COMPILING_IN_PYPY
  7330. __pyx_pw_9multidict_10_multidict_5_Base_23__repr__, /*tp_repr*/
  7331. #else
  7332. 0, /*tp_repr*/
  7333. #endif
  7334. 0, /*tp_as_number*/
  7335. 0, /*tp_as_sequence*/
  7336. 0, /*tp_as_mapping*/
  7337. 0, /*tp_hash*/
  7338. 0, /*tp_call*/
  7339. 0, /*tp_str*/
  7340. 0, /*tp_getattro*/
  7341. 0, /*tp_setattro*/
  7342. 0, /*tp_as_buffer*/
  7343. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  7344. 0, /*tp_doc*/
  7345. __pyx_tp_traverse_9multidict_10_multidict__Base, /*tp_traverse*/
  7346. __pyx_tp_clear_9multidict_10_multidict__Base, /*tp_clear*/
  7347. 0, /*tp_richcompare*/
  7348. 0, /*tp_weaklistoffset*/
  7349. #if CYTHON_COMPILING_IN_PYPY
  7350. __pyx_pw_9multidict_10_multidict_5_Base_13__iter__, /*tp_iter*/
  7351. #else
  7352. 0, /*tp_iter*/
  7353. #endif
  7354. 0, /*tp_iternext*/
  7355. __pyx_methods_9multidict_10_multidict_MultiDictProxy, /*tp_methods*/
  7356. 0, /*tp_members*/
  7357. 0, /*tp_getset*/
  7358. 0, /*tp_base*/
  7359. 0, /*tp_dict*/
  7360. 0, /*tp_descr_get*/
  7361. 0, /*tp_descr_set*/
  7362. 0, /*tp_dictoffset*/
  7363. __pyx_pw_9multidict_10_multidict_14MultiDictProxy_1__init__, /*tp_init*/
  7364. 0, /*tp_alloc*/
  7365. __pyx_tp_new_9multidict_10_multidict_MultiDictProxy, /*tp_new*/
  7366. 0, /*tp_free*/
  7367. 0, /*tp_is_gc*/
  7368. 0, /*tp_bases*/
  7369. 0, /*tp_mro*/
  7370. 0, /*tp_cache*/
  7371. 0, /*tp_subclasses*/
  7372. 0, /*tp_weaklist*/
  7373. 0, /*tp_del*/
  7374. 0, /*tp_version_tag*/
  7375. #if PY_VERSION_HEX >= 0x030400a1
  7376. 0, /*tp_finalize*/
  7377. #endif
  7378. };
  7379. static struct __pyx_vtabstruct_9multidict_10_multidict_CIMultiDictProxy __pyx_vtable_9multidict_10_multidict_CIMultiDictProxy;
  7380. static PyObject *__pyx_tp_new_9multidict_10_multidict_CIMultiDictProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  7381. struct __pyx_obj_9multidict_10_multidict_CIMultiDictProxy *p;
  7382. PyObject *o = __pyx_tp_new_9multidict_10_multidict_MultiDictProxy(t, a, k);
  7383. if (unlikely(!o)) return 0;
  7384. p = ((struct __pyx_obj_9multidict_10_multidict_CIMultiDictProxy *)o);
  7385. p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9multidict_10_multidict__Base*)__pyx_vtabptr_9multidict_10_multidict_CIMultiDictProxy;
  7386. return o;
  7387. }
  7388. static PyTypeObject __pyx_type_9multidict_10_multidict_CIMultiDictProxy = {
  7389. PyVarObject_HEAD_INIT(0, 0)
  7390. "multidict._multidict.CIMultiDictProxy", /*tp_name*/
  7391. sizeof(struct __pyx_obj_9multidict_10_multidict_CIMultiDictProxy), /*tp_basicsize*/
  7392. 0, /*tp_itemsize*/
  7393. __pyx_tp_dealloc_9multidict_10_multidict__Base, /*tp_dealloc*/
  7394. 0, /*tp_print*/
  7395. 0, /*tp_getattr*/
  7396. 0, /*tp_setattr*/
  7397. #if PY_MAJOR_VERSION < 3
  7398. 0, /*tp_compare*/
  7399. #endif
  7400. #if PY_MAJOR_VERSION >= 3
  7401. 0, /*tp_as_async*/
  7402. #endif
  7403. #if CYTHON_COMPILING_IN_PYPY
  7404. __pyx_pw_9multidict_10_multidict_5_Base_23__repr__, /*tp_repr*/
  7405. #else
  7406. 0, /*tp_repr*/
  7407. #endif
  7408. 0, /*tp_as_number*/
  7409. 0, /*tp_as_sequence*/
  7410. 0, /*tp_as_mapping*/
  7411. 0, /*tp_hash*/
  7412. 0, /*tp_call*/
  7413. 0, /*tp_str*/
  7414. 0, /*tp_getattro*/
  7415. 0, /*tp_setattro*/
  7416. 0, /*tp_as_buffer*/
  7417. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  7418. 0, /*tp_doc*/
  7419. __pyx_tp_traverse_9multidict_10_multidict__Base, /*tp_traverse*/
  7420. __pyx_tp_clear_9multidict_10_multidict__Base, /*tp_clear*/
  7421. 0, /*tp_richcompare*/
  7422. 0, /*tp_weaklistoffset*/
  7423. #if CYTHON_COMPILING_IN_PYPY
  7424. __pyx_pw_9multidict_10_multidict_5_Base_13__iter__, /*tp_iter*/
  7425. #else
  7426. 0, /*tp_iter*/
  7427. #endif
  7428. 0, /*tp_iternext*/
  7429. 0, /*tp_methods*/
  7430. 0, /*tp_members*/
  7431. 0, /*tp_getset*/
  7432. 0, /*tp_base*/
  7433. 0, /*tp_dict*/
  7434. 0, /*tp_descr_get*/
  7435. 0, /*tp_descr_set*/
  7436. 0, /*tp_dictoffset*/
  7437. #if CYTHON_COMPILING_IN_PYPY
  7438. __pyx_pw_9multidict_10_multidict_14MultiDictProxy_1__init__, /*tp_init*/
  7439. #else
  7440. 0, /*tp_init*/
  7441. #endif
  7442. 0, /*tp_alloc*/
  7443. __pyx_tp_new_9multidict_10_multidict_CIMultiDictProxy, /*tp_new*/
  7444. 0, /*tp_free*/
  7445. 0, /*tp_is_gc*/
  7446. 0, /*tp_bases*/
  7447. 0, /*tp_mro*/
  7448. 0, /*tp_cache*/
  7449. 0, /*tp_subclasses*/
  7450. 0, /*tp_weaklist*/
  7451. 0, /*tp_del*/
  7452. 0, /*tp_version_tag*/
  7453. #if PY_VERSION_HEX >= 0x030400a1
  7454. 0, /*tp_finalize*/
  7455. #endif
  7456. };
  7457. static struct __pyx_vtabstruct_9multidict_10_multidict_MultiDict __pyx_vtable_9multidict_10_multidict_MultiDict;
  7458. static PyObject *__pyx_tp_new_9multidict_10_multidict_MultiDict(PyTypeObject *t, PyObject *a, PyObject *k) {
  7459. struct __pyx_obj_9multidict_10_multidict_MultiDict *p;
  7460. PyObject *o = __pyx_tp_new_9multidict_10_multidict__Base(t, a, k);
  7461. if (unlikely(!o)) return 0;
  7462. p = ((struct __pyx_obj_9multidict_10_multidict_MultiDict *)o);
  7463. p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9multidict_10_multidict__Base*)__pyx_vtabptr_9multidict_10_multidict_MultiDict;
  7464. return o;
  7465. }
  7466. static int __pyx_mp_ass_subscript_9multidict_10_multidict_MultiDict(PyObject *o, PyObject *i, PyObject *v) {
  7467. if (v) {
  7468. return __pyx_pw_9multidict_10_multidict_9MultiDict_13__setitem__(o, i, v);
  7469. }
  7470. else {
  7471. return __pyx_pw_9multidict_10_multidict_9MultiDict_15__delitem__(o, i);
  7472. }
  7473. }
  7474. static PyMethodDef __pyx_methods_9multidict_10_multidict_MultiDict[] = {
  7475. {"__reduce__", (PyCFunction)__pyx_pw_9multidict_10_multidict_9MultiDict_3__reduce__, METH_NOARGS, 0},
  7476. {"add", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9multidict_10_multidict_9MultiDict_5add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9multidict_10_multidict_9MultiDict_4add},
  7477. {"copy", (PyCFunction)__pyx_pw_9multidict_10_multidict_9MultiDict_7copy, METH_NOARGS, __pyx_doc_9multidict_10_multidict_9MultiDict_6copy},
  7478. {"extend", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9multidict_10_multidict_9MultiDict_9extend, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9multidict_10_multidict_9MultiDict_8extend},
  7479. {"clear", (PyCFunction)__pyx_pw_9multidict_10_multidict_9MultiDict_11clear, METH_NOARGS, __pyx_doc_9multidict_10_multidict_9MultiDict_10clear},
  7480. {"setdefault", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9multidict_10_multidict_9MultiDict_17setdefault, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9multidict_10_multidict_9MultiDict_16setdefault},
  7481. {"popone", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9multidict_10_multidict_9MultiDict_19popone, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9multidict_10_multidict_9MultiDict_18popone},
  7482. {"popall", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9multidict_10_multidict_9MultiDict_21popall, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9multidict_10_multidict_9MultiDict_20popall},
  7483. {"popitem", (PyCFunction)__pyx_pw_9multidict_10_multidict_9MultiDict_23popitem, METH_NOARGS, __pyx_doc_9multidict_10_multidict_9MultiDict_22popitem},
  7484. {"update", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9multidict_10_multidict_9MultiDict_25update, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9multidict_10_multidict_9MultiDict_24update},
  7485. {0, 0, 0, 0}
  7486. };
  7487. static PyMappingMethods __pyx_tp_as_mapping_MultiDict = {
  7488. #if CYTHON_COMPILING_IN_PYPY
  7489. __pyx_pw_9multidict_10_multidict_5_Base_15__len__, /*mp_length*/
  7490. #else
  7491. 0, /*mp_length*/
  7492. #endif
  7493. #if CYTHON_COMPILING_IN_PYPY
  7494. __pyx_pw_9multidict_10_multidict_5_Base_7__getitem__, /*mp_subscript*/
  7495. #else
  7496. 0, /*mp_subscript*/
  7497. #endif
  7498. __pyx_mp_ass_subscript_9multidict_10_multidict_MultiDict, /*mp_ass_subscript*/
  7499. };
  7500. static PyTypeObject __pyx_type_9multidict_10_multidict_MultiDict = {
  7501. PyVarObject_HEAD_INIT(0, 0)
  7502. "multidict._multidict.MultiDict", /*tp_name*/
  7503. sizeof(struct __pyx_obj_9multidict_10_multidict_MultiDict), /*tp_basicsize*/
  7504. 0, /*tp_itemsize*/
  7505. __pyx_tp_dealloc_9multidict_10_multidict__Base, /*tp_dealloc*/
  7506. 0, /*tp_print*/
  7507. 0, /*tp_getattr*/
  7508. 0, /*tp_setattr*/
  7509. #if PY_MAJOR_VERSION < 3
  7510. 0, /*tp_compare*/
  7511. #endif
  7512. #if PY_MAJOR_VERSION >= 3
  7513. 0, /*tp_as_async*/
  7514. #endif
  7515. #if CYTHON_COMPILING_IN_PYPY
  7516. __pyx_pw_9multidict_10_multidict_5_Base_23__repr__, /*tp_repr*/
  7517. #else
  7518. 0, /*tp_repr*/
  7519. #endif
  7520. 0, /*tp_as_number*/
  7521. 0, /*tp_as_sequence*/
  7522. &__pyx_tp_as_mapping_MultiDict, /*tp_as_mapping*/
  7523. 0, /*tp_hash*/
  7524. 0, /*tp_call*/
  7525. 0, /*tp_str*/
  7526. 0, /*tp_getattro*/
  7527. 0, /*tp_setattro*/
  7528. 0, /*tp_as_buffer*/
  7529. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  7530. "An ordered dictionary that can have multiple values for each key.", /*tp_doc*/
  7531. __pyx_tp_traverse_9multidict_10_multidict__Base, /*tp_traverse*/
  7532. __pyx_tp_clear_9multidict_10_multidict__Base, /*tp_clear*/
  7533. 0, /*tp_richcompare*/
  7534. 0, /*tp_weaklistoffset*/
  7535. #if CYTHON_COMPILING_IN_PYPY
  7536. __pyx_pw_9multidict_10_multidict_5_Base_13__iter__, /*tp_iter*/
  7537. #else
  7538. 0, /*tp_iter*/
  7539. #endif
  7540. 0, /*tp_iternext*/
  7541. __pyx_methods_9multidict_10_multidict_MultiDict, /*tp_methods*/
  7542. 0, /*tp_members*/
  7543. 0, /*tp_getset*/
  7544. 0, /*tp_base*/
  7545. 0, /*tp_dict*/
  7546. 0, /*tp_descr_get*/
  7547. 0, /*tp_descr_set*/
  7548. 0, /*tp_dictoffset*/
  7549. __pyx_pw_9multidict_10_multidict_9MultiDict_1__init__, /*tp_init*/
  7550. 0, /*tp_alloc*/
  7551. __pyx_tp_new_9multidict_10_multidict_MultiDict, /*tp_new*/
  7552. 0, /*tp_free*/
  7553. 0, /*tp_is_gc*/
  7554. 0, /*tp_bases*/
  7555. 0, /*tp_mro*/
  7556. 0, /*tp_cache*/
  7557. 0, /*tp_subclasses*/
  7558. 0, /*tp_weaklist*/
  7559. 0, /*tp_del*/
  7560. 0, /*tp_version_tag*/
  7561. #if PY_VERSION_HEX >= 0x030400a1
  7562. 0, /*tp_finalize*/
  7563. #endif
  7564. };
  7565. static struct __pyx_vtabstruct_9multidict_10_multidict_CIMultiDict __pyx_vtable_9multidict_10_multidict_CIMultiDict;
  7566. static PyObject *__pyx_tp_new_9multidict_10_multidict_CIMultiDict(PyTypeObject *t, PyObject *a, PyObject *k) {
  7567. struct __pyx_obj_9multidict_10_multidict_CIMultiDict *p;
  7568. PyObject *o = __pyx_tp_new_9multidict_10_multidict_MultiDict(t, a, k);
  7569. if (unlikely(!o)) return 0;
  7570. p = ((struct __pyx_obj_9multidict_10_multidict_CIMultiDict *)o);
  7571. p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9multidict_10_multidict__Base*)__pyx_vtabptr_9multidict_10_multidict_CIMultiDict;
  7572. return o;
  7573. }
  7574. static PyMethodDef __pyx_methods_9multidict_10_multidict_CIMultiDict[] = {
  7575. {"__reduce__", (PyCFunction)__pyx_pw_9multidict_10_multidict_11CIMultiDict_3__reduce__, METH_NOARGS, 0},
  7576. {"copy", (PyCFunction)__pyx_pw_9multidict_10_multidict_11CIMultiDict_5copy, METH_NOARGS, __pyx_doc_9multidict_10_multidict_11CIMultiDict_4copy},
  7577. {0, 0, 0, 0}
  7578. };
  7579. static PyTypeObject __pyx_type_9multidict_10_multidict_CIMultiDict = {
  7580. PyVarObject_HEAD_INIT(0, 0)
  7581. "multidict._multidict.CIMultiDict", /*tp_name*/
  7582. sizeof(struct __pyx_obj_9multidict_10_multidict_CIMultiDict), /*tp_basicsize*/
  7583. 0, /*tp_itemsize*/
  7584. __pyx_tp_dealloc_9multidict_10_multidict__Base, /*tp_dealloc*/
  7585. 0, /*tp_print*/
  7586. 0, /*tp_getattr*/
  7587. 0, /*tp_setattr*/
  7588. #if PY_MAJOR_VERSION < 3
  7589. 0, /*tp_compare*/
  7590. #endif
  7591. #if PY_MAJOR_VERSION >= 3
  7592. 0, /*tp_as_async*/
  7593. #endif
  7594. #if CYTHON_COMPILING_IN_PYPY
  7595. __pyx_pw_9multidict_10_multidict_5_Base_23__repr__, /*tp_repr*/
  7596. #else
  7597. 0, /*tp_repr*/
  7598. #endif
  7599. 0, /*tp_as_number*/
  7600. 0, /*tp_as_sequence*/
  7601. 0, /*tp_as_mapping*/
  7602. 0, /*tp_hash*/
  7603. 0, /*tp_call*/
  7604. 0, /*tp_str*/
  7605. 0, /*tp_getattro*/
  7606. 0, /*tp_setattro*/
  7607. 0, /*tp_as_buffer*/
  7608. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  7609. "An ordered dictionary that can have multiple values for each key.", /*tp_doc*/
  7610. __pyx_tp_traverse_9multidict_10_multidict__Base, /*tp_traverse*/
  7611. __pyx_tp_clear_9multidict_10_multidict__Base, /*tp_clear*/
  7612. 0, /*tp_richcompare*/
  7613. 0, /*tp_weaklistoffset*/
  7614. #if CYTHON_COMPILING_IN_PYPY
  7615. __pyx_pw_9multidict_10_multidict_5_Base_13__iter__, /*tp_iter*/
  7616. #else
  7617. 0, /*tp_iter*/
  7618. #endif
  7619. 0, /*tp_iternext*/
  7620. __pyx_methods_9multidict_10_multidict_CIMultiDict, /*tp_methods*/
  7621. 0, /*tp_members*/
  7622. 0, /*tp_getset*/
  7623. 0, /*tp_base*/
  7624. 0, /*tp_dict*/
  7625. 0, /*tp_descr_get*/
  7626. 0, /*tp_descr_set*/
  7627. 0, /*tp_dictoffset*/
  7628. __pyx_pw_9multidict_10_multidict_11CIMultiDict_1__init__, /*tp_init*/
  7629. 0, /*tp_alloc*/
  7630. __pyx_tp_new_9multidict_10_multidict_CIMultiDict, /*tp_new*/
  7631. 0, /*tp_free*/
  7632. 0, /*tp_is_gc*/
  7633. 0, /*tp_bases*/
  7634. 0, /*tp_mro*/
  7635. 0, /*tp_cache*/
  7636. 0, /*tp_subclasses*/
  7637. 0, /*tp_weaklist*/
  7638. 0, /*tp_del*/
  7639. 0, /*tp_version_tag*/
  7640. #if PY_VERSION_HEX >= 0x030400a1
  7641. 0, /*tp_finalize*/
  7642. #endif
  7643. };
  7644. static PyMethodDef __pyx_methods[] = {
  7645. {0, 0, 0, 0}
  7646. };
  7647. #if PY_MAJOR_VERSION >= 3
  7648. #if CYTHON_PEP489_MULTI_PHASE_INIT
  7649. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  7650. static int __pyx_pymod_exec__multidict(PyObject* module); /*proto*/
  7651. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  7652. {Py_mod_create, (void*)__pyx_pymod_create},
  7653. {Py_mod_exec, (void*)__pyx_pymod_exec__multidict},
  7654. {0, NULL}
  7655. };
  7656. #endif
  7657. static struct PyModuleDef __pyx_moduledef = {
  7658. PyModuleDef_HEAD_INIT,
  7659. "_multidict",
  7660. 0, /* m_doc */
  7661. #if CYTHON_PEP489_MULTI_PHASE_INIT
  7662. 0, /* m_size */
  7663. #else
  7664. -1, /* m_size */
  7665. #endif
  7666. __pyx_methods /* m_methods */,
  7667. #if CYTHON_PEP489_MULTI_PHASE_INIT
  7668. __pyx_moduledef_slots, /* m_slots */
  7669. #else
  7670. NULL, /* m_reload */
  7671. #endif
  7672. NULL, /* m_traverse */
  7673. NULL, /* m_clear */
  7674. NULL /* m_free */
  7675. };
  7676. #endif
  7677. #ifndef CYTHON_SMALL_CODE
  7678. #if defined(__clang__)
  7679. #define CYTHON_SMALL_CODE
  7680. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  7681. #define CYTHON_SMALL_CODE __attribute__((cold))
  7682. #else
  7683. #define CYTHON_SMALL_CODE
  7684. #endif
  7685. #endif
  7686. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  7687. {&__pyx_n_s_Base, __pyx_k_Base, sizeof(__pyx_k_Base), 0, 0, 1, 1},
  7688. {&__pyx_n_s_CIMultiDict, __pyx_k_CIMultiDict, sizeof(__pyx_k_CIMultiDict), 0, 0, 1, 1},
  7689. {&__pyx_n_s_CIMultiDictProxy, __pyx_k_CIMultiDictProxy, sizeof(__pyx_k_CIMultiDictProxy), 0, 0, 1, 1},
  7690. {&__pyx_kp_s_Incompatible_checksums_s_vs_0x4d, __pyx_k_Incompatible_checksums_s_vs_0x4d, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x4d), 0, 0, 1, 0},
  7691. {&__pyx_n_s_Iterable, __pyx_k_Iterable, sizeof(__pyx_k_Iterable), 0, 0, 1, 1},
  7692. {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  7693. {&__pyx_n_s_Mapping, __pyx_k_Mapping, sizeof(__pyx_k_Mapping), 0, 0, 1, 1},
  7694. {&__pyx_n_s_MultiDict, __pyx_k_MultiDict, sizeof(__pyx_k_MultiDict), 0, 0, 1, 1},
  7695. {&__pyx_n_s_MultiDictProxy, __pyx_k_MultiDictProxy, sizeof(__pyx_k_MultiDictProxy), 0, 0, 1, 1},
  7696. {&__pyx_kp_s_MultiDict_keys_should_be_either, __pyx_k_MultiDict_keys_should_be_either, sizeof(__pyx_k_MultiDict_keys_should_be_either), 0, 0, 1, 0},
  7697. {&__pyx_n_s_MultiMapping, __pyx_k_MultiMapping, sizeof(__pyx_k_MultiMapping), 0, 0, 1, 1},
  7698. {&__pyx_n_s_MutableMultiMapping, __pyx_k_MutableMultiMapping, sizeof(__pyx_k_MutableMultiMapping), 0, 0, 1, 1},
  7699. {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
  7700. {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  7701. {&__pyx_n_s_Set, __pyx_k_Set, sizeof(__pyx_k_Set), 0, 0, 1, 1},
  7702. {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  7703. {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
  7704. {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0},
  7705. {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1},
  7706. {&__pyx_n_s_abc_2, __pyx_k_abc_2, sizeof(__pyx_k_abc_2), 0, 0, 1, 1},
  7707. {&__pyx_n_s_arg, __pyx_k_arg, sizeof(__pyx_k_arg), 0, 0, 1, 1},
  7708. {&__pyx_n_s_base_class, __pyx_k_base_class, sizeof(__pyx_k_base_class), 0, 0, 1, 1},
  7709. {&__pyx_kp_s_can_t_pickle_objects, __pyx_k_can_t_pickle_objects, sizeof(__pyx_k_can_t_pickle_objects), 0, 0, 1, 0},
  7710. {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  7711. {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  7712. {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  7713. {&__pyx_n_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 1},
  7714. {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  7715. {&__pyx_kp_s_ctor_requires_instance_not, __pyx_k_ctor_requires_instance_not, sizeof(__pyx_k_ctor_requires_instance_not), 0, 0, 1, 0},
  7716. {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
  7717. {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  7718. {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
  7719. {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  7720. {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  7721. {&__pyx_n_s_getversion, __pyx_k_getversion, sizeof(__pyx_k_getversion), 0, 0, 1, 1},
  7722. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  7723. {&__pyx_n_s_istr, __pyx_k_istr, sizeof(__pyx_k_istr), 0, 0, 1, 1},
  7724. {&__pyx_n_s_istr_2, __pyx_k_istr_2, sizeof(__pyx_k_istr_2), 0, 0, 1, 1},
  7725. {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  7726. {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  7727. {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  7728. {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  7729. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  7730. {&__pyx_n_s_md, __pyx_k_md, sizeof(__pyx_k_md), 0, 0, 1, 1},
  7731. {&__pyx_n_s_multidict__multidict, __pyx_k_multidict__multidict, sizeof(__pyx_k_multidict__multidict), 0, 0, 1, 1},
  7732. {&__pyx_kp_s_multidict__multidict_pyx, __pyx_k_multidict__multidict_pyx, sizeof(__pyx_k_multidict__multidict_pyx), 0, 0, 1, 0},
  7733. {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  7734. {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  7735. {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  7736. {&__pyx_kp_s_or, __pyx_k_or, sizeof(__pyx_k_or), 0, 0, 1, 0},
  7737. {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  7738. {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  7739. {&__pyx_n_s_popone, __pyx_k_popone, sizeof(__pyx_k_popone), 0, 0, 1, 1},
  7740. {&__pyx_n_s_proxy_classes, __pyx_k_proxy_classes, sizeof(__pyx_k_proxy_classes), 0, 0, 1, 1},
  7741. {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  7742. {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  7743. {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  7744. {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  7745. {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  7746. {&__pyx_n_s_pyx_unpickle__Base, __pyx_k_pyx_unpickle__Base, sizeof(__pyx_k_pyx_unpickle__Base), 0, 0, 1, 1},
  7747. {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  7748. {&__pyx_kp_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 0},
  7749. {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  7750. {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  7751. {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  7752. {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1},
  7753. {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  7754. {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  7755. {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  7756. {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  7757. {&__pyx_kp_s_takes_at_most_1_positional_argu, __pyx_k_takes_at_most_1_positional_argu, sizeof(__pyx_k_takes_at_most_1_positional_argu), 0, 0, 1, 0},
  7758. {&__pyx_kp_s_takes_either_dict_or_list_of_ke, __pyx_k_takes_either_dict_or_list_of_ke, sizeof(__pyx_k_takes_either_dict_or_list_of_ke), 0, 0, 1, 0},
  7759. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  7760. {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  7761. {&__pyx_n_s_upstr, __pyx_k_upstr, sizeof(__pyx_k_upstr), 0, 0, 1, 1},
  7762. {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  7763. {0, 0, 0, 0, 0, 0, 0}
  7764. };
  7765. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  7766. __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 16, __pyx_L1_error)
  7767. __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 40, __pyx_L1_error)
  7768. __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 134, __pyx_L1_error)
  7769. __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 144, __pyx_L1_error)
  7770. return 0;
  7771. __pyx_L1_error:;
  7772. return -1;
  7773. }
  7774. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  7775. __Pyx_RefNannyDeclarations
  7776. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  7777. /* "multidict/_multidict.pyx":181
  7778. * return str(key)
  7779. * else:
  7780. * raise TypeError("MultiDict keys should be either str " # <<<<<<<<<<<<<<
  7781. * "or subclasses of str")
  7782. *
  7783. */
  7784. __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_MultiDict_keys_should_be_either); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 181, __pyx_L1_error)
  7785. __Pyx_GOTREF(__pyx_tuple__5);
  7786. __Pyx_GIVEREF(__pyx_tuple__5);
  7787. /* "multidict/_multidict.pyx":25
  7788. * multidict_views_init()
  7789. *
  7790. * def getversion(_Base md): # <<<<<<<<<<<<<<
  7791. * return pair_list_version(md._impl)
  7792. *
  7793. */
  7794. __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_md); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 25, __pyx_L1_error)
  7795. __Pyx_GOTREF(__pyx_tuple__8);
  7796. __Pyx_GIVEREF(__pyx_tuple__8);
  7797. __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_multidict__multidict_pyx, __pyx_n_s_getversion, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 25, __pyx_L1_error)
  7798. /* "(tree fragment)":1
  7799. * def __pyx_unpickle__Base(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  7800. * cdef object __pyx_PickleError
  7801. * cdef object __pyx_result
  7802. */
  7803. __pyx_tuple__10 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 1, __pyx_L1_error)
  7804. __Pyx_GOTREF(__pyx_tuple__10);
  7805. __Pyx_GIVEREF(__pyx_tuple__10);
  7806. __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__Base, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(1, 1, __pyx_L1_error)
  7807. __Pyx_RefNannyFinishContext();
  7808. return 0;
  7809. __pyx_L1_error:;
  7810. __Pyx_RefNannyFinishContext();
  7811. return -1;
  7812. }
  7813. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  7814. __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  7815. if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  7816. __pyx_int_81294078 = PyInt_FromLong(81294078L); if (unlikely(!__pyx_int_81294078)) __PYX_ERR(0, 1, __pyx_L1_error)
  7817. return 0;
  7818. __pyx_L1_error:;
  7819. return -1;
  7820. }
  7821. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
  7822. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
  7823. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
  7824. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
  7825. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
  7826. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
  7827. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
  7828. static int __Pyx_modinit_global_init_code(void) {
  7829. __Pyx_RefNannyDeclarations
  7830. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  7831. /*--- Global init code ---*/
  7832. __pyx_v_9multidict_10_multidict__marker = Py_None; Py_INCREF(Py_None);
  7833. __pyx_v_9multidict_10_multidict__istr = Py_None; Py_INCREF(Py_None);
  7834. __Pyx_RefNannyFinishContext();
  7835. return 0;
  7836. }
  7837. static int __Pyx_modinit_variable_export_code(void) {
  7838. __Pyx_RefNannyDeclarations
  7839. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  7840. /*--- Variable export code ---*/
  7841. __Pyx_RefNannyFinishContext();
  7842. return 0;
  7843. }
  7844. static int __Pyx_modinit_function_export_code(void) {
  7845. __Pyx_RefNannyDeclarations
  7846. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  7847. /*--- Function export code ---*/
  7848. __Pyx_RefNannyFinishContext();
  7849. return 0;
  7850. }
  7851. static int __Pyx_modinit_type_init_code(void) {
  7852. __Pyx_RefNannyDeclarations
  7853. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  7854. /*--- Type init code ---*/
  7855. __pyx_vtabptr_9multidict_10_multidict__Base = &__pyx_vtable_9multidict_10_multidict__Base;
  7856. __pyx_vtable_9multidict_10_multidict__Base._getone = (PyObject *(*)(struct __pyx_obj_9multidict_10_multidict__Base *, PyObject *, PyObject *))__pyx_f_9multidict_10_multidict_5_Base__getone;
  7857. __pyx_vtable_9multidict_10_multidict__Base._contains = (PyObject *(*)(struct __pyx_obj_9multidict_10_multidict__Base *, PyObject *))__pyx_f_9multidict_10_multidict_5_Base__contains;
  7858. __pyx_vtable_9multidict_10_multidict__Base.keys = (PyObject *(*)(struct __pyx_obj_9multidict_10_multidict__Base *, int __pyx_skip_dispatch))__pyx_f_9multidict_10_multidict_5_Base_keys;
  7859. if (PyType_Ready(&__pyx_type_9multidict_10_multidict__Base) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  7860. __pyx_type_9multidict_10_multidict__Base.tp_print = 0;
  7861. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9multidict_10_multidict__Base.tp_dictoffset && __pyx_type_9multidict_10_multidict__Base.tp_getattro == PyObject_GenericGetAttr)) {
  7862. __pyx_type_9multidict_10_multidict__Base.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  7863. }
  7864. if (__Pyx_SetVtable(__pyx_type_9multidict_10_multidict__Base.tp_dict, __pyx_vtabptr_9multidict_10_multidict__Base) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  7865. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Base, (PyObject *)&__pyx_type_9multidict_10_multidict__Base) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  7866. if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9multidict_10_multidict__Base) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  7867. __pyx_ptype_9multidict_10_multidict__Base = &__pyx_type_9multidict_10_multidict__Base;
  7868. __pyx_vtabptr_9multidict_10_multidict_MultiDictProxy = &__pyx_vtable_9multidict_10_multidict_MultiDictProxy;
  7869. __pyx_vtable_9multidict_10_multidict_MultiDictProxy.__pyx_base = *__pyx_vtabptr_9multidict_10_multidict__Base;
  7870. __pyx_type_9multidict_10_multidict_MultiDictProxy.tp_base = __pyx_ptype_9multidict_10_multidict__Base;
  7871. if (PyType_Ready(&__pyx_type_9multidict_10_multidict_MultiDictProxy) < 0) __PYX_ERR(0, 137, __pyx_L1_error)
  7872. __pyx_type_9multidict_10_multidict_MultiDictProxy.tp_print = 0;
  7873. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9multidict_10_multidict_MultiDictProxy.tp_dictoffset && __pyx_type_9multidict_10_multidict_MultiDictProxy.tp_getattro == PyObject_GenericGetAttr)) {
  7874. __pyx_type_9multidict_10_multidict_MultiDictProxy.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  7875. }
  7876. if (__Pyx_SetVtable(__pyx_type_9multidict_10_multidict_MultiDictProxy.tp_dict, __pyx_vtabptr_9multidict_10_multidict_MultiDictProxy) < 0) __PYX_ERR(0, 137, __pyx_L1_error)
  7877. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MultiDictProxy, (PyObject *)&__pyx_type_9multidict_10_multidict_MultiDictProxy) < 0) __PYX_ERR(0, 137, __pyx_L1_error)
  7878. __pyx_ptype_9multidict_10_multidict_MultiDictProxy = &__pyx_type_9multidict_10_multidict_MultiDictProxy;
  7879. __pyx_vtabptr_9multidict_10_multidict_CIMultiDictProxy = &__pyx_vtable_9multidict_10_multidict_CIMultiDictProxy;
  7880. __pyx_vtable_9multidict_10_multidict_CIMultiDictProxy.__pyx_base = *__pyx_vtabptr_9multidict_10_multidict_MultiDictProxy;
  7881. __pyx_type_9multidict_10_multidict_CIMultiDictProxy.tp_base = __pyx_ptype_9multidict_10_multidict_MultiDictProxy;
  7882. if (PyType_Ready(&__pyx_type_9multidict_10_multidict_CIMultiDictProxy) < 0) __PYX_ERR(0, 164, __pyx_L1_error)
  7883. __pyx_type_9multidict_10_multidict_CIMultiDictProxy.tp_print = 0;
  7884. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9multidict_10_multidict_CIMultiDictProxy.tp_dictoffset && __pyx_type_9multidict_10_multidict_CIMultiDictProxy.tp_getattro == PyObject_GenericGetAttr)) {
  7885. __pyx_type_9multidict_10_multidict_CIMultiDictProxy.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  7886. }
  7887. if (__Pyx_SetVtable(__pyx_type_9multidict_10_multidict_CIMultiDictProxy.tp_dict, __pyx_vtabptr_9multidict_10_multidict_CIMultiDictProxy) < 0) __PYX_ERR(0, 164, __pyx_L1_error)
  7888. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CIMultiDictProxy, (PyObject *)&__pyx_type_9multidict_10_multidict_CIMultiDictProxy) < 0) __PYX_ERR(0, 164, __pyx_L1_error)
  7889. __pyx_ptype_9multidict_10_multidict_CIMultiDictProxy = &__pyx_type_9multidict_10_multidict_CIMultiDictProxy;
  7890. __pyx_vtabptr_9multidict_10_multidict_MultiDict = &__pyx_vtable_9multidict_10_multidict_MultiDict;
  7891. __pyx_vtable_9multidict_10_multidict_MultiDict.__pyx_base = *__pyx_vtabptr_9multidict_10_multidict__Base;
  7892. __pyx_vtable_9multidict_10_multidict_MultiDict._extend = (PyObject *(*)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *, PyObject *, PyObject *, int))__pyx_f_9multidict_10_multidict_9MultiDict__extend;
  7893. __pyx_vtable_9multidict_10_multidict_MultiDict._update_items = (PyObject *(*)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *))__pyx_f_9multidict_10_multidict_9MultiDict__update_items;
  7894. __pyx_vtable_9multidict_10_multidict_MultiDict._append_items = (PyObject *(*)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *))__pyx_f_9multidict_10_multidict_9MultiDict__append_items;
  7895. __pyx_vtable_9multidict_10_multidict_MultiDict._append_items_seq = (PyObject *(*)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *, PyObject *))__pyx_f_9multidict_10_multidict_9MultiDict__append_items_seq;
  7896. __pyx_vtable_9multidict_10_multidict_MultiDict._add = (PyObject *(*)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *, PyObject *))__pyx_f_9multidict_10_multidict_9MultiDict__add;
  7897. __pyx_vtable_9multidict_10_multidict_MultiDict._replace = (PyObject *(*)(struct __pyx_obj_9multidict_10_multidict_MultiDict *, PyObject *, PyObject *))__pyx_f_9multidict_10_multidict_9MultiDict__replace;
  7898. __pyx_type_9multidict_10_multidict_MultiDict.tp_base = __pyx_ptype_9multidict_10_multidict__Base;
  7899. if (PyType_Ready(&__pyx_type_9multidict_10_multidict_MultiDict) < 0) __PYX_ERR(0, 185, __pyx_L1_error)
  7900. __pyx_type_9multidict_10_multidict_MultiDict.tp_print = 0;
  7901. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9multidict_10_multidict_MultiDict.tp_dictoffset && __pyx_type_9multidict_10_multidict_MultiDict.tp_getattro == PyObject_GenericGetAttr)) {
  7902. __pyx_type_9multidict_10_multidict_MultiDict.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  7903. }
  7904. if (__Pyx_SetVtable(__pyx_type_9multidict_10_multidict_MultiDict.tp_dict, __pyx_vtabptr_9multidict_10_multidict_MultiDict) < 0) __PYX_ERR(0, 185, __pyx_L1_error)
  7905. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MultiDict, (PyObject *)&__pyx_type_9multidict_10_multidict_MultiDict) < 0) __PYX_ERR(0, 185, __pyx_L1_error)
  7906. __pyx_ptype_9multidict_10_multidict_MultiDict = &__pyx_type_9multidict_10_multidict_MultiDict;
  7907. __pyx_vtabptr_9multidict_10_multidict_CIMultiDict = &__pyx_vtable_9multidict_10_multidict_CIMultiDict;
  7908. __pyx_vtable_9multidict_10_multidict_CIMultiDict.__pyx_base = *__pyx_vtabptr_9multidict_10_multidict_MultiDict;
  7909. __pyx_type_9multidict_10_multidict_CIMultiDict.tp_base = __pyx_ptype_9multidict_10_multidict_MultiDict;
  7910. if (PyType_Ready(&__pyx_type_9multidict_10_multidict_CIMultiDict) < 0) __PYX_ERR(0, 341, __pyx_L1_error)
  7911. __pyx_type_9multidict_10_multidict_CIMultiDict.tp_print = 0;
  7912. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9multidict_10_multidict_CIMultiDict.tp_dictoffset && __pyx_type_9multidict_10_multidict_CIMultiDict.tp_getattro == PyObject_GenericGetAttr)) {
  7913. __pyx_type_9multidict_10_multidict_CIMultiDict.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  7914. }
  7915. if (__Pyx_SetVtable(__pyx_type_9multidict_10_multidict_CIMultiDict.tp_dict, __pyx_vtabptr_9multidict_10_multidict_CIMultiDict) < 0) __PYX_ERR(0, 341, __pyx_L1_error)
  7916. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CIMultiDict, (PyObject *)&__pyx_type_9multidict_10_multidict_CIMultiDict) < 0) __PYX_ERR(0, 341, __pyx_L1_error)
  7917. __pyx_ptype_9multidict_10_multidict_CIMultiDict = &__pyx_type_9multidict_10_multidict_CIMultiDict;
  7918. __Pyx_RefNannyFinishContext();
  7919. return 0;
  7920. __pyx_L1_error:;
  7921. __Pyx_RefNannyFinishContext();
  7922. return -1;
  7923. }
  7924. static int __Pyx_modinit_type_import_code(void) {
  7925. __Pyx_RefNannyDeclarations
  7926. PyObject *__pyx_t_1 = NULL;
  7927. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  7928. /*--- Type import code ---*/
  7929. __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
  7930. __Pyx_GOTREF(__pyx_t_1);
  7931. __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  7932. #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  7933. sizeof(PyTypeObject),
  7934. #else
  7935. sizeof(PyHeapTypeObject),
  7936. #endif
  7937. __Pyx_ImportType_CheckSize_Warn);
  7938. if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
  7939. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7940. __Pyx_RefNannyFinishContext();
  7941. return 0;
  7942. __pyx_L1_error:;
  7943. __Pyx_XDECREF(__pyx_t_1);
  7944. __Pyx_RefNannyFinishContext();
  7945. return -1;
  7946. }
  7947. static int __Pyx_modinit_variable_import_code(void) {
  7948. __Pyx_RefNannyDeclarations
  7949. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  7950. /*--- Variable import code ---*/
  7951. __Pyx_RefNannyFinishContext();
  7952. return 0;
  7953. }
  7954. static int __Pyx_modinit_function_import_code(void) {
  7955. __Pyx_RefNannyDeclarations
  7956. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  7957. /*--- Function import code ---*/
  7958. __Pyx_RefNannyFinishContext();
  7959. return 0;
  7960. }
  7961. #if PY_MAJOR_VERSION < 3
  7962. #ifdef CYTHON_NO_PYINIT_EXPORT
  7963. #define __Pyx_PyMODINIT_FUNC void
  7964. #else
  7965. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  7966. #endif
  7967. #else
  7968. #ifdef CYTHON_NO_PYINIT_EXPORT
  7969. #define __Pyx_PyMODINIT_FUNC PyObject *
  7970. #else
  7971. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  7972. #endif
  7973. #endif
  7974. #if PY_MAJOR_VERSION < 3
  7975. __Pyx_PyMODINIT_FUNC init_multidict(void) CYTHON_SMALL_CODE; /*proto*/
  7976. __Pyx_PyMODINIT_FUNC init_multidict(void)
  7977. #else
  7978. __Pyx_PyMODINIT_FUNC PyInit__multidict(void) CYTHON_SMALL_CODE; /*proto*/
  7979. __Pyx_PyMODINIT_FUNC PyInit__multidict(void)
  7980. #if CYTHON_PEP489_MULTI_PHASE_INIT
  7981. {
  7982. return PyModuleDef_Init(&__pyx_moduledef);
  7983. }
  7984. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  7985. #if PY_VERSION_HEX >= 0x030700A1
  7986. static PY_INT64_T main_interpreter_id = -1;
  7987. PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  7988. if (main_interpreter_id == -1) {
  7989. main_interpreter_id = current_id;
  7990. return (unlikely(current_id == -1)) ? -1 : 0;
  7991. } else if (unlikely(main_interpreter_id != current_id))
  7992. #else
  7993. static PyInterpreterState *main_interpreter = NULL;
  7994. PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
  7995. if (!main_interpreter) {
  7996. main_interpreter = current_interpreter;
  7997. } else if (unlikely(main_interpreter != current_interpreter))
  7998. #endif
  7999. {
  8000. PyErr_SetString(
  8001. PyExc_ImportError,
  8002. "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  8003. return -1;
  8004. }
  8005. return 0;
  8006. }
  8007. 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) {
  8008. PyObject *value = PyObject_GetAttrString(spec, from_name);
  8009. int result = 0;
  8010. if (likely(value)) {
  8011. if (allow_none || value != Py_None) {
  8012. result = PyDict_SetItemString(moddict, to_name, value);
  8013. }
  8014. Py_DECREF(value);
  8015. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  8016. PyErr_Clear();
  8017. } else {
  8018. result = -1;
  8019. }
  8020. return result;
  8021. }
  8022. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
  8023. PyObject *module = NULL, *moddict, *modname;
  8024. if (__Pyx_check_single_interpreter())
  8025. return NULL;
  8026. if (__pyx_m)
  8027. return __Pyx_NewRef(__pyx_m);
  8028. modname = PyObject_GetAttrString(spec, "name");
  8029. if (unlikely(!modname)) goto bad;
  8030. module = PyModule_NewObject(modname);
  8031. Py_DECREF(modname);
  8032. if (unlikely(!module)) goto bad;
  8033. moddict = PyModule_GetDict(module);
  8034. if (unlikely(!moddict)) goto bad;
  8035. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  8036. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  8037. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  8038. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  8039. return module;
  8040. bad:
  8041. Py_XDECREF(module);
  8042. return NULL;
  8043. }
  8044. static CYTHON_SMALL_CODE int __pyx_pymod_exec__multidict(PyObject *__pyx_pyinit_module)
  8045. #endif
  8046. #endif
  8047. {
  8048. PyObject *__pyx_t_1 = NULL;
  8049. PyObject *__pyx_t_2 = NULL;
  8050. int __pyx_t_3;
  8051. __Pyx_RefNannyDeclarations
  8052. #if CYTHON_PEP489_MULTI_PHASE_INIT
  8053. if (__pyx_m) {
  8054. if (__pyx_m == __pyx_pyinit_module) return 0;
  8055. PyErr_SetString(PyExc_RuntimeError, "Module '_multidict' has already been imported. Re-initialisation is not supported.");
  8056. return -1;
  8057. }
  8058. #elif PY_MAJOR_VERSION >= 3
  8059. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  8060. #endif
  8061. #if CYTHON_REFNANNY
  8062. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  8063. if (!__Pyx_RefNanny) {
  8064. PyErr_Clear();
  8065. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  8066. if (!__Pyx_RefNanny)
  8067. Py_FatalError("failed to import 'refnanny' module");
  8068. }
  8069. #endif
  8070. __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__multidict(void)", 0);
  8071. if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8072. #ifdef __Pxy_PyFrame_Initialize_Offsets
  8073. __Pxy_PyFrame_Initialize_Offsets();
  8074. #endif
  8075. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  8076. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  8077. __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  8078. #ifdef __Pyx_CyFunction_USED
  8079. if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8080. #endif
  8081. #ifdef __Pyx_FusedFunction_USED
  8082. if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8083. #endif
  8084. #ifdef __Pyx_Coroutine_USED
  8085. if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8086. #endif
  8087. #ifdef __Pyx_Generator_USED
  8088. if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8089. #endif
  8090. #ifdef __Pyx_AsyncGen_USED
  8091. if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8092. #endif
  8093. #ifdef __Pyx_StopAsyncIteration_USED
  8094. if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8095. #endif
  8096. /*--- Library function declarations ---*/
  8097. /*--- Threads initialization code ---*/
  8098. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  8099. #ifdef WITH_THREAD /* Python build with threading support? */
  8100. PyEval_InitThreads();
  8101. #endif
  8102. #endif
  8103. /*--- Module creation code ---*/
  8104. #if CYTHON_PEP489_MULTI_PHASE_INIT
  8105. __pyx_m = __pyx_pyinit_module;
  8106. Py_INCREF(__pyx_m);
  8107. #else
  8108. #if PY_MAJOR_VERSION < 3
  8109. __pyx_m = Py_InitModule4("_multidict", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  8110. #else
  8111. __pyx_m = PyModule_Create(&__pyx_moduledef);
  8112. #endif
  8113. if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  8114. #endif
  8115. __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  8116. Py_INCREF(__pyx_d);
  8117. __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  8118. __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  8119. #if CYTHON_COMPILING_IN_PYPY
  8120. Py_INCREF(__pyx_b);
  8121. #endif
  8122. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  8123. /*--- Initialize various global constants etc. ---*/
  8124. if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8125. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  8126. if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8127. #endif
  8128. if (__pyx_module_is_main_multidict___multidict) {
  8129. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8130. }
  8131. #if PY_MAJOR_VERSION >= 3
  8132. {
  8133. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  8134. if (!PyDict_GetItemString(modules, "multidict._multidict")) {
  8135. if (unlikely(PyDict_SetItemString(modules, "multidict._multidict", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  8136. }
  8137. }
  8138. #endif
  8139. /*--- Builtin init code ---*/
  8140. if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8141. /*--- Constants init code ---*/
  8142. if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8143. /*--- Global type/function init code ---*/
  8144. (void)__Pyx_modinit_global_init_code();
  8145. (void)__Pyx_modinit_variable_export_code();
  8146. (void)__Pyx_modinit_function_export_code();
  8147. if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  8148. if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
  8149. (void)__Pyx_modinit_variable_import_code();
  8150. (void)__Pyx_modinit_function_import_code();
  8151. /*--- Execution code ---*/
  8152. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  8153. if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8154. #endif
  8155. /* "multidict/_multidict.pyx":3
  8156. * from __future__ import absolute_import
  8157. *
  8158. * import sys # <<<<<<<<<<<<<<
  8159. * from collections import abc
  8160. * from collections.abc import Iterable, Set
  8161. */
  8162. __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  8163. __Pyx_GOTREF(__pyx_t_1);
  8164. if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  8165. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8166. /* "multidict/_multidict.pyx":4
  8167. *
  8168. * import sys
  8169. * from collections import abc # <<<<<<<<<<<<<<
  8170. * from collections.abc import Iterable, Set
  8171. *
  8172. */
  8173. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
  8174. __Pyx_GOTREF(__pyx_t_1);
  8175. __Pyx_INCREF(__pyx_n_s_abc);
  8176. __Pyx_GIVEREF(__pyx_n_s_abc);
  8177. PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_abc);
  8178. __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
  8179. __Pyx_GOTREF(__pyx_t_2);
  8180. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8181. __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_abc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
  8182. __Pyx_GOTREF(__pyx_t_1);
  8183. if (PyDict_SetItem(__pyx_d, __pyx_n_s_abc, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
  8184. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8185. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8186. /* "multidict/_multidict.pyx":5
  8187. * import sys
  8188. * from collections import abc
  8189. * from collections.abc import Iterable, Set # <<<<<<<<<<<<<<
  8190. *
  8191. * from cpython.object cimport PyObject_Str, Py_NE, PyObject_RichCompare
  8192. */
  8193. __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
  8194. __Pyx_GOTREF(__pyx_t_2);
  8195. __Pyx_INCREF(__pyx_n_s_Iterable);
  8196. __Pyx_GIVEREF(__pyx_n_s_Iterable);
  8197. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Iterable);
  8198. __Pyx_INCREF(__pyx_n_s_Set);
  8199. __Pyx_GIVEREF(__pyx_n_s_Set);
  8200. PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Set);
  8201. __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
  8202. __Pyx_GOTREF(__pyx_t_1);
  8203. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8204. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Iterable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
  8205. __Pyx_GOTREF(__pyx_t_2);
  8206. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Iterable, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
  8207. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8208. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Set); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
  8209. __Pyx_GOTREF(__pyx_t_2);
  8210. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Set, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
  8211. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8212. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8213. /* "multidict/_multidict.pyx":9
  8214. * from cpython.object cimport PyObject_Str, Py_NE, PyObject_RichCompare
  8215. *
  8216. * from ._abc import MultiMapping, MutableMultiMapping # <<<<<<<<<<<<<<
  8217. * from ._istr import istr
  8218. *
  8219. */
  8220. __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  8221. __Pyx_GOTREF(__pyx_t_1);
  8222. __Pyx_INCREF(__pyx_n_s_MultiMapping);
  8223. __Pyx_GIVEREF(__pyx_n_s_MultiMapping);
  8224. PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_MultiMapping);
  8225. __Pyx_INCREF(__pyx_n_s_MutableMultiMapping);
  8226. __Pyx_GIVEREF(__pyx_n_s_MutableMultiMapping);
  8227. PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_MutableMultiMapping);
  8228. __pyx_t_2 = __Pyx_Import(__pyx_n_s_abc_2, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  8229. __Pyx_GOTREF(__pyx_t_2);
  8230. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8231. __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_MultiMapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  8232. __Pyx_GOTREF(__pyx_t_1);
  8233. if (PyDict_SetItem(__pyx_d, __pyx_n_s_MultiMapping, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  8234. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8235. __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_MutableMultiMapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  8236. __Pyx_GOTREF(__pyx_t_1);
  8237. if (PyDict_SetItem(__pyx_d, __pyx_n_s_MutableMultiMapping, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  8238. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8239. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8240. /* "multidict/_multidict.pyx":10
  8241. *
  8242. * from ._abc import MultiMapping, MutableMultiMapping
  8243. * from ._istr import istr # <<<<<<<<<<<<<<
  8244. *
  8245. * from ._multidict_iter cimport *
  8246. */
  8247. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  8248. __Pyx_GOTREF(__pyx_t_2);
  8249. __Pyx_INCREF(__pyx_n_s_istr_2);
  8250. __Pyx_GIVEREF(__pyx_n_s_istr_2);
  8251. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_istr_2);
  8252. __pyx_t_1 = __Pyx_Import(__pyx_n_s_istr, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  8253. __Pyx_GOTREF(__pyx_t_1);
  8254. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8255. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_istr_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  8256. __Pyx_GOTREF(__pyx_t_2);
  8257. if (PyDict_SetItem(__pyx_d, __pyx_n_s_istr_2, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  8258. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8259. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8260. /* "multidict/_multidict.pyx":16
  8261. * from ._pair_list cimport *
  8262. *
  8263. * cdef object _marker = object() # <<<<<<<<<<<<<<
  8264. *
  8265. * upstr = istr # for relaxing backward compatibility problems
  8266. */
  8267. __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  8268. __Pyx_GOTREF(__pyx_t_1);
  8269. __Pyx_XGOTREF(__pyx_v_9multidict_10_multidict__marker);
  8270. __Pyx_DECREF_SET(__pyx_v_9multidict_10_multidict__marker, __pyx_t_1);
  8271. __Pyx_GIVEREF(__pyx_t_1);
  8272. __pyx_t_1 = 0;
  8273. /* "multidict/_multidict.pyx":18
  8274. * cdef object _marker = object()
  8275. *
  8276. * upstr = istr # for relaxing backward compatibility problems # <<<<<<<<<<<<<<
  8277. * cdef object _istr = istr
  8278. *
  8279. */
  8280. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_istr_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
  8281. __Pyx_GOTREF(__pyx_t_1);
  8282. if (PyDict_SetItem(__pyx_d, __pyx_n_s_upstr, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  8283. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8284. /* "multidict/_multidict.pyx":19
  8285. *
  8286. * upstr = istr # for relaxing backward compatibility problems
  8287. * cdef object _istr = istr # <<<<<<<<<<<<<<
  8288. *
  8289. * pair_list_init(istr)
  8290. */
  8291. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_istr_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  8292. __Pyx_GOTREF(__pyx_t_1);
  8293. __Pyx_XGOTREF(__pyx_v_9multidict_10_multidict__istr);
  8294. __Pyx_DECREF_SET(__pyx_v_9multidict_10_multidict__istr, __pyx_t_1);
  8295. __Pyx_GIVEREF(__pyx_t_1);
  8296. __pyx_t_1 = 0;
  8297. /* "multidict/_multidict.pyx":21
  8298. * cdef object _istr = istr
  8299. *
  8300. * pair_list_init(istr) # <<<<<<<<<<<<<<
  8301. * # multidict_iter_init()
  8302. * multidict_views_init()
  8303. */
  8304. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_istr_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
  8305. __Pyx_GOTREF(__pyx_t_1);
  8306. __pyx_t_3 = pair_list_init(__pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 21, __pyx_L1_error)
  8307. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8308. /* "multidict/_multidict.pyx":23
  8309. * pair_list_init(istr)
  8310. * # multidict_iter_init()
  8311. * multidict_views_init() # <<<<<<<<<<<<<<
  8312. *
  8313. * def getversion(_Base md):
  8314. */
  8315. __pyx_t_3 = multidict_views_init(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 23, __pyx_L1_error)
  8316. /* "multidict/_multidict.pyx":25
  8317. * multidict_views_init()
  8318. *
  8319. * def getversion(_Base md): # <<<<<<<<<<<<<<
  8320. * return pair_list_version(md._impl)
  8321. *
  8322. */
  8323. __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9multidict_10_multidict_1getversion, NULL, __pyx_n_s_multidict__multidict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  8324. __Pyx_GOTREF(__pyx_t_1);
  8325. if (PyDict_SetItem(__pyx_d, __pyx_n_s_getversion, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  8326. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8327. /* "multidict/_multidict.pyx":36
  8328. * return self._impl
  8329. *
  8330. * def getall(self, key, default=_marker): # <<<<<<<<<<<<<<
  8331. * """Return a list of all values matching the key."""
  8332. * try:
  8333. */
  8334. __Pyx_INCREF(__pyx_v_9multidict_10_multidict__marker);
  8335. __pyx_k_ = __pyx_v_9multidict_10_multidict__marker;
  8336. __Pyx_GIVEREF(__pyx_v_9multidict_10_multidict__marker);
  8337. /* "multidict/_multidict.pyx":46
  8338. * raise
  8339. *
  8340. * def getone(self, key, default=_marker): # <<<<<<<<<<<<<<
  8341. * """Get first value matching the key."""
  8342. * return self._getone(key, default)
  8343. */
  8344. __Pyx_INCREF(__pyx_v_9multidict_10_multidict__marker);
  8345. __pyx_k__2 = __pyx_v_9multidict_10_multidict__marker;
  8346. __Pyx_GIVEREF(__pyx_v_9multidict_10_multidict__marker);
  8347. /* "multidict/_multidict.pyx":138
  8348. *
  8349. * cdef class MultiDictProxy(_Base):
  8350. * _proxy_classes = (MultiDict, MultiDictProxy) # <<<<<<<<<<<<<<
  8351. * _base_class = MultiDict
  8352. *
  8353. */
  8354. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
  8355. __Pyx_GOTREF(__pyx_t_1);
  8356. __Pyx_INCREF(((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDict));
  8357. __Pyx_GIVEREF(((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDict));
  8358. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDict));
  8359. __Pyx_INCREF(((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDictProxy));
  8360. __Pyx_GIVEREF(((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDictProxy));
  8361. PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDictProxy));
  8362. if (PyDict_SetItem((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDictProxy->tp_dict, __pyx_n_s_proxy_classes, __pyx_t_1) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
  8363. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8364. PyType_Modified(__pyx_ptype_9multidict_10_multidict_MultiDictProxy);
  8365. /* "multidict/_multidict.pyx":139
  8366. * cdef class MultiDictProxy(_Base):
  8367. * _proxy_classes = (MultiDict, MultiDictProxy)
  8368. * _base_class = MultiDict # <<<<<<<<<<<<<<
  8369. *
  8370. * def __init__(self, arg):
  8371. */
  8372. if (PyDict_SetItem((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDictProxy->tp_dict, __pyx_n_s_base_class, ((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDict)) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
  8373. PyType_Modified(__pyx_ptype_9multidict_10_multidict_MultiDictProxy);
  8374. /* "multidict/_multidict.pyx":161
  8375. * return self._base_class(self)
  8376. *
  8377. * MultiMapping.register(MultiDictProxy) # <<<<<<<<<<<<<<
  8378. *
  8379. *
  8380. */
  8381. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MultiMapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
  8382. __Pyx_GOTREF(__pyx_t_1);
  8383. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_register); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
  8384. __Pyx_GOTREF(__pyx_t_2);
  8385. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8386. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDictProxy)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
  8387. __Pyx_GOTREF(__pyx_t_1);
  8388. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8389. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8390. /* "multidict/_multidict.pyx":165
  8391. *
  8392. * cdef class CIMultiDictProxy(MultiDictProxy):
  8393. * _proxy_classes = (CIMultiDict, CIMultiDictProxy) # <<<<<<<<<<<<<<
  8394. * _base_class = CIMultiDict
  8395. *
  8396. */
  8397. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
  8398. __Pyx_GOTREF(__pyx_t_1);
  8399. __Pyx_INCREF(((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDict));
  8400. __Pyx_GIVEREF(((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDict));
  8401. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDict));
  8402. __Pyx_INCREF(((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDictProxy));
  8403. __Pyx_GIVEREF(((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDictProxy));
  8404. PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDictProxy));
  8405. if (PyDict_SetItem((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDictProxy->tp_dict, __pyx_n_s_proxy_classes, __pyx_t_1) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
  8406. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8407. PyType_Modified(__pyx_ptype_9multidict_10_multidict_CIMultiDictProxy);
  8408. /* "multidict/_multidict.pyx":166
  8409. * cdef class CIMultiDictProxy(MultiDictProxy):
  8410. * _proxy_classes = (CIMultiDict, CIMultiDictProxy)
  8411. * _base_class = CIMultiDict # <<<<<<<<<<<<<<
  8412. *
  8413. *
  8414. */
  8415. if (PyDict_SetItem((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDictProxy->tp_dict, __pyx_n_s_base_class, ((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDict)) < 0) __PYX_ERR(0, 166, __pyx_L1_error)
  8416. PyType_Modified(__pyx_ptype_9multidict_10_multidict_CIMultiDictProxy);
  8417. /* "multidict/_multidict.pyx":169
  8418. *
  8419. *
  8420. * MultiMapping.register(CIMultiDictProxy) # <<<<<<<<<<<<<<
  8421. *
  8422. *
  8423. */
  8424. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MultiMapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
  8425. __Pyx_GOTREF(__pyx_t_1);
  8426. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_register); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error)
  8427. __Pyx_GOTREF(__pyx_t_2);
  8428. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8429. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDictProxy)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
  8430. __Pyx_GOTREF(__pyx_t_1);
  8431. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8432. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8433. /* "multidict/_multidict.pyx":295
  8434. * return pair_list_set_default(self._impl, key, default)
  8435. *
  8436. * def popone(self, key, default=_marker): # <<<<<<<<<<<<<<
  8437. * """Remove the last occurrence of key and return the corresponding
  8438. * value.
  8439. */
  8440. __Pyx_INCREF(__pyx_v_9multidict_10_multidict__marker);
  8441. __pyx_k__6 = __pyx_v_9multidict_10_multidict__marker;
  8442. __Pyx_GIVEREF(__pyx_v_9multidict_10_multidict__marker);
  8443. /* "multidict/_multidict.pyx":311
  8444. * return default
  8445. *
  8446. * pop = popone # <<<<<<<<<<<<<<
  8447. *
  8448. * def popall(self, key, default=_marker):
  8449. */
  8450. __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDict, __pyx_n_s_popone); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
  8451. __Pyx_GOTREF(__pyx_t_1);
  8452. if (PyDict_SetItem((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDict->tp_dict, __pyx_n_s_pop, __pyx_t_1) < 0) __PYX_ERR(0, 311, __pyx_L1_error)
  8453. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8454. PyType_Modified(__pyx_ptype_9multidict_10_multidict_MultiDict);
  8455. /* "multidict/_multidict.pyx":313
  8456. * pop = popone
  8457. *
  8458. * def popall(self, key, default=_marker): # <<<<<<<<<<<<<<
  8459. * """Remove all occurrences of key and return the list of corresponding
  8460. * values.
  8461. */
  8462. __Pyx_INCREF(__pyx_v_9multidict_10_multidict__marker);
  8463. __pyx_k__7 = __pyx_v_9multidict_10_multidict__marker;
  8464. __Pyx_GIVEREF(__pyx_v_9multidict_10_multidict__marker);
  8465. /* "multidict/_multidict.pyx":338
  8466. *
  8467. *
  8468. * MutableMultiMapping.register(MultiDict) # <<<<<<<<<<<<<<
  8469. *
  8470. *
  8471. */
  8472. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MutableMultiMapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error)
  8473. __Pyx_GOTREF(__pyx_t_1);
  8474. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_register); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error)
  8475. __Pyx_GOTREF(__pyx_t_2);
  8476. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8477. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_ptype_9multidict_10_multidict_MultiDict)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error)
  8478. __Pyx_GOTREF(__pyx_t_1);
  8479. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8480. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8481. /* "multidict/_multidict.pyx":361
  8482. *
  8483. *
  8484. * MutableMultiMapping.register(CIMultiDict) # <<<<<<<<<<<<<<
  8485. *
  8486. */
  8487. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MutableMultiMapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error)
  8488. __Pyx_GOTREF(__pyx_t_1);
  8489. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_register); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error)
  8490. __Pyx_GOTREF(__pyx_t_2);
  8491. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8492. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_ptype_9multidict_10_multidict_CIMultiDict)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error)
  8493. __Pyx_GOTREF(__pyx_t_1);
  8494. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8495. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8496. /* "(tree fragment)":1
  8497. * def __pyx_unpickle__Base(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  8498. * cdef object __pyx_PickleError
  8499. * cdef object __pyx_result
  8500. */
  8501. __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9multidict_10_multidict_3__pyx_unpickle__Base, NULL, __pyx_n_s_multidict__multidict); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  8502. __Pyx_GOTREF(__pyx_t_1);
  8503. if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle__Base, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  8504. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8505. /* "multidict/_multidict.pyx":1
  8506. * from __future__ import absolute_import # <<<<<<<<<<<<<<
  8507. *
  8508. * import sys
  8509. */
  8510. __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  8511. __Pyx_GOTREF(__pyx_t_1);
  8512. if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8513. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8514. /*--- Wrapped vars code ---*/
  8515. goto __pyx_L0;
  8516. __pyx_L1_error:;
  8517. __Pyx_XDECREF(__pyx_t_1);
  8518. __Pyx_XDECREF(__pyx_t_2);
  8519. if (__pyx_m) {
  8520. if (__pyx_d) {
  8521. __Pyx_AddTraceback("init multidict._multidict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8522. }
  8523. Py_CLEAR(__pyx_m);
  8524. } else if (!PyErr_Occurred()) {
  8525. PyErr_SetString(PyExc_ImportError, "init multidict._multidict");
  8526. }
  8527. __pyx_L0:;
  8528. __Pyx_RefNannyFinishContext();
  8529. #if CYTHON_PEP489_MULTI_PHASE_INIT
  8530. return (__pyx_m != NULL) ? 0 : -1;
  8531. #elif PY_MAJOR_VERSION >= 3
  8532. return __pyx_m;
  8533. #else
  8534. return;
  8535. #endif
  8536. }
  8537. /* --- Runtime support code --- */
  8538. /* Refnanny */
  8539. #if CYTHON_REFNANNY
  8540. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  8541. PyObject *m = NULL, *p = NULL;
  8542. void *r = NULL;
  8543. m = PyImport_ImportModule(modname);
  8544. if (!m) goto end;
  8545. p = PyObject_GetAttrString(m, "RefNannyAPI");
  8546. if (!p) goto end;
  8547. r = PyLong_AsVoidPtr(p);
  8548. end:
  8549. Py_XDECREF(p);
  8550. Py_XDECREF(m);
  8551. return (__Pyx_RefNannyAPIStruct *)r;
  8552. }
  8553. #endif
  8554. /* PyObjectGetAttrStr */
  8555. #if CYTHON_USE_TYPE_SLOTS
  8556. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  8557. PyTypeObject* tp = Py_TYPE(obj);
  8558. if (likely(tp->tp_getattro))
  8559. return tp->tp_getattro(obj, attr_name);
  8560. #if PY_MAJOR_VERSION < 3
  8561. if (likely(tp->tp_getattr))
  8562. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  8563. #endif
  8564. return PyObject_GetAttr(obj, attr_name);
  8565. }
  8566. #endif
  8567. /* GetBuiltinName */
  8568. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  8569. PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  8570. if (unlikely(!result)) {
  8571. PyErr_Format(PyExc_NameError,
  8572. #if PY_MAJOR_VERSION >= 3
  8573. "name '%U' is not defined", name);
  8574. #else
  8575. "name '%.200s' is not defined", PyString_AS_STRING(name));
  8576. #endif
  8577. }
  8578. return result;
  8579. }
  8580. /* ArgTypeTest */
  8581. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
  8582. {
  8583. if (unlikely(!type)) {
  8584. PyErr_SetString(PyExc_SystemError, "Missing type object");
  8585. return 0;
  8586. }
  8587. else if (exact) {
  8588. #if PY_MAJOR_VERSION == 2
  8589. if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  8590. #endif
  8591. }
  8592. else {
  8593. if (likely(__Pyx_TypeCheck(obj, type))) return 1;
  8594. }
  8595. PyErr_Format(PyExc_TypeError,
  8596. "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
  8597. name, type->tp_name, Py_TYPE(obj)->tp_name);
  8598. return 0;
  8599. }
  8600. /* RaiseDoubleKeywords */
  8601. static void __Pyx_RaiseDoubleKeywordsError(
  8602. const char* func_name,
  8603. PyObject* kw_name)
  8604. {
  8605. PyErr_Format(PyExc_TypeError,
  8606. #if PY_MAJOR_VERSION >= 3
  8607. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  8608. #else
  8609. "%s() got multiple values for keyword argument '%s'", func_name,
  8610. PyString_AsString(kw_name));
  8611. #endif
  8612. }
  8613. /* ParseKeywords */
  8614. static int __Pyx_ParseOptionalKeywords(
  8615. PyObject *kwds,
  8616. PyObject **argnames[],
  8617. PyObject *kwds2,
  8618. PyObject *values[],
  8619. Py_ssize_t num_pos_args,
  8620. const char* function_name)
  8621. {
  8622. PyObject *key = 0, *value = 0;
  8623. Py_ssize_t pos = 0;
  8624. PyObject*** name;
  8625. PyObject*** first_kw_arg = argnames + num_pos_args;
  8626. while (PyDict_Next(kwds, &pos, &key, &value)) {
  8627. name = first_kw_arg;
  8628. while (*name && (**name != key)) name++;
  8629. if (*name) {
  8630. values[name-argnames] = value;
  8631. continue;
  8632. }
  8633. name = first_kw_arg;
  8634. #if PY_MAJOR_VERSION < 3
  8635. if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
  8636. while (*name) {
  8637. if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  8638. && _PyString_Eq(**name, key)) {
  8639. values[name-argnames] = value;
  8640. break;
  8641. }
  8642. name++;
  8643. }
  8644. if (*name) continue;
  8645. else {
  8646. PyObject*** argname = argnames;
  8647. while (argname != first_kw_arg) {
  8648. if ((**argname == key) || (
  8649. (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  8650. && _PyString_Eq(**argname, key))) {
  8651. goto arg_passed_twice;
  8652. }
  8653. argname++;
  8654. }
  8655. }
  8656. } else
  8657. #endif
  8658. if (likely(PyUnicode_Check(key))) {
  8659. while (*name) {
  8660. int cmp = (**name == key) ? 0 :
  8661. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  8662. (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
  8663. #endif
  8664. PyUnicode_Compare(**name, key);
  8665. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  8666. if (cmp == 0) {
  8667. values[name-argnames] = value;
  8668. break;
  8669. }
  8670. name++;
  8671. }
  8672. if (*name) continue;
  8673. else {
  8674. PyObject*** argname = argnames;
  8675. while (argname != first_kw_arg) {
  8676. int cmp = (**argname == key) ? 0 :
  8677. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  8678. (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
  8679. #endif
  8680. PyUnicode_Compare(**argname, key);
  8681. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  8682. if (cmp == 0) goto arg_passed_twice;
  8683. argname++;
  8684. }
  8685. }
  8686. } else
  8687. goto invalid_keyword_type;
  8688. if (kwds2) {
  8689. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  8690. } else {
  8691. goto invalid_keyword;
  8692. }
  8693. }
  8694. return 0;
  8695. arg_passed_twice:
  8696. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  8697. goto bad;
  8698. invalid_keyword_type:
  8699. PyErr_Format(PyExc_TypeError,
  8700. "%.200s() keywords must be strings", function_name);
  8701. goto bad;
  8702. invalid_keyword:
  8703. PyErr_Format(PyExc_TypeError,
  8704. #if PY_MAJOR_VERSION < 3
  8705. "%.200s() got an unexpected keyword argument '%.200s'",
  8706. function_name, PyString_AsString(key));
  8707. #else
  8708. "%s() got an unexpected keyword argument '%U'",
  8709. function_name, key);
  8710. #endif
  8711. bad:
  8712. return -1;
  8713. }
  8714. /* RaiseArgTupleInvalid */
  8715. static void __Pyx_RaiseArgtupleInvalid(
  8716. const char* func_name,
  8717. int exact,
  8718. Py_ssize_t num_min,
  8719. Py_ssize_t num_max,
  8720. Py_ssize_t num_found)
  8721. {
  8722. Py_ssize_t num_expected;
  8723. const char *more_or_less;
  8724. if (num_found < num_min) {
  8725. num_expected = num_min;
  8726. more_or_less = "at least";
  8727. } else {
  8728. num_expected = num_max;
  8729. more_or_less = "at most";
  8730. }
  8731. if (exact) {
  8732. more_or_less = "exactly";
  8733. }
  8734. PyErr_Format(PyExc_TypeError,
  8735. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  8736. func_name, more_or_less, num_expected,
  8737. (num_expected == 1) ? "" : "s", num_found);
  8738. }
  8739. /* GetTopmostException */
  8740. #if CYTHON_USE_EXC_INFO_STACK
  8741. static _PyErr_StackItem *
  8742. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  8743. {
  8744. _PyErr_StackItem *exc_info = tstate->exc_info;
  8745. while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
  8746. exc_info->previous_item != NULL)
  8747. {
  8748. exc_info = exc_info->previous_item;
  8749. }
  8750. return exc_info;
  8751. }
  8752. #endif
  8753. /* SaveResetException */
  8754. #if CYTHON_FAST_THREAD_STATE
  8755. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  8756. #if CYTHON_USE_EXC_INFO_STACK
  8757. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  8758. *type = exc_info->exc_type;
  8759. *value = exc_info->exc_value;
  8760. *tb = exc_info->exc_traceback;
  8761. #else
  8762. *type = tstate->exc_type;
  8763. *value = tstate->exc_value;
  8764. *tb = tstate->exc_traceback;
  8765. #endif
  8766. Py_XINCREF(*type);
  8767. Py_XINCREF(*value);
  8768. Py_XINCREF(*tb);
  8769. }
  8770. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  8771. PyObject *tmp_type, *tmp_value, *tmp_tb;
  8772. #if CYTHON_USE_EXC_INFO_STACK
  8773. _PyErr_StackItem *exc_info = tstate->exc_info;
  8774. tmp_type = exc_info->exc_type;
  8775. tmp_value = exc_info->exc_value;
  8776. tmp_tb = exc_info->exc_traceback;
  8777. exc_info->exc_type = type;
  8778. exc_info->exc_value = value;
  8779. exc_info->exc_traceback = tb;
  8780. #else
  8781. tmp_type = tstate->exc_type;
  8782. tmp_value = tstate->exc_value;
  8783. tmp_tb = tstate->exc_traceback;
  8784. tstate->exc_type = type;
  8785. tstate->exc_value = value;
  8786. tstate->exc_traceback = tb;
  8787. #endif
  8788. Py_XDECREF(tmp_type);
  8789. Py_XDECREF(tmp_value);
  8790. Py_XDECREF(tmp_tb);
  8791. }
  8792. #endif
  8793. /* PyErrExceptionMatches */
  8794. #if CYTHON_FAST_THREAD_STATE
  8795. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  8796. Py_ssize_t i, n;
  8797. n = PyTuple_GET_SIZE(tuple);
  8798. #if PY_MAJOR_VERSION >= 3
  8799. for (i=0; i<n; i++) {
  8800. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  8801. }
  8802. #endif
  8803. for (i=0; i<n; i++) {
  8804. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  8805. }
  8806. return 0;
  8807. }
  8808. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  8809. PyObject *exc_type = tstate->curexc_type;
  8810. if (exc_type == err) return 1;
  8811. if (unlikely(!exc_type)) return 0;
  8812. if (unlikely(PyTuple_Check(err)))
  8813. return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  8814. return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  8815. }
  8816. #endif
  8817. /* GetException */
  8818. #if CYTHON_FAST_THREAD_STATE
  8819. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  8820. #else
  8821. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  8822. #endif
  8823. {
  8824. PyObject *local_type, *local_value, *local_tb;
  8825. #if CYTHON_FAST_THREAD_STATE
  8826. PyObject *tmp_type, *tmp_value, *tmp_tb;
  8827. local_type = tstate->curexc_type;
  8828. local_value = tstate->curexc_value;
  8829. local_tb = tstate->curexc_traceback;
  8830. tstate->curexc_type = 0;
  8831. tstate->curexc_value = 0;
  8832. tstate->curexc_traceback = 0;
  8833. #else
  8834. PyErr_Fetch(&local_type, &local_value, &local_tb);
  8835. #endif
  8836. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  8837. #if CYTHON_FAST_THREAD_STATE
  8838. if (unlikely(tstate->curexc_type))
  8839. #else
  8840. if (unlikely(PyErr_Occurred()))
  8841. #endif
  8842. goto bad;
  8843. #if PY_MAJOR_VERSION >= 3
  8844. if (local_tb) {
  8845. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  8846. goto bad;
  8847. }
  8848. #endif
  8849. Py_XINCREF(local_tb);
  8850. Py_XINCREF(local_type);
  8851. Py_XINCREF(local_value);
  8852. *type = local_type;
  8853. *value = local_value;
  8854. *tb = local_tb;
  8855. #if CYTHON_FAST_THREAD_STATE
  8856. #if CYTHON_USE_EXC_INFO_STACK
  8857. {
  8858. _PyErr_StackItem *exc_info = tstate->exc_info;
  8859. tmp_type = exc_info->exc_type;
  8860. tmp_value = exc_info->exc_value;
  8861. tmp_tb = exc_info->exc_traceback;
  8862. exc_info->exc_type = local_type;
  8863. exc_info->exc_value = local_value;
  8864. exc_info->exc_traceback = local_tb;
  8865. }
  8866. #else
  8867. tmp_type = tstate->exc_type;
  8868. tmp_value = tstate->exc_value;
  8869. tmp_tb = tstate->exc_traceback;
  8870. tstate->exc_type = local_type;
  8871. tstate->exc_value = local_value;
  8872. tstate->exc_traceback = local_tb;
  8873. #endif
  8874. Py_XDECREF(tmp_type);
  8875. Py_XDECREF(tmp_value);
  8876. Py_XDECREF(tmp_tb);
  8877. #else
  8878. PyErr_SetExcInfo(local_type, local_value, local_tb);
  8879. #endif
  8880. return 0;
  8881. bad:
  8882. *type = 0;
  8883. *value = 0;
  8884. *tb = 0;
  8885. Py_XDECREF(local_type);
  8886. Py_XDECREF(local_value);
  8887. Py_XDECREF(local_tb);
  8888. return -1;
  8889. }
  8890. /* PyErrFetchRestore */
  8891. #if CYTHON_FAST_THREAD_STATE
  8892. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  8893. PyObject *tmp_type, *tmp_value, *tmp_tb;
  8894. tmp_type = tstate->curexc_type;
  8895. tmp_value = tstate->curexc_value;
  8896. tmp_tb = tstate->curexc_traceback;
  8897. tstate->curexc_type = type;
  8898. tstate->curexc_value = value;
  8899. tstate->curexc_traceback = tb;
  8900. Py_XDECREF(tmp_type);
  8901. Py_XDECREF(tmp_value);
  8902. Py_XDECREF(tmp_tb);
  8903. }
  8904. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  8905. *type = tstate->curexc_type;
  8906. *value = tstate->curexc_value;
  8907. *tb = tstate->curexc_traceback;
  8908. tstate->curexc_type = 0;
  8909. tstate->curexc_value = 0;
  8910. tstate->curexc_traceback = 0;
  8911. }
  8912. #endif
  8913. /* PyFunctionFastCall */
  8914. #if CYTHON_FAST_PYCALL
  8915. static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
  8916. PyObject *globals) {
  8917. PyFrameObject *f;
  8918. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  8919. PyObject **fastlocals;
  8920. Py_ssize_t i;
  8921. PyObject *result;
  8922. assert(globals != NULL);
  8923. /* XXX Perhaps we should create a specialized
  8924. PyFrame_New() that doesn't take locals, but does
  8925. take builtins without sanity checking them.
  8926. */
  8927. assert(tstate != NULL);
  8928. f = PyFrame_New(tstate, co, globals, NULL);
  8929. if (f == NULL) {
  8930. return NULL;
  8931. }
  8932. fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
  8933. for (i = 0; i < na; i++) {
  8934. Py_INCREF(*args);
  8935. fastlocals[i] = *args++;
  8936. }
  8937. result = PyEval_EvalFrameEx(f,0);
  8938. ++tstate->recursion_depth;
  8939. Py_DECREF(f);
  8940. --tstate->recursion_depth;
  8941. return result;
  8942. }
  8943. #if 1 || PY_VERSION_HEX < 0x030600B1
  8944. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
  8945. PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
  8946. PyObject *globals = PyFunction_GET_GLOBALS(func);
  8947. PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
  8948. PyObject *closure;
  8949. #if PY_MAJOR_VERSION >= 3
  8950. PyObject *kwdefs;
  8951. #endif
  8952. PyObject *kwtuple, **k;
  8953. PyObject **d;
  8954. Py_ssize_t nd;
  8955. Py_ssize_t nk;
  8956. PyObject *result;
  8957. assert(kwargs == NULL || PyDict_Check(kwargs));
  8958. nk = kwargs ? PyDict_Size(kwargs) : 0;
  8959. if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
  8960. return NULL;
  8961. }
  8962. if (
  8963. #if PY_MAJOR_VERSION >= 3
  8964. co->co_kwonlyargcount == 0 &&
  8965. #endif
  8966. likely(kwargs == NULL || nk == 0) &&
  8967. co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
  8968. if (argdefs == NULL && co->co_argcount == nargs) {
  8969. result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
  8970. goto done;
  8971. }
  8972. else if (nargs == 0 && argdefs != NULL
  8973. && co->co_argcount == Py_SIZE(argdefs)) {
  8974. /* function called with no arguments, but all parameters have
  8975. a default value: use default values as arguments .*/
  8976. args = &PyTuple_GET_ITEM(argdefs, 0);
  8977. result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
  8978. goto done;
  8979. }
  8980. }
  8981. if (kwargs != NULL) {
  8982. Py_ssize_t pos, i;
  8983. kwtuple = PyTuple_New(2 * nk);
  8984. if (kwtuple == NULL) {
  8985. result = NULL;
  8986. goto done;
  8987. }
  8988. k = &PyTuple_GET_ITEM(kwtuple, 0);
  8989. pos = i = 0;
  8990. while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
  8991. Py_INCREF(k[i]);
  8992. Py_INCREF(k[i+1]);
  8993. i += 2;
  8994. }
  8995. nk = i / 2;
  8996. }
  8997. else {
  8998. kwtuple = NULL;
  8999. k = NULL;
  9000. }
  9001. closure = PyFunction_GET_CLOSURE(func);
  9002. #if PY_MAJOR_VERSION >= 3
  9003. kwdefs = PyFunction_GET_KW_DEFAULTS(func);
  9004. #endif
  9005. if (argdefs != NULL) {
  9006. d = &PyTuple_GET_ITEM(argdefs, 0);
  9007. nd = Py_SIZE(argdefs);
  9008. }
  9009. else {
  9010. d = NULL;
  9011. nd = 0;
  9012. }
  9013. #if PY_MAJOR_VERSION >= 3
  9014. result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
  9015. args, nargs,
  9016. k, (int)nk,
  9017. d, (int)nd, kwdefs, closure);
  9018. #else
  9019. result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
  9020. args, nargs,
  9021. k, (int)nk,
  9022. d, (int)nd, closure);
  9023. #endif
  9024. Py_XDECREF(kwtuple);
  9025. done:
  9026. Py_LeaveRecursiveCall();
  9027. return result;
  9028. }
  9029. #endif
  9030. #endif
  9031. /* PyObjectCall */
  9032. #if CYTHON_COMPILING_IN_CPYTHON
  9033. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  9034. PyObject *result;
  9035. ternaryfunc call = func->ob_type->tp_call;
  9036. if (unlikely(!call))
  9037. return PyObject_Call(func, arg, kw);
  9038. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  9039. return NULL;
  9040. result = (*call)(func, arg, kw);
  9041. Py_LeaveRecursiveCall();
  9042. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  9043. PyErr_SetString(
  9044. PyExc_SystemError,
  9045. "NULL result without error in PyObject_Call");
  9046. }
  9047. return result;
  9048. }
  9049. #endif
  9050. /* PyObjectCallMethO */
  9051. #if CYTHON_COMPILING_IN_CPYTHON
  9052. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  9053. PyObject *self, *result;
  9054. PyCFunction cfunc;
  9055. cfunc = PyCFunction_GET_FUNCTION(func);
  9056. self = PyCFunction_GET_SELF(func);
  9057. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  9058. return NULL;
  9059. result = cfunc(self, arg);
  9060. Py_LeaveRecursiveCall();
  9061. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  9062. PyErr_SetString(
  9063. PyExc_SystemError,
  9064. "NULL result without error in PyObject_Call");
  9065. }
  9066. return result;
  9067. }
  9068. #endif
  9069. /* PyObjectCallNoArg */
  9070. #if CYTHON_COMPILING_IN_CPYTHON
  9071. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
  9072. #if CYTHON_FAST_PYCALL
  9073. if (PyFunction_Check(func)) {
  9074. return __Pyx_PyFunction_FastCall(func, NULL, 0);
  9075. }
  9076. #endif
  9077. #ifdef __Pyx_CyFunction_USED
  9078. if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
  9079. #else
  9080. if (likely(PyCFunction_Check(func)))
  9081. #endif
  9082. {
  9083. if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
  9084. return __Pyx_PyObject_CallMethO(func, NULL);
  9085. }
  9086. }
  9087. return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
  9088. }
  9089. #endif
  9090. /* PyCFunctionFastCall */
  9091. #if CYTHON_FAST_PYCCALL
  9092. static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
  9093. PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
  9094. PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  9095. PyObject *self = PyCFunction_GET_SELF(func);
  9096. int flags = PyCFunction_GET_FLAGS(func);
  9097. assert(PyCFunction_Check(func));
  9098. assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
  9099. assert(nargs >= 0);
  9100. assert(nargs == 0 || args != NULL);
  9101. /* _PyCFunction_FastCallDict() must not be called with an exception set,
  9102. because it may clear it (directly or indirectly) and so the
  9103. caller loses its exception */
  9104. assert(!PyErr_Occurred());
  9105. if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
  9106. return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
  9107. } else {
  9108. return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
  9109. }
  9110. }
  9111. #endif
  9112. /* PyObjectCallOneArg */
  9113. #if CYTHON_COMPILING_IN_CPYTHON
  9114. static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  9115. PyObject *result;
  9116. PyObject *args = PyTuple_New(1);
  9117. if (unlikely(!args)) return NULL;
  9118. Py_INCREF(arg);
  9119. PyTuple_SET_ITEM(args, 0, arg);
  9120. result = __Pyx_PyObject_Call(func, args, NULL);
  9121. Py_DECREF(args);
  9122. return result;
  9123. }
  9124. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  9125. #if CYTHON_FAST_PYCALL
  9126. if (PyFunction_Check(func)) {
  9127. return __Pyx_PyFunction_FastCall(func, &arg, 1);
  9128. }
  9129. #endif
  9130. if (likely(PyCFunction_Check(func))) {
  9131. if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
  9132. return __Pyx_PyObject_CallMethO(func, arg);
  9133. #if CYTHON_FAST_PYCCALL
  9134. } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
  9135. return __Pyx_PyCFunction_FastCall(func, &arg, 1);
  9136. #endif
  9137. }
  9138. }
  9139. return __Pyx__PyObject_CallOneArg(func, arg);
  9140. }
  9141. #else
  9142. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  9143. PyObject *result;
  9144. PyObject *args = PyTuple_Pack(1, arg);
  9145. if (unlikely(!args)) return NULL;
  9146. result = __Pyx_PyObject_Call(func, args, NULL);
  9147. Py_DECREF(args);
  9148. return result;
  9149. }
  9150. #endif
  9151. /* RaiseTooManyValuesToUnpack */
  9152. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  9153. PyErr_Format(PyExc_ValueError,
  9154. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  9155. }
  9156. /* RaiseNeedMoreValuesToUnpack */
  9157. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  9158. PyErr_Format(PyExc_ValueError,
  9159. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  9160. index, (index == 1) ? "" : "s");
  9161. }
  9162. /* IterFinish */
  9163. static CYTHON_INLINE int __Pyx_IterFinish(void) {
  9164. #if CYTHON_FAST_THREAD_STATE
  9165. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  9166. PyObject* exc_type = tstate->curexc_type;
  9167. if (unlikely(exc_type)) {
  9168. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
  9169. PyObject *exc_value, *exc_tb;
  9170. exc_value = tstate->curexc_value;
  9171. exc_tb = tstate->curexc_traceback;
  9172. tstate->curexc_type = 0;
  9173. tstate->curexc_value = 0;
  9174. tstate->curexc_traceback = 0;
  9175. Py_DECREF(exc_type);
  9176. Py_XDECREF(exc_value);
  9177. Py_XDECREF(exc_tb);
  9178. return 0;
  9179. } else {
  9180. return -1;
  9181. }
  9182. }
  9183. return 0;
  9184. #else
  9185. if (unlikely(PyErr_Occurred())) {
  9186. if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
  9187. PyErr_Clear();
  9188. return 0;
  9189. } else {
  9190. return -1;
  9191. }
  9192. }
  9193. return 0;
  9194. #endif
  9195. }
  9196. /* UnpackItemEndCheck */
  9197. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
  9198. if (unlikely(retval)) {
  9199. Py_DECREF(retval);
  9200. __Pyx_RaiseTooManyValuesError(expected);
  9201. return -1;
  9202. } else {
  9203. return __Pyx_IterFinish();
  9204. }
  9205. return 0;
  9206. }
  9207. /* StringJoin */
  9208. #if !CYTHON_COMPILING_IN_CPYTHON
  9209. static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
  9210. return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
  9211. }
  9212. #endif
  9213. /* GetModuleGlobalName */
  9214. #if CYTHON_USE_DICT_VERSIONS
  9215. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  9216. #else
  9217. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  9218. #endif
  9219. {
  9220. PyObject *result;
  9221. #if !CYTHON_AVOID_BORROWED_REFS
  9222. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
  9223. result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
  9224. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  9225. if (likely(result)) {
  9226. return __Pyx_NewRef(result);
  9227. } else if (unlikely(PyErr_Occurred())) {
  9228. return NULL;
  9229. }
  9230. #else
  9231. result = PyDict_GetItem(__pyx_d, name);
  9232. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  9233. if (likely(result)) {
  9234. return __Pyx_NewRef(result);
  9235. }
  9236. #endif
  9237. #else
  9238. result = PyObject_GetItem(__pyx_d, name);
  9239. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  9240. if (likely(result)) {
  9241. return __Pyx_NewRef(result);
  9242. }
  9243. PyErr_Clear();
  9244. #endif
  9245. return __Pyx_GetBuiltinName(name);
  9246. }
  9247. /* GetAttr */
  9248. static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
  9249. #if CYTHON_USE_TYPE_SLOTS
  9250. #if PY_MAJOR_VERSION >= 3
  9251. if (likely(PyUnicode_Check(n)))
  9252. #else
  9253. if (likely(PyString_Check(n)))
  9254. #endif
  9255. return __Pyx_PyObject_GetAttrStr(o, n);
  9256. #endif
  9257. return PyObject_GetAttr(o, n);
  9258. }
  9259. /* GetAttr3 */
  9260. static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
  9261. __Pyx_PyThreadState_declare
  9262. __Pyx_PyThreadState_assign
  9263. if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  9264. return NULL;
  9265. __Pyx_PyErr_Clear();
  9266. Py_INCREF(d);
  9267. return d;
  9268. }
  9269. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
  9270. PyObject *r = __Pyx_GetAttr(o, n);
  9271. return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
  9272. }
  9273. /* RaiseException */
  9274. #if PY_MAJOR_VERSION < 3
  9275. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  9276. CYTHON_UNUSED PyObject *cause) {
  9277. __Pyx_PyThreadState_declare
  9278. Py_XINCREF(type);
  9279. if (!value || value == Py_None)
  9280. value = NULL;
  9281. else
  9282. Py_INCREF(value);
  9283. if (!tb || tb == Py_None)
  9284. tb = NULL;
  9285. else {
  9286. Py_INCREF(tb);
  9287. if (!PyTraceBack_Check(tb)) {
  9288. PyErr_SetString(PyExc_TypeError,
  9289. "raise: arg 3 must be a traceback or None");
  9290. goto raise_error;
  9291. }
  9292. }
  9293. if (PyType_Check(type)) {
  9294. #if CYTHON_COMPILING_IN_PYPY
  9295. if (!value) {
  9296. Py_INCREF(Py_None);
  9297. value = Py_None;
  9298. }
  9299. #endif
  9300. PyErr_NormalizeException(&type, &value, &tb);
  9301. } else {
  9302. if (value) {
  9303. PyErr_SetString(PyExc_TypeError,
  9304. "instance exception may not have a separate value");
  9305. goto raise_error;
  9306. }
  9307. value = type;
  9308. type = (PyObject*) Py_TYPE(type);
  9309. Py_INCREF(type);
  9310. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  9311. PyErr_SetString(PyExc_TypeError,
  9312. "raise: exception class must be a subclass of BaseException");
  9313. goto raise_error;
  9314. }
  9315. }
  9316. __Pyx_PyThreadState_assign
  9317. __Pyx_ErrRestore(type, value, tb);
  9318. return;
  9319. raise_error:
  9320. Py_XDECREF(value);
  9321. Py_XDECREF(type);
  9322. Py_XDECREF(tb);
  9323. return;
  9324. }
  9325. #else
  9326. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  9327. PyObject* owned_instance = NULL;
  9328. if (tb == Py_None) {
  9329. tb = 0;
  9330. } else if (tb && !PyTraceBack_Check(tb)) {
  9331. PyErr_SetString(PyExc_TypeError,
  9332. "raise: arg 3 must be a traceback or None");
  9333. goto bad;
  9334. }
  9335. if (value == Py_None)
  9336. value = 0;
  9337. if (PyExceptionInstance_Check(type)) {
  9338. if (value) {
  9339. PyErr_SetString(PyExc_TypeError,
  9340. "instance exception may not have a separate value");
  9341. goto bad;
  9342. }
  9343. value = type;
  9344. type = (PyObject*) Py_TYPE(value);
  9345. } else if (PyExceptionClass_Check(type)) {
  9346. PyObject *instance_class = NULL;
  9347. if (value && PyExceptionInstance_Check(value)) {
  9348. instance_class = (PyObject*) Py_TYPE(value);
  9349. if (instance_class != type) {
  9350. int is_subclass = PyObject_IsSubclass(instance_class, type);
  9351. if (!is_subclass) {
  9352. instance_class = NULL;
  9353. } else if (unlikely(is_subclass == -1)) {
  9354. goto bad;
  9355. } else {
  9356. type = instance_class;
  9357. }
  9358. }
  9359. }
  9360. if (!instance_class) {
  9361. PyObject *args;
  9362. if (!value)
  9363. args = PyTuple_New(0);
  9364. else if (PyTuple_Check(value)) {
  9365. Py_INCREF(value);
  9366. args = value;
  9367. } else
  9368. args = PyTuple_Pack(1, value);
  9369. if (!args)
  9370. goto bad;
  9371. owned_instance = PyObject_Call(type, args, NULL);
  9372. Py_DECREF(args);
  9373. if (!owned_instance)
  9374. goto bad;
  9375. value = owned_instance;
  9376. if (!PyExceptionInstance_Check(value)) {
  9377. PyErr_Format(PyExc_TypeError,
  9378. "calling %R should have returned an instance of "
  9379. "BaseException, not %R",
  9380. type, Py_TYPE(value));
  9381. goto bad;
  9382. }
  9383. }
  9384. } else {
  9385. PyErr_SetString(PyExc_TypeError,
  9386. "raise: exception class must be a subclass of BaseException");
  9387. goto bad;
  9388. }
  9389. if (cause) {
  9390. PyObject *fixed_cause;
  9391. if (cause == Py_None) {
  9392. fixed_cause = NULL;
  9393. } else if (PyExceptionClass_Check(cause)) {
  9394. fixed_cause = PyObject_CallObject(cause, NULL);
  9395. if (fixed_cause == NULL)
  9396. goto bad;
  9397. } else if (PyExceptionInstance_Check(cause)) {
  9398. fixed_cause = cause;
  9399. Py_INCREF(fixed_cause);
  9400. } else {
  9401. PyErr_SetString(PyExc_TypeError,
  9402. "exception causes must derive from "
  9403. "BaseException");
  9404. goto bad;
  9405. }
  9406. PyException_SetCause(value, fixed_cause);
  9407. }
  9408. PyErr_SetObject(type, value);
  9409. if (tb) {
  9410. #if CYTHON_COMPILING_IN_PYPY
  9411. PyObject *tmp_type, *tmp_value, *tmp_tb;
  9412. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  9413. Py_INCREF(tb);
  9414. PyErr_Restore(tmp_type, tmp_value, tb);
  9415. Py_XDECREF(tmp_tb);
  9416. #else
  9417. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  9418. PyObject* tmp_tb = tstate->curexc_traceback;
  9419. if (tb != tmp_tb) {
  9420. Py_INCREF(tb);
  9421. tstate->curexc_traceback = tb;
  9422. Py_XDECREF(tmp_tb);
  9423. }
  9424. #endif
  9425. }
  9426. bad:
  9427. Py_XDECREF(owned_instance);
  9428. return;
  9429. }
  9430. #endif
  9431. /* ExtTypeTest */
  9432. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
  9433. if (unlikely(!type)) {
  9434. PyErr_SetString(PyExc_SystemError, "Missing type object");
  9435. return 0;
  9436. }
  9437. if (likely(__Pyx_TypeCheck(obj, type)))
  9438. return 1;
  9439. PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
  9440. Py_TYPE(obj)->tp_name, type->tp_name);
  9441. return 0;
  9442. }
  9443. /* PyObjectCall2Args */
  9444. static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
  9445. PyObject *args, *result = NULL;
  9446. #if CYTHON_FAST_PYCALL
  9447. if (PyFunction_Check(function)) {
  9448. PyObject *args[2] = {arg1, arg2};
  9449. return __Pyx_PyFunction_FastCall(function, args, 2);
  9450. }
  9451. #endif
  9452. #if CYTHON_FAST_PYCCALL
  9453. if (__Pyx_PyFastCFunction_Check(function)) {
  9454. PyObject *args[2] = {arg1, arg2};
  9455. return __Pyx_PyCFunction_FastCall(function, args, 2);
  9456. }
  9457. #endif
  9458. args = PyTuple_New(2);
  9459. if (unlikely(!args)) goto done;
  9460. Py_INCREF(arg1);
  9461. PyTuple_SET_ITEM(args, 0, arg1);
  9462. Py_INCREF(arg2);
  9463. PyTuple_SET_ITEM(args, 1, arg2);
  9464. Py_INCREF(function);
  9465. result = __Pyx_PyObject_Call(function, args, NULL);
  9466. Py_DECREF(args);
  9467. Py_DECREF(function);
  9468. done:
  9469. return result;
  9470. }
  9471. /* KeywordStringCheck */
  9472. static int __Pyx_CheckKeywordStrings(
  9473. PyObject *kwdict,
  9474. const char* function_name,
  9475. int kw_allowed)
  9476. {
  9477. PyObject* key = 0;
  9478. Py_ssize_t pos = 0;
  9479. #if CYTHON_COMPILING_IN_PYPY
  9480. if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
  9481. goto invalid_keyword;
  9482. return 1;
  9483. #else
  9484. while (PyDict_Next(kwdict, &pos, &key, 0)) {
  9485. #if PY_MAJOR_VERSION < 3
  9486. if (unlikely(!PyString_Check(key)))
  9487. #endif
  9488. if (unlikely(!PyUnicode_Check(key)))
  9489. goto invalid_keyword_type;
  9490. }
  9491. if ((!kw_allowed) && unlikely(key))
  9492. goto invalid_keyword;
  9493. return 1;
  9494. invalid_keyword_type:
  9495. PyErr_Format(PyExc_TypeError,
  9496. "%.200s() keywords must be strings", function_name);
  9497. return 0;
  9498. #endif
  9499. invalid_keyword:
  9500. PyErr_Format(PyExc_TypeError,
  9501. #if PY_MAJOR_VERSION < 3
  9502. "%.200s() got an unexpected keyword argument '%.200s'",
  9503. function_name, PyString_AsString(key));
  9504. #else
  9505. "%s() got an unexpected keyword argument '%U'",
  9506. function_name, key);
  9507. #endif
  9508. return 0;
  9509. }
  9510. /* GetItemInt */
  9511. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  9512. PyObject *r;
  9513. if (!j) return NULL;
  9514. r = PyObject_GetItem(o, j);
  9515. Py_DECREF(j);
  9516. return r;
  9517. }
  9518. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  9519. CYTHON_NCP_UNUSED int wraparound,
  9520. CYTHON_NCP_UNUSED int boundscheck) {
  9521. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9522. Py_ssize_t wrapped_i = i;
  9523. if (wraparound & unlikely(i < 0)) {
  9524. wrapped_i += PyList_GET_SIZE(o);
  9525. }
  9526. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
  9527. PyObject *r = PyList_GET_ITEM(o, wrapped_i);
  9528. Py_INCREF(r);
  9529. return r;
  9530. }
  9531. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  9532. #else
  9533. return PySequence_GetItem(o, i);
  9534. #endif
  9535. }
  9536. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  9537. CYTHON_NCP_UNUSED int wraparound,
  9538. CYTHON_NCP_UNUSED int boundscheck) {
  9539. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9540. Py_ssize_t wrapped_i = i;
  9541. if (wraparound & unlikely(i < 0)) {
  9542. wrapped_i += PyTuple_GET_SIZE(o);
  9543. }
  9544. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
  9545. PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
  9546. Py_INCREF(r);
  9547. return r;
  9548. }
  9549. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  9550. #else
  9551. return PySequence_GetItem(o, i);
  9552. #endif
  9553. }
  9554. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  9555. CYTHON_NCP_UNUSED int wraparound,
  9556. CYTHON_NCP_UNUSED int boundscheck) {
  9557. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
  9558. if (is_list || PyList_CheckExact(o)) {
  9559. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  9560. if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
  9561. PyObject *r = PyList_GET_ITEM(o, n);
  9562. Py_INCREF(r);
  9563. return r;
  9564. }
  9565. }
  9566. else if (PyTuple_CheckExact(o)) {
  9567. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  9568. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
  9569. PyObject *r = PyTuple_GET_ITEM(o, n);
  9570. Py_INCREF(r);
  9571. return r;
  9572. }
  9573. } else {
  9574. PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  9575. if (likely(m && m->sq_item)) {
  9576. if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  9577. Py_ssize_t l = m->sq_length(o);
  9578. if (likely(l >= 0)) {
  9579. i += l;
  9580. } else {
  9581. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  9582. return NULL;
  9583. PyErr_Clear();
  9584. }
  9585. }
  9586. return m->sq_item(o, i);
  9587. }
  9588. }
  9589. #else
  9590. if (is_list || PySequence_Check(o)) {
  9591. return PySequence_GetItem(o, i);
  9592. }
  9593. #endif
  9594. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  9595. }
  9596. /* HasAttr */
  9597. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
  9598. PyObject *r;
  9599. if (unlikely(!__Pyx_PyBaseString_Check(n))) {
  9600. PyErr_SetString(PyExc_TypeError,
  9601. "hasattr(): attribute name must be string");
  9602. return -1;
  9603. }
  9604. r = __Pyx_GetAttr(o, n);
  9605. if (unlikely(!r)) {
  9606. PyErr_Clear();
  9607. return 0;
  9608. } else {
  9609. Py_DECREF(r);
  9610. return 1;
  9611. }
  9612. }
  9613. /* UnpackUnboundCMethod */
  9614. static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
  9615. PyObject *method;
  9616. method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
  9617. if (unlikely(!method))
  9618. return -1;
  9619. target->method = method;
  9620. #if CYTHON_COMPILING_IN_CPYTHON
  9621. #if PY_MAJOR_VERSION >= 3
  9622. if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
  9623. #endif
  9624. {
  9625. PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
  9626. target->func = descr->d_method->ml_meth;
  9627. target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
  9628. }
  9629. #endif
  9630. return 0;
  9631. }
  9632. /* CallUnboundCMethod0 */
  9633. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
  9634. PyObject *args, *result = NULL;
  9635. if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
  9636. #if CYTHON_ASSUME_SAFE_MACROS
  9637. args = PyTuple_New(1);
  9638. if (unlikely(!args)) goto bad;
  9639. Py_INCREF(self);
  9640. PyTuple_SET_ITEM(args, 0, self);
  9641. #else
  9642. args = PyTuple_Pack(1, self);
  9643. if (unlikely(!args)) goto bad;
  9644. #endif
  9645. result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
  9646. Py_DECREF(args);
  9647. bad:
  9648. return result;
  9649. }
  9650. /* py_dict_items */
  9651. static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
  9652. if (PY_MAJOR_VERSION >= 3)
  9653. return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d);
  9654. else
  9655. return PyDict_Items(d);
  9656. }
  9657. /* Import */
  9658. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  9659. PyObject *empty_list = 0;
  9660. PyObject *module = 0;
  9661. PyObject *global_dict = 0;
  9662. PyObject *empty_dict = 0;
  9663. PyObject *list;
  9664. #if PY_MAJOR_VERSION < 3
  9665. PyObject *py_import;
  9666. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  9667. if (!py_import)
  9668. goto bad;
  9669. #endif
  9670. if (from_list)
  9671. list = from_list;
  9672. else {
  9673. empty_list = PyList_New(0);
  9674. if (!empty_list)
  9675. goto bad;
  9676. list = empty_list;
  9677. }
  9678. global_dict = PyModule_GetDict(__pyx_m);
  9679. if (!global_dict)
  9680. goto bad;
  9681. empty_dict = PyDict_New();
  9682. if (!empty_dict)
  9683. goto bad;
  9684. {
  9685. #if PY_MAJOR_VERSION >= 3
  9686. if (level == -1) {
  9687. if (strchr(__Pyx_MODULE_NAME, '.')) {
  9688. module = PyImport_ImportModuleLevelObject(
  9689. name, global_dict, empty_dict, list, 1);
  9690. if (!module) {
  9691. if (!PyErr_ExceptionMatches(PyExc_ImportError))
  9692. goto bad;
  9693. PyErr_Clear();
  9694. }
  9695. }
  9696. level = 0;
  9697. }
  9698. #endif
  9699. if (!module) {
  9700. #if PY_MAJOR_VERSION < 3
  9701. PyObject *py_level = PyInt_FromLong(level);
  9702. if (!py_level)
  9703. goto bad;
  9704. module = PyObject_CallFunctionObjArgs(py_import,
  9705. name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
  9706. Py_DECREF(py_level);
  9707. #else
  9708. module = PyImport_ImportModuleLevelObject(
  9709. name, global_dict, empty_dict, list, level);
  9710. #endif
  9711. }
  9712. }
  9713. bad:
  9714. #if PY_MAJOR_VERSION < 3
  9715. Py_XDECREF(py_import);
  9716. #endif
  9717. Py_XDECREF(empty_list);
  9718. Py_XDECREF(empty_dict);
  9719. return module;
  9720. }
  9721. /* ImportFrom */
  9722. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  9723. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  9724. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  9725. PyErr_Format(PyExc_ImportError,
  9726. #if PY_MAJOR_VERSION < 3
  9727. "cannot import name %.230s", PyString_AS_STRING(name));
  9728. #else
  9729. "cannot import name %S", name);
  9730. #endif
  9731. }
  9732. return value;
  9733. }
  9734. /* PyObject_GenericGetAttrNoDict */
  9735. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  9736. static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
  9737. PyErr_Format(PyExc_AttributeError,
  9738. #if PY_MAJOR_VERSION >= 3
  9739. "'%.50s' object has no attribute '%U'",
  9740. tp->tp_name, attr_name);
  9741. #else
  9742. "'%.50s' object has no attribute '%.400s'",
  9743. tp->tp_name, PyString_AS_STRING(attr_name));
  9744. #endif
  9745. return NULL;
  9746. }
  9747. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
  9748. PyObject *descr;
  9749. PyTypeObject *tp = Py_TYPE(obj);
  9750. if (unlikely(!PyString_Check(attr_name))) {
  9751. return PyObject_GenericGetAttr(obj, attr_name);
  9752. }
  9753. assert(!tp->tp_dictoffset);
  9754. descr = _PyType_Lookup(tp, attr_name);
  9755. if (unlikely(!descr)) {
  9756. return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
  9757. }
  9758. Py_INCREF(descr);
  9759. #if PY_MAJOR_VERSION < 3
  9760. if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
  9761. #endif
  9762. {
  9763. descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
  9764. if (unlikely(f)) {
  9765. PyObject *res = f(descr, obj, (PyObject *)tp);
  9766. Py_DECREF(descr);
  9767. return res;
  9768. }
  9769. }
  9770. return descr;
  9771. }
  9772. #endif
  9773. /* PyObject_GenericGetAttr */
  9774. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  9775. static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
  9776. if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
  9777. return PyObject_GenericGetAttr(obj, attr_name);
  9778. }
  9779. return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
  9780. }
  9781. #endif
  9782. /* SetVTable */
  9783. static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
  9784. #if PY_VERSION_HEX >= 0x02070000
  9785. PyObject *ob = PyCapsule_New(vtable, 0, 0);
  9786. #else
  9787. PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
  9788. #endif
  9789. if (!ob)
  9790. goto bad;
  9791. if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
  9792. goto bad;
  9793. Py_DECREF(ob);
  9794. return 0;
  9795. bad:
  9796. Py_XDECREF(ob);
  9797. return -1;
  9798. }
  9799. /* SetupReduce */
  9800. static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  9801. int ret;
  9802. PyObject *name_attr;
  9803. name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
  9804. if (likely(name_attr)) {
  9805. ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  9806. } else {
  9807. ret = -1;
  9808. }
  9809. if (unlikely(ret < 0)) {
  9810. PyErr_Clear();
  9811. ret = 0;
  9812. }
  9813. Py_XDECREF(name_attr);
  9814. return ret;
  9815. }
  9816. static int __Pyx_setup_reduce(PyObject* type_obj) {
  9817. int ret = 0;
  9818. PyObject *object_reduce = NULL;
  9819. PyObject *object_reduce_ex = NULL;
  9820. PyObject *reduce = NULL;
  9821. PyObject *reduce_ex = NULL;
  9822. PyObject *reduce_cython = NULL;
  9823. PyObject *setstate = NULL;
  9824. PyObject *setstate_cython = NULL;
  9825. #if CYTHON_USE_PYTYPE_LOOKUP
  9826. if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
  9827. #else
  9828. if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
  9829. #endif
  9830. #if CYTHON_USE_PYTYPE_LOOKUP
  9831. object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
  9832. #else
  9833. object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
  9834. #endif
  9835. reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
  9836. if (reduce_ex == object_reduce_ex) {
  9837. #if CYTHON_USE_PYTYPE_LOOKUP
  9838. object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
  9839. #else
  9840. object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
  9841. #endif
  9842. reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
  9843. if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
  9844. reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
  9845. ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
  9846. ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
  9847. setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
  9848. if (!setstate) PyErr_Clear();
  9849. if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
  9850. setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
  9851. ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
  9852. ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
  9853. }
  9854. PyType_Modified((PyTypeObject*)type_obj);
  9855. }
  9856. }
  9857. goto GOOD;
  9858. BAD:
  9859. if (!PyErr_Occurred())
  9860. PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
  9861. ret = -1;
  9862. GOOD:
  9863. #if !CYTHON_USE_PYTYPE_LOOKUP
  9864. Py_XDECREF(object_reduce);
  9865. Py_XDECREF(object_reduce_ex);
  9866. #endif
  9867. Py_XDECREF(reduce);
  9868. Py_XDECREF(reduce_ex);
  9869. Py_XDECREF(reduce_cython);
  9870. Py_XDECREF(setstate);
  9871. Py_XDECREF(setstate_cython);
  9872. return ret;
  9873. }
  9874. /* TypeImport */
  9875. #ifndef __PYX_HAVE_RT_ImportType
  9876. #define __PYX_HAVE_RT_ImportType
  9877. static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
  9878. size_t size, enum __Pyx_ImportType_CheckSize check_size)
  9879. {
  9880. PyObject *result = 0;
  9881. char warning[200];
  9882. Py_ssize_t basicsize;
  9883. #ifdef Py_LIMITED_API
  9884. PyObject *py_basicsize;
  9885. #endif
  9886. result = PyObject_GetAttrString(module, class_name);
  9887. if (!result)
  9888. goto bad;
  9889. if (!PyType_Check(result)) {
  9890. PyErr_Format(PyExc_TypeError,
  9891. "%.200s.%.200s is not a type object",
  9892. module_name, class_name);
  9893. goto bad;
  9894. }
  9895. #ifndef Py_LIMITED_API
  9896. basicsize = ((PyTypeObject *)result)->tp_basicsize;
  9897. #else
  9898. py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
  9899. if (!py_basicsize)
  9900. goto bad;
  9901. basicsize = PyLong_AsSsize_t(py_basicsize);
  9902. Py_DECREF(py_basicsize);
  9903. py_basicsize = 0;
  9904. if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
  9905. goto bad;
  9906. #endif
  9907. if ((size_t)basicsize < size) {
  9908. PyErr_Format(PyExc_ValueError,
  9909. "%.200s.%.200s size changed, may indicate binary incompatibility. "
  9910. "Expected %zd from C header, got %zd from PyObject",
  9911. module_name, class_name, size, basicsize);
  9912. goto bad;
  9913. }
  9914. if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
  9915. PyErr_Format(PyExc_ValueError,
  9916. "%.200s.%.200s size changed, may indicate binary incompatibility. "
  9917. "Expected %zd from C header, got %zd from PyObject",
  9918. module_name, class_name, size, basicsize);
  9919. goto bad;
  9920. }
  9921. else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
  9922. PyOS_snprintf(warning, sizeof(warning),
  9923. "%s.%s size changed, may indicate binary incompatibility. "
  9924. "Expected %zd from C header, got %zd from PyObject",
  9925. module_name, class_name, size, basicsize);
  9926. if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
  9927. }
  9928. return (PyTypeObject *)result;
  9929. bad:
  9930. Py_XDECREF(result);
  9931. return NULL;
  9932. }
  9933. #endif
  9934. /* GetNameInClass */
  9935. static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) {
  9936. PyObject *result;
  9937. __Pyx_PyThreadState_declare
  9938. __Pyx_PyThreadState_assign
  9939. if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  9940. return NULL;
  9941. __Pyx_PyErr_Clear();
  9942. __Pyx_GetModuleGlobalNameUncached(result, name);
  9943. return result;
  9944. }
  9945. static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
  9946. PyObject *result;
  9947. result = __Pyx_PyObject_GetAttrStr(nmspace, name);
  9948. if (!result) {
  9949. result = __Pyx_GetGlobalNameAfterAttributeLookup(name);
  9950. }
  9951. return result;
  9952. }
  9953. /* CLineInTraceback */
  9954. #ifndef CYTHON_CLINE_IN_TRACEBACK
  9955. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
  9956. PyObject *use_cline;
  9957. PyObject *ptype, *pvalue, *ptraceback;
  9958. #if CYTHON_COMPILING_IN_CPYTHON
  9959. PyObject **cython_runtime_dict;
  9960. #endif
  9961. if (unlikely(!__pyx_cython_runtime)) {
  9962. return c_line;
  9963. }
  9964. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  9965. #if CYTHON_COMPILING_IN_CPYTHON
  9966. cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
  9967. if (likely(cython_runtime_dict)) {
  9968. __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  9969. use_cline, *cython_runtime_dict,
  9970. __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
  9971. } else
  9972. #endif
  9973. {
  9974. PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
  9975. if (use_cline_obj) {
  9976. use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
  9977. Py_DECREF(use_cline_obj);
  9978. } else {
  9979. PyErr_Clear();
  9980. use_cline = NULL;
  9981. }
  9982. }
  9983. if (!use_cline) {
  9984. c_line = 0;
  9985. PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
  9986. }
  9987. else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  9988. c_line = 0;
  9989. }
  9990. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  9991. return c_line;
  9992. }
  9993. #endif
  9994. /* CodeObjectCache */
  9995. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  9996. int start = 0, mid = 0, end = count - 1;
  9997. if (end >= 0 && code_line > entries[end].code_line) {
  9998. return count;
  9999. }
  10000. while (start < end) {
  10001. mid = start + (end - start) / 2;
  10002. if (code_line < entries[mid].code_line) {
  10003. end = mid;
  10004. } else if (code_line > entries[mid].code_line) {
  10005. start = mid + 1;
  10006. } else {
  10007. return mid;
  10008. }
  10009. }
  10010. if (code_line <= entries[mid].code_line) {
  10011. return mid;
  10012. } else {
  10013. return mid + 1;
  10014. }
  10015. }
  10016. static PyCodeObject *__pyx_find_code_object(int code_line) {
  10017. PyCodeObject* code_object;
  10018. int pos;
  10019. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  10020. return NULL;
  10021. }
  10022. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  10023. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  10024. return NULL;
  10025. }
  10026. code_object = __pyx_code_cache.entries[pos].code_object;
  10027. Py_INCREF(code_object);
  10028. return code_object;
  10029. }
  10030. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  10031. int pos, i;
  10032. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  10033. if (unlikely(!code_line)) {
  10034. return;
  10035. }
  10036. if (unlikely(!entries)) {
  10037. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  10038. if (likely(entries)) {
  10039. __pyx_code_cache.entries = entries;
  10040. __pyx_code_cache.max_count = 64;
  10041. __pyx_code_cache.count = 1;
  10042. entries[0].code_line = code_line;
  10043. entries[0].code_object = code_object;
  10044. Py_INCREF(code_object);
  10045. }
  10046. return;
  10047. }
  10048. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  10049. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  10050. PyCodeObject* tmp = entries[pos].code_object;
  10051. entries[pos].code_object = code_object;
  10052. Py_DECREF(tmp);
  10053. return;
  10054. }
  10055. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  10056. int new_max = __pyx_code_cache.max_count + 64;
  10057. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  10058. __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
  10059. if (unlikely(!entries)) {
  10060. return;
  10061. }
  10062. __pyx_code_cache.entries = entries;
  10063. __pyx_code_cache.max_count = new_max;
  10064. }
  10065. for (i=__pyx_code_cache.count; i>pos; i--) {
  10066. entries[i] = entries[i-1];
  10067. }
  10068. entries[pos].code_line = code_line;
  10069. entries[pos].code_object = code_object;
  10070. __pyx_code_cache.count++;
  10071. Py_INCREF(code_object);
  10072. }
  10073. /* AddTraceback */
  10074. #include "compile.h"
  10075. #include "frameobject.h"
  10076. #include "traceback.h"
  10077. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  10078. const char *funcname, int c_line,
  10079. int py_line, const char *filename) {
  10080. PyCodeObject *py_code = 0;
  10081. PyObject *py_srcfile = 0;
  10082. PyObject *py_funcname = 0;
  10083. #if PY_MAJOR_VERSION < 3
  10084. py_srcfile = PyString_FromString(filename);
  10085. #else
  10086. py_srcfile = PyUnicode_FromString(filename);
  10087. #endif
  10088. if (!py_srcfile) goto bad;
  10089. if (c_line) {
  10090. #if PY_MAJOR_VERSION < 3
  10091. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  10092. #else
  10093. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  10094. #endif
  10095. }
  10096. else {
  10097. #if PY_MAJOR_VERSION < 3
  10098. py_funcname = PyString_FromString(funcname);
  10099. #else
  10100. py_funcname = PyUnicode_FromString(funcname);
  10101. #endif
  10102. }
  10103. if (!py_funcname) goto bad;
  10104. py_code = __Pyx_PyCode_New(
  10105. 0,
  10106. 0,
  10107. 0,
  10108. 0,
  10109. 0,
  10110. __pyx_empty_bytes, /*PyObject *code,*/
  10111. __pyx_empty_tuple, /*PyObject *consts,*/
  10112. __pyx_empty_tuple, /*PyObject *names,*/
  10113. __pyx_empty_tuple, /*PyObject *varnames,*/
  10114. __pyx_empty_tuple, /*PyObject *freevars,*/
  10115. __pyx_empty_tuple, /*PyObject *cellvars,*/
  10116. py_srcfile, /*PyObject *filename,*/
  10117. py_funcname, /*PyObject *name,*/
  10118. py_line,
  10119. __pyx_empty_bytes /*PyObject *lnotab*/
  10120. );
  10121. Py_DECREF(py_srcfile);
  10122. Py_DECREF(py_funcname);
  10123. return py_code;
  10124. bad:
  10125. Py_XDECREF(py_srcfile);
  10126. Py_XDECREF(py_funcname);
  10127. return NULL;
  10128. }
  10129. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  10130. int py_line, const char *filename) {
  10131. PyCodeObject *py_code = 0;
  10132. PyFrameObject *py_frame = 0;
  10133. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  10134. if (c_line) {
  10135. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  10136. }
  10137. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  10138. if (!py_code) {
  10139. py_code = __Pyx_CreateCodeObjectForTraceback(
  10140. funcname, c_line, py_line, filename);
  10141. if (!py_code) goto bad;
  10142. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  10143. }
  10144. py_frame = PyFrame_New(
  10145. tstate, /*PyThreadState *tstate,*/
  10146. py_code, /*PyCodeObject *code,*/
  10147. __pyx_d, /*PyObject *globals,*/
  10148. 0 /*PyObject *locals*/
  10149. );
  10150. if (!py_frame) goto bad;
  10151. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  10152. PyTraceBack_Here(py_frame);
  10153. bad:
  10154. Py_XDECREF(py_code);
  10155. Py_XDECREF(py_frame);
  10156. }
  10157. /* CIntFromPyVerify */
  10158. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  10159. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  10160. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  10161. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  10162. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  10163. {\
  10164. func_type value = func_value;\
  10165. if (sizeof(target_type) < sizeof(func_type)) {\
  10166. if (unlikely(value != (func_type) (target_type) value)) {\
  10167. func_type zero = 0;\
  10168. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  10169. return (target_type) -1;\
  10170. if (is_unsigned && unlikely(value < zero))\
  10171. goto raise_neg_overflow;\
  10172. else\
  10173. goto raise_overflow;\
  10174. }\
  10175. }\
  10176. return (target_type) value;\
  10177. }
  10178. /* CIntToPy */
  10179. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) {
  10180. const uint64_t neg_one = (uint64_t) ((uint64_t) 0 - (uint64_t) 1), const_zero = (uint64_t) 0;
  10181. const int is_unsigned = neg_one > const_zero;
  10182. if (is_unsigned) {
  10183. if (sizeof(uint64_t) < sizeof(long)) {
  10184. return PyInt_FromLong((long) value);
  10185. } else if (sizeof(uint64_t) <= sizeof(unsigned long)) {
  10186. return PyLong_FromUnsignedLong((unsigned long) value);
  10187. #ifdef HAVE_LONG_LONG
  10188. } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
  10189. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  10190. #endif
  10191. }
  10192. } else {
  10193. if (sizeof(uint64_t) <= sizeof(long)) {
  10194. return PyInt_FromLong((long) value);
  10195. #ifdef HAVE_LONG_LONG
  10196. } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
  10197. return PyLong_FromLongLong((PY_LONG_LONG) value);
  10198. #endif
  10199. }
  10200. }
  10201. {
  10202. int one = 1; int little = (int)*(unsigned char *)&one;
  10203. unsigned char *bytes = (unsigned char *)&value;
  10204. return _PyLong_FromByteArray(bytes, sizeof(uint64_t),
  10205. little, !is_unsigned);
  10206. }
  10207. }
  10208. /* CIntToPy */
  10209. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  10210. const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
  10211. const int is_unsigned = neg_one > const_zero;
  10212. if (is_unsigned) {
  10213. if (sizeof(int) < sizeof(long)) {
  10214. return PyInt_FromLong((long) value);
  10215. } else if (sizeof(int) <= sizeof(unsigned long)) {
  10216. return PyLong_FromUnsignedLong((unsigned long) value);
  10217. #ifdef HAVE_LONG_LONG
  10218. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  10219. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  10220. #endif
  10221. }
  10222. } else {
  10223. if (sizeof(int) <= sizeof(long)) {
  10224. return PyInt_FromLong((long) value);
  10225. #ifdef HAVE_LONG_LONG
  10226. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  10227. return PyLong_FromLongLong((PY_LONG_LONG) value);
  10228. #endif
  10229. }
  10230. }
  10231. {
  10232. int one = 1; int little = (int)*(unsigned char *)&one;
  10233. unsigned char *bytes = (unsigned char *)&value;
  10234. return _PyLong_FromByteArray(bytes, sizeof(int),
  10235. little, !is_unsigned);
  10236. }
  10237. }
  10238. /* CIntToPy */
  10239. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  10240. const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
  10241. const int is_unsigned = neg_one > const_zero;
  10242. if (is_unsigned) {
  10243. if (sizeof(long) < sizeof(long)) {
  10244. return PyInt_FromLong((long) value);
  10245. } else if (sizeof(long) <= sizeof(unsigned long)) {
  10246. return PyLong_FromUnsignedLong((unsigned long) value);
  10247. #ifdef HAVE_LONG_LONG
  10248. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  10249. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  10250. #endif
  10251. }
  10252. } else {
  10253. if (sizeof(long) <= sizeof(long)) {
  10254. return PyInt_FromLong((long) value);
  10255. #ifdef HAVE_LONG_LONG
  10256. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  10257. return PyLong_FromLongLong((PY_LONG_LONG) value);
  10258. #endif
  10259. }
  10260. }
  10261. {
  10262. int one = 1; int little = (int)*(unsigned char *)&one;
  10263. unsigned char *bytes = (unsigned char *)&value;
  10264. return _PyLong_FromByteArray(bytes, sizeof(long),
  10265. little, !is_unsigned);
  10266. }
  10267. }
  10268. /* CIntFromPy */
  10269. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  10270. const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
  10271. const int is_unsigned = neg_one > const_zero;
  10272. #if PY_MAJOR_VERSION < 3
  10273. if (likely(PyInt_Check(x))) {
  10274. if (sizeof(long) < sizeof(long)) {
  10275. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  10276. } else {
  10277. long val = PyInt_AS_LONG(x);
  10278. if (is_unsigned && unlikely(val < 0)) {
  10279. goto raise_neg_overflow;
  10280. }
  10281. return (long) val;
  10282. }
  10283. } else
  10284. #endif
  10285. if (likely(PyLong_Check(x))) {
  10286. if (is_unsigned) {
  10287. #if CYTHON_USE_PYLONG_INTERNALS
  10288. const digit* digits = ((PyLongObject*)x)->ob_digit;
  10289. switch (Py_SIZE(x)) {
  10290. case 0: return (long) 0;
  10291. case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
  10292. case 2:
  10293. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  10294. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  10295. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10296. } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
  10297. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  10298. }
  10299. }
  10300. break;
  10301. case 3:
  10302. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  10303. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  10304. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10305. } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
  10306. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  10307. }
  10308. }
  10309. break;
  10310. case 4:
  10311. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  10312. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  10313. __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])))
  10314. } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
  10315. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  10316. }
  10317. }
  10318. break;
  10319. }
  10320. #endif
  10321. #if CYTHON_COMPILING_IN_CPYTHON
  10322. if (unlikely(Py_SIZE(x) < 0)) {
  10323. goto raise_neg_overflow;
  10324. }
  10325. #else
  10326. {
  10327. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  10328. if (unlikely(result < 0))
  10329. return (long) -1;
  10330. if (unlikely(result == 1))
  10331. goto raise_neg_overflow;
  10332. }
  10333. #endif
  10334. if (sizeof(long) <= sizeof(unsigned long)) {
  10335. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  10336. #ifdef HAVE_LONG_LONG
  10337. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  10338. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  10339. #endif
  10340. }
  10341. } else {
  10342. #if CYTHON_USE_PYLONG_INTERNALS
  10343. const digit* digits = ((PyLongObject*)x)->ob_digit;
  10344. switch (Py_SIZE(x)) {
  10345. case 0: return (long) 0;
  10346. case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
  10347. case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
  10348. case -2:
  10349. if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
  10350. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  10351. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10352. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  10353. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10354. }
  10355. }
  10356. break;
  10357. case 2:
  10358. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  10359. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  10360. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10361. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  10362. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10363. }
  10364. }
  10365. break;
  10366. case -3:
  10367. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  10368. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  10369. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10370. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  10371. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10372. }
  10373. }
  10374. break;
  10375. case 3:
  10376. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  10377. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  10378. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10379. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  10380. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10381. }
  10382. }
  10383. break;
  10384. case -4:
  10385. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  10386. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  10387. __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])))
  10388. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  10389. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10390. }
  10391. }
  10392. break;
  10393. case 4:
  10394. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  10395. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  10396. __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])))
  10397. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  10398. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10399. }
  10400. }
  10401. break;
  10402. }
  10403. #endif
  10404. if (sizeof(long) <= sizeof(long)) {
  10405. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  10406. #ifdef HAVE_LONG_LONG
  10407. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  10408. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  10409. #endif
  10410. }
  10411. }
  10412. {
  10413. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  10414. PyErr_SetString(PyExc_RuntimeError,
  10415. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  10416. #else
  10417. long val;
  10418. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  10419. #if PY_MAJOR_VERSION < 3
  10420. if (likely(v) && !PyLong_Check(v)) {
  10421. PyObject *tmp = v;
  10422. v = PyNumber_Long(tmp);
  10423. Py_DECREF(tmp);
  10424. }
  10425. #endif
  10426. if (likely(v)) {
  10427. int one = 1; int is_little = (int)*(unsigned char *)&one;
  10428. unsigned char *bytes = (unsigned char *)&val;
  10429. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  10430. bytes, sizeof(val),
  10431. is_little, !is_unsigned);
  10432. Py_DECREF(v);
  10433. if (likely(!ret))
  10434. return val;
  10435. }
  10436. #endif
  10437. return (long) -1;
  10438. }
  10439. } else {
  10440. long val;
  10441. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  10442. if (!tmp) return (long) -1;
  10443. val = __Pyx_PyInt_As_long(tmp);
  10444. Py_DECREF(tmp);
  10445. return val;
  10446. }
  10447. raise_overflow:
  10448. PyErr_SetString(PyExc_OverflowError,
  10449. "value too large to convert to long");
  10450. return (long) -1;
  10451. raise_neg_overflow:
  10452. PyErr_SetString(PyExc_OverflowError,
  10453. "can't convert negative value to long");
  10454. return (long) -1;
  10455. }
  10456. /* CIntFromPy */
  10457. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  10458. const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
  10459. const int is_unsigned = neg_one > const_zero;
  10460. #if PY_MAJOR_VERSION < 3
  10461. if (likely(PyInt_Check(x))) {
  10462. if (sizeof(int) < sizeof(long)) {
  10463. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  10464. } else {
  10465. long val = PyInt_AS_LONG(x);
  10466. if (is_unsigned && unlikely(val < 0)) {
  10467. goto raise_neg_overflow;
  10468. }
  10469. return (int) val;
  10470. }
  10471. } else
  10472. #endif
  10473. if (likely(PyLong_Check(x))) {
  10474. if (is_unsigned) {
  10475. #if CYTHON_USE_PYLONG_INTERNALS
  10476. const digit* digits = ((PyLongObject*)x)->ob_digit;
  10477. switch (Py_SIZE(x)) {
  10478. case 0: return (int) 0;
  10479. case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
  10480. case 2:
  10481. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  10482. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  10483. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10484. } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
  10485. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  10486. }
  10487. }
  10488. break;
  10489. case 3:
  10490. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  10491. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  10492. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10493. } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
  10494. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  10495. }
  10496. }
  10497. break;
  10498. case 4:
  10499. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  10500. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  10501. __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])))
  10502. } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
  10503. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  10504. }
  10505. }
  10506. break;
  10507. }
  10508. #endif
  10509. #if CYTHON_COMPILING_IN_CPYTHON
  10510. if (unlikely(Py_SIZE(x) < 0)) {
  10511. goto raise_neg_overflow;
  10512. }
  10513. #else
  10514. {
  10515. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  10516. if (unlikely(result < 0))
  10517. return (int) -1;
  10518. if (unlikely(result == 1))
  10519. goto raise_neg_overflow;
  10520. }
  10521. #endif
  10522. if (sizeof(int) <= sizeof(unsigned long)) {
  10523. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  10524. #ifdef HAVE_LONG_LONG
  10525. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  10526. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  10527. #endif
  10528. }
  10529. } else {
  10530. #if CYTHON_USE_PYLONG_INTERNALS
  10531. const digit* digits = ((PyLongObject*)x)->ob_digit;
  10532. switch (Py_SIZE(x)) {
  10533. case 0: return (int) 0;
  10534. case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
  10535. case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
  10536. case -2:
  10537. if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
  10538. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  10539. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10540. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  10541. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  10542. }
  10543. }
  10544. break;
  10545. case 2:
  10546. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  10547. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  10548. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10549. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  10550. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  10551. }
  10552. }
  10553. break;
  10554. case -3:
  10555. if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  10556. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  10557. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10558. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  10559. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  10560. }
  10561. }
  10562. break;
  10563. case 3:
  10564. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  10565. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  10566. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10567. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  10568. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  10569. }
  10570. }
  10571. break;
  10572. case -4:
  10573. if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  10574. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  10575. __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])))
  10576. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  10577. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  10578. }
  10579. }
  10580. break;
  10581. case 4:
  10582. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  10583. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  10584. __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])))
  10585. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  10586. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  10587. }
  10588. }
  10589. break;
  10590. }
  10591. #endif
  10592. if (sizeof(int) <= sizeof(long)) {
  10593. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  10594. #ifdef HAVE_LONG_LONG
  10595. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  10596. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  10597. #endif
  10598. }
  10599. }
  10600. {
  10601. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  10602. PyErr_SetString(PyExc_RuntimeError,
  10603. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  10604. #else
  10605. int val;
  10606. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  10607. #if PY_MAJOR_VERSION < 3
  10608. if (likely(v) && !PyLong_Check(v)) {
  10609. PyObject *tmp = v;
  10610. v = PyNumber_Long(tmp);
  10611. Py_DECREF(tmp);
  10612. }
  10613. #endif
  10614. if (likely(v)) {
  10615. int one = 1; int is_little = (int)*(unsigned char *)&one;
  10616. unsigned char *bytes = (unsigned char *)&val;
  10617. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  10618. bytes, sizeof(val),
  10619. is_little, !is_unsigned);
  10620. Py_DECREF(v);
  10621. if (likely(!ret))
  10622. return val;
  10623. }
  10624. #endif
  10625. return (int) -1;
  10626. }
  10627. } else {
  10628. int val;
  10629. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  10630. if (!tmp) return (int) -1;
  10631. val = __Pyx_PyInt_As_int(tmp);
  10632. Py_DECREF(tmp);
  10633. return val;
  10634. }
  10635. raise_overflow:
  10636. PyErr_SetString(PyExc_OverflowError,
  10637. "value too large to convert to int");
  10638. return (int) -1;
  10639. raise_neg_overflow:
  10640. PyErr_SetString(PyExc_OverflowError,
  10641. "can't convert negative value to int");
  10642. return (int) -1;
  10643. }
  10644. /* FastTypeChecks */
  10645. #if CYTHON_COMPILING_IN_CPYTHON
  10646. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  10647. while (a) {
  10648. a = a->tp_base;
  10649. if (a == b)
  10650. return 1;
  10651. }
  10652. return b == &PyBaseObject_Type;
  10653. }
  10654. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  10655. PyObject *mro;
  10656. if (a == b) return 1;
  10657. mro = a->tp_mro;
  10658. if (likely(mro)) {
  10659. Py_ssize_t i, n;
  10660. n = PyTuple_GET_SIZE(mro);
  10661. for (i = 0; i < n; i++) {
  10662. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  10663. return 1;
  10664. }
  10665. return 0;
  10666. }
  10667. return __Pyx_InBases(a, b);
  10668. }
  10669. #if PY_MAJOR_VERSION == 2
  10670. static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
  10671. PyObject *exception, *value, *tb;
  10672. int res;
  10673. __Pyx_PyThreadState_declare
  10674. __Pyx_PyThreadState_assign
  10675. __Pyx_ErrFetch(&exception, &value, &tb);
  10676. res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
  10677. if (unlikely(res == -1)) {
  10678. PyErr_WriteUnraisable(err);
  10679. res = 0;
  10680. }
  10681. if (!res) {
  10682. res = PyObject_IsSubclass(err, exc_type2);
  10683. if (unlikely(res == -1)) {
  10684. PyErr_WriteUnraisable(err);
  10685. res = 0;
  10686. }
  10687. }
  10688. __Pyx_ErrRestore(exception, value, tb);
  10689. return res;
  10690. }
  10691. #else
  10692. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  10693. int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
  10694. if (!res) {
  10695. res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  10696. }
  10697. return res;
  10698. }
  10699. #endif
  10700. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  10701. Py_ssize_t i, n;
  10702. assert(PyExceptionClass_Check(exc_type));
  10703. n = PyTuple_GET_SIZE(tuple);
  10704. #if PY_MAJOR_VERSION >= 3
  10705. for (i=0; i<n; i++) {
  10706. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  10707. }
  10708. #endif
  10709. for (i=0; i<n; i++) {
  10710. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  10711. #if PY_MAJOR_VERSION < 3
  10712. if (likely(exc_type == t)) return 1;
  10713. #endif
  10714. if (likely(PyExceptionClass_Check(t))) {
  10715. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  10716. } else {
  10717. }
  10718. }
  10719. return 0;
  10720. }
  10721. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  10722. if (likely(err == exc_type)) return 1;
  10723. if (likely(PyExceptionClass_Check(err))) {
  10724. if (likely(PyExceptionClass_Check(exc_type))) {
  10725. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  10726. } else if (likely(PyTuple_Check(exc_type))) {
  10727. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  10728. } else {
  10729. }
  10730. }
  10731. return PyErr_GivenExceptionMatches(err, exc_type);
  10732. }
  10733. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  10734. assert(PyExceptionClass_Check(exc_type1));
  10735. assert(PyExceptionClass_Check(exc_type2));
  10736. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  10737. if (likely(PyExceptionClass_Check(err))) {
  10738. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  10739. }
  10740. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  10741. }
  10742. #endif
  10743. /* CheckBinaryVersion */
  10744. static int __Pyx_check_binary_version(void) {
  10745. char ctversion[4], rtversion[4];
  10746. PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  10747. PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  10748. if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  10749. char message[200];
  10750. PyOS_snprintf(message, sizeof(message),
  10751. "compiletime version %s of module '%.100s' "
  10752. "does not match runtime version %s",
  10753. ctversion, __Pyx_MODULE_NAME, rtversion);
  10754. return PyErr_WarnEx(NULL, message, 1);
  10755. }
  10756. return 0;
  10757. }
  10758. /* InitStrings */
  10759. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  10760. while (t->p) {
  10761. #if PY_MAJOR_VERSION < 3
  10762. if (t->is_unicode) {
  10763. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  10764. } else if (t->intern) {
  10765. *t->p = PyString_InternFromString(t->s);
  10766. } else {
  10767. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  10768. }
  10769. #else
  10770. if (t->is_unicode | t->is_str) {
  10771. if (t->intern) {
  10772. *t->p = PyUnicode_InternFromString(t->s);
  10773. } else if (t->encoding) {
  10774. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  10775. } else {
  10776. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  10777. }
  10778. } else {
  10779. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  10780. }
  10781. #endif
  10782. if (!*t->p)
  10783. return -1;
  10784. if (PyObject_Hash(*t->p) == -1)
  10785. return -1;
  10786. ++t;
  10787. }
  10788. return 0;
  10789. }
  10790. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  10791. return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
  10792. }
  10793. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  10794. Py_ssize_t ignore;
  10795. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  10796. }
  10797. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  10798. #if !CYTHON_PEP393_ENABLED
  10799. static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  10800. char* defenc_c;
  10801. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  10802. if (!defenc) return NULL;
  10803. defenc_c = PyBytes_AS_STRING(defenc);
  10804. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  10805. {
  10806. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  10807. char* c;
  10808. for (c = defenc_c; c < end; c++) {
  10809. if ((unsigned char) (*c) >= 128) {
  10810. PyUnicode_AsASCIIString(o);
  10811. return NULL;
  10812. }
  10813. }
  10814. }
  10815. #endif
  10816. *length = PyBytes_GET_SIZE(defenc);
  10817. return defenc_c;
  10818. }
  10819. #else
  10820. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  10821. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  10822. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  10823. if (likely(PyUnicode_IS_ASCII(o))) {
  10824. *length = PyUnicode_GET_LENGTH(o);
  10825. return PyUnicode_AsUTF8(o);
  10826. } else {
  10827. PyUnicode_AsASCIIString(o);
  10828. return NULL;
  10829. }
  10830. #else
  10831. return PyUnicode_AsUTF8AndSize(o, length);
  10832. #endif
  10833. }
  10834. #endif
  10835. #endif
  10836. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  10837. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  10838. if (
  10839. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  10840. __Pyx_sys_getdefaultencoding_not_ascii &&
  10841. #endif
  10842. PyUnicode_Check(o)) {
  10843. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  10844. } else
  10845. #endif
  10846. #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
  10847. if (PyByteArray_Check(o)) {
  10848. *length = PyByteArray_GET_SIZE(o);
  10849. return PyByteArray_AS_STRING(o);
  10850. } else
  10851. #endif
  10852. {
  10853. char* result;
  10854. int r = PyBytes_AsStringAndSize(o, &result, length);
  10855. if (unlikely(r < 0)) {
  10856. return NULL;
  10857. } else {
  10858. return result;
  10859. }
  10860. }
  10861. }
  10862. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  10863. int is_true = x == Py_True;
  10864. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  10865. else return PyObject_IsTrue(x);
  10866. }
  10867. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  10868. int retval;
  10869. if (unlikely(!x)) return -1;
  10870. retval = __Pyx_PyObject_IsTrue(x);
  10871. Py_DECREF(x);
  10872. return retval;
  10873. }
  10874. static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
  10875. #if PY_MAJOR_VERSION >= 3
  10876. if (PyLong_Check(result)) {
  10877. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  10878. "__int__ returned non-int (type %.200s). "
  10879. "The ability to return an instance of a strict subclass of int "
  10880. "is deprecated, and may be removed in a future version of Python.",
  10881. Py_TYPE(result)->tp_name)) {
  10882. Py_DECREF(result);
  10883. return NULL;
  10884. }
  10885. return result;
  10886. }
  10887. #endif
  10888. PyErr_Format(PyExc_TypeError,
  10889. "__%.4s__ returned non-%.4s (type %.200s)",
  10890. type_name, type_name, Py_TYPE(result)->tp_name);
  10891. Py_DECREF(result);
  10892. return NULL;
  10893. }
  10894. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
  10895. #if CYTHON_USE_TYPE_SLOTS
  10896. PyNumberMethods *m;
  10897. #endif
  10898. const char *name = NULL;
  10899. PyObject *res = NULL;
  10900. #if PY_MAJOR_VERSION < 3
  10901. if (likely(PyInt_Check(x) || PyLong_Check(x)))
  10902. #else
  10903. if (likely(PyLong_Check(x)))
  10904. #endif
  10905. return __Pyx_NewRef(x);
  10906. #if CYTHON_USE_TYPE_SLOTS
  10907. m = Py_TYPE(x)->tp_as_number;
  10908. #if PY_MAJOR_VERSION < 3
  10909. if (m && m->nb_int) {
  10910. name = "int";
  10911. res = m->nb_int(x);
  10912. }
  10913. else if (m && m->nb_long) {
  10914. name = "long";
  10915. res = m->nb_long(x);
  10916. }
  10917. #else
  10918. if (likely(m && m->nb_int)) {
  10919. name = "int";
  10920. res = m->nb_int(x);
  10921. }
  10922. #endif
  10923. #else
  10924. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  10925. res = PyNumber_Int(x);
  10926. }
  10927. #endif
  10928. if (likely(res)) {
  10929. #if PY_MAJOR_VERSION < 3
  10930. if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
  10931. #else
  10932. if (unlikely(!PyLong_CheckExact(res))) {
  10933. #endif
  10934. return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
  10935. }
  10936. }
  10937. else if (!PyErr_Occurred()) {
  10938. PyErr_SetString(PyExc_TypeError,
  10939. "an integer is required");
  10940. }
  10941. return res;
  10942. }
  10943. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  10944. Py_ssize_t ival;
  10945. PyObject *x;
  10946. #if PY_MAJOR_VERSION < 3
  10947. if (likely(PyInt_CheckExact(b))) {
  10948. if (sizeof(Py_ssize_t) >= sizeof(long))
  10949. return PyInt_AS_LONG(b);
  10950. else
  10951. return PyInt_AsSsize_t(b);
  10952. }
  10953. #endif
  10954. if (likely(PyLong_CheckExact(b))) {
  10955. #if CYTHON_USE_PYLONG_INTERNALS
  10956. const digit* digits = ((PyLongObject*)b)->ob_digit;
  10957. const Py_ssize_t size = Py_SIZE(b);
  10958. if (likely(__Pyx_sst_abs(size) <= 1)) {
  10959. ival = likely(size) ? digits[0] : 0;
  10960. if (size == -1) ival = -ival;
  10961. return ival;
  10962. } else {
  10963. switch (size) {
  10964. case 2:
  10965. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  10966. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  10967. }
  10968. break;
  10969. case -2:
  10970. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  10971. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  10972. }
  10973. break;
  10974. case 3:
  10975. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  10976. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  10977. }
  10978. break;
  10979. case -3:
  10980. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  10981. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  10982. }
  10983. break;
  10984. case 4:
  10985. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  10986. 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]));
  10987. }
  10988. break;
  10989. case -4:
  10990. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  10991. 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]));
  10992. }
  10993. break;
  10994. }
  10995. }
  10996. #endif
  10997. return PyLong_AsSsize_t(b);
  10998. }
  10999. x = PyNumber_Index(b);
  11000. if (!x) return -1;
  11001. ival = PyInt_AsSsize_t(x);
  11002. Py_DECREF(x);
  11003. return ival;
  11004. }
  11005. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  11006. return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
  11007. }
  11008. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  11009. return PyInt_FromSize_t(ival);
  11010. }
  11011. #endif /* Py_PYTHON_H */