diff --git a/streaming_form_data/_parser.c b/streaming_form_data/_parser.c index d69a64dd..3247d936 100644 --- a/streaming_form_data/_parser.c +++ b/streaming_form_data/_parser.c @@ -1462,7 +1462,15 @@ typedef unsigned char __pyx_t_19streaming_form_data_7_parser_Byte; /*--- Type declarations ---*/ struct __pyx_obj_19streaming_form_data_7_parser_Finder; struct __pyx_obj_19streaming_form_data_7_parser_Part; +struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart; struct __pyx_obj_19streaming_form_data_7_parser__Parser; +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start; +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received; +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish; +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part; +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part; +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body; +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received; struct __pyx_obj___Pyx_EnumMeta; /* "streaming_form_data/_parser.pyx":20 @@ -1492,7 +1500,7 @@ enum __pyx_t_19streaming_form_data_7_parser_ErrorGroup { __pyx_e_19streaming_form_data_7_parser_UnexpectedPart = 0x190 }; -/* "streaming_form_data/_parser.pyx":127 +/* "streaming_form_data/_parser.pyx":162 * * * cdef enum ParserState: # <<<<<<<<<<<<<< @@ -1546,7 +1554,21 @@ struct __pyx_obj_19streaming_form_data_7_parser_Part { }; -/* "streaming_form_data/_parser.pyx":147 +/* "streaming_form_data/_parser.pyx":127 + * + * + * cdef class AsyncPart: # <<<<<<<<<<<<<< + * """One part of a multipart/form-data request + * """ + */ +struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart { + PyObject_HEAD + PyObject *name; + PyObject *targets; +}; + + +/* "streaming_form_data/_parser.pyx":182 * * * cdef class _Parser: # <<<<<<<<<<<<<< @@ -1570,6 +1592,113 @@ struct __pyx_obj_19streaming_form_data_7_parser__Parser { }; +/* "streaming_form_data/_parser.pyx":149 + * target.multipart_content_type = value + * + * async def start(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.start() + */ +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start { + PyObject_HEAD + struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self; + PyObject *__pyx_v_target; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; +}; + + +/* "streaming_form_data/_parser.pyx":153 + * await target.start() + * + * async def data_received(self, bytes chunk): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.data_received(chunk) + */ +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received { + PyObject_HEAD + PyObject *__pyx_v_chunk; + struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self; + PyObject *__pyx_v_target; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; +}; + + +/* "streaming_form_data/_parser.pyx":157 + * await target.data_received(chunk) + * + * async def finish(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.finish() + */ +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish { + PyObject_HEAD + struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self; + PyObject *__pyx_v_target; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; +}; + + +/* "streaming_form_data/_parser.pyx":229 + * self.active_part.start() + * + * async def async_set_active_part(self, part, str filename): # <<<<<<<<<<<<<< + * self.active_part = part + * self.active_part.set_multipart_filename(filename) + */ +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part { + PyObject_HEAD + PyObject *__pyx_v_filename; + PyObject *__pyx_v_part; + struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self; +}; + + +/* "streaming_form_data/_parser.pyx":239 + * self.active_part = None + * + * async def async_unset_active_part(self): # <<<<<<<<<<<<<< + * if self.active_part: + * await self.active_part.finish() + */ +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part { + PyObject_HEAD + struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self; +}; + + +/* "streaming_form_data/_parser.pyx":248 + * self.active_part.data_received(value) + * + * async def async_on_body(self, bytes value): # <<<<<<<<<<<<<< + * if self.active_part and len(value) > 0: + * await self.active_part.data_received(value) + */ +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body { + PyObject_HEAD + struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self; + PyObject *__pyx_v_value; +}; + + +/* "streaming_form_data/_parser.pyx":268 + * return self._parse(chunk, index) + * + * async def async_data_received(self, bytes data): # <<<<<<<<<<<<<< + * if not data: + * return 0 + */ +struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received { + PyObject_HEAD + PyObject *__pyx_v_chunk; + PyObject *__pyx_v_data; + size_t __pyx_v_index; + struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self; +}; + + /* "EnumBase":16 * * @cython.internal @@ -1602,7 +1731,7 @@ struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder { static struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *__pyx_vtabptr_19streaming_form_data_7_parser_Finder; -/* "streaming_form_data/_parser.pyx":147 +/* "streaming_form_data/_parser.pyx":182 * * * cdef class _Parser: # <<<<<<<<<<<<<< @@ -1612,6 +1741,7 @@ static struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *__pyx_vtab struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser { PyObject *(*_part_for)(struct __pyx_obj_19streaming_form_data_7_parser__Parser *, PyObject *); + PyObject *(*include_leftover_buffer)(struct __pyx_obj_19streaming_form_data_7_parser__Parser *, PyObject *); size_t (*rewind_fast_forward)(struct __pyx_obj_19streaming_form_data_7_parser__Parser *, __pyx_t_19streaming_form_data_7_parser_Byte const *, size_t, size_t); PyObject *(*mark_error)(struct __pyx_obj_19streaming_form_data_7_parser__Parser *); }; @@ -2039,6 +2169,48 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + /* PyObjectCall2Args.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); @@ -2048,9 +2220,138 @@ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **me /* PyObjectCallMethod1.proto */ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* CoroutineBase.proto */ +struct __pyx_CoroutineObject; +typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_ExcInfoStruct _PyErr_StackItem +#else +typedef struct { + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; +} __Pyx_ExcInfoStruct; +#endif +typedef struct __pyx_CoroutineObject { + PyObject_HEAD + __pyx_coroutine_body_t body; + PyObject *closure; + __Pyx_ExcInfoStruct gi_exc_state; + PyObject *gi_weakreflist; + PyObject *classobj; + PyObject *yieldfrom; + PyObject *gi_name; + PyObject *gi_qualname; + PyObject *gi_modulename; + PyObject *gi_code; + PyObject *gi_frame; + int resume_label; + char is_running; +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); +static int __Pyx_Coroutine_clear(PyObject *self); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static PyObject *__Pyx_Coroutine_Close(PyObject *self); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_Coroutine_SwapException(self) +#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) +#else +#define __Pyx_Coroutine_SwapException(self) {\ + __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ + __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ + } +#define __Pyx_Coroutine_ResetAndClearException(self) {\ + __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ + (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ + } +#endif +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) +#endif +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); + +/* PyObject_GenericGetAttrNoDict.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr +#endif + +/* PatchModuleWithCoroutine.proto */ +static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); + +/* PatchGeneratorABC.proto */ +static int __Pyx_patch_abc(void); + +/* Coroutine.proto */ +#define __Pyx_Coroutine_USED +#define __Pyx_Coroutine_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CoroutineType) +#define __Pyx_Coroutine_Check(obj) __Pyx_Coroutine_CheckExact(obj) +#define __Pyx_CoroutineAwait_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CoroutineAwaitType) +#define __Pyx_Coroutine_New(body, code, closure, name, qualname, module_name)\ + __Pyx__Coroutine_New(__pyx_CoroutineType, body, code, closure, name, qualname, module_name) +static int __pyx_Coroutine_init(PyObject *module); +static PyObject *__Pyx__Coroutine_await(PyObject *coroutine); +typedef struct { + PyObject_HEAD + PyObject *coroutine; +} __pyx_CoroutineAwaitObject; +static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self, PyObject *arg); +static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args); + +/* GetAwaitIter.proto */ +static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o); +static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *o); + +/* CoroutineYieldFrom.proto */ +static CYTHON_INLINE PyObject* __Pyx_Coroutine_Yield_From(__pyx_CoroutineObject *gen, PyObject *source); + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* pep479.proto */ +static void __Pyx_Generator_Replace_StopIteration(int in_async_gen); + /* append.proto */ static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* ReturnWithStopIteration.proto */ +#define __Pyx_ReturnWithStopIteration(value)\ + if (value == Py_None) PyErr_SetNone(PyExc_StopIteration); else __Pyx__ReturnWithStopIteration(value) +static void __Pyx__ReturnWithStopIteration(PyObject* value); + /* decode_c_string_utf16.proto */ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 0; @@ -2102,44 +2403,9 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); -#endif - -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif - -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - /* ExtTypeTest.proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); -/* IncludeStructmemberH.proto */ -#include - -/* FixUpExtensionType.proto */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); -#endif - -/* PyObjectCallNoArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); - /* PyObjectCallMethod0.proto */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); @@ -2151,13 +2417,6 @@ static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffs /* PyType_Ready.proto */ CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); -/* PyObject_GenericGetAttrNoDict.proto */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr -#endif - /* PyObject_GenericGetAttr.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); @@ -2181,16 +2440,6 @@ static int __Pyx_MergeVtables(PyTypeObject *type); static int __Pyx_setup_reduce(PyObject* type_obj); #endif -/* FetchSharedCythonModule.proto */ -static PyObject *__Pyx_FetchSharedCythonABIModule(void); - -/* FetchCommonType.proto */ -#if !CYTHON_USE_TYPE_SPECS -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); -#else -static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); -#endif - /* PyMethodNew.proto */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { @@ -2502,6 +2751,7 @@ static int __pyx_f_19streaming_form_data_7_parser_6Finder_active(struct __pyx_ob static int __pyx_f_19streaming_form_data_7_parser_6Finder_found(struct __pyx_obj_19streaming_form_data_7_parser_Finder *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ static size_t __pyx_f_19streaming_form_data_7_parser_6Finder_matched_length(struct __pyx_obj_19streaming_form_data_7_parser_Finder *__pyx_v_self); /* proto*/ static PyObject *__pyx_f_19streaming_form_data_7_parser_7_Parser__part_for(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_name); /* proto*/ +static PyObject *__pyx_f_19streaming_form_data_7_parser_7_Parser_include_leftover_buffer(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_data); /* proto*/ static size_t __pyx_f_19streaming_form_data_7_parser_7_Parser_rewind_fast_forward(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_v_chunk_ptr, size_t __pyx_v_pos_first, size_t __pyx_v_pos_last); /* proto*/ static PyObject *__pyx_f_19streaming_form_data_7_parser_7_Parser_mark_error(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self); /* proto*/ @@ -2516,6 +2766,7 @@ static PyObject *__Pyx_FlagBase = 0; static PyObject *__Pyx_globals = 0; static PyObject *__pyx_f_19streaming_form_data_7_parser___pyx_unpickle_Finder__set_state(struct __pyx_obj_19streaming_form_data_7_parser_Finder *, PyObject *); /*proto*/ static PyObject *__pyx_f_19streaming_form_data_7_parser___pyx_unpickle_Part__set_state(struct __pyx_obj_19streaming_form_data_7_parser_Part *, PyObject *); /*proto*/ +static PyObject *__pyx_f_19streaming_form_data_7_parser___pyx_unpickle_AsyncPart__set_state(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *, PyObject *); /*proto*/ static PyObject *__pyx_f_19streaming_form_data_7_parser___pyx_unpickle__Parser__set_state(struct __pyx_obj_19streaming_form_data_7_parser__Parser *, PyObject *); /*proto*/ static PyObject *__Pyx_Enum_54f4e2__19streaming_form_data_7_parser_enum__dunderpyx_t_19streaming_form_data_7_parser_ErrorGroup__etc_to_py(enum __pyx_t_19streaming_form_data_7_parser_ErrorGroup); /*proto*/ static PyObject *__pyx_unpickle___Pyx_EnumMeta__set_state(struct __pyx_obj___Pyx_EnumMeta *, PyObject *); /*proto*/ @@ -2532,9 +2783,9 @@ static PyObject *__pyx_builtin_ValueError; static const char __pyx_k_[] = ""; static const char __pyx_k_v[] = "v"; static const char __pyx_k__3[] = "."; -static const char __pyx_k__5[] = "\r\n"; static const char __pyx_k_gc[] = "gc"; -static const char __pyx_k__58[] = "?"; +static const char __pyx_k__12[] = "\r\n"; +static const char __pyx_k__71[] = "?"; static const char __pyx_k_cls[] = "cls"; static const char __pyx_k_dct[] = "dct"; static const char __pyx_k_doc[] = "__doc__"; @@ -2546,6 +2797,7 @@ static const char __pyx_k_s_s[] = "%s.%s"; static const char __pyx_k_str[] = "__str__"; static const char __pyx_k_HTTP[] = "HTTP"; static const char __pyx_k_Part[] = "Part"; +static const char __pyx_k_args[] = "args"; static const char __pyx_k_byte[] = "byte"; static const char __pyx_k_data[] = "data"; static const char __pyx_k_dict[] = "__dict__"; @@ -2557,9 +2809,12 @@ static const char __pyx_k_name[] = "name"; static const char __pyx_k_part[] = "part"; static const char __pyx_k_repr[] = "__repr__"; static const char __pyx_k_self[] = "self"; +static const char __pyx_k_send[] = "send"; static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_await[] = "__await__"; static const char __pyx_k_chunk[] = "chunk"; static const char __pyx_k_class[] = "__class__"; +static const char __pyx_k_close[] = "close"; static const char __pyx_k_ender[] = "ender"; static const char __pyx_k_found[] = "found"; static const char __pyx_k_index[] = "index"; @@ -2568,6 +2823,7 @@ static const char __pyx_k_s_s_d[] = "<%s.%s: %d>"; static const char __pyx_k_start[] = "start"; static const char __pyx_k_state[] = "state"; static const char __pyx_k_super[] = "super"; +static const char __pyx_k_throw[] = "throw"; static const char __pyx_k_value[] = "value"; static const char __pyx_k_Finder[] = "Finder"; static const char __pyx_k_Parser[] = "Parser"; @@ -2605,11 +2861,13 @@ static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_inactive[] = "inactive"; static const char __pyx_k_module_2[] = "module"; static const char __pyx_k_parsestr[] = "parsestr"; +static const char __pyx_k_part_cls[] = "part_cls"; static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_qualname[] = "__qualname__"; static const char __pyx_k_register[] = "register"; static const char __pyx_k_set_name[] = "__set_name__"; static const char __pyx_k_setstate[] = "__setstate__"; +static const char __pyx_k_AsyncPart[] = "AsyncPart"; static const char __pyx_k_chunk_len[] = "chunk_len"; static const char __pyx_k_chunk_ptr[] = "chunk_ptr"; static const char __pyx_k_delimiter[] = "delimiter"; @@ -2649,6 +2907,7 @@ static const char __pyx_k_stringsource[] = ""; static const char __pyx_k_use_setstate[] = "use_setstate"; static const char __pyx_k_Finder_active[] = "Finder.active"; static const char __pyx_k_Parser__parse[] = "_Parser._parse"; +static const char __pyx_k_async_on_body[] = "async_on_body"; static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_data_received[] = "data_received"; static const char __pyx_k_init_subclass[] = "__init_subclass__"; @@ -2656,12 +2915,15 @@ static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_Parser_on_body[] = "_Parser.on_body"; static const char __pyx_k_UnexpectedPart[] = "UnexpectedPart"; static const char __pyx_k_matched_length[] = "matched_length"; +static const char __pyx_k_AsyncPart_start[] = "AsyncPart.start"; static const char __pyx_k_Finder_inactive[] = "Finder.inactive"; static const char __pyx_k_Parser_register[] = "_Parser.register"; static const char __pyx_k_Part_add_target[] = "Part.add_target"; +static const char __pyx_k_is_async_target[] = "is_async_target"; static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; static const char __pyx_k_set_active_part[] = "set_active_part"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; +static const char __pyx_k_AsyncPart_finish[] = "AsyncPart.finish"; static const char __pyx_k_get_content_type[] = "get_content_type"; static const char __pyx_k_pyx_unpickle_Part[] = "__pyx_unpickle_Part"; static const char __pyx_k_unset_active_part[] = "unset_active_part"; @@ -2675,32 +2937,46 @@ static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_multipart_filename[] = "multipart_filename"; static const char __pyx_k_Pyx_EnumBase___repr[] = "__Pyx_EnumBase.__repr__"; static const char __pyx_k_Pyx_FlagBase___repr[] = "__Pyx_FlagBase.__repr__"; +static const char __pyx_k_async_data_received[] = "async_data_received"; static const char __pyx_k_content_disposition[] = "content-disposition"; static const char __pyx_k_pyx_unpickle_Finder[] = "__pyx_unpickle_Finder"; +static const char __pyx_k_AsyncPart_add_target[] = "AsyncPart.add_target"; +static const char __pyx_k_Parser_async_on_body[] = "_Parser.async_on_body"; static const char __pyx_k_Parser_data_received[] = "_Parser.data_received"; static const char __pyx_k_Part___reduce_cython[] = "Part.__reduce_cython__"; static const char __pyx_k_Unknown_enum_value_s[] = "Unknown enum value: '%s'"; static const char __pyx_k_pyx_unpickle__Parser[] = "__pyx_unpickle__Parser"; +static const char __pyx_k_async_set_active_part[] = "async_set_active_part"; static const char __pyx_k_Finder___reduce_cython[] = "Finder.__reduce_cython__"; static const char __pyx_k_Parser___reduce_cython[] = "_Parser.__reduce_cython__"; static const char __pyx_k_Parser_set_active_part[] = "_Parser.set_active_part"; static const char __pyx_k_Part___setstate_cython[] = "Part.__setstate_cython__"; static const char __pyx_k_multipart_content_type[] = "multipart_content_type"; +static const char __pyx_k_pyx_unpickle_AsyncPart[] = "__pyx_unpickle_AsyncPart"; static const char __pyx_k_set_multipart_filename[] = "set_multipart_filename"; +static const char __pyx_k_AsyncPart_data_received[] = "AsyncPart.data_received"; +static const char __pyx_k_async_unset_active_part[] = "async_unset_active_part"; static const char __pyx_k_get_content_disposition[] = "get_content_disposition"; static const char __pyx_k_Empty_values_not_allowed[] = "Empty values not allowed"; static const char __pyx_k_Finder___setstate_cython[] = "Finder.__setstate_cython__"; static const char __pyx_k_Parser___setstate_cython[] = "_Parser.__setstate_cython__"; static const char __pyx_k_Parser_unset_active_part[] = "_Parser.unset_active_part"; +static const char __pyx_k_AsyncPart___reduce_cython[] = "AsyncPart.__reduce_cython__"; +static const char __pyx_k_Parser_async_data_received[] = "_Parser.async_data_received"; static const char __pyx_k_set_multipart_content_type[] = "set_multipart_content_type"; +static const char __pyx_k_AsyncPart___setstate_cython[] = "AsyncPart.__setstate_cython__"; static const char __pyx_k_Part_set_multipart_filename[] = "Part.set_multipart_filename"; static const char __pyx_k_pyx_unpickle___Pyx_EnumMeta[] = "__pyx_unpickle___Pyx_EnumMeta"; static const char __pyx_k_streaming_form_data__parser[] = "streaming_form_data._parser"; static const char __pyx_k_streaming_form_data_targets[] = "streaming_form_data.targets"; +static const char __pyx_k_Parser_async_set_active_part[] = "_Parser.async_set_active_part"; static const char __pyx_k_Pyx_EnumMeta___reduce_cython[] = "__Pyx_EnumMeta.__reduce_cython__"; +static const char __pyx_k_Parser_async_unset_active_part[] = "_Parser.async_unset_active_part"; static const char __pyx_k_Pyx_EnumMeta___setstate_cython[] = "__Pyx_EnumMeta.__setstate_cython__"; +static const char __pyx_k_AsyncPart_set_multipart_content[] = "AsyncPart.set_multipart_content_type"; static const char __pyx_k_Part_set_multipart_content_type[] = "Part.set_multipart_content_type"; static const char __pyx_k_streaming_form_data__parser_pyx[] = "streaming_form_data/_parser.pyx"; +static const char __pyx_k_AsyncPart_set_multipart_filename[] = "AsyncPart.set_multipart_filename"; static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())"; static const char __pyx_k_Incompatible_checksums_0x_x_vs_0_2[] = "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))"; static const char __pyx_k_Incompatible_checksums_0x_x_vs_0_3[] = "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))"; @@ -2738,24 +3014,49 @@ static int __pyx_pf_19streaming_form_data_7_parser_4Part_4name_2__set__(struct _ static int __pyx_pf_19streaming_form_data_7_parser_4Part_4name_4__del__(struct __pyx_obj_19streaming_form_data_7_parser_Part *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_19streaming_form_data_7_parser_4Part_14__reduce_cython__(struct __pyx_obj_19streaming_form_data_7_parser_Part *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_19streaming_form_data_7_parser_4Part_16__setstate_cython__(struct __pyx_obj_19streaming_form_data_7_parser_Part *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_19streaming_form_data_7_parser_9AsyncPart___init__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_target); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_2add_target(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_target); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4set_multipart_filename(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_6set_multipart_content_type(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_8start(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_11data_received(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_chunk); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_14finish(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4name___get__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self); /* proto */ +static int __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4name_2__set__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4name_4__del__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_17__reduce_cython__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_19__setstate_cython__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_19streaming_form_data_7_parser_7_Parser___init__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_delimiter, PyObject *__pyx_v_ender, int __pyx_v_strict); /* proto */ static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_2register(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_target); /* proto */ static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_4set_active_part(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_part, PyObject *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_6unset_active_part(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_8on_body(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_10data_received(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_12_parse(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_chunk, size_t __pyx_v_index); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_6async_set_active_part(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_part, PyObject *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_9unset_active_part(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_11async_unset_active_part(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_14on_body(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_16async_on_body(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_19data_received(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_21async_data_received(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_24_parse(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_chunk, size_t __pyx_v_index); /* proto */ static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name___get__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self); /* proto */ static int __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_2__set__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ static int __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_4__del__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_14__reduce_cython__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_16__setstate_cython__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_26__reduce_cython__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_28__setstate_cython__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_19streaming_form_data_7_parser___pyx_unpickle_Finder(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_19streaming_form_data_7_parser_2__pyx_unpickle_Part(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_19streaming_form_data_7_parser_4__pyx_unpickle__Parser(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_4__pyx_unpickle_AsyncPart(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_19streaming_form_data_7_parser_6__pyx_unpickle__Parser(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_19streaming_form_data_7_parser_Finder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_19streaming_form_data_7_parser_Part(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser_AsyncPart(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_19streaming_form_data_7_parser__Parser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct__start(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_2_finish(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, 0, 0, 0, 0}; /* #### Code section: late_includes ### */ /* #### Code section: module_state ### */ @@ -2787,15 +3088,40 @@ typedef struct { #if CYTHON_USE_MODULE_STATE PyObject *__pyx_type_19streaming_form_data_7_parser_Finder; PyObject *__pyx_type_19streaming_form_data_7_parser_Part; + PyObject *__pyx_type_19streaming_form_data_7_parser_AsyncPart; PyObject *__pyx_type_19streaming_form_data_7_parser__Parser; + PyObject *__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start; + PyObject *__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received; + PyObject *__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish; + PyObject *__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part; + PyObject *__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part; + PyObject *__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body; + PyObject *__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received; PyObject *__Pyx_EnumMeta; #endif PyTypeObject *__pyx_ptype_19streaming_form_data_7_parser_Finder; PyTypeObject *__pyx_ptype_19streaming_form_data_7_parser_Part; + PyTypeObject *__pyx_ptype_19streaming_form_data_7_parser_AsyncPart; PyTypeObject *__pyx_ptype_19streaming_form_data_7_parser__Parser; + PyTypeObject *__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start; + PyTypeObject *__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received; + PyTypeObject *__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish; + PyTypeObject *__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part; + PyTypeObject *__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part; + PyTypeObject *__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body; + PyTypeObject *__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received; PyTypeObject *__pyx_ptype___Pyx_EnumMeta; PyObject *__pyx_kp_s_; PyObject *__pyx_kp_u_; + PyObject *__pyx_n_s_AsyncPart; + PyObject *__pyx_n_s_AsyncPart___reduce_cython; + PyObject *__pyx_n_s_AsyncPart___setstate_cython; + PyObject *__pyx_n_s_AsyncPart_add_target; + PyObject *__pyx_n_s_AsyncPart_data_received; + PyObject *__pyx_n_s_AsyncPart_finish; + PyObject *__pyx_n_s_AsyncPart_set_multipart_content; + PyObject *__pyx_n_s_AsyncPart_set_multipart_filename; + PyObject *__pyx_n_s_AsyncPart_start; PyObject *__pyx_n_s_Delimiting; PyObject *__pyx_kp_u_Empty_values_not_allowed; PyObject *__pyx_n_s_EnumBase; @@ -2823,6 +3149,10 @@ typedef struct { PyObject *__pyx_n_s_Parser___reduce_cython; PyObject *__pyx_n_s_Parser___setstate_cython; PyObject *__pyx_n_s_Parser__parse; + PyObject *__pyx_n_s_Parser_async_data_received; + PyObject *__pyx_n_s_Parser_async_on_body; + PyObject *__pyx_n_s_Parser_async_set_active_part; + PyObject *__pyx_n_s_Parser_async_unset_active_part; PyObject *__pyx_n_s_Parser_data_received; PyObject *__pyx_n_s_Parser_on_body; PyObject *__pyx_n_s_Parser_register; @@ -2852,13 +3182,19 @@ typedef struct { PyObject *__pyx_n_s_UnexpectedPart; PyObject *__pyx_kp_s_Unknown_enum_value_s; PyObject *__pyx_n_s_ValueError; + PyObject *__pyx_kp_b__12; PyObject *__pyx_kp_u__3; - PyObject *__pyx_kp_b__5; - PyObject *__pyx_n_s__58; + PyObject *__pyx_n_s__71; PyObject *__pyx_n_s_active; PyObject *__pyx_n_s_add_target; PyObject *__pyx_n_s_append; + PyObject *__pyx_n_s_args; + PyObject *__pyx_n_s_async_data_received; + PyObject *__pyx_n_s_async_on_body; + PyObject *__pyx_n_s_async_set_active_part; + PyObject *__pyx_n_s_async_unset_active_part; PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_await; PyObject *__pyx_n_s_buffer_start; PyObject *__pyx_n_s_byte; PyObject *__pyx_n_s_chunk; @@ -2867,6 +3203,7 @@ typedef struct { PyObject *__pyx_n_s_class; PyObject *__pyx_n_s_class_getitem; PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_close; PyObject *__pyx_n_s_cls; PyObject *__pyx_n_s_collections; PyObject *__pyx_kp_u_content_disposition; @@ -2902,6 +3239,7 @@ typedef struct { PyObject *__pyx_n_s_index; PyObject *__pyx_n_s_init; PyObject *__pyx_n_s_init_subclass; + PyObject *__pyx_n_s_is_async_target; PyObject *__pyx_n_s_is_coroutine; PyObject *__pyx_kp_u_isenabled; PyObject *__pyx_n_s_main; @@ -2926,6 +3264,7 @@ typedef struct { PyObject *__pyx_n_s_parse; PyObject *__pyx_n_s_parsestr; PyObject *__pyx_n_s_part; + PyObject *__pyx_n_s_part_cls; PyObject *__pyx_n_s_pickle; PyObject *__pyx_n_s_policy; PyObject *__pyx_n_s_prepare; @@ -2934,6 +3273,7 @@ typedef struct { PyObject *__pyx_n_s_pyx_result; PyObject *__pyx_n_s_pyx_state; PyObject *__pyx_n_s_pyx_type; + PyObject *__pyx_n_s_pyx_unpickle_AsyncPart; PyObject *__pyx_n_s_pyx_unpickle_Finder; PyObject *__pyx_n_s_pyx_unpickle_Part; PyObject *__pyx_n_s_pyx_unpickle__Parser; @@ -2949,6 +3289,7 @@ typedef struct { PyObject *__pyx_kp_s_s_s; PyObject *__pyx_kp_s_s_s_d; PyObject *__pyx_n_s_self; + PyObject *__pyx_n_s_send; PyObject *__pyx_n_s_set_active_part; PyObject *__pyx_n_s_set_multipart_content_type; PyObject *__pyx_n_s_set_multipart_filename; @@ -2959,7 +3300,7 @@ typedef struct { PyObject *__pyx_n_s_start; PyObject *__pyx_n_s_state; PyObject *__pyx_n_s_str; - PyObject *__pyx_kp_s_streaming_form_data__parser; + PyObject *__pyx_n_s_streaming_form_data__parser; PyObject *__pyx_kp_s_streaming_form_data__parser_pyx; PyObject *__pyx_n_s_streaming_form_data_targets; PyObject *__pyx_n_s_strict; @@ -2967,6 +3308,7 @@ typedef struct { PyObject *__pyx_n_s_super; PyObject *__pyx_n_s_target; PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_throw; PyObject *__pyx_n_s_unset_active_part; PyObject *__pyx_n_s_update; PyObject *__pyx_n_s_use_setstate; @@ -2988,58 +3330,71 @@ typedef struct { PyObject *__pyx_int_248083859; PyObject *__pyx_tuple__2; PyObject *__pyx_tuple__4; - PyObject *__pyx_tuple__6; - PyObject *__pyx_tuple__7; - PyObject *__pyx_tuple__8; - PyObject *__pyx_tuple__9; - PyObject *__pyx_tuple__11; PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__14; PyObject *__pyx_tuple__15; PyObject *__pyx_tuple__16; + PyObject *__pyx_tuple__18; + PyObject *__pyx_tuple__20; PyObject *__pyx_tuple__22; - PyObject *__pyx_tuple__24; + PyObject *__pyx_tuple__23; + PyObject *__pyx_tuple__29; PyObject *__pyx_tuple__31; - PyObject *__pyx_tuple__33; - PyObject *__pyx_tuple__37; - PyObject *__pyx_tuple__42; + PyObject *__pyx_tuple__38; + PyObject *__pyx_tuple__40; PyObject *__pyx_tuple__44; - PyObject *__pyx_tuple__47; - PyObject *__pyx_tuple__49; - PyObject *__pyx_tuple__51; + PyObject *__pyx_tuple__54; + PyObject *__pyx_tuple__56; + PyObject *__pyx_tuple__59; + PyObject *__pyx_tuple__61; + PyObject *__pyx_tuple__63; + PyObject *__pyx_codeobj__5; + PyObject *__pyx_codeobj__6; + PyObject *__pyx_codeobj__7; + PyObject *__pyx_codeobj__8; + PyObject *__pyx_codeobj__9; PyObject *__pyx_codeobj__10; - PyObject *__pyx_codeobj__12; - PyObject *__pyx_codeobj__14; + PyObject *__pyx_codeobj__11; PyObject *__pyx_codeobj__17; - PyObject *__pyx_codeobj__18; PyObject *__pyx_codeobj__19; - PyObject *__pyx_codeobj__20; PyObject *__pyx_codeobj__21; - PyObject *__pyx_codeobj__23; + PyObject *__pyx_codeobj__24; PyObject *__pyx_codeobj__25; PyObject *__pyx_codeobj__26; PyObject *__pyx_codeobj__27; PyObject *__pyx_codeobj__28; - PyObject *__pyx_codeobj__29; PyObject *__pyx_codeobj__30; PyObject *__pyx_codeobj__32; + PyObject *__pyx_codeobj__33; PyObject *__pyx_codeobj__34; PyObject *__pyx_codeobj__35; PyObject *__pyx_codeobj__36; - PyObject *__pyx_codeobj__38; + PyObject *__pyx_codeobj__37; PyObject *__pyx_codeobj__39; - PyObject *__pyx_codeobj__40; PyObject *__pyx_codeobj__41; + PyObject *__pyx_codeobj__42; PyObject *__pyx_codeobj__43; PyObject *__pyx_codeobj__45; PyObject *__pyx_codeobj__46; + PyObject *__pyx_codeobj__47; PyObject *__pyx_codeobj__48; + PyObject *__pyx_codeobj__49; PyObject *__pyx_codeobj__50; + PyObject *__pyx_codeobj__51; PyObject *__pyx_codeobj__52; PyObject *__pyx_codeobj__53; - PyObject *__pyx_codeobj__54; PyObject *__pyx_codeobj__55; - PyObject *__pyx_codeobj__56; PyObject *__pyx_codeobj__57; + PyObject *__pyx_codeobj__58; + PyObject *__pyx_codeobj__60; + PyObject *__pyx_codeobj__62; + PyObject *__pyx_codeobj__64; + PyObject *__pyx_codeobj__65; + PyObject *__pyx_codeobj__66; + PyObject *__pyx_codeobj__67; + PyObject *__pyx_codeobj__68; + PyObject *__pyx_codeobj__69; + PyObject *__pyx_codeobj__70; } __pyx_mstate; #if CYTHON_USE_MODULE_STATE @@ -3086,12 +3441,37 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_type_19streaming_form_data_7_parser_Finder); Py_CLEAR(clear_module_state->__pyx_ptype_19streaming_form_data_7_parser_Part); Py_CLEAR(clear_module_state->__pyx_type_19streaming_form_data_7_parser_Part); + Py_CLEAR(clear_module_state->__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + Py_CLEAR(clear_module_state->__pyx_type_19streaming_form_data_7_parser_AsyncPart); Py_CLEAR(clear_module_state->__pyx_ptype_19streaming_form_data_7_parser__Parser); Py_CLEAR(clear_module_state->__pyx_type_19streaming_form_data_7_parser__Parser); + Py_CLEAR(clear_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start); + Py_CLEAR(clear_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start); + Py_CLEAR(clear_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received); + Py_CLEAR(clear_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received); + Py_CLEAR(clear_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish); + Py_CLEAR(clear_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish); + Py_CLEAR(clear_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part); + Py_CLEAR(clear_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part); + Py_CLEAR(clear_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part); + Py_CLEAR(clear_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part); + Py_CLEAR(clear_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body); + Py_CLEAR(clear_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body); + Py_CLEAR(clear_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received); + Py_CLEAR(clear_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received); Py_CLEAR(clear_module_state->__pyx_ptype___Pyx_EnumMeta); Py_CLEAR(clear_module_state->__Pyx_EnumMeta); Py_CLEAR(clear_module_state->__pyx_kp_s_); Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_n_s_AsyncPart); + Py_CLEAR(clear_module_state->__pyx_n_s_AsyncPart___reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_AsyncPart___setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_AsyncPart_add_target); + Py_CLEAR(clear_module_state->__pyx_n_s_AsyncPart_data_received); + Py_CLEAR(clear_module_state->__pyx_n_s_AsyncPart_finish); + Py_CLEAR(clear_module_state->__pyx_n_s_AsyncPart_set_multipart_content); + Py_CLEAR(clear_module_state->__pyx_n_s_AsyncPart_set_multipart_filename); + Py_CLEAR(clear_module_state->__pyx_n_s_AsyncPart_start); Py_CLEAR(clear_module_state->__pyx_n_s_Delimiting); Py_CLEAR(clear_module_state->__pyx_kp_u_Empty_values_not_allowed); Py_CLEAR(clear_module_state->__pyx_n_s_EnumBase); @@ -3119,6 +3499,10 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_Parser___reduce_cython); Py_CLEAR(clear_module_state->__pyx_n_s_Parser___setstate_cython); Py_CLEAR(clear_module_state->__pyx_n_s_Parser__parse); + Py_CLEAR(clear_module_state->__pyx_n_s_Parser_async_data_received); + Py_CLEAR(clear_module_state->__pyx_n_s_Parser_async_on_body); + Py_CLEAR(clear_module_state->__pyx_n_s_Parser_async_set_active_part); + Py_CLEAR(clear_module_state->__pyx_n_s_Parser_async_unset_active_part); Py_CLEAR(clear_module_state->__pyx_n_s_Parser_data_received); Py_CLEAR(clear_module_state->__pyx_n_s_Parser_on_body); Py_CLEAR(clear_module_state->__pyx_n_s_Parser_register); @@ -3148,13 +3532,19 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_UnexpectedPart); Py_CLEAR(clear_module_state->__pyx_kp_s_Unknown_enum_value_s); Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); + Py_CLEAR(clear_module_state->__pyx_kp_b__12); Py_CLEAR(clear_module_state->__pyx_kp_u__3); - Py_CLEAR(clear_module_state->__pyx_kp_b__5); - Py_CLEAR(clear_module_state->__pyx_n_s__58); + Py_CLEAR(clear_module_state->__pyx_n_s__71); Py_CLEAR(clear_module_state->__pyx_n_s_active); Py_CLEAR(clear_module_state->__pyx_n_s_add_target); Py_CLEAR(clear_module_state->__pyx_n_s_append); + Py_CLEAR(clear_module_state->__pyx_n_s_args); + Py_CLEAR(clear_module_state->__pyx_n_s_async_data_received); + Py_CLEAR(clear_module_state->__pyx_n_s_async_on_body); + Py_CLEAR(clear_module_state->__pyx_n_s_async_set_active_part); + Py_CLEAR(clear_module_state->__pyx_n_s_async_unset_active_part); Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_await); Py_CLEAR(clear_module_state->__pyx_n_s_buffer_start); Py_CLEAR(clear_module_state->__pyx_n_s_byte); Py_CLEAR(clear_module_state->__pyx_n_s_chunk); @@ -3163,6 +3553,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_class); Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_close); Py_CLEAR(clear_module_state->__pyx_n_s_cls); Py_CLEAR(clear_module_state->__pyx_n_s_collections); Py_CLEAR(clear_module_state->__pyx_kp_u_content_disposition); @@ -3198,6 +3589,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_index); Py_CLEAR(clear_module_state->__pyx_n_s_init); Py_CLEAR(clear_module_state->__pyx_n_s_init_subclass); + Py_CLEAR(clear_module_state->__pyx_n_s_is_async_target); Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); Py_CLEAR(clear_module_state->__pyx_n_s_main); @@ -3222,6 +3614,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_parse); Py_CLEAR(clear_module_state->__pyx_n_s_parsestr); Py_CLEAR(clear_module_state->__pyx_n_s_part); + Py_CLEAR(clear_module_state->__pyx_n_s_part_cls); Py_CLEAR(clear_module_state->__pyx_n_s_pickle); Py_CLEAR(clear_module_state->__pyx_n_s_policy); Py_CLEAR(clear_module_state->__pyx_n_s_prepare); @@ -3230,6 +3623,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_AsyncPart); Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Finder); Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Part); Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle__Parser); @@ -3245,6 +3639,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_kp_s_s_s); Py_CLEAR(clear_module_state->__pyx_kp_s_s_s_d); Py_CLEAR(clear_module_state->__pyx_n_s_self); + Py_CLEAR(clear_module_state->__pyx_n_s_send); Py_CLEAR(clear_module_state->__pyx_n_s_set_active_part); Py_CLEAR(clear_module_state->__pyx_n_s_set_multipart_content_type); Py_CLEAR(clear_module_state->__pyx_n_s_set_multipart_filename); @@ -3255,7 +3650,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_start); Py_CLEAR(clear_module_state->__pyx_n_s_state); Py_CLEAR(clear_module_state->__pyx_n_s_str); - Py_CLEAR(clear_module_state->__pyx_kp_s_streaming_form_data__parser); + Py_CLEAR(clear_module_state->__pyx_n_s_streaming_form_data__parser); Py_CLEAR(clear_module_state->__pyx_kp_s_streaming_form_data__parser_pyx); Py_CLEAR(clear_module_state->__pyx_n_s_streaming_form_data_targets); Py_CLEAR(clear_module_state->__pyx_n_s_strict); @@ -3263,6 +3658,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_super); Py_CLEAR(clear_module_state->__pyx_n_s_target); Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_throw); Py_CLEAR(clear_module_state->__pyx_n_s_unset_active_part); Py_CLEAR(clear_module_state->__pyx_n_s_update); Py_CLEAR(clear_module_state->__pyx_n_s_use_setstate); @@ -3284,58 +3680,71 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_int_248083859); Py_CLEAR(clear_module_state->__pyx_tuple__2); Py_CLEAR(clear_module_state->__pyx_tuple__4); - Py_CLEAR(clear_module_state->__pyx_tuple__6); - Py_CLEAR(clear_module_state->__pyx_tuple__7); - Py_CLEAR(clear_module_state->__pyx_tuple__8); - Py_CLEAR(clear_module_state->__pyx_tuple__9); - Py_CLEAR(clear_module_state->__pyx_tuple__11); Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__14); Py_CLEAR(clear_module_state->__pyx_tuple__15); Py_CLEAR(clear_module_state->__pyx_tuple__16); + Py_CLEAR(clear_module_state->__pyx_tuple__18); + Py_CLEAR(clear_module_state->__pyx_tuple__20); Py_CLEAR(clear_module_state->__pyx_tuple__22); - Py_CLEAR(clear_module_state->__pyx_tuple__24); + Py_CLEAR(clear_module_state->__pyx_tuple__23); + Py_CLEAR(clear_module_state->__pyx_tuple__29); Py_CLEAR(clear_module_state->__pyx_tuple__31); - Py_CLEAR(clear_module_state->__pyx_tuple__33); - Py_CLEAR(clear_module_state->__pyx_tuple__37); - Py_CLEAR(clear_module_state->__pyx_tuple__42); + Py_CLEAR(clear_module_state->__pyx_tuple__38); + Py_CLEAR(clear_module_state->__pyx_tuple__40); Py_CLEAR(clear_module_state->__pyx_tuple__44); - Py_CLEAR(clear_module_state->__pyx_tuple__47); - Py_CLEAR(clear_module_state->__pyx_tuple__49); - Py_CLEAR(clear_module_state->__pyx_tuple__51); + Py_CLEAR(clear_module_state->__pyx_tuple__54); + Py_CLEAR(clear_module_state->__pyx_tuple__56); + Py_CLEAR(clear_module_state->__pyx_tuple__59); + Py_CLEAR(clear_module_state->__pyx_tuple__61); + Py_CLEAR(clear_module_state->__pyx_tuple__63); + Py_CLEAR(clear_module_state->__pyx_codeobj__5); + Py_CLEAR(clear_module_state->__pyx_codeobj__6); + Py_CLEAR(clear_module_state->__pyx_codeobj__7); + Py_CLEAR(clear_module_state->__pyx_codeobj__8); + Py_CLEAR(clear_module_state->__pyx_codeobj__9); Py_CLEAR(clear_module_state->__pyx_codeobj__10); - Py_CLEAR(clear_module_state->__pyx_codeobj__12); - Py_CLEAR(clear_module_state->__pyx_codeobj__14); + Py_CLEAR(clear_module_state->__pyx_codeobj__11); Py_CLEAR(clear_module_state->__pyx_codeobj__17); - Py_CLEAR(clear_module_state->__pyx_codeobj__18); Py_CLEAR(clear_module_state->__pyx_codeobj__19); - Py_CLEAR(clear_module_state->__pyx_codeobj__20); Py_CLEAR(clear_module_state->__pyx_codeobj__21); - Py_CLEAR(clear_module_state->__pyx_codeobj__23); + Py_CLEAR(clear_module_state->__pyx_codeobj__24); Py_CLEAR(clear_module_state->__pyx_codeobj__25); Py_CLEAR(clear_module_state->__pyx_codeobj__26); Py_CLEAR(clear_module_state->__pyx_codeobj__27); Py_CLEAR(clear_module_state->__pyx_codeobj__28); - Py_CLEAR(clear_module_state->__pyx_codeobj__29); Py_CLEAR(clear_module_state->__pyx_codeobj__30); Py_CLEAR(clear_module_state->__pyx_codeobj__32); + Py_CLEAR(clear_module_state->__pyx_codeobj__33); Py_CLEAR(clear_module_state->__pyx_codeobj__34); Py_CLEAR(clear_module_state->__pyx_codeobj__35); Py_CLEAR(clear_module_state->__pyx_codeobj__36); - Py_CLEAR(clear_module_state->__pyx_codeobj__38); + Py_CLEAR(clear_module_state->__pyx_codeobj__37); Py_CLEAR(clear_module_state->__pyx_codeobj__39); - Py_CLEAR(clear_module_state->__pyx_codeobj__40); Py_CLEAR(clear_module_state->__pyx_codeobj__41); + Py_CLEAR(clear_module_state->__pyx_codeobj__42); Py_CLEAR(clear_module_state->__pyx_codeobj__43); Py_CLEAR(clear_module_state->__pyx_codeobj__45); Py_CLEAR(clear_module_state->__pyx_codeobj__46); + Py_CLEAR(clear_module_state->__pyx_codeobj__47); Py_CLEAR(clear_module_state->__pyx_codeobj__48); + Py_CLEAR(clear_module_state->__pyx_codeobj__49); Py_CLEAR(clear_module_state->__pyx_codeobj__50); + Py_CLEAR(clear_module_state->__pyx_codeobj__51); Py_CLEAR(clear_module_state->__pyx_codeobj__52); Py_CLEAR(clear_module_state->__pyx_codeobj__53); - Py_CLEAR(clear_module_state->__pyx_codeobj__54); Py_CLEAR(clear_module_state->__pyx_codeobj__55); - Py_CLEAR(clear_module_state->__pyx_codeobj__56); Py_CLEAR(clear_module_state->__pyx_codeobj__57); + Py_CLEAR(clear_module_state->__pyx_codeobj__58); + Py_CLEAR(clear_module_state->__pyx_codeobj__60); + Py_CLEAR(clear_module_state->__pyx_codeobj__62); + Py_CLEAR(clear_module_state->__pyx_codeobj__64); + Py_CLEAR(clear_module_state->__pyx_codeobj__65); + Py_CLEAR(clear_module_state->__pyx_codeobj__66); + Py_CLEAR(clear_module_state->__pyx_codeobj__67); + Py_CLEAR(clear_module_state->__pyx_codeobj__68); + Py_CLEAR(clear_module_state->__pyx_codeobj__69); + Py_CLEAR(clear_module_state->__pyx_codeobj__70); return 0; } #endif @@ -3360,12 +3769,37 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_type_19streaming_form_data_7_parser_Finder); Py_VISIT(traverse_module_state->__pyx_ptype_19streaming_form_data_7_parser_Part); Py_VISIT(traverse_module_state->__pyx_type_19streaming_form_data_7_parser_Part); + Py_VISIT(traverse_module_state->__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + Py_VISIT(traverse_module_state->__pyx_type_19streaming_form_data_7_parser_AsyncPart); Py_VISIT(traverse_module_state->__pyx_ptype_19streaming_form_data_7_parser__Parser); Py_VISIT(traverse_module_state->__pyx_type_19streaming_form_data_7_parser__Parser); + Py_VISIT(traverse_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start); + Py_VISIT(traverse_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start); + Py_VISIT(traverse_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received); + Py_VISIT(traverse_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received); + Py_VISIT(traverse_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish); + Py_VISIT(traverse_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish); + Py_VISIT(traverse_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part); + Py_VISIT(traverse_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part); + Py_VISIT(traverse_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part); + Py_VISIT(traverse_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part); + Py_VISIT(traverse_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body); + Py_VISIT(traverse_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body); + Py_VISIT(traverse_module_state->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received); + Py_VISIT(traverse_module_state->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received); Py_VISIT(traverse_module_state->__pyx_ptype___Pyx_EnumMeta); Py_VISIT(traverse_module_state->__Pyx_EnumMeta); Py_VISIT(traverse_module_state->__pyx_kp_s_); Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_n_s_AsyncPart); + Py_VISIT(traverse_module_state->__pyx_n_s_AsyncPart___reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_AsyncPart___setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_AsyncPart_add_target); + Py_VISIT(traverse_module_state->__pyx_n_s_AsyncPart_data_received); + Py_VISIT(traverse_module_state->__pyx_n_s_AsyncPart_finish); + Py_VISIT(traverse_module_state->__pyx_n_s_AsyncPart_set_multipart_content); + Py_VISIT(traverse_module_state->__pyx_n_s_AsyncPart_set_multipart_filename); + Py_VISIT(traverse_module_state->__pyx_n_s_AsyncPart_start); Py_VISIT(traverse_module_state->__pyx_n_s_Delimiting); Py_VISIT(traverse_module_state->__pyx_kp_u_Empty_values_not_allowed); Py_VISIT(traverse_module_state->__pyx_n_s_EnumBase); @@ -3393,6 +3827,10 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_Parser___reduce_cython); Py_VISIT(traverse_module_state->__pyx_n_s_Parser___setstate_cython); Py_VISIT(traverse_module_state->__pyx_n_s_Parser__parse); + Py_VISIT(traverse_module_state->__pyx_n_s_Parser_async_data_received); + Py_VISIT(traverse_module_state->__pyx_n_s_Parser_async_on_body); + Py_VISIT(traverse_module_state->__pyx_n_s_Parser_async_set_active_part); + Py_VISIT(traverse_module_state->__pyx_n_s_Parser_async_unset_active_part); Py_VISIT(traverse_module_state->__pyx_n_s_Parser_data_received); Py_VISIT(traverse_module_state->__pyx_n_s_Parser_on_body); Py_VISIT(traverse_module_state->__pyx_n_s_Parser_register); @@ -3422,13 +3860,19 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_UnexpectedPart); Py_VISIT(traverse_module_state->__pyx_kp_s_Unknown_enum_value_s); Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); + Py_VISIT(traverse_module_state->__pyx_kp_b__12); Py_VISIT(traverse_module_state->__pyx_kp_u__3); - Py_VISIT(traverse_module_state->__pyx_kp_b__5); - Py_VISIT(traverse_module_state->__pyx_n_s__58); + Py_VISIT(traverse_module_state->__pyx_n_s__71); Py_VISIT(traverse_module_state->__pyx_n_s_active); Py_VISIT(traverse_module_state->__pyx_n_s_add_target); Py_VISIT(traverse_module_state->__pyx_n_s_append); + Py_VISIT(traverse_module_state->__pyx_n_s_args); + Py_VISIT(traverse_module_state->__pyx_n_s_async_data_received); + Py_VISIT(traverse_module_state->__pyx_n_s_async_on_body); + Py_VISIT(traverse_module_state->__pyx_n_s_async_set_active_part); + Py_VISIT(traverse_module_state->__pyx_n_s_async_unset_active_part); Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_await); Py_VISIT(traverse_module_state->__pyx_n_s_buffer_start); Py_VISIT(traverse_module_state->__pyx_n_s_byte); Py_VISIT(traverse_module_state->__pyx_n_s_chunk); @@ -3437,6 +3881,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_class); Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_close); Py_VISIT(traverse_module_state->__pyx_n_s_cls); Py_VISIT(traverse_module_state->__pyx_n_s_collections); Py_VISIT(traverse_module_state->__pyx_kp_u_content_disposition); @@ -3472,6 +3917,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_index); Py_VISIT(traverse_module_state->__pyx_n_s_init); Py_VISIT(traverse_module_state->__pyx_n_s_init_subclass); + Py_VISIT(traverse_module_state->__pyx_n_s_is_async_target); Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); Py_VISIT(traverse_module_state->__pyx_n_s_main); @@ -3496,6 +3942,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_parse); Py_VISIT(traverse_module_state->__pyx_n_s_parsestr); Py_VISIT(traverse_module_state->__pyx_n_s_part); + Py_VISIT(traverse_module_state->__pyx_n_s_part_cls); Py_VISIT(traverse_module_state->__pyx_n_s_pickle); Py_VISIT(traverse_module_state->__pyx_n_s_policy); Py_VISIT(traverse_module_state->__pyx_n_s_prepare); @@ -3504,6 +3951,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_AsyncPart); Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Finder); Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Part); Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle__Parser); @@ -3519,6 +3967,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_kp_s_s_s); Py_VISIT(traverse_module_state->__pyx_kp_s_s_s_d); Py_VISIT(traverse_module_state->__pyx_n_s_self); + Py_VISIT(traverse_module_state->__pyx_n_s_send); Py_VISIT(traverse_module_state->__pyx_n_s_set_active_part); Py_VISIT(traverse_module_state->__pyx_n_s_set_multipart_content_type); Py_VISIT(traverse_module_state->__pyx_n_s_set_multipart_filename); @@ -3529,7 +3978,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_start); Py_VISIT(traverse_module_state->__pyx_n_s_state); Py_VISIT(traverse_module_state->__pyx_n_s_str); - Py_VISIT(traverse_module_state->__pyx_kp_s_streaming_form_data__parser); + Py_VISIT(traverse_module_state->__pyx_n_s_streaming_form_data__parser); Py_VISIT(traverse_module_state->__pyx_kp_s_streaming_form_data__parser_pyx); Py_VISIT(traverse_module_state->__pyx_n_s_streaming_form_data_targets); Py_VISIT(traverse_module_state->__pyx_n_s_strict); @@ -3537,6 +3986,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_super); Py_VISIT(traverse_module_state->__pyx_n_s_target); Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_throw); Py_VISIT(traverse_module_state->__pyx_n_s_unset_active_part); Py_VISIT(traverse_module_state->__pyx_n_s_update); Py_VISIT(traverse_module_state->__pyx_n_s_use_setstate); @@ -3558,58 +4008,71 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_int_248083859); Py_VISIT(traverse_module_state->__pyx_tuple__2); Py_VISIT(traverse_module_state->__pyx_tuple__4); - Py_VISIT(traverse_module_state->__pyx_tuple__6); - Py_VISIT(traverse_module_state->__pyx_tuple__7); - Py_VISIT(traverse_module_state->__pyx_tuple__8); - Py_VISIT(traverse_module_state->__pyx_tuple__9); - Py_VISIT(traverse_module_state->__pyx_tuple__11); Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__14); Py_VISIT(traverse_module_state->__pyx_tuple__15); Py_VISIT(traverse_module_state->__pyx_tuple__16); + Py_VISIT(traverse_module_state->__pyx_tuple__18); + Py_VISIT(traverse_module_state->__pyx_tuple__20); Py_VISIT(traverse_module_state->__pyx_tuple__22); - Py_VISIT(traverse_module_state->__pyx_tuple__24); + Py_VISIT(traverse_module_state->__pyx_tuple__23); + Py_VISIT(traverse_module_state->__pyx_tuple__29); Py_VISIT(traverse_module_state->__pyx_tuple__31); - Py_VISIT(traverse_module_state->__pyx_tuple__33); - Py_VISIT(traverse_module_state->__pyx_tuple__37); - Py_VISIT(traverse_module_state->__pyx_tuple__42); + Py_VISIT(traverse_module_state->__pyx_tuple__38); + Py_VISIT(traverse_module_state->__pyx_tuple__40); Py_VISIT(traverse_module_state->__pyx_tuple__44); - Py_VISIT(traverse_module_state->__pyx_tuple__47); - Py_VISIT(traverse_module_state->__pyx_tuple__49); - Py_VISIT(traverse_module_state->__pyx_tuple__51); + Py_VISIT(traverse_module_state->__pyx_tuple__54); + Py_VISIT(traverse_module_state->__pyx_tuple__56); + Py_VISIT(traverse_module_state->__pyx_tuple__59); + Py_VISIT(traverse_module_state->__pyx_tuple__61); + Py_VISIT(traverse_module_state->__pyx_tuple__63); + Py_VISIT(traverse_module_state->__pyx_codeobj__5); + Py_VISIT(traverse_module_state->__pyx_codeobj__6); + Py_VISIT(traverse_module_state->__pyx_codeobj__7); + Py_VISIT(traverse_module_state->__pyx_codeobj__8); + Py_VISIT(traverse_module_state->__pyx_codeobj__9); Py_VISIT(traverse_module_state->__pyx_codeobj__10); - Py_VISIT(traverse_module_state->__pyx_codeobj__12); - Py_VISIT(traverse_module_state->__pyx_codeobj__14); + Py_VISIT(traverse_module_state->__pyx_codeobj__11); Py_VISIT(traverse_module_state->__pyx_codeobj__17); - Py_VISIT(traverse_module_state->__pyx_codeobj__18); Py_VISIT(traverse_module_state->__pyx_codeobj__19); - Py_VISIT(traverse_module_state->__pyx_codeobj__20); Py_VISIT(traverse_module_state->__pyx_codeobj__21); - Py_VISIT(traverse_module_state->__pyx_codeobj__23); + Py_VISIT(traverse_module_state->__pyx_codeobj__24); Py_VISIT(traverse_module_state->__pyx_codeobj__25); Py_VISIT(traverse_module_state->__pyx_codeobj__26); Py_VISIT(traverse_module_state->__pyx_codeobj__27); Py_VISIT(traverse_module_state->__pyx_codeobj__28); - Py_VISIT(traverse_module_state->__pyx_codeobj__29); Py_VISIT(traverse_module_state->__pyx_codeobj__30); Py_VISIT(traverse_module_state->__pyx_codeobj__32); + Py_VISIT(traverse_module_state->__pyx_codeobj__33); Py_VISIT(traverse_module_state->__pyx_codeobj__34); Py_VISIT(traverse_module_state->__pyx_codeobj__35); Py_VISIT(traverse_module_state->__pyx_codeobj__36); - Py_VISIT(traverse_module_state->__pyx_codeobj__38); + Py_VISIT(traverse_module_state->__pyx_codeobj__37); Py_VISIT(traverse_module_state->__pyx_codeobj__39); - Py_VISIT(traverse_module_state->__pyx_codeobj__40); Py_VISIT(traverse_module_state->__pyx_codeobj__41); + Py_VISIT(traverse_module_state->__pyx_codeobj__42); Py_VISIT(traverse_module_state->__pyx_codeobj__43); Py_VISIT(traverse_module_state->__pyx_codeobj__45); Py_VISIT(traverse_module_state->__pyx_codeobj__46); + Py_VISIT(traverse_module_state->__pyx_codeobj__47); Py_VISIT(traverse_module_state->__pyx_codeobj__48); + Py_VISIT(traverse_module_state->__pyx_codeobj__49); Py_VISIT(traverse_module_state->__pyx_codeobj__50); + Py_VISIT(traverse_module_state->__pyx_codeobj__51); Py_VISIT(traverse_module_state->__pyx_codeobj__52); Py_VISIT(traverse_module_state->__pyx_codeobj__53); - Py_VISIT(traverse_module_state->__pyx_codeobj__54); Py_VISIT(traverse_module_state->__pyx_codeobj__55); - Py_VISIT(traverse_module_state->__pyx_codeobj__56); Py_VISIT(traverse_module_state->__pyx_codeobj__57); + Py_VISIT(traverse_module_state->__pyx_codeobj__58); + Py_VISIT(traverse_module_state->__pyx_codeobj__60); + Py_VISIT(traverse_module_state->__pyx_codeobj__62); + Py_VISIT(traverse_module_state->__pyx_codeobj__64); + Py_VISIT(traverse_module_state->__pyx_codeobj__65); + Py_VISIT(traverse_module_state->__pyx_codeobj__66); + Py_VISIT(traverse_module_state->__pyx_codeobj__67); + Py_VISIT(traverse_module_state->__pyx_codeobj__68); + Py_VISIT(traverse_module_state->__pyx_codeobj__69); + Py_VISIT(traverse_module_state->__pyx_codeobj__70); return 0; } #endif @@ -3641,15 +4104,40 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #if CYTHON_USE_MODULE_STATE #define __pyx_type_19streaming_form_data_7_parser_Finder __pyx_mstate_global->__pyx_type_19streaming_form_data_7_parser_Finder #define __pyx_type_19streaming_form_data_7_parser_Part __pyx_mstate_global->__pyx_type_19streaming_form_data_7_parser_Part +#define __pyx_type_19streaming_form_data_7_parser_AsyncPart __pyx_mstate_global->__pyx_type_19streaming_form_data_7_parser_AsyncPart #define __pyx_type_19streaming_form_data_7_parser__Parser __pyx_mstate_global->__pyx_type_19streaming_form_data_7_parser__Parser +#define __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start __pyx_mstate_global->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start +#define __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received __pyx_mstate_global->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received +#define __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish __pyx_mstate_global->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish +#define __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part __pyx_mstate_global->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part +#define __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part __pyx_mstate_global->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part +#define __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body __pyx_mstate_global->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body +#define __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received __pyx_mstate_global->__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received #define __Pyx_EnumMeta __pyx_mstate_global->__Pyx_EnumMeta #endif #define __pyx_ptype_19streaming_form_data_7_parser_Finder __pyx_mstate_global->__pyx_ptype_19streaming_form_data_7_parser_Finder #define __pyx_ptype_19streaming_form_data_7_parser_Part __pyx_mstate_global->__pyx_ptype_19streaming_form_data_7_parser_Part +#define __pyx_ptype_19streaming_form_data_7_parser_AsyncPart __pyx_mstate_global->__pyx_ptype_19streaming_form_data_7_parser_AsyncPart #define __pyx_ptype_19streaming_form_data_7_parser__Parser __pyx_mstate_global->__pyx_ptype_19streaming_form_data_7_parser__Parser +#define __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start __pyx_mstate_global->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start +#define __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received __pyx_mstate_global->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received +#define __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish __pyx_mstate_global->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish +#define __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part __pyx_mstate_global->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part +#define __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part __pyx_mstate_global->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part +#define __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body __pyx_mstate_global->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body +#define __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received __pyx_mstate_global->__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received #define __pyx_ptype___Pyx_EnumMeta __pyx_mstate_global->__pyx_ptype___Pyx_EnumMeta #define __pyx_kp_s_ __pyx_mstate_global->__pyx_kp_s_ #define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_n_s_AsyncPart __pyx_mstate_global->__pyx_n_s_AsyncPart +#define __pyx_n_s_AsyncPart___reduce_cython __pyx_mstate_global->__pyx_n_s_AsyncPart___reduce_cython +#define __pyx_n_s_AsyncPart___setstate_cython __pyx_mstate_global->__pyx_n_s_AsyncPart___setstate_cython +#define __pyx_n_s_AsyncPart_add_target __pyx_mstate_global->__pyx_n_s_AsyncPart_add_target +#define __pyx_n_s_AsyncPart_data_received __pyx_mstate_global->__pyx_n_s_AsyncPart_data_received +#define __pyx_n_s_AsyncPart_finish __pyx_mstate_global->__pyx_n_s_AsyncPart_finish +#define __pyx_n_s_AsyncPart_set_multipart_content __pyx_mstate_global->__pyx_n_s_AsyncPart_set_multipart_content +#define __pyx_n_s_AsyncPart_set_multipart_filename __pyx_mstate_global->__pyx_n_s_AsyncPart_set_multipart_filename +#define __pyx_n_s_AsyncPart_start __pyx_mstate_global->__pyx_n_s_AsyncPart_start #define __pyx_n_s_Delimiting __pyx_mstate_global->__pyx_n_s_Delimiting #define __pyx_kp_u_Empty_values_not_allowed __pyx_mstate_global->__pyx_kp_u_Empty_values_not_allowed #define __pyx_n_s_EnumBase __pyx_mstate_global->__pyx_n_s_EnumBase @@ -3677,6 +4165,10 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_Parser___reduce_cython __pyx_mstate_global->__pyx_n_s_Parser___reduce_cython #define __pyx_n_s_Parser___setstate_cython __pyx_mstate_global->__pyx_n_s_Parser___setstate_cython #define __pyx_n_s_Parser__parse __pyx_mstate_global->__pyx_n_s_Parser__parse +#define __pyx_n_s_Parser_async_data_received __pyx_mstate_global->__pyx_n_s_Parser_async_data_received +#define __pyx_n_s_Parser_async_on_body __pyx_mstate_global->__pyx_n_s_Parser_async_on_body +#define __pyx_n_s_Parser_async_set_active_part __pyx_mstate_global->__pyx_n_s_Parser_async_set_active_part +#define __pyx_n_s_Parser_async_unset_active_part __pyx_mstate_global->__pyx_n_s_Parser_async_unset_active_part #define __pyx_n_s_Parser_data_received __pyx_mstate_global->__pyx_n_s_Parser_data_received #define __pyx_n_s_Parser_on_body __pyx_mstate_global->__pyx_n_s_Parser_on_body #define __pyx_n_s_Parser_register __pyx_mstate_global->__pyx_n_s_Parser_register @@ -3706,13 +4198,19 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_UnexpectedPart __pyx_mstate_global->__pyx_n_s_UnexpectedPart #define __pyx_kp_s_Unknown_enum_value_s __pyx_mstate_global->__pyx_kp_s_Unknown_enum_value_s #define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError +#define __pyx_kp_b__12 __pyx_mstate_global->__pyx_kp_b__12 #define __pyx_kp_u__3 __pyx_mstate_global->__pyx_kp_u__3 -#define __pyx_kp_b__5 __pyx_mstate_global->__pyx_kp_b__5 -#define __pyx_n_s__58 __pyx_mstate_global->__pyx_n_s__58 +#define __pyx_n_s__71 __pyx_mstate_global->__pyx_n_s__71 #define __pyx_n_s_active __pyx_mstate_global->__pyx_n_s_active #define __pyx_n_s_add_target __pyx_mstate_global->__pyx_n_s_add_target #define __pyx_n_s_append __pyx_mstate_global->__pyx_n_s_append +#define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args +#define __pyx_n_s_async_data_received __pyx_mstate_global->__pyx_n_s_async_data_received +#define __pyx_n_s_async_on_body __pyx_mstate_global->__pyx_n_s_async_on_body +#define __pyx_n_s_async_set_active_part __pyx_mstate_global->__pyx_n_s_async_set_active_part +#define __pyx_n_s_async_unset_active_part __pyx_mstate_global->__pyx_n_s_async_unset_active_part #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_await __pyx_mstate_global->__pyx_n_s_await #define __pyx_n_s_buffer_start __pyx_mstate_global->__pyx_n_s_buffer_start #define __pyx_n_s_byte __pyx_mstate_global->__pyx_n_s_byte #define __pyx_n_s_chunk __pyx_mstate_global->__pyx_n_s_chunk @@ -3721,6 +4219,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class #define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close #define __pyx_n_s_cls __pyx_mstate_global->__pyx_n_s_cls #define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections #define __pyx_kp_u_content_disposition __pyx_mstate_global->__pyx_kp_u_content_disposition @@ -3756,6 +4255,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index #define __pyx_n_s_init __pyx_mstate_global->__pyx_n_s_init #define __pyx_n_s_init_subclass __pyx_mstate_global->__pyx_n_s_init_subclass +#define __pyx_n_s_is_async_target __pyx_mstate_global->__pyx_n_s_is_async_target #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine #define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main @@ -3780,6 +4280,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_parse __pyx_mstate_global->__pyx_n_s_parse #define __pyx_n_s_parsestr __pyx_mstate_global->__pyx_n_s_parsestr #define __pyx_n_s_part __pyx_mstate_global->__pyx_n_s_part +#define __pyx_n_s_part_cls __pyx_mstate_global->__pyx_n_s_part_cls #define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle #define __pyx_n_s_policy __pyx_mstate_global->__pyx_n_s_policy #define __pyx_n_s_prepare __pyx_mstate_global->__pyx_n_s_prepare @@ -3788,6 +4289,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result #define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state #define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type +#define __pyx_n_s_pyx_unpickle_AsyncPart __pyx_mstate_global->__pyx_n_s_pyx_unpickle_AsyncPart #define __pyx_n_s_pyx_unpickle_Finder __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Finder #define __pyx_n_s_pyx_unpickle_Part __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Part #define __pyx_n_s_pyx_unpickle__Parser __pyx_mstate_global->__pyx_n_s_pyx_unpickle__Parser @@ -3803,6 +4305,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_kp_s_s_s __pyx_mstate_global->__pyx_kp_s_s_s #define __pyx_kp_s_s_s_d __pyx_mstate_global->__pyx_kp_s_s_s_d #define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self +#define __pyx_n_s_send __pyx_mstate_global->__pyx_n_s_send #define __pyx_n_s_set_active_part __pyx_mstate_global->__pyx_n_s_set_active_part #define __pyx_n_s_set_multipart_content_type __pyx_mstate_global->__pyx_n_s_set_multipart_content_type #define __pyx_n_s_set_multipart_filename __pyx_mstate_global->__pyx_n_s_set_multipart_filename @@ -3813,7 +4316,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start #define __pyx_n_s_state __pyx_mstate_global->__pyx_n_s_state #define __pyx_n_s_str __pyx_mstate_global->__pyx_n_s_str -#define __pyx_kp_s_streaming_form_data__parser __pyx_mstate_global->__pyx_kp_s_streaming_form_data__parser +#define __pyx_n_s_streaming_form_data__parser __pyx_mstate_global->__pyx_n_s_streaming_form_data__parser #define __pyx_kp_s_streaming_form_data__parser_pyx __pyx_mstate_global->__pyx_kp_s_streaming_form_data__parser_pyx #define __pyx_n_s_streaming_form_data_targets __pyx_mstate_global->__pyx_n_s_streaming_form_data_targets #define __pyx_n_s_strict __pyx_mstate_global->__pyx_n_s_strict @@ -3821,6 +4324,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_super __pyx_mstate_global->__pyx_n_s_super #define __pyx_n_s_target __pyx_mstate_global->__pyx_n_s_target #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_throw __pyx_mstate_global->__pyx_n_s_throw #define __pyx_n_s_unset_active_part __pyx_mstate_global->__pyx_n_s_unset_active_part #define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update #define __pyx_n_s_use_setstate __pyx_mstate_global->__pyx_n_s_use_setstate @@ -3842,58 +4346,71 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_int_248083859 __pyx_mstate_global->__pyx_int_248083859 #define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2 #define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 -#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 -#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7 -#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 -#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 -#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 #define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 #define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 #define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 +#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 #define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 -#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24 +#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23 +#define __pyx_tuple__29 __pyx_mstate_global->__pyx_tuple__29 #define __pyx_tuple__31 __pyx_mstate_global->__pyx_tuple__31 -#define __pyx_tuple__33 __pyx_mstate_global->__pyx_tuple__33 -#define __pyx_tuple__37 __pyx_mstate_global->__pyx_tuple__37 -#define __pyx_tuple__42 __pyx_mstate_global->__pyx_tuple__42 +#define __pyx_tuple__38 __pyx_mstate_global->__pyx_tuple__38 +#define __pyx_tuple__40 __pyx_mstate_global->__pyx_tuple__40 #define __pyx_tuple__44 __pyx_mstate_global->__pyx_tuple__44 -#define __pyx_tuple__47 __pyx_mstate_global->__pyx_tuple__47 -#define __pyx_tuple__49 __pyx_mstate_global->__pyx_tuple__49 -#define __pyx_tuple__51 __pyx_mstate_global->__pyx_tuple__51 +#define __pyx_tuple__54 __pyx_mstate_global->__pyx_tuple__54 +#define __pyx_tuple__56 __pyx_mstate_global->__pyx_tuple__56 +#define __pyx_tuple__59 __pyx_mstate_global->__pyx_tuple__59 +#define __pyx_tuple__61 __pyx_mstate_global->__pyx_tuple__61 +#define __pyx_tuple__63 __pyx_mstate_global->__pyx_tuple__63 +#define __pyx_codeobj__5 __pyx_mstate_global->__pyx_codeobj__5 +#define __pyx_codeobj__6 __pyx_mstate_global->__pyx_codeobj__6 +#define __pyx_codeobj__7 __pyx_mstate_global->__pyx_codeobj__7 +#define __pyx_codeobj__8 __pyx_mstate_global->__pyx_codeobj__8 +#define __pyx_codeobj__9 __pyx_mstate_global->__pyx_codeobj__9 #define __pyx_codeobj__10 __pyx_mstate_global->__pyx_codeobj__10 -#define __pyx_codeobj__12 __pyx_mstate_global->__pyx_codeobj__12 -#define __pyx_codeobj__14 __pyx_mstate_global->__pyx_codeobj__14 +#define __pyx_codeobj__11 __pyx_mstate_global->__pyx_codeobj__11 #define __pyx_codeobj__17 __pyx_mstate_global->__pyx_codeobj__17 -#define __pyx_codeobj__18 __pyx_mstate_global->__pyx_codeobj__18 #define __pyx_codeobj__19 __pyx_mstate_global->__pyx_codeobj__19 -#define __pyx_codeobj__20 __pyx_mstate_global->__pyx_codeobj__20 #define __pyx_codeobj__21 __pyx_mstate_global->__pyx_codeobj__21 -#define __pyx_codeobj__23 __pyx_mstate_global->__pyx_codeobj__23 +#define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24 #define __pyx_codeobj__25 __pyx_mstate_global->__pyx_codeobj__25 #define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26 #define __pyx_codeobj__27 __pyx_mstate_global->__pyx_codeobj__27 #define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28 -#define __pyx_codeobj__29 __pyx_mstate_global->__pyx_codeobj__29 #define __pyx_codeobj__30 __pyx_mstate_global->__pyx_codeobj__30 #define __pyx_codeobj__32 __pyx_mstate_global->__pyx_codeobj__32 +#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33 #define __pyx_codeobj__34 __pyx_mstate_global->__pyx_codeobj__34 #define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35 #define __pyx_codeobj__36 __pyx_mstate_global->__pyx_codeobj__36 -#define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38 +#define __pyx_codeobj__37 __pyx_mstate_global->__pyx_codeobj__37 #define __pyx_codeobj__39 __pyx_mstate_global->__pyx_codeobj__39 -#define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40 #define __pyx_codeobj__41 __pyx_mstate_global->__pyx_codeobj__41 +#define __pyx_codeobj__42 __pyx_mstate_global->__pyx_codeobj__42 #define __pyx_codeobj__43 __pyx_mstate_global->__pyx_codeobj__43 #define __pyx_codeobj__45 __pyx_mstate_global->__pyx_codeobj__45 #define __pyx_codeobj__46 __pyx_mstate_global->__pyx_codeobj__46 +#define __pyx_codeobj__47 __pyx_mstate_global->__pyx_codeobj__47 #define __pyx_codeobj__48 __pyx_mstate_global->__pyx_codeobj__48 +#define __pyx_codeobj__49 __pyx_mstate_global->__pyx_codeobj__49 #define __pyx_codeobj__50 __pyx_mstate_global->__pyx_codeobj__50 +#define __pyx_codeobj__51 __pyx_mstate_global->__pyx_codeobj__51 #define __pyx_codeobj__52 __pyx_mstate_global->__pyx_codeobj__52 #define __pyx_codeobj__53 __pyx_mstate_global->__pyx_codeobj__53 -#define __pyx_codeobj__54 __pyx_mstate_global->__pyx_codeobj__54 #define __pyx_codeobj__55 __pyx_mstate_global->__pyx_codeobj__55 -#define __pyx_codeobj__56 __pyx_mstate_global->__pyx_codeobj__56 #define __pyx_codeobj__57 __pyx_mstate_global->__pyx_codeobj__57 +#define __pyx_codeobj__58 __pyx_mstate_global->__pyx_codeobj__58 +#define __pyx_codeobj__60 __pyx_mstate_global->__pyx_codeobj__60 +#define __pyx_codeobj__62 __pyx_mstate_global->__pyx_codeobj__62 +#define __pyx_codeobj__64 __pyx_mstate_global->__pyx_codeobj__64 +#define __pyx_codeobj__65 __pyx_mstate_global->__pyx_codeobj__65 +#define __pyx_codeobj__66 __pyx_mstate_global->__pyx_codeobj__66 +#define __pyx_codeobj__67 __pyx_mstate_global->__pyx_codeobj__67 +#define __pyx_codeobj__68 __pyx_mstate_global->__pyx_codeobj__68 +#define __pyx_codeobj__69 __pyx_mstate_global->__pyx_codeobj__69 +#define __pyx_codeobj__70 __pyx_mstate_global->__pyx_codeobj__70 /* #### Code section: module_code ### */ /* "EnumTypeToPy":3 @@ -10236,23 +10753,22 @@ static PyObject *__pyx_pf_19streaming_form_data_7_parser_4Part_16__setstate_cyth return __pyx_r; } -/* "streaming_form_data/_parser.pyx":161 - * cdef public str unexpected_part_name +/* "streaming_form_data/_parser.pyx":134 + * cdef list targets * - * def __init__(self, bytes delimiter, bytes ender, bint strict): # <<<<<<<<<<<<<< - * self.delimiter_finder = Finder(delimiter) - * self.ender_finder = Finder(ender) + * def __init__(self, str name, object target): # <<<<<<<<<<<<<< + * self.name = name + * self.targets = [target] */ /* Python wrapper */ -static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_delimiter = 0; - PyObject *__pyx_v_ender = 0; - int __pyx_v_strict; +static int __pyx_pw_19streaming_form_data_7_parser_9AsyncPart_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_19streaming_form_data_7_parser_9AsyncPart_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + PyObject *__pyx_v_target = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[3] = {0,0,0}; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -10266,12 +10782,10 @@ static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__(PyObject * #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_delimiter,&__pyx_n_s_ender,&__pyx_n_s_strict,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_target,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); - CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); @@ -10282,51 +10796,39 @@ static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__(PyObject * kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_delimiter)) != 0)) { + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) { (void)__Pyx_Arg_NewRef_VARARGS(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ender)) != 0)) { + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_target)) != 0)) { (void)__Pyx_Arg_NewRef_VARARGS(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 161, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_strict)) != 0)) { - (void)__Pyx_Arg_NewRef_VARARGS(values[2]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 161, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 134, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 161, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 134, __pyx_L3_error) } - } else if (unlikely(__pyx_nargs != 3)) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); - values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); } - __pyx_v_delimiter = ((PyObject*)values[0]); - __pyx_v_ender = ((PyObject*)values[1]); - __pyx_v_strict = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_strict == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L3_error) + __pyx_v_name = ((PyObject*)values[0]); + __pyx_v_target = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 161, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 134, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -10336,13 +10838,12 @@ static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__(PyObject * __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } - __Pyx_AddTraceback("streaming_form_data._parser._Parser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delimiter), (&PyBytes_Type), 1, "delimiter", 1))) __PYX_ERR(0, 161, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ender), (&PyBytes_Type), 1, "ender", 1))) __PYX_ERR(0, 161, __pyx_L1_error) - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser___init__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_delimiter, __pyx_v_ender, __pyx_v_strict); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart___init__(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self), __pyx_v_name, __pyx_v_target); /* function exit code */ goto __pyx_L0; @@ -10359,203 +10860,52 @@ static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__(PyObject * return __pyx_r; } -static int __pyx_pf_19streaming_form_data_7_parser_7_Parser___init__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_delimiter, PyObject *__pyx_v_ender, int __pyx_v_strict) { +static int __pyx_pf_19streaming_form_data_7_parser_9AsyncPart___init__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_target) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 1); - /* "streaming_form_data/_parser.pyx":162 + /* "streaming_form_data/_parser.pyx":135 * - * def __init__(self, bytes delimiter, bytes ender, bint strict): - * self.delimiter_finder = Finder(delimiter) # <<<<<<<<<<<<<< - * self.ender_finder = Finder(ender) - * - */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder), __pyx_v_delimiter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF((PyObject *)__pyx_v_self->delimiter_finder); - __Pyx_DECREF((PyObject *)__pyx_v_self->delimiter_finder); - __pyx_v_self->delimiter_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "streaming_form_data/_parser.pyx":163 - * def __init__(self, bytes delimiter, bytes ender, bint strict): - * self.delimiter_finder = Finder(delimiter) - * self.ender_finder = Finder(ender) # <<<<<<<<<<<<<< - * - * self.delimiter_length = len(delimiter) - */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder), __pyx_v_ender); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF((PyObject *)__pyx_v_self->ender_finder); - __Pyx_DECREF((PyObject *)__pyx_v_self->ender_finder); - __pyx_v_self->ender_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "streaming_form_data/_parser.pyx":165 - * self.ender_finder = Finder(ender) - * - * self.delimiter_length = len(delimiter) # <<<<<<<<<<<<<< - * self.ender_length = len(ender) - * - */ - if (unlikely(__pyx_v_delimiter == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 165, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_PyBytes_GET_SIZE(__pyx_v_delimiter); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 165, __pyx_L1_error) - __pyx_v_self->delimiter_length = __pyx_t_2; - - /* "streaming_form_data/_parser.pyx":166 - * - * self.delimiter_length = len(delimiter) - * self.ender_length = len(ender) # <<<<<<<<<<<<<< - * - * self.state = ParserState.PS_START - */ - if (unlikely(__pyx_v_ender == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 166, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_PyBytes_GET_SIZE(__pyx_v_ender); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 166, __pyx_L1_error) - __pyx_v_self->ender_length = __pyx_t_2; - - /* "streaming_form_data/_parser.pyx":168 - * self.ender_length = len(ender) - * - * self.state = ParserState.PS_START # <<<<<<<<<<<<<< - * - * self.expected_parts = [] - */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_START; - - /* "streaming_form_data/_parser.pyx":170 - * self.state = ParserState.PS_START - * - * self.expected_parts = [] # <<<<<<<<<<<<<< - * - * self.active_part = None - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->expected_parts); - __Pyx_DECREF(__pyx_v_self->expected_parts); - __pyx_v_self->expected_parts = __pyx_t_1; - __pyx_t_1 = 0; - - /* "streaming_form_data/_parser.pyx":172 - * self.expected_parts = [] - * - * self.active_part = None # <<<<<<<<<<<<<< - * self.default_part = Part('_default', NullTarget()) + * def __init__(self, str name, object target): + * self.name = name # <<<<<<<<<<<<<< + * self.targets = [target] * */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->active_part); - __Pyx_DECREF(__pyx_v_self->active_part); - __pyx_v_self->active_part = Py_None; + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; - /* "streaming_form_data/_parser.pyx":173 - * - * self.active_part = None - * self.default_part = Part('_default', NullTarget()) # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":136 + * def __init__(self, str name, object target): + * self.name = name + * self.targets = [target] # <<<<<<<<<<<<<< * - * self._leftover_buffer = None + * def add_target(self, object target): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_NullTarget); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_n_u_default); - __Pyx_GIVEREF(__pyx_n_u_default); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_default)) __PYX_ERR(0, 173, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_v_target); + __Pyx_GIVEREF(__pyx_v_target); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_target)) __PYX_ERR(0, 136, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->default_part); - __Pyx_DECREF(__pyx_v_self->default_part); - __pyx_v_self->default_part = __pyx_t_1; + __Pyx_GOTREF(__pyx_v_self->targets); + __Pyx_DECREF(__pyx_v_self->targets); + __pyx_v_self->targets = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":175 - * self.default_part = Part('_default', NullTarget()) - * - * self._leftover_buffer = None # <<<<<<<<<<<<<< - * - * self.strict = strict - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->_leftover_buffer); - __Pyx_DECREF(__pyx_v_self->_leftover_buffer); - __pyx_v_self->_leftover_buffer = ((PyObject*)Py_None); - - /* "streaming_form_data/_parser.pyx":177 - * self._leftover_buffer = None - * - * self.strict = strict # <<<<<<<<<<<<<< - * self.unexpected_part_name = '' - * - */ - __pyx_v_self->strict = __pyx_v_strict; - - /* "streaming_form_data/_parser.pyx":178 - * - * self.strict = strict - * self.unexpected_part_name = '' # <<<<<<<<<<<<<< - * - * def register(self, str name, object target): - */ - __Pyx_INCREF(__pyx_kp_u_); - __Pyx_GIVEREF(__pyx_kp_u_); - __Pyx_GOTREF(__pyx_v_self->unexpected_part_name); - __Pyx_DECREF(__pyx_v_self->unexpected_part_name); - __pyx_v_self->unexpected_part_name = __pyx_kp_u_; - - /* "streaming_form_data/_parser.pyx":161 - * cdef public str unexpected_part_name + /* "streaming_form_data/_parser.pyx":134 + * cdef list targets * - * def __init__(self, bytes delimiter, bytes ender, bint strict): # <<<<<<<<<<<<<< - * self.delimiter_finder = Finder(delimiter) - * self.ender_finder = Finder(ender) + * def __init__(self, str name, object target): # <<<<<<<<<<<<<< + * self.name = name + * self.targets = [target] */ /* function exit code */ @@ -10563,52 +10913,49 @@ static int __pyx_pf_19streaming_form_data_7_parser_7_Parser___init__(struct __py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("streaming_form_data._parser._Parser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "streaming_form_data/_parser.pyx":180 - * self.unexpected_part_name = '' +/* "streaming_form_data/_parser.pyx":138 + * self.targets = [target] * - * def register(self, str name, object target): # <<<<<<<<<<<<<< - * part = self._part_for(name) + * def add_target(self, object target): # <<<<<<<<<<<<<< + * self.targets.append(target) * */ /* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_3register(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_3add_target(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_3register = {"register", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_3register, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_3register(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_3add_target = {"add_target", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_3add_target, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_3add_target(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { - PyObject *__pyx_v_name = 0; PyObject *__pyx_v_target = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[2] = {0,0}; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("register (wrapper)", 0); + __Pyx_RefNannySetupContext("add_target (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -10618,12 +10965,10 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_target,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; @@ -10632,39 +10977,27 @@ PyObject *__pyx_args, PyObject *__pyx_kwds kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) { + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_target)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L3_error) else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_target)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("register", 1, 2, 2, 1); __PYX_ERR(0, 180, __pyx_L3_error) - } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "register") < 0)) __PYX_ERR(0, 180, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "add_target") < 0)) __PYX_ERR(0, 138, __pyx_L3_error) } - } else if (unlikely(__pyx_nargs != 2)) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_name = ((PyObject*)values[0]); - __pyx_v_target = values[1]; + __pyx_v_target = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("register", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 180, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_target", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 138, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -10674,18 +11007,13 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __Pyx_AddTraceback("streaming_form_data._parser._Parser.register", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.add_target", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 180, __pyx_L1_error) - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_2register(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_name, __pyx_v_target); + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_2add_target(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self), __pyx_v_target); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -10696,171 +11024,84 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_2register(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_target) { - PyObject *__pyx_v_part = NULL; +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_2add_target(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_target) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; + int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("register", 1); + __Pyx_RefNannySetupContext("add_target", 1); - /* "streaming_form_data/_parser.pyx":181 + /* "streaming_form_data/_parser.pyx":139 * - * def register(self, str name, object target): - * part = self._part_for(name) # <<<<<<<<<<<<<< + * def add_target(self, object target): + * self.targets.append(target) # <<<<<<<<<<<<<< * - * if part: + * def set_multipart_filename(self, str value): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->_part_for(__pyx_v_self, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_part = __pyx_t_1; - __pyx_t_1 = 0; + if (unlikely(__pyx_v_self->targets == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); + __PYX_ERR(0, 139, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyList_Append(__pyx_v_self->targets, __pyx_v_target); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 139, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":183 - * part = self._part_for(name) + /* "streaming_form_data/_parser.pyx":138 + * self.targets = [target] + * + * def add_target(self, object target): # <<<<<<<<<<<<<< + * self.targets.append(target) * - * if part: # <<<<<<<<<<<<<< - * part.add_target(target) - * else: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_part); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 183, __pyx_L1_error) - if (__pyx_t_2) { - /* "streaming_form_data/_parser.pyx":184 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.add_target", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "streaming_form_data/_parser.pyx":141 + * self.targets.append(target) * - * if part: - * part.add_target(target) # <<<<<<<<<<<<<< - * else: - * self.expected_parts.append(Part(name, target)) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_part, __pyx_n_s_add_target); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_target}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "streaming_form_data/_parser.pyx":183 - * part = self._part_for(name) - * - * if part: # <<<<<<<<<<<<<< - * part.add_target(target) - * else: - */ - goto __pyx_L3; - } - - /* "streaming_form_data/_parser.pyx":186 - * part.add_target(target) - * else: - * self.expected_parts.append(Part(name, target)) # <<<<<<<<<<<<<< - * - * def set_active_part(self, part, str filename): - */ - /*else*/ { - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name)) __PYX_ERR(0, 186, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_target); - __Pyx_GIVEREF(__pyx_v_target); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_target)) __PYX_ERR(0, 186, __pyx_L1_error); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_self->expected_parts, __pyx_t_3); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L3:; - - /* "streaming_form_data/_parser.pyx":180 - * self.unexpected_part_name = '' - * - * def register(self, str name, object target): # <<<<<<<<<<<<<< - * part = self._part_for(name) - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("streaming_form_data._parser._Parser.register", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_part); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "streaming_form_data/_parser.pyx":188 - * self.expected_parts.append(Part(name, target)) - * - * def set_active_part(self, part, str filename): # <<<<<<<<<<<<<< - * self.active_part = part - * self.active_part.set_multipart_filename(filename) + * def set_multipart_filename(self, str value): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.multipart_filename = value */ /* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_5set_active_part(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_5set_multipart_filename(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_5set_active_part = {"set_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_5set_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_5set_active_part(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_5set_multipart_filename = {"set_multipart_filename", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_5set_multipart_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_5set_multipart_filename(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { - PyObject *__pyx_v_part = 0; - PyObject *__pyx_v_filename = 0; + PyObject *__pyx_v_value = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[2] = {0,0}; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_active_part (wrapper)", 0); + __Pyx_RefNannySetupContext("set_multipart_filename (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -10870,12 +11111,10 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_part,&__pyx_n_s_filename,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; @@ -10884,39 +11123,27 @@ PyObject *__pyx_args, PyObject *__pyx_kwds kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_part)) != 0)) { + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("set_active_part", 1, 2, 2, 1); __PYX_ERR(0, 188, __pyx_L3_error) - } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_active_part") < 0)) __PYX_ERR(0, 188, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_multipart_filename") < 0)) __PYX_ERR(0, 141, __pyx_L3_error) } - } else if (unlikely(__pyx_nargs != 2)) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_part = values[0]; - __pyx_v_filename = ((PyObject*)values[1]); + __pyx_v_value = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_active_part", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 188, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_multipart_filename", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 141, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -10926,12 +11153,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __Pyx_AddTraceback("streaming_form_data._parser._Parser.set_active_part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.set_multipart_filename", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(0, 188, __pyx_L1_error) - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_4set_active_part(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_part, __pyx_v_filename); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyUnicode_Type), 1, "value", 1))) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4set_multipart_filename(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self), __pyx_v_value); /* function exit code */ goto __pyx_L0; @@ -10948,103 +11175,73 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_4set_active_part(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_part, PyObject *__pyx_v_filename) { +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4set_multipart_filename(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_v_target = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("set_active_part", 1); + __Pyx_RefNannySetupContext("set_multipart_filename", 1); - /* "streaming_form_data/_parser.pyx":189 + /* "streaming_form_data/_parser.pyx":142 + * + * def set_multipart_filename(self, str value): + * for target in self.targets: # <<<<<<<<<<<<<< + * target.multipart_filename = value * - * def set_active_part(self, part, str filename): - * self.active_part = part # <<<<<<<<<<<<<< - * self.active_part.set_multipart_filename(filename) - * self.active_part.start() */ - __Pyx_INCREF(__pyx_v_part); - __Pyx_GIVEREF(__pyx_v_part); - __Pyx_GOTREF(__pyx_v_self->active_part); - __Pyx_DECREF(__pyx_v_self->active_part); - __pyx_v_self->active_part = __pyx_v_part; + if (unlikely(__pyx_v_self->targets == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 142, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_self->targets; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 142, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 142, __pyx_L1_error) + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XDECREF_SET(__pyx_v_target, __pyx_t_3); + __pyx_t_3 = 0; - /* "streaming_form_data/_parser.pyx":190 - * def set_active_part(self, part, str filename): - * self.active_part = part - * self.active_part.set_multipart_filename(filename) # <<<<<<<<<<<<<< - * self.active_part.start() + /* "streaming_form_data/_parser.pyx":143 + * def set_multipart_filename(self, str value): + * for target in self.targets: + * target.multipart_filename = value # <<<<<<<<<<<<<< * + * def set_multipart_content_type(self, str value): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_set_multipart_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_filename}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_target, __pyx_n_s_multipart_filename, __pyx_v_value) < 0) __PYX_ERR(0, 143, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":191 - * self.active_part = part - * self.active_part.set_multipart_filename(filename) - * self.active_part.start() # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":142 + * + * def set_multipart_filename(self, str value): + * for target in self.targets: # <<<<<<<<<<<<<< + * target.multipart_filename = value * - * def unset_active_part(self): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":188 - * self.expected_parts.append(Part(name, target)) + /* "streaming_form_data/_parser.pyx":141 + * self.targets.append(target) * - * def set_active_part(self, part, str filename): # <<<<<<<<<<<<<< - * self.active_part = part - * self.active_part.set_multipart_filename(filename) + * def set_multipart_filename(self, str value): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.multipart_filename = value */ /* function exit code */ @@ -11052,202 +11249,52 @@ static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_4set_active_pa goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("streaming_form_data._parser._Parser.set_active_part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.set_multipart_filename", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_target); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "streaming_form_data/_parser.pyx":193 - * self.active_part.start() +/* "streaming_form_data/_parser.pyx":145 + * target.multipart_filename = value * - * def unset_active_part(self): # <<<<<<<<<<<<<< - * if self.active_part: - * self.active_part.finish() + * def set_multipart_content_type(self, str value): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.multipart_content_type = value */ /* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_7unset_active_part(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_7set_multipart_content_type(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_7unset_active_part = {"unset_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_7unset_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_7unset_active_part(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_7set_multipart_content_type = {"set_multipart_content_type", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_7set_multipart_content_type, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_7set_multipart_content_type(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { + PyObject *__pyx_v_value = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("unset_active_part (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("unset_active_part", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "unset_active_part", 0))) return NULL; - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_6unset_active_part(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_6unset_active_part(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("unset_active_part", 1); - - /* "streaming_form_data/_parser.pyx":194 - * - * def unset_active_part(self): - * if self.active_part: # <<<<<<<<<<<<<< - * self.active_part.finish() - * self.active_part = None - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->active_part); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 194, __pyx_L1_error) - if (__pyx_t_1) { - - /* "streaming_form_data/_parser.pyx":195 - * def unset_active_part(self): - * if self.active_part: - * self.active_part.finish() # <<<<<<<<<<<<<< - * self.active_part = None - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_finish); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; - __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "streaming_form_data/_parser.pyx":194 - * - * def unset_active_part(self): - * if self.active_part: # <<<<<<<<<<<<<< - * self.active_part.finish() - * self.active_part = None - */ - } - - /* "streaming_form_data/_parser.pyx":196 - * if self.active_part: - * self.active_part.finish() - * self.active_part = None # <<<<<<<<<<<<<< - * - * def on_body(self, bytes value): - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->active_part); - __Pyx_DECREF(__pyx_v_self->active_part); - __pyx_v_self->active_part = Py_None; - - /* "streaming_form_data/_parser.pyx":193 - * self.active_part.start() - * - * def unset_active_part(self): # <<<<<<<<<<<<<< - * if self.active_part: - * self.active_part.finish() - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("streaming_form_data._parser._Parser.unset_active_part", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "streaming_form_data/_parser.pyx":198 - * self.active_part = None - * - * def on_body(self, bytes value): # <<<<<<<<<<<<<< - * if self.active_part and len(value) > 0: - * self.active_part.data_received(value) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_9on_body(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_9on_body = {"on_body", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_9on_body, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_9on_body(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v_value = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[1] = {0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("on_body (wrapper)", 0); + __Pyx_RefNannySetupContext("set_multipart_content_type (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -11273,12 +11320,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "on_body") < 0)) __PYX_ERR(0, 198, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_multipart_content_type") < 0)) __PYX_ERR(0, 145, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -11289,7 +11336,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("on_body", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 198, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_multipart_content_type", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 145, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -11299,12 +11346,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __Pyx_AddTraceback("streaming_form_data._parser._Parser.on_body", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.set_multipart_content_type", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyBytes_Type), 1, "value", 1))) __PYX_ERR(0, 198, __pyx_L1_error) - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_8on_body(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_value); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyUnicode_Type), 1, "value", 1))) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_6set_multipart_content_type(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self), __pyx_v_value); /* function exit code */ goto __pyx_L0; @@ -11321,286 +11368,357 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_8on_body(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_value) { +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_6set_multipart_content_type(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_v_target = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("on_body", 1); + __Pyx_RefNannySetupContext("set_multipart_content_type", 1); - /* "streaming_form_data/_parser.pyx":199 + /* "streaming_form_data/_parser.pyx":146 * - * def on_body(self, bytes value): - * if self.active_part and len(value) > 0: # <<<<<<<<<<<<<< - * self.active_part.data_received(value) + * def set_multipart_content_type(self, str value): + * for target in self.targets: # <<<<<<<<<<<<<< + * target.multipart_content_type = value * */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->active_part); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 199, __pyx_L1_error) - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - if (unlikely(__pyx_v_value == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 199, __pyx_L1_error) + if (unlikely(__pyx_v_self->targets == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 146, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_v_value); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 199, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_3 > 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { + __pyx_t_1 = __pyx_v_self->targets; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 146, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 146, __pyx_L1_error) + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XDECREF_SET(__pyx_v_target, __pyx_t_3); + __pyx_t_3 = 0; - /* "streaming_form_data/_parser.pyx":200 - * def on_body(self, bytes value): - * if self.active_part and len(value) > 0: - * self.active_part.data_received(value) # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":147 + * def set_multipart_content_type(self, str value): + * for target in self.targets: + * target.multipart_content_type = value # <<<<<<<<<<<<<< * - * cdef _part_for(self, str name): + * async def start(self): */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_data_received); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_7 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_target, __pyx_n_s_multipart_content_type, __pyx_v_value) < 0) __PYX_ERR(0, 147, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":199 + /* "streaming_form_data/_parser.pyx":146 * - * def on_body(self, bytes value): - * if self.active_part and len(value) > 0: # <<<<<<<<<<<<<< - * self.active_part.data_received(value) + * def set_multipart_content_type(self, str value): + * for target in self.targets: # <<<<<<<<<<<<<< + * target.multipart_content_type = value * */ } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":198 - * self.active_part = None + /* "streaming_form_data/_parser.pyx":145 + * target.multipart_filename = value * - * def on_body(self, bytes value): # <<<<<<<<<<<<<< - * if self.active_part and len(value) > 0: - * self.active_part.data_received(value) + * def set_multipart_content_type(self, str value): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.multipart_content_type = value */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("streaming_form_data._parser._Parser.on_body", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.set_multipart_content_type", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_target); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_19streaming_form_data_7_parser_9AsyncPart_10generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "streaming_form_data/_parser.pyx":202 - * self.active_part.data_received(value) +/* "streaming_form_data/_parser.pyx":149 + * target.multipart_content_type = value * - * cdef _part_for(self, str name): # <<<<<<<<<<<<<< - * for part in self.expected_parts: - * if part.name == name: + * async def start(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.start() */ -static PyObject *__pyx_f_19streaming_form_data_7_parser_7_Parser__part_for(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_name) { - PyObject *__pyx_v_part = NULL; - PyObject *__pyx_r = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_9start(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_9start = {"start", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_9start, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_9start(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_lineno = 0; + __Pyx_RefNannySetupContext("start (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("start", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "start", 0))) return NULL; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_8start(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_8start(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_part_for", 1); + __Pyx_RefNannySetupContext("start", 0); + __pyx_cur_scope = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct__start(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 149, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_19streaming_form_data_7_parser_9AsyncPart_10generator, __pyx_codeobj__5, (PyObject *) __pyx_cur_scope, __pyx_n_s_start, __pyx_n_s_AsyncPart_start, __pyx_n_s_streaming_form_data__parser); if (unlikely(!gen)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } - /* "streaming_form_data/_parser.pyx":203 + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_19streaming_form_data_7_parser_9AsyncPart_10generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start *__pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_await; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 149, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":150 + * + * async def start(self): + * for target in self.targets: # <<<<<<<<<<<<<< + * await target.start() * - * cdef _part_for(self, str name): - * for part in self.expected_parts: # <<<<<<<<<<<<<< - * if part.name == name: - * return part */ - if (likely(PyList_CheckExact(__pyx_v_self->expected_parts)) || PyTuple_CheckExact(__pyx_v_self->expected_parts)) { - __pyx_t_1 = __pyx_v_self->expected_parts; __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->expected_parts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) + if (unlikely(__pyx_cur_scope->__pyx_v_self->targets == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 150, __pyx_L1_error) } + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->targets; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - { - Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); - #if !CYTHON_ASSUME_SAFE_MACROS - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 203, __pyx_L1_error) - #endif - if (__pyx_t_2 >= __pyx_temp) break; - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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, 203, __pyx_L1_error) - #else - __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - { - Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); - #if !CYTHON_ASSUME_SAFE_MACROS - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 203, __pyx_L1_error) - #endif - if (__pyx_t_2 >= __pyx_temp) break; - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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, 203, __pyx_L1_error) - #else - __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 203, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 150, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; } - __Pyx_XDECREF_SET(__pyx_v_part, __pyx_t_4); - __pyx_t_4 = 0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 150, __pyx_L1_error) + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_target); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_target, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; - /* "streaming_form_data/_parser.pyx":204 - * cdef _part_for(self, str name): - * for part in self.expected_parts: - * if part.name == name: # <<<<<<<<<<<<<< - * return part + /* "streaming_form_data/_parser.pyx":151 + * async def start(self): + * for target in self.targets: + * await target.start() # <<<<<<<<<<<<<< * + * async def data_received(self, bytes chunk): */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_part, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_v_name, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - - /* "streaming_form_data/_parser.pyx":205 - * for part in self.expected_parts: - * if part.name == name: - * return part # <<<<<<<<<<<<<< - * - * def data_received(self, bytes data): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_part); - __pyx_r = __pyx_v_part; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - - /* "streaming_form_data/_parser.pyx":204 - * cdef _part_for(self, str name): - * for part in self.expected_parts: - * if part.name == name: # <<<<<<<<<<<<<< - * return part - * - */ + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 151, __pyx_L1_error) + } else { + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear(); + else __PYX_ERR(0, 151, __pyx_L1_error) + } } - /* "streaming_form_data/_parser.pyx":203 + /* "streaming_form_data/_parser.pyx":150 + * + * async def start(self): + * for target in self.targets: # <<<<<<<<<<<<<< + * await target.start() * - * cdef _part_for(self, str name): - * for part in self.expected_parts: # <<<<<<<<<<<<<< - * if part.name == name: - * return part */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "streaming_form_data/_parser.pyx":202 - * self.active_part.data_received(value) + /* "streaming_form_data/_parser.pyx":149 + * target.multipart_content_type = value * - * cdef _part_for(self, str name): # <<<<<<<<<<<<<< - * for part in self.expected_parts: - * if part.name == name: + * async def start(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.start() */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; + __Pyx_Generator_Replace_StopIteration(0); __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("streaming_form_data._parser._Parser._part_for", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("start", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_part); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_19streaming_form_data_7_parser_9AsyncPart_13generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "streaming_form_data/_parser.pyx":207 - * return part +/* "streaming_form_data/_parser.pyx":153 + * await target.start() * - * def data_received(self, bytes data): # <<<<<<<<<<<<<< - * if not data: - * return 0 + * async def data_received(self, bytes chunk): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.data_received(chunk) */ /* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_11data_received(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_12data_received(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_11data_received = {"data_received", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_11data_received, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_11data_received(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_12data_received = {"data_received", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_12data_received, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_12data_received(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { - PyObject *__pyx_v_data = 0; + PyObject *__pyx_v_chunk = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif @@ -11621,7 +11739,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chunk,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { @@ -11633,27 +11751,27 @@ PyObject *__pyx_args, PyObject *__pyx_kwds kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chunk)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 207, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "data_received") < 0)) __PYX_ERR(0, 207, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "data_received") < 0)) __PYX_ERR(0, 153, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_data = ((PyObject*)values[0]); + __pyx_v_chunk = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("data_received", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 207, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("data_received", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 153, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -11663,12 +11781,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __Pyx_AddTraceback("streaming_form_data._parser._Parser.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) __PYX_ERR(0, 207, __pyx_L1_error) - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_10data_received(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_data); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chunk), (&PyBytes_Type), 1, "chunk", 1))) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_11data_received(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self), __pyx_v_chunk); /* function exit code */ goto __pyx_L0; @@ -11685,239 +11803,232 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_10data_received(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_data) { - PyObject *__pyx_v_chunk = 0; - size_t __pyx_v_index; +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_11data_received(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_chunk) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("data_received", 1); + __Pyx_RefNannySetupContext("data_received", 0); + __pyx_cur_scope = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 153, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_chunk = __pyx_v_chunk; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_chunk); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chunk); + { + __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_19streaming_form_data_7_parser_9AsyncPart_13generator1, __pyx_codeobj__6, (PyObject *) __pyx_cur_scope, __pyx_n_s_data_received, __pyx_n_s_AsyncPart_data_received, __pyx_n_s_streaming_form_data__parser); if (unlikely(!gen)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } - /* "streaming_form_data/_parser.pyx":208 - * - * def data_received(self, bytes data): - * if not data: # <<<<<<<<<<<<<< - * return 0 - * - */ - __pyx_t_1 = (__pyx_v_data != Py_None)&&(PyBytes_GET_SIZE(__pyx_v_data) != 0); - __pyx_t_2 = (!__pyx_t_1); - if (__pyx_t_2) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":209 - * def data_received(self, bytes data): - * if not data: - * return 0 # <<<<<<<<<<<<<< - * - * cdef bytes chunk - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_0); - __pyx_r = __pyx_int_0; - goto __pyx_L0; +static PyObject *__pyx_gb_19streaming_form_data_7_parser_9AsyncPart_13generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received *__pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("data_received", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_await; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 153, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":208 + /* "streaming_form_data/_parser.pyx":154 * - * def data_received(self, bytes data): - * if not data: # <<<<<<<<<<<<<< - * return 0 + * async def data_received(self, bytes chunk): + * for target in self.targets: # <<<<<<<<<<<<<< + * await target.data_received(chunk) * */ + if (unlikely(__pyx_cur_scope->__pyx_v_self->targets == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 154, __pyx_L1_error) } - - /* "streaming_form_data/_parser.pyx":214 - * cdef size_t index - * - * if self._leftover_buffer: # <<<<<<<<<<<<<< - * chunk = self._leftover_buffer + data - * index = len(self._leftover_buffer) - */ - __pyx_t_2 = (__pyx_v_self->_leftover_buffer != Py_None)&&(PyBytes_GET_SIZE(__pyx_v_self->_leftover_buffer) != 0); - if (__pyx_t_2) { - - /* "streaming_form_data/_parser.pyx":215 - * - * if self._leftover_buffer: - * chunk = self._leftover_buffer + data # <<<<<<<<<<<<<< - * index = len(self._leftover_buffer) - * self._leftover_buffer = None - */ - __pyx_t_3 = PyNumber_Add(__pyx_v_self->_leftover_buffer, __pyx_v_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->targets; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 154, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 154, __pyx_L1_error) + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_v_chunk = ((PyObject*)__pyx_t_3); + #endif + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_target); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_target, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - /* "streaming_form_data/_parser.pyx":216 - * if self._leftover_buffer: - * chunk = self._leftover_buffer + data - * index = len(self._leftover_buffer) # <<<<<<<<<<<<<< - * self._leftover_buffer = None - * else: + /* "streaming_form_data/_parser.pyx":155 + * async def data_received(self, bytes chunk): + * for target in self.targets: + * await target.data_received(chunk) # <<<<<<<<<<<<<< + * + * async def finish(self): */ - __pyx_t_3 = __pyx_v_self->_leftover_buffer; - __Pyx_INCREF(__pyx_t_3); - if (unlikely(__pyx_t_3 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_data_received); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_chunk}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_t_4 = __Pyx_PyBytes_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_index = __pyx_t_4; - - /* "streaming_form_data/_parser.pyx":217 - * chunk = self._leftover_buffer + data - * index = len(self._leftover_buffer) - * self._leftover_buffer = None # <<<<<<<<<<<<<< - * else: - * chunk = data - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->_leftover_buffer); - __Pyx_DECREF(__pyx_v_self->_leftover_buffer); - __pyx_v_self->_leftover_buffer = ((PyObject*)Py_None); - - /* "streaming_form_data/_parser.pyx":214 - * cdef size_t index - * - * if self._leftover_buffer: # <<<<<<<<<<<<<< - * chunk = self._leftover_buffer + data - * index = len(self._leftover_buffer) - */ - goto __pyx_L4; - } - - /* "streaming_form_data/_parser.pyx":219 - * self._leftover_buffer = None - * else: - * chunk = data # <<<<<<<<<<<<<< - * index = 0 - * - */ - /*else*/ { - __Pyx_INCREF(__pyx_v_data); - __pyx_v_chunk = __pyx_v_data; - - /* "streaming_form_data/_parser.pyx":220 - * else: - * chunk = data - * index = 0 # <<<<<<<<<<<<<< - * - * return self._parse(chunk, index) - */ - __pyx_v_index = 0; - } - __pyx_L4:; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 155, __pyx_L1_error) + } else { + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear(); + else __PYX_ERR(0, 155, __pyx_L1_error) + } + } - /* "streaming_form_data/_parser.pyx":222 - * index = 0 + /* "streaming_form_data/_parser.pyx":154 * - * return self._parse(chunk, index) # <<<<<<<<<<<<<< + * async def data_received(self, bytes chunk): + * for target in self.targets: # <<<<<<<<<<<<<< + * await target.data_received(chunk) * - * def _parse(self, bytes chunk, size_t index): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_parse); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_chunk, __pyx_t_6}; - __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "streaming_form_data/_parser.pyx":207 - * return part + /* "streaming_form_data/_parser.pyx":153 + * await target.start() * - * def data_received(self, bytes data): # <<<<<<<<<<<<<< - * if not data: - * return 0 + * async def data_received(self, bytes chunk): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.data_received(chunk) */ /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; __pyx_L1_error:; + __Pyx_Generator_Replace_StopIteration(0); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("streaming_form_data._parser._Parser.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("data_received", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_chunk); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_19streaming_form_data_7_parser_9AsyncPart_16generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "streaming_form_data/_parser.pyx":224 - * return self._parse(chunk, index) +/* "streaming_form_data/_parser.pyx":157 + * await target.data_received(chunk) * - * def _parse(self, bytes chunk, size_t index): # <<<<<<<<<<<<<< - * cdef size_t idx, buffer_start, chunk_len - * cdef size_t match_start, skip_count, matched_length + * async def finish(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.finish() */ /* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_13_parse(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_15finish(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_13_parse = {"_parse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_13_parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_13_parse(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_15finish = {"finish", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_15finish, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_15finish(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { - PyObject *__pyx_v_chunk = 0; - size_t __pyx_v_index; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[2] = {0,0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_parse (wrapper)", 0); + __Pyx_RefNannySetupContext("finish (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -11926,5816 +12037,11388 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chunk,&__pyx_n_s_index,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chunk)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_index)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("_parse", 1, 2, 2, 1); __PYX_ERR(0, 224, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_parse") < 0)) __PYX_ERR(0, 224, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 2)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - } - __pyx_v_chunk = ((PyObject*)values[0]); - __pyx_v_index = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_index == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L3_error) + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("finish", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "finish", 0))) return NULL; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_14finish(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_14finish(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("finish", 0); + __pyx_cur_scope = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_2_finish(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 157, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_parse", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 224, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } + __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_19streaming_form_data_7_parser_9AsyncPart_16generator2, __pyx_codeobj__7, (PyObject *) __pyx_cur_scope, __pyx_n_s_finish, __pyx_n_s_AsyncPart_finish, __pyx_n_s_streaming_form_data__parser); if (unlikely(!gen)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - __Pyx_AddTraceback("streaming_form_data._parser._Parser._parse", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chunk), (&PyBytes_Type), 1, "chunk", 1))) __PYX_ERR(0, 224, __pyx_L1_error) - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_12_parse(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_chunk, __pyx_v_index); /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.finish", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_12_parse(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_chunk, size_t __pyx_v_index) { - size_t __pyx_v_idx; - size_t __pyx_v_buffer_start; - size_t __pyx_v_chunk_len; - size_t __pyx_v_match_start; - size_t __pyx_v_skip_count; - size_t __pyx_v_matched_length; - __pyx_t_19streaming_form_data_7_parser_Byte __pyx_v_byte; - __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_v_chunk_ptr; - PyObject *__pyx_v_message = NULL; - PyObject *__pyx_v_params = NULL; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_part = NULL; +static PyObject *__pyx_gb_19streaming_form_data_7_parser_9AsyncPart_16generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish *__pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish *)__pyx_generator->closure); PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_t_1; + PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - size_t __pyx_t_14; - size_t __pyx_t_15; - size_t __pyx_t_16; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_parse", 1); - - /* "streaming_form_data/_parser.pyx":230 - * cdef const Byte *chunk_ptr - * - * chunk_ptr = chunk # <<<<<<<<<<<<<< - * chunk_len = len(chunk) - * buffer_start = 0 - */ - if (unlikely(__pyx_v_chunk == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("finish", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_await; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; } - __pyx_t_1 = __Pyx_PyBytes_AsUString(__pyx_v_chunk); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L1_error) - __pyx_v_chunk_ptr = __pyx_t_1; + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 157, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":231 + /* "streaming_form_data/_parser.pyx":158 * - * chunk_ptr = chunk - * chunk_len = len(chunk) # <<<<<<<<<<<<<< - * buffer_start = 0 + * async def finish(self): + * for target in self.targets: # <<<<<<<<<<<<<< + * await target.finish() * */ - if (unlikely(__pyx_v_chunk == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 231, __pyx_L1_error) + if (unlikely(__pyx_cur_scope->__pyx_v_self->targets == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 158, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_GET_SIZE(__pyx_v_chunk); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 231, __pyx_L1_error) - __pyx_v_chunk_len = __pyx_t_2; + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->targets; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 158, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 158, __pyx_L1_error) + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_target); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_target, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; - /* "streaming_form_data/_parser.pyx":232 - * chunk_ptr = chunk - * chunk_len = len(chunk) - * buffer_start = 0 # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":159 + * async def finish(self): + * for target in self.targets: + * await target.finish() # <<<<<<<<<<<<<< * - * idx = index - */ - __pyx_v_buffer_start = 0; - - /* "streaming_form_data/_parser.pyx":234 - * buffer_start = 0 * - * idx = index # <<<<<<<<<<<<<< - * while idx < chunk_len: - * byte = chunk_ptr[idx] */ - __pyx_v_idx = __pyx_v_index; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_finish); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 159, __pyx_L1_error) + } else { + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear(); + else __PYX_ERR(0, 159, __pyx_L1_error) + } + } - /* "streaming_form_data/_parser.pyx":235 + /* "streaming_form_data/_parser.pyx":158 * - * idx = index - * while idx < chunk_len: # <<<<<<<<<<<<<< - * byte = chunk_ptr[idx] + * async def finish(self): + * for target in self.targets: # <<<<<<<<<<<<<< + * await target.finish() * */ - while (1) { - __pyx_t_3 = (__pyx_v_idx < __pyx_v_chunk_len); - if (!__pyx_t_3) break; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "streaming_form_data/_parser.pyx":236 - * idx = index - * while idx < chunk_len: - * byte = chunk_ptr[idx] # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":157 + * await target.data_received(chunk) * - * if self.state == ParserState.PS_START: + * async def finish(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.finish() */ - __pyx_v_byte = (__pyx_v_chunk_ptr[__pyx_v_idx]); - /* "streaming_form_data/_parser.pyx":238 - * byte = chunk_ptr[idx] - * - * if self.state == ParserState.PS_START: # <<<<<<<<<<<<<< - * if byte == c_hyphen: - * buffer_start = idx - */ - switch (__pyx_v_self->state) { - case __pyx_e_19streaming_form_data_7_parser_PS_START: + /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_Generator_Replace_StopIteration(0); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("finish", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":239 +/* "streaming_form_data/_parser.pyx":131 + * """ + * + * cdef public str name # <<<<<<<<<<<<<< + * cdef list targets * - * if self.state == ParserState.PS_START: - * if byte == c_hyphen: # <<<<<<<<<<<<<< - * buffer_start = idx - * self.state = ParserState.PS_STARTING_BOUNDARY */ - __pyx_t_3 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_hyphen); - if (__pyx_t_3) { - /* "streaming_form_data/_parser.pyx":240 - * if self.state == ParserState.PS_START: - * if byte == c_hyphen: - * buffer_start = idx # <<<<<<<<<<<<<< - * self.state = ParserState.PS_STARTING_BOUNDARY - * elif byte == c_cr: - */ - __pyx_v_buffer_start = __pyx_v_idx; +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_4name_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_4name_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4name___get__(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self)); - /* "streaming_form_data/_parser.pyx":241 - * if byte == c_hyphen: - * buffer_start = idx - * self.state = ParserState.PS_STARTING_BOUNDARY # <<<<<<<<<<<<<< - * elif byte == c_cr: - * self.state = ParserState.PS_START_CR - */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_STARTING_BOUNDARY; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":239 - * - * if self.state == ParserState.PS_START: - * if byte == c_hyphen: # <<<<<<<<<<<<<< - * buffer_start = idx - * self.state = ParserState.PS_STARTING_BOUNDARY - */ - goto __pyx_L5; - } +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4name___get__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 1); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; - /* "streaming_form_data/_parser.pyx":242 - * buffer_start = idx - * self.state = ParserState.PS_STARTING_BOUNDARY - * elif byte == c_cr: # <<<<<<<<<<<<<< - * self.state = ParserState.PS_START_CR - * else: - */ - __pyx_t_3 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_cr); - if (__pyx_t_3) { + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":243 - * self.state = ParserState.PS_STARTING_BOUNDARY - * elif byte == c_cr: - * self.state = ParserState.PS_START_CR # <<<<<<<<<<<<<< - * else: - * self.mark_error() - */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_START_CR; +/* Python wrapper */ +static int __pyx_pw_19streaming_form_data_7_parser_9AsyncPart_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_19streaming_form_data_7_parser_9AsyncPart_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4name_2__set__(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - /* "streaming_form_data/_parser.pyx":242 - * buffer_start = idx - * self.state = ParserState.PS_STARTING_BOUNDARY - * elif byte == c_cr: # <<<<<<<<<<<<<< - * self.state = ParserState.PS_START_CR - * else: - */ - goto __pyx_L5; - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":245 - * self.state = ParserState.PS_START_CR - * else: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Delimiting + 1 - * - */ - /*else*/ { - __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; +static int __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4name_2__set__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 1); + if (!(likely(PyUnicode_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_value))) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_1 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":246 - * else: - * self.mark_error() - * return ErrorGroup.Delimiting + 1 # <<<<<<<<<<<<<< - * - * elif self.state == ParserState.PS_START_CR: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Delimiting + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - __pyx_L5:; + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":238 - * byte = chunk_ptr[idx] - * - * if self.state == ParserState.PS_START: # <<<<<<<<<<<<<< - * if byte == c_hyphen: - * buffer_start = idx - */ - break; - case __pyx_e_19streaming_form_data_7_parser_PS_START_CR: +/* Python wrapper */ +static int __pyx_pw_19streaming_form_data_7_parser_9AsyncPart_4name_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_19streaming_form_data_7_parser_9AsyncPart_4name_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4name_4__del__(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self)); - /* "streaming_form_data/_parser.pyx":249 - * - * elif self.state == ParserState.PS_START_CR: - * if byte == c_lf: # <<<<<<<<<<<<<< - * self.state = ParserState.PS_START - * else: - */ - __pyx_t_3 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_lf); - if (__pyx_t_3) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":250 - * elif self.state == ParserState.PS_START_CR: - * if byte == c_lf: - * self.state = ParserState.PS_START # <<<<<<<<<<<<<< - * else: - * self.mark_error() - */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_START; +static int __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_4name_4__del__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 1); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = ((PyObject*)Py_None); - /* "streaming_form_data/_parser.pyx":249 - * - * elif self.state == ParserState.PS_START_CR: - * if byte == c_lf: # <<<<<<<<<<<<<< - * self.state = ParserState.PS_START - * else: - */ - goto __pyx_L6; - } + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":252 - * self.state = ParserState.PS_START - * else: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Delimiting + 4 - * +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - /*else*/ { - __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "streaming_form_data/_parser.pyx":253 - * else: - * self.mark_error() - * return ErrorGroup.Delimiting + 4 # <<<<<<<<<<<<<< - * - * elif self.state == ParserState.PS_STARTING_BOUNDARY: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Delimiting + 4)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - __pyx_L6:; +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_18__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_18__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_18__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_18__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_17__reduce_cython__(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self)); - /* "streaming_form_data/_parser.pyx":248 - * return ErrorGroup.Delimiting + 1 - * - * elif self.state == ParserState.PS_START_CR: # <<<<<<<<<<<<<< - * if byte == c_lf: - * self.state = ParserState.PS_START - */ - break; - case __pyx_e_19streaming_form_data_7_parser_PS_STARTING_BOUNDARY: + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":256 - * - * elif self.state == ParserState.PS_STARTING_BOUNDARY: - * if byte != c_hyphen: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Delimiting + 2 - */ - __pyx_t_3 = (__pyx_v_byte != __pyx_v_19streaming_form_data_7_parser_c_hyphen); - if (__pyx_t_3) { +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_17__reduce_cython__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 1); - /* "streaming_form_data/_parser.pyx":257 - * elif self.state == ParserState.PS_STARTING_BOUNDARY: - * if byte != c_hyphen: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Delimiting + 2 - * + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name, self.targets) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: */ - __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->targets); + __Pyx_GIVEREF(__pyx_v_self->targets); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->targets)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":258 - * if byte != c_hyphen: - * self.mark_error() - * return ErrorGroup.Delimiting + 2 # <<<<<<<<<<<<<< - * - * self.state = ParserState.PS_READING_BOUNDARY + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name, self.targets) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Delimiting + 2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __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) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":256 - * - * elif self.state == ParserState.PS_STARTING_BOUNDARY: - * if byte != c_hyphen: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Delimiting + 2 + /* "(tree fragment)":7 + * state = (self.name, self.targets) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - } + __pyx_t_2 = (__pyx_v__dict != Py_None); + if (__pyx_t_2) { - /* "streaming_form_data/_parser.pyx":260 - * return ErrorGroup.Delimiting + 2 - * - * self.state = ParserState.PS_READING_BOUNDARY # <<<<<<<<<<<<<< - * elif self.state == ParserState.PS_READING_BOUNDARY: - * if byte == c_cr: + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_READING_BOUNDARY; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "streaming_form_data/_parser.pyx":255 - * return ErrorGroup.Delimiting + 4 - * - * elif self.state == ParserState.PS_STARTING_BOUNDARY: # <<<<<<<<<<<<<< - * if byte != c_hyphen: - * self.mark_error() + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.name is not None or self.targets is not None */ - break; - case __pyx_e_19streaming_form_data_7_parser_PS_READING_BOUNDARY: + __pyx_v_use_setstate = 1; - /* "streaming_form_data/_parser.pyx":262 - * self.state = ParserState.PS_READING_BOUNDARY - * elif self.state == ParserState.PS_READING_BOUNDARY: - * if byte == c_cr: # <<<<<<<<<<<<<< - * self.state = ParserState.PS_ENDING_BOUNDARY - * + /* "(tree fragment)":7 + * state = (self.name, self.targets) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - __pyx_t_3 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_cr); - if (__pyx_t_3) { + goto __pyx_L3; + } - /* "streaming_form_data/_parser.pyx":263 - * elif self.state == ParserState.PS_READING_BOUNDARY: - * if byte == c_cr: - * self.state = ParserState.PS_ENDING_BOUNDARY # <<<<<<<<<<<<<< - * - * elif self.state == ParserState.PS_ENDING_BOUNDARY: - */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_ENDING_BOUNDARY; - - /* "streaming_form_data/_parser.pyx":262 - * self.state = ParserState.PS_READING_BOUNDARY - * elif self.state == ParserState.PS_READING_BOUNDARY: - * if byte == c_cr: # <<<<<<<<<<<<<< - * self.state = ParserState.PS_ENDING_BOUNDARY - * - */ - } - - /* "streaming_form_data/_parser.pyx":261 - * - * self.state = ParserState.PS_READING_BOUNDARY - * elif self.state == ParserState.PS_READING_BOUNDARY: # <<<<<<<<<<<<<< - * if byte == c_cr: - * self.state = ParserState.PS_ENDING_BOUNDARY - */ - break; - case __pyx_e_19streaming_form_data_7_parser_PS_ENDING_BOUNDARY: - - /* "streaming_form_data/_parser.pyx":266 - * - * elif self.state == ParserState.PS_ENDING_BOUNDARY: - * if byte != c_lf: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Delimiting + 3 - */ - __pyx_t_3 = (__pyx_v_byte != __pyx_v_19streaming_form_data_7_parser_c_lf); - if (__pyx_t_3) { - - /* "streaming_form_data/_parser.pyx":267 - * elif self.state == ParserState.PS_ENDING_BOUNDARY: - * if byte != c_lf: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Delimiting + 3 - * + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = self.name is not None or self.targets is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, None), state */ - __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + /*else*/ { + __pyx_t_4 = (__pyx_v_self->name != ((PyObject*)Py_None)); + if (!__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = (__pyx_v_self->targets != ((PyObject*)Py_None)); + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; - /* "streaming_form_data/_parser.pyx":268 - * if byte != c_lf: - * self.mark_error() - * return ErrorGroup.Delimiting + 3 # <<<<<<<<<<<<<< - * - * # ensure we have read correct starting delimiter + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None or self.targets is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, None), state + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Delimiting + 3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + if (__pyx_v_use_setstate) { - /* "streaming_form_data/_parser.pyx":266 - * - * elif self.state == ParserState.PS_ENDING_BOUNDARY: - * if byte != c_lf: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Delimiting + 3 + /* "(tree fragment)":13 + * use_setstate = self.name is not None or self.targets is not None + * if use_setstate: + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, state) */ - } + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_AsyncPart); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_121382421); + __Pyx_GIVEREF(__pyx_int_121382421); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_121382421)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "streaming_form_data/_parser.pyx":271 - * - * # ensure we have read correct starting delimiter - * if b'\r\n' + chunk[buffer_start: idx + 1] != \ # <<<<<<<<<<<<<< - * self.delimiter_finder.target: - * self.mark_error() + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None or self.targets is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, None), state + * else: */ - if (unlikely(__pyx_v_chunk == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 271, __pyx_L1_error) - } - __pyx_t_4 = PySequence_GetSlice(__pyx_v_chunk, __pyx_v_buffer_start, (__pyx_v_idx + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyNumber_Add(__pyx_kp_b__5, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } - /* "streaming_form_data/_parser.pyx":272 - * # ensure we have read correct starting delimiter - * if b'\r\n' + chunk[buffer_start: idx + 1] != \ - * self.delimiter_finder.target: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Delimiting + 5 + /* "(tree fragment)":15 + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, None), state + * else: + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_AsyncPart__set_state(self, __pyx_state) */ - __pyx_t_3 = (__Pyx_PyBytes_Equals(__pyx_t_5, __pyx_v_self->delimiter_finder->target, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_AsyncPart); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_121382421); + __Pyx_GIVEREF(__pyx_int_121382421); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_121382421)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } - /* "streaming_form_data/_parser.pyx":271 - * - * # ensure we have read correct starting delimiter - * if b'\r\n' + chunk[buffer_start: idx + 1] != \ # <<<<<<<<<<<<<< - * self.delimiter_finder.target: - * self.mark_error() + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - if (__pyx_t_3) { - /* "streaming_form_data/_parser.pyx":273 - * if b'\r\n' + chunk[buffer_start: idx + 1] != \ - * self.delimiter_finder.target: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Delimiting + 5 - * - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":274 - * self.delimiter_finder.target: - * self.mark_error() - * return ErrorGroup.Delimiting + 5 # <<<<<<<<<<<<<< - * - * buffer_start = idx + 1 +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_AsyncPart__set_state(self, __pyx_state) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Delimiting + 5)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - /* "streaming_form_data/_parser.pyx":271 - * - * # ensure we have read correct starting delimiter - * if b'\r\n' + chunk[buffer_start: idx + 1] != \ # <<<<<<<<<<<<<< - * self.delimiter_finder.target: - * self.mark_error() - */ +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_20__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_20__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_20__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_20__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - - /* "streaming_form_data/_parser.pyx":276 - * return ErrorGroup.Delimiting + 5 - * - * buffer_start = idx + 1 # <<<<<<<<<<<<<< - * - * self.state = ParserState.PS_READING_HEADER + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_9AsyncPart_19__setstate_cython__(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser_9AsyncPart_19__setstate_cython__(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 1); + + /* "(tree fragment)":17 + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_AsyncPart__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - __pyx_v_buffer_start = (__pyx_v_idx + 1); + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_f_19streaming_form_data_7_parser___pyx_unpickle_AsyncPart__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":278 - * buffer_start = idx + 1 - * - * self.state = ParserState.PS_READING_HEADER # <<<<<<<<<<<<<< - * elif self.state == ParserState.PS_READING_HEADER: - * if byte == c_cr: + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_AsyncPart__set_state(self, __pyx_state) */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_READING_HEADER; - /* "streaming_form_data/_parser.pyx":265 - * self.state = ParserState.PS_ENDING_BOUNDARY + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("streaming_form_data._parser.AsyncPart.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "streaming_form_data/_parser.pyx":196 + * cdef public str unexpected_part_name * - * elif self.state == ParserState.PS_ENDING_BOUNDARY: # <<<<<<<<<<<<<< - * if byte != c_lf: - * self.mark_error() + * def __init__(self, bytes delimiter, bytes ender, bint strict): # <<<<<<<<<<<<<< + * self.delimiter_finder = Finder(delimiter) + * self.ender_finder = Finder(ender) */ - break; - case __pyx_e_19streaming_form_data_7_parser_PS_READING_HEADER: - /* "streaming_form_data/_parser.pyx":280 - * self.state = ParserState.PS_READING_HEADER - * elif self.state == ParserState.PS_READING_HEADER: - * if byte == c_cr: # <<<<<<<<<<<<<< - * self.state = ParserState.PS_ENDING_HEADER +/* Python wrapper */ +static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_delimiter = 0; + PyObject *__pyx_v_ender = 0; + int __pyx_v_strict; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_delimiter,&__pyx_n_s_ender,&__pyx_n_s_strict,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_delimiter)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ender)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 196, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_strict)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 196, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 196, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + } + __pyx_v_delimiter = ((PyObject*)values[0]); + __pyx_v_ender = ((PyObject*)values[1]); + __pyx_v_strict = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_strict == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 196, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser._Parser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delimiter), (&PyBytes_Type), 1, "delimiter", 1))) __PYX_ERR(0, 196, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ender), (&PyBytes_Type), 1, "ender", 1))) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser___init__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_delimiter, __pyx_v_ender, __pyx_v_strict); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19streaming_form_data_7_parser_7_Parser___init__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_delimiter, PyObject *__pyx_v_ender, int __pyx_v_strict) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 1); + + /* "streaming_form_data/_parser.pyx":197 + * + * def __init__(self, bytes delimiter, bytes ender, bint strict): + * self.delimiter_finder = Finder(delimiter) # <<<<<<<<<<<<<< + * self.ender_finder = Finder(ender) * */ - __pyx_t_3 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_cr); - if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder), __pyx_v_delimiter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->delimiter_finder); + __Pyx_DECREF((PyObject *)__pyx_v_self->delimiter_finder); + __pyx_v_self->delimiter_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)__pyx_t_1); + __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":281 - * elif self.state == ParserState.PS_READING_HEADER: - * if byte == c_cr: - * self.state = ParserState.PS_ENDING_HEADER # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":198 + * def __init__(self, bytes delimiter, bytes ender, bint strict): + * self.delimiter_finder = Finder(delimiter) + * self.ender_finder = Finder(ender) # <<<<<<<<<<<<<< * - * elif self.state == ParserState.PS_ENDING_HEADER: + * self.delimiter_length = len(delimiter) */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_ENDING_HEADER; + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder), __pyx_v_ender); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->ender_finder); + __Pyx_DECREF((PyObject *)__pyx_v_self->ender_finder); + __pyx_v_self->ender_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)__pyx_t_1); + __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":280 - * self.state = ParserState.PS_READING_HEADER - * elif self.state == ParserState.PS_READING_HEADER: - * if byte == c_cr: # <<<<<<<<<<<<<< - * self.state = ParserState.PS_ENDING_HEADER + /* "streaming_form_data/_parser.pyx":200 + * self.ender_finder = Finder(ender) + * + * self.delimiter_length = len(delimiter) # <<<<<<<<<<<<<< + * self.ender_length = len(ender) * */ - } + if (unlikely(__pyx_v_delimiter == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 200, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyBytes_GET_SIZE(__pyx_v_delimiter); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_v_self->delimiter_length = __pyx_t_2; - /* "streaming_form_data/_parser.pyx":279 + /* "streaming_form_data/_parser.pyx":201 * - * self.state = ParserState.PS_READING_HEADER - * elif self.state == ParserState.PS_READING_HEADER: # <<<<<<<<<<<<<< - * if byte == c_cr: - * self.state = ParserState.PS_ENDING_HEADER - */ - break; - case __pyx_e_19streaming_form_data_7_parser_PS_ENDING_HEADER: - - /* "streaming_form_data/_parser.pyx":284 + * self.delimiter_length = len(delimiter) + * self.ender_length = len(ender) # <<<<<<<<<<<<<< * - * elif self.state == ParserState.PS_ENDING_HEADER: - * if byte != c_lf: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.PartHeaders + 1 + * self.state = ParserState.PS_START */ - __pyx_t_3 = (__pyx_v_byte != __pyx_v_19streaming_form_data_7_parser_c_lf); - if (__pyx_t_3) { + if (unlikely(__pyx_v_ender == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 201, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyBytes_GET_SIZE(__pyx_v_ender); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_v_self->ender_length = __pyx_t_2; - /* "streaming_form_data/_parser.pyx":285 - * elif self.state == ParserState.PS_ENDING_HEADER: - * if byte != c_lf: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.PartHeaders + 1 + /* "streaming_form_data/_parser.pyx":203 + * self.ender_length = len(ender) * - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "streaming_form_data/_parser.pyx":286 - * if byte != c_lf: - * self.mark_error() - * return ErrorGroup.PartHeaders + 1 # <<<<<<<<<<<<<< + * self.state = ParserState.PS_START # <<<<<<<<<<<<<< * - * message = Parser(policy=HTTP).parsestr(chunk[buffer_start: idx + 1].decode('utf-8')) + * self.expected_parts = [] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_PartHeaders + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_START; - /* "streaming_form_data/_parser.pyx":284 + /* "streaming_form_data/_parser.pyx":205 + * self.state = ParserState.PS_START * - * elif self.state == ParserState.PS_ENDING_HEADER: - * if byte != c_lf: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.PartHeaders + 1 + * self.expected_parts = [] # <<<<<<<<<<<<<< + * + * self.active_part = None */ - } + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->expected_parts); + __Pyx_DECREF(__pyx_v_self->expected_parts); + __pyx_v_self->expected_parts = __pyx_t_1; + __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":288 - * return ErrorGroup.PartHeaders + 1 + /* "streaming_form_data/_parser.pyx":207 + * self.expected_parts = [] * - * message = Parser(policy=HTTP).parsestr(chunk[buffer_start: idx + 1].decode('utf-8')) # <<<<<<<<<<<<<< + * self.active_part = None # <<<<<<<<<<<<<< + * self.default_part = Part('_default', NullTarget()) * - * if 'content-disposition' in message: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Parser); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_HTTP); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_policy, __pyx_t_7) < 0) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_parsestr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(__pyx_v_chunk == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 288, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_decode_bytes(__pyx_v_chunk, __pyx_v_buffer_start, (__pyx_v_idx + 1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_XDECREF_SET(__pyx_v_message, __pyx_t_5); - __pyx_t_5 = 0; + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->active_part); + __Pyx_DECREF(__pyx_v_self->active_part); + __pyx_v_self->active_part = Py_None; - /* "streaming_form_data/_parser.pyx":290 - * message = Parser(policy=HTTP).parsestr(chunk[buffer_start: idx + 1].decode('utf-8')) + /* "streaming_form_data/_parser.pyx":208 * - * if 'content-disposition' in message: # <<<<<<<<<<<<<< - * if not message.get_content_disposition() == 'form-data': - * self.mark_error() + * self.active_part = None + * self.default_part = Part('_default', NullTarget()) # <<<<<<<<<<<<<< + * + * self._leftover_buffer = None */ - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_content_disposition, __pyx_v_message, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 290, __pyx_L1_error) - if (__pyx_t_3) { + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_NullTarget); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_n_u_default); + __Pyx_GIVEREF(__pyx_n_u_default); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_default)) __PYX_ERR(0, 208, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->default_part); + __Pyx_DECREF(__pyx_v_self->default_part); + __pyx_v_self->default_part = __pyx_t_1; + __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":291 + /* "streaming_form_data/_parser.pyx":210 + * self.default_part = Part('_default', NullTarget()) * - * if 'content-disposition' in message: - * if not message.get_content_disposition() == 'form-data': # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.PartHeaders + 1 + * self._leftover_buffer = None # <<<<<<<<<<<<<< + * + * self.strict = strict */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_n_s_get_content_disposition); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_kp_u_form_data, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_9 = (!__pyx_t_3); - if (__pyx_t_9) { + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_leftover_buffer); + __Pyx_DECREF(__pyx_v_self->_leftover_buffer); + __pyx_v_self->_leftover_buffer = ((PyObject*)Py_None); - /* "streaming_form_data/_parser.pyx":292 - * if 'content-disposition' in message: - * if not message.get_content_disposition() == 'form-data': - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.PartHeaders + 1 + /* "streaming_form_data/_parser.pyx":212 + * self._leftover_buffer = None + * + * self.strict = strict # <<<<<<<<<<<<<< + * self.unexpected_part_name = '' * */ - __pyx_t_5 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_self->strict = __pyx_v_strict; - /* "streaming_form_data/_parser.pyx":293 - * if not message.get_content_disposition() == 'form-data': - * self.mark_error() - * return ErrorGroup.PartHeaders + 1 # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":213 * - * params = message['content-disposition'].params + * self.strict = strict + * self.unexpected_part_name = '' # <<<<<<<<<<<<<< + * + * def register(self, str name, object target): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_PartHeaders + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __Pyx_INCREF(__pyx_kp_u_); + __Pyx_GIVEREF(__pyx_kp_u_); + __Pyx_GOTREF(__pyx_v_self->unexpected_part_name); + __Pyx_DECREF(__pyx_v_self->unexpected_part_name); + __pyx_v_self->unexpected_part_name = __pyx_kp_u_; - /* "streaming_form_data/_parser.pyx":291 + /* "streaming_form_data/_parser.pyx":196 + * cdef public str unexpected_part_name * - * if 'content-disposition' in message: - * if not message.get_content_disposition() == 'form-data': # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.PartHeaders + 1 + * def __init__(self, bytes delimiter, bytes ender, bint strict): # <<<<<<<<<<<<<< + * self.delimiter_finder = Finder(delimiter) + * self.ender_finder = Finder(ender) */ - } - /* "streaming_form_data/_parser.pyx":295 - * return ErrorGroup.PartHeaders + 1 + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "streaming_form_data/_parser.pyx":215 + * self.unexpected_part_name = '' * - * params = message['content-disposition'].params # <<<<<<<<<<<<<< - * name = params.get('name') + * def register(self, str name, object target): # <<<<<<<<<<<<<< + * part = self._part_for(name) * */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_message, __pyx_kp_u_content_disposition); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_params); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_params, __pyx_t_6); - __pyx_t_6 = 0; - /* "streaming_form_data/_parser.pyx":296 - * - * params = message['content-disposition'].params - * name = params.get('name') # <<<<<<<<<<<<<< - * - * if name: - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_params, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_3register(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_3register = {"register", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_3register, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_3register(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_name = 0; + PyObject *__pyx_v_target = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("register (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_target,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_n_u_name}; - __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_target)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; } - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6); - __pyx_t_6 = 0; - - /* "streaming_form_data/_parser.pyx":298 - * name = params.get('name') - * - * if name: # <<<<<<<<<<<<<< - * part = self._part_for(name) - * if part is None: - */ - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 298, __pyx_L1_error) - if (__pyx_t_9) { + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("register", 1, 2, 2, 1); __PYX_ERR(0, 215, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "register") < 0)) __PYX_ERR(0, 215, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_name = ((PyObject*)values[0]); + __pyx_v_target = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("register", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 215, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser._Parser.register", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_2register(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_name, __pyx_v_target); - /* "streaming_form_data/_parser.pyx":299 - * - * if name: - * part = self._part_for(name) # <<<<<<<<<<<<<< - * if part is None: - * part = self.default_part - */ - if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_name))) __PYX_ERR(0, 299, __pyx_L1_error) - __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->_part_for(__pyx_v_self, ((PyObject*)__pyx_v_name)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XDECREF_SET(__pyx_v_part, __pyx_t_6); - __pyx_t_6 = 0; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":300 - * if name: - * part = self._part_for(name) - * if part is None: # <<<<<<<<<<<<<< - * part = self.default_part - * if self.strict: - */ - __pyx_t_9 = (__pyx_v_part == Py_None); - if (__pyx_t_9) { +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_2register(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_target) { + PyObject *__pyx_v_part = NULL; + PyTypeObject *__pyx_v_part_cls = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("register", 1); - /* "streaming_form_data/_parser.pyx":301 - * part = self._part_for(name) - * if part is None: - * part = self.default_part # <<<<<<<<<<<<<< - * if self.strict: - * self.unexpected_part_name = name + /* "streaming_form_data/_parser.pyx":216 + * + * def register(self, str name, object target): + * part = self._part_for(name) # <<<<<<<<<<<<<< + * + * if part: */ - __pyx_t_6 = __pyx_v_self->default_part; - __Pyx_INCREF(__pyx_t_6); - __Pyx_DECREF_SET(__pyx_v_part, __pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_1 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->_part_for(__pyx_v_self, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_part = __pyx_t_1; + __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":302 - * if part is None: - * part = self.default_part - * if self.strict: # <<<<<<<<<<<<<< - * self.unexpected_part_name = name - * self.mark_error() + /* "streaming_form_data/_parser.pyx":218 + * part = self._part_for(name) + * + * if part: # <<<<<<<<<<<<<< + * part.add_target(target) + * else: */ - if (__pyx_v_self->strict) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_part); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 218, __pyx_L1_error) + if (__pyx_t_2) { - /* "streaming_form_data/_parser.pyx":303 - * part = self.default_part - * if self.strict: - * self.unexpected_part_name = name # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.UnexpectedPart + /* "streaming_form_data/_parser.pyx":219 + * + * if part: + * part.add_target(target) # <<<<<<<<<<<<<< + * else: + * part_cls = AsyncPart if is_async_target(target) else Part */ - if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_name))) __PYX_ERR(0, 303, __pyx_L1_error) - __pyx_t_6 = __pyx_v_name; - __Pyx_INCREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_v_self->unexpected_part_name); - __Pyx_DECREF(__pyx_v_self->unexpected_part_name); - __pyx_v_self->unexpected_part_name = ((PyObject*)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_part, __pyx_n_s_add_target); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_target}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":304 - * if self.strict: - * self.unexpected_part_name = name - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.UnexpectedPart + /* "streaming_form_data/_parser.pyx":218 + * part = self._part_for(name) * + * if part: # <<<<<<<<<<<<<< + * part.add_target(target) + * else: */ - __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L3; + } - /* "streaming_form_data/_parser.pyx":305 - * self.unexpected_part_name = name - * self.mark_error() - * return ErrorGroup.UnexpectedPart # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":221 + * part.add_target(target) + * else: + * part_cls = AsyncPart if is_async_target(target) else Part # <<<<<<<<<<<<<< + * self.expected_parts.append(part_cls(name, target)) * - * self.set_active_part(part, params.get('filename')) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_Enum_54f4e2__19streaming_form_data_7_parser_enum__dunderpyx_t_19streaming_form_data_7_parser_ErrorGroup__etc_to_py(__pyx_e_19streaming_form_data_7_parser_UnexpectedPart); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - /* "streaming_form_data/_parser.pyx":302 - * if part is None: - * part = self.default_part - * if self.strict: # <<<<<<<<<<<<<< - * self.unexpected_part_name = name - * self.mark_error() - */ - } - - /* "streaming_form_data/_parser.pyx":300 - * if name: - * part = self._part_for(name) - * if part is None: # <<<<<<<<<<<<<< - * part = self.default_part - * if self.strict: - */ - } - - /* "streaming_form_data/_parser.pyx":307 - * return ErrorGroup.UnexpectedPart - * - * self.set_active_part(part, params.get('filename')) # <<<<<<<<<<<<<< - * elif 'content-type' in message: - * if self.active_part: - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_active_part); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_params, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_n_u_filename}; - __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __pyx_t_4 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_part, __pyx_t_7}; - __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "streaming_form_data/_parser.pyx":298 - * name = params.get('name') - * - * if name: # <<<<<<<<<<<<<< - * part = self._part_for(name) - * if part is None: - */ - } - - /* "streaming_form_data/_parser.pyx":290 - * message = Parser(policy=HTTP).parsestr(chunk[buffer_start: idx + 1].decode('utf-8')) - * - * if 'content-disposition' in message: # <<<<<<<<<<<<<< - * if not message.get_content_disposition() == 'form-data': - * self.mark_error() */ - goto __pyx_L13; + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_is_async_target); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_5 = 1; } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_target}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + __Pyx_INCREF((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + __pyx_t_1 = ((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + } else { + __Pyx_INCREF((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part); + __pyx_t_1 = ((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part); + } + __pyx_v_part_cls = ((PyTypeObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":308 + /* "streaming_form_data/_parser.pyx":222 + * else: + * part_cls = AsyncPart if is_async_target(target) else Part + * self.expected_parts.append(part_cls(name, target)) # <<<<<<<<<<<<<< * - * self.set_active_part(part, params.get('filename')) - * elif 'content-type' in message: # <<<<<<<<<<<<<< - * if self.active_part: - * self.active_part.set_multipart_content_type( - */ - __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_content_type, __pyx_v_message, Py_EQ)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 308, __pyx_L1_error) - if (__pyx_t_9) { - - /* "streaming_form_data/_parser.pyx":309 - * self.set_active_part(part, params.get('filename')) - * elif 'content-type' in message: - * if self.active_part: # <<<<<<<<<<<<<< - * self.active_part.set_multipart_content_type( - * message.get_content_type() - */ - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_self->active_part); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 309, __pyx_L1_error) - if (__pyx_t_9) { - - /* "streaming_form_data/_parser.pyx":310 - * elif 'content-type' in message: - * if self.active_part: - * self.active_part.set_multipart_content_type( # <<<<<<<<<<<<<< - * message.get_content_type() - * ) + * def set_active_part(self, part, str filename): */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_set_multipart_content_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name)) __PYX_ERR(0, 222, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_target); + __Pyx_GIVEREF(__pyx_v_target); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_target)) __PYX_ERR(0, 222, __pyx_L1_error); + __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_part_cls), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_self->expected_parts, __pyx_t_3); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; - /* "streaming_form_data/_parser.pyx":311 - * if self.active_part: - * self.active_part.set_multipart_content_type( - * message.get_content_type() # <<<<<<<<<<<<<< - * ) + /* "streaming_form_data/_parser.pyx":215 + * self.unexpected_part_name = '' * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_n_s_get_content_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; - __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __pyx_t_4 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; - __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "streaming_form_data/_parser.pyx":309 - * self.set_active_part(part, params.get('filename')) - * elif 'content-type' in message: - * if self.active_part: # <<<<<<<<<<<<<< - * self.active_part.set_multipart_content_type( - * message.get_content_type() - */ - } - - /* "streaming_form_data/_parser.pyx":308 + * def register(self, str name, object target): # <<<<<<<<<<<<<< + * part = self._part_for(name) * - * self.set_active_part(part, params.get('filename')) - * elif 'content-type' in message: # <<<<<<<<<<<<<< - * if self.active_part: - * self.active_part.set_multipart_content_type( */ - } - __pyx_L13:; - /* "streaming_form_data/_parser.pyx":314 - * ) - * - * buffer_start = idx + 1 # <<<<<<<<<<<<<< - * - * self.state = ParserState.PS_ENDED_HEADER - */ - __pyx_v_buffer_start = (__pyx_v_idx + 1); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.register", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_part); + __Pyx_XDECREF((PyObject *)__pyx_v_part_cls); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":316 - * buffer_start = idx + 1 +/* "streaming_form_data/_parser.pyx":224 + * self.expected_parts.append(part_cls(name, target)) * - * self.state = ParserState.PS_ENDED_HEADER # <<<<<<<<<<<<<< - * elif self.state == ParserState.PS_ENDED_HEADER: - * if byte == c_cr: + * def set_active_part(self, part, str filename): # <<<<<<<<<<<<<< + * self.active_part = part + * self.active_part.set_multipart_filename(filename) */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_ENDED_HEADER; - /* "streaming_form_data/_parser.pyx":283 - * self.state = ParserState.PS_ENDING_HEADER - * - * elif self.state == ParserState.PS_ENDING_HEADER: # <<<<<<<<<<<<<< - * if byte != c_lf: - * self.mark_error() - */ - break; - case __pyx_e_19streaming_form_data_7_parser_PS_ENDED_HEADER: +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_5set_active_part(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_5set_active_part = {"set_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_5set_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_5set_active_part(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_part = 0; + PyObject *__pyx_v_filename = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_active_part (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_part,&__pyx_n_s_filename,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_part)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("set_active_part", 1, 2, 2, 1); __PYX_ERR(0, 224, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_active_part") < 0)) __PYX_ERR(0, 224, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_part = values[0]; + __pyx_v_filename = ((PyObject*)values[1]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_active_part", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 224, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser._Parser.set_active_part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_4set_active_part(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_part, __pyx_v_filename); - /* "streaming_form_data/_parser.pyx":318 - * self.state = ParserState.PS_ENDED_HEADER - * elif self.state == ParserState.PS_ENDED_HEADER: - * if byte == c_cr: # <<<<<<<<<<<<<< - * self.state = ParserState.PS_ENDING_ALL_HEADERS - * else: - */ - __pyx_t_9 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_cr); - if (__pyx_t_9) { + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":319 - * elif self.state == ParserState.PS_ENDED_HEADER: - * if byte == c_cr: - * self.state = ParserState.PS_ENDING_ALL_HEADERS # <<<<<<<<<<<<<< - * else: - * self.state = ParserState.PS_READING_HEADER - */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_ENDING_ALL_HEADERS; +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_4set_active_part(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_part, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_active_part", 1); - /* "streaming_form_data/_parser.pyx":318 - * self.state = ParserState.PS_ENDED_HEADER - * elif self.state == ParserState.PS_ENDED_HEADER: - * if byte == c_cr: # <<<<<<<<<<<<<< - * self.state = ParserState.PS_ENDING_ALL_HEADERS - * else: + /* "streaming_form_data/_parser.pyx":225 + * + * def set_active_part(self, part, str filename): + * self.active_part = part # <<<<<<<<<<<<<< + * self.active_part.set_multipart_filename(filename) + * self.active_part.start() */ - goto __pyx_L19; - } + __Pyx_INCREF(__pyx_v_part); + __Pyx_GIVEREF(__pyx_v_part); + __Pyx_GOTREF(__pyx_v_self->active_part); + __Pyx_DECREF(__pyx_v_self->active_part); + __pyx_v_self->active_part = __pyx_v_part; - /* "streaming_form_data/_parser.pyx":321 - * self.state = ParserState.PS_ENDING_ALL_HEADERS - * else: - * self.state = ParserState.PS_READING_HEADER # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":226 + * def set_active_part(self, part, str filename): + * self.active_part = part + * self.active_part.set_multipart_filename(filename) # <<<<<<<<<<<<<< + * self.active_part.start() * - * elif self.state == ParserState.PS_ENDING_ALL_HEADERS: */ - /*else*/ { - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_READING_HEADER; - } - __pyx_L19:; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_set_multipart_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_filename}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":317 + /* "streaming_form_data/_parser.pyx":227 + * self.active_part = part + * self.active_part.set_multipart_filename(filename) + * self.active_part.start() # <<<<<<<<<<<<<< * - * self.state = ParserState.PS_ENDED_HEADER - * elif self.state == ParserState.PS_ENDED_HEADER: # <<<<<<<<<<<<<< - * if byte == c_cr: - * self.state = ParserState.PS_ENDING_ALL_HEADERS + * async def async_set_active_part(self, part, str filename): */ - break; - case __pyx_e_19streaming_form_data_7_parser_PS_ENDING_ALL_HEADERS: + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":324 + /* "streaming_form_data/_parser.pyx":224 + * self.expected_parts.append(part_cls(name, target)) * - * elif self.state == ParserState.PS_ENDING_ALL_HEADERS: - * if byte != c_lf: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.PartHeaders + 2 + * def set_active_part(self, part, str filename): # <<<<<<<<<<<<<< + * self.active_part = part + * self.active_part.set_multipart_filename(filename) */ - __pyx_t_9 = (__pyx_v_byte != __pyx_v_19streaming_form_data_7_parser_c_lf); - if (__pyx_t_9) { - /* "streaming_form_data/_parser.pyx":325 - * elif self.state == ParserState.PS_ENDING_ALL_HEADERS: - * if byte != c_lf: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.PartHeaders + 2 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.set_active_part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_19streaming_form_data_7_parser_7_Parser_8generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "streaming_form_data/_parser.pyx":229 + * self.active_part.start() * + * async def async_set_active_part(self, part, str filename): # <<<<<<<<<<<<<< + * self.active_part = part + * self.active_part.set_multipart_filename(filename) */ - __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 325, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "streaming_form_data/_parser.pyx":326 - * if byte != c_lf: - * self.mark_error() - * return ErrorGroup.PartHeaders + 2 # <<<<<<<<<<<<<< - * - * buffer_start = idx + 1 - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_PartHeaders + 2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - /* "streaming_form_data/_parser.pyx":324 - * - * elif self.state == ParserState.PS_ENDING_ALL_HEADERS: - * if byte != c_lf: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.PartHeaders + 2 - */ +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_7async_set_active_part(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_7async_set_active_part = {"async_set_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_7async_set_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_7async_set_active_part(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_part = 0; + PyObject *__pyx_v_filename = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("async_set_active_part (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_part,&__pyx_n_s_filename,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_part)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("async_set_active_part", 1, 2, 2, 1); __PYX_ERR(0, 229, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "async_set_active_part") < 0)) __PYX_ERR(0, 229, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_part = values[0]; + __pyx_v_filename = ((PyObject*)values[1]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("async_set_active_part", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 229, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser._Parser.async_set_active_part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_6async_set_active_part(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_part, __pyx_v_filename); - /* "streaming_form_data/_parser.pyx":328 - * return ErrorGroup.PartHeaders + 2 - * - * buffer_start = idx + 1 # <<<<<<<<<<<<<< - * - * self.state = ParserState.PS_READING_BODY - */ - __pyx_v_buffer_start = (__pyx_v_idx + 1); + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":330 - * buffer_start = idx + 1 - * - * self.state = ParserState.PS_READING_BODY # <<<<<<<<<<<<<< - * elif self.state == ParserState.PS_READING_BODY: - * self.delimiter_finder.feed(byte) - */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_READING_BODY; +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_6async_set_active_part(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_part, PyObject *__pyx_v_filename) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("async_set_active_part", 0); + __pyx_cur_scope = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 229, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_part = __pyx_v_part; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_part); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_part); + __pyx_cur_scope->__pyx_v_filename = __pyx_v_filename; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_filename); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_filename); + { + __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_19streaming_form_data_7_parser_7_Parser_8generator3, __pyx_codeobj__8, (PyObject *) __pyx_cur_scope, __pyx_n_s_async_set_active_part, __pyx_n_s_Parser_async_set_active_part, __pyx_n_s_streaming_form_data__parser); if (unlikely(!gen)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } - /* "streaming_form_data/_parser.pyx":323 - * self.state = ParserState.PS_READING_HEADER - * - * elif self.state == ParserState.PS_ENDING_ALL_HEADERS: # <<<<<<<<<<<<<< - * if byte != c_lf: - * self.mark_error() - */ - break; - case __pyx_e_19streaming_form_data_7_parser_PS_READING_BODY: + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("streaming_form_data._parser._Parser.async_set_active_part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":332 - * self.state = ParserState.PS_READING_BODY - * elif self.state == ParserState.PS_READING_BODY: - * self.delimiter_finder.feed(byte) # <<<<<<<<<<<<<< - * self.ender_finder.feed(byte) +static PyObject *__pyx_gb_19streaming_form_data_7_parser_7_Parser_8generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part *__pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("async_set_active_part", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L4_resume_from_await; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 229, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":230 * + * async def async_set_active_part(self, part, str filename): + * self.active_part = part # <<<<<<<<<<<<<< + * self.active_part.set_multipart_filename(filename) + * await self.active_part.start() */ - __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->feed(__pyx_v_self->delimiter_finder, __pyx_v_byte, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_part); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_part); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->active_part); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->active_part); + __pyx_cur_scope->__pyx_v_self->active_part = __pyx_cur_scope->__pyx_v_part; - /* "streaming_form_data/_parser.pyx":333 - * elif self.state == ParserState.PS_READING_BODY: - * self.delimiter_finder.feed(byte) - * self.ender_finder.feed(byte) # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":231 + * async def async_set_active_part(self, part, str filename): + * self.active_part = part + * self.active_part.set_multipart_filename(filename) # <<<<<<<<<<<<<< + * await self.active_part.start() * - * if self.delimiter_finder.found(): */ - __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->feed(__pyx_v_self->ender_finder, __pyx_v_byte, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->active_part, __pyx_n_s_set_multipart_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_filename}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":335 - * self.ender_finder.feed(byte) - * - * if self.delimiter_finder.found(): # <<<<<<<<<<<<<< - * self.state = ParserState.PS_READING_HEADER + /* "streaming_form_data/_parser.pyx":232 + * self.active_part = part + * self.active_part.set_multipart_filename(filename) + * await self.active_part.start() # <<<<<<<<<<<<<< * + * def unset_active_part(self): */ - __pyx_t_9 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->found(__pyx_v_self->delimiter_finder, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 335, __pyx_L1_error) - if (__pyx_t_9) { + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->active_part, __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L4_resume_from_await:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 232, __pyx_L1_error) + } else { + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear(); + else __PYX_ERR(0, 232, __pyx_L1_error) + } + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "streaming_form_data/_parser.pyx":336 - * - * if self.delimiter_finder.found(): - * self.state = ParserState.PS_READING_HEADER # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":229 + * self.active_part.start() * - * if idx + 1 < self.delimiter_length: + * async def async_set_active_part(self, part, str filename): # <<<<<<<<<<<<<< + * self.active_part = part + * self.active_part.set_multipart_filename(filename) */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_READING_HEADER; - /* "streaming_form_data/_parser.pyx":338 - * self.state = ParserState.PS_READING_HEADER - * - * if idx + 1 < self.delimiter_length: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Internal + 1 - */ - __pyx_t_9 = ((__pyx_v_idx + 1) < __pyx_v_self->delimiter_length); - if (__pyx_t_9) { + /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_Generator_Replace_StopIteration(0); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("async_set_active_part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":339 - * - * if idx + 1 < self.delimiter_length: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Internal + 1 +/* "streaming_form_data/_parser.pyx":234 + * await self.active_part.start() * + * def unset_active_part(self): # <<<<<<<<<<<<<< + * if self.active_part: + * self.active_part.finish() */ - __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "streaming_form_data/_parser.pyx":340 - * if idx + 1 < self.delimiter_length: - * self.mark_error() - * return ErrorGroup.Internal + 1 # <<<<<<<<<<<<<< - * - * match_start = idx + 1 - self.delimiter_length - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_10unset_active_part(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_10unset_active_part = {"unset_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_10unset_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_10unset_active_part(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unset_active_part (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("unset_active_part", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "unset_active_part", 0))) return NULL; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_9unset_active_part(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self)); - /* "streaming_form_data/_parser.pyx":338 - * self.state = ParserState.PS_READING_HEADER - * - * if idx + 1 < self.delimiter_length: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Internal + 1 - */ - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":342 - * return ErrorGroup.Internal + 1 - * - * match_start = idx + 1 - self.delimiter_length # <<<<<<<<<<<<<< +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_9unset_active_part(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unset_active_part", 1); + + /* "streaming_form_data/_parser.pyx":235 * - * if match_start >= buffer_start: + * def unset_active_part(self): + * if self.active_part: # <<<<<<<<<<<<<< + * self.active_part.finish() + * self.active_part = None */ - __pyx_v_match_start = ((__pyx_v_idx + 1) - __pyx_v_self->delimiter_length); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->active_part); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 235, __pyx_L1_error) + if (__pyx_t_1) { - /* "streaming_form_data/_parser.pyx":344 - * match_start = idx + 1 - self.delimiter_length + /* "streaming_form_data/_parser.pyx":236 + * def unset_active_part(self): + * if self.active_part: + * self.active_part.finish() # <<<<<<<<<<<<<< + * self.active_part = None * - * if match_start >= buffer_start: # <<<<<<<<<<<<<< - * try: - * self.on_body(chunk[buffer_start: match_start]) */ - __pyx_t_9 = (__pyx_v_match_start >= __pyx_v_buffer_start); - if (__pyx_t_9) { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_finish); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "streaming_form_data/_parser.pyx":345 + /* "streaming_form_data/_parser.pyx":235 * - * if match_start >= buffer_start: - * try: # <<<<<<<<<<<<<< - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: + * def unset_active_part(self): + * if self.active_part: # <<<<<<<<<<<<<< + * self.active_part.finish() + * self.active_part = None */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - /*try:*/ { + } - /* "streaming_form_data/_parser.pyx":346 - * if match_start >= buffer_start: - * try: - * self.on_body(chunk[buffer_start: match_start]) # <<<<<<<<<<<<<< - * except Exception: - * self.mark_error() + /* "streaming_form_data/_parser.pyx":237 + * if self.active_part: + * self.active_part.finish() + * self.active_part = None # <<<<<<<<<<<<<< + * + * async def async_unset_active_part(self): */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_body); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_chunk == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 346, __pyx_L24_error) - } - __pyx_t_7 = PySequence_GetSlice(__pyx_v_chunk, __pyx_v_buffer_start, __pyx_v_match_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 346, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; - __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->active_part); + __Pyx_DECREF(__pyx_v_self->active_part); + __pyx_v_self->active_part = Py_None; - /* "streaming_form_data/_parser.pyx":345 + /* "streaming_form_data/_parser.pyx":234 + * await self.active_part.start() * - * if match_start >= buffer_start: - * try: # <<<<<<<<<<<<<< - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: + * def unset_active_part(self): # <<<<<<<<<<<<<< + * if self.active_part: + * self.active_part.finish() */ - } - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - goto __pyx_L31_try_end; - __pyx_L24_error:; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "streaming_form_data/_parser.pyx":347 - * try: - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: # <<<<<<<<<<<<<< - * self.mark_error() - * raise - */ - __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_8) { - __Pyx_AddTraceback("streaming_form_data._parser._Parser._parse", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 347, __pyx_L26_except_error) - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_7); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.unset_active_part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_19streaming_form_data_7_parser_7_Parser_13generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ - /* "streaming_form_data/_parser.pyx":348 - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: - * self.mark_error() # <<<<<<<<<<<<<< - * raise +/* "streaming_form_data/_parser.pyx":239 + * self.active_part = None * + * async def async_unset_active_part(self): # <<<<<<<<<<<<<< + * if self.active_part: + * await self.active_part.finish() */ - __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L26_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "streaming_form_data/_parser.pyx":349 - * except Exception: - * self.mark_error() - * raise # <<<<<<<<<<<<<< - * - * buffer_start = idx + 1 - */ - __Pyx_GIVEREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_5, __pyx_t_7); - __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_7 = 0; - __PYX_ERR(0, 349, __pyx_L26_except_error) - } - goto __pyx_L26_except_error; - - /* "streaming_form_data/_parser.pyx":345 - * - * if match_start >= buffer_start: - * try: # <<<<<<<<<<<<<< - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: - */ - __pyx_L26_except_error:; - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); - goto __pyx_L1_error; - __pyx_L31_try_end:; - } - - /* "streaming_form_data/_parser.pyx":351 - * raise - * - * buffer_start = idx + 1 # <<<<<<<<<<<<<< - * else: - * self.mark_error() - */ - __pyx_v_buffer_start = (__pyx_v_idx + 1); +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_12async_unset_active_part(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_12async_unset_active_part = {"async_unset_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_12async_unset_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_12async_unset_active_part(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("async_unset_active_part (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("async_unset_active_part", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "async_unset_active_part", 0))) return NULL; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_11async_unset_active_part(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self)); - /* "streaming_form_data/_parser.pyx":344 - * match_start = idx + 1 - self.delimiter_length - * - * if match_start >= buffer_start: # <<<<<<<<<<<<<< - * try: - * self.on_body(chunk[buffer_start: match_start]) - */ - goto __pyx_L23; - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":353 - * buffer_start = idx + 1 - * else: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Internal + 2 - * - */ - /*else*/ { - __pyx_t_7 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_11async_unset_active_part(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("async_unset_active_part", 0); + __pyx_cur_scope = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 239, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_19streaming_form_data_7_parser_7_Parser_13generator4, __pyx_codeobj__9, (PyObject *) __pyx_cur_scope, __pyx_n_s_async_unset_active_part, __pyx_n_s_Parser_async_unset_active_part, __pyx_n_s_streaming_form_data__parser); if (unlikely(!gen)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } - /* "streaming_form_data/_parser.pyx":354 - * else: - * self.mark_error() - * return ErrorGroup.Internal + 2 # <<<<<<<<<<<<<< - * - * self.unset_active_part() - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 2)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - } - __pyx_L23:; + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("streaming_form_data._parser._Parser.async_unset_active_part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":356 - * return ErrorGroup.Internal + 2 - * - * self.unset_active_part() # <<<<<<<<<<<<<< - * self.delimiter_finder.reset() - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unset_active_part); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; - __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; +static PyObject *__pyx_gb_19streaming_form_data_7_parser_7_Parser_13generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part *__pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("async_unset_active_part", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L5_resume_from_await; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 239, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":357 + /* "streaming_form_data/_parser.pyx":240 * - * self.unset_active_part() - * self.delimiter_finder.reset() # <<<<<<<<<<<<<< - * - * elif self.ender_finder.found(): + * async def async_unset_active_part(self): + * if self.active_part: # <<<<<<<<<<<<<< + * await self.active_part.finish() + * self.active_part = None */ - __pyx_t_7 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->reset(__pyx_v_self->delimiter_finder); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_self->active_part); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 240, __pyx_L1_error) + if (__pyx_t_1) { - /* "streaming_form_data/_parser.pyx":335 - * self.ender_finder.feed(byte) - * - * if self.delimiter_finder.found(): # <<<<<<<<<<<<<< - * self.state = ParserState.PS_READING_HEADER + /* "streaming_form_data/_parser.pyx":241 + * async def async_unset_active_part(self): + * if self.active_part: + * await self.active_part.finish() # <<<<<<<<<<<<<< + * self.active_part = None * */ - goto __pyx_L21; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->active_part, __pyx_n_s_finish); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L5_resume_from_await:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 241, __pyx_L1_error) + } else { + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear(); + else __PYX_ERR(0, 241, __pyx_L1_error) } + } - /* "streaming_form_data/_parser.pyx":359 - * self.delimiter_finder.reset() - * - * elif self.ender_finder.found(): # <<<<<<<<<<<<<< - * self.state = ParserState.PS_END + /* "streaming_form_data/_parser.pyx":240 * + * async def async_unset_active_part(self): + * if self.active_part: # <<<<<<<<<<<<<< + * await self.active_part.finish() + * self.active_part = None */ - __pyx_t_9 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->found(__pyx_v_self->ender_finder, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L1_error) - if (__pyx_t_9) { + } - /* "streaming_form_data/_parser.pyx":360 - * - * elif self.ender_finder.found(): - * self.state = ParserState.PS_END # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":242 + * if self.active_part: + * await self.active_part.finish() + * self.active_part = None # <<<<<<<<<<<<<< * - * if idx + 1 < self.ender_length: + * def on_body(self, bytes value): */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_END; + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->active_part); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->active_part); + __pyx_cur_scope->__pyx_v_self->active_part = Py_None; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "streaming_form_data/_parser.pyx":362 - * self.state = ParserState.PS_END + /* "streaming_form_data/_parser.pyx":239 + * self.active_part = None * - * if idx + 1 < self.ender_length: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Internal + 3 + * async def async_unset_active_part(self): # <<<<<<<<<<<<<< + * if self.active_part: + * await self.active_part.finish() */ - __pyx_t_9 = ((__pyx_v_idx + 1) < __pyx_v_self->ender_length); - if (__pyx_t_9) { - /* "streaming_form_data/_parser.pyx":363 - * - * if idx + 1 < self.ender_length: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Internal + 3 - * match_start = idx + 1 - self.ender_length - */ - __pyx_t_7 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_Generator_Replace_StopIteration(0); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("async_unset_active_part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":364 - * if idx + 1 < self.ender_length: - * self.mark_error() - * return ErrorGroup.Internal + 3 # <<<<<<<<<<<<<< - * match_start = idx + 1 - self.ender_length +/* "streaming_form_data/_parser.pyx":244 + * self.active_part = None * + * def on_body(self, bytes value): # <<<<<<<<<<<<<< + * if self.active_part and len(value) > 0: + * self.active_part.data_received(value) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 3)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - /* "streaming_form_data/_parser.pyx":362 - * self.state = ParserState.PS_END - * - * if idx + 1 < self.ender_length: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Internal + 3 - */ +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_15on_body(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_15on_body = {"on_body", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_15on_body, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_15on_body(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_value = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("on_body (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "on_body") < 0)) __PYX_ERR(0, 244, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_value = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("on_body", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 244, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser._Parser.on_body", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyBytes_Type), 1, "value", 1))) __PYX_ERR(0, 244, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_14on_body(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_value); - /* "streaming_form_data/_parser.pyx":365 - * self.mark_error() - * return ErrorGroup.Internal + 3 - * match_start = idx + 1 - self.ender_length # <<<<<<<<<<<<<< + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_14on_body(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("on_body", 1); + + /* "streaming_form_data/_parser.pyx":245 + * + * def on_body(self, bytes value): + * if self.active_part and len(value) > 0: # <<<<<<<<<<<<<< + * self.active_part.data_received(value) * - * if match_start >= buffer_start: */ - __pyx_v_match_start = ((__pyx_v_idx + 1) - __pyx_v_self->ender_length); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->active_part); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 245, __pyx_L1_error) + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + if (unlikely(__pyx_v_value == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 245, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_v_value); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_3 > 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "streaming_form_data/_parser.pyx":367 - * match_start = idx + 1 - self.ender_length + /* "streaming_form_data/_parser.pyx":246 + * def on_body(self, bytes value): + * if self.active_part and len(value) > 0: + * self.active_part.data_received(value) # <<<<<<<<<<<<<< * - * if match_start >= buffer_start: # <<<<<<<<<<<<<< - * try: - * self.on_body(chunk[buffer_start: match_start]) + * async def async_on_body(self, bytes value): */ - __pyx_t_9 = (__pyx_v_match_start >= __pyx_v_buffer_start); - if (__pyx_t_9) { + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_data_received); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_value}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "streaming_form_data/_parser.pyx":368 + /* "streaming_form_data/_parser.pyx":245 + * + * def on_body(self, bytes value): + * if self.active_part and len(value) > 0: # <<<<<<<<<<<<<< + * self.active_part.data_received(value) * - * if match_start >= buffer_start: - * try: # <<<<<<<<<<<<<< - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_11); - /*try:*/ { + } - /* "streaming_form_data/_parser.pyx":369 - * if match_start >= buffer_start: - * try: - * self.on_body(chunk[buffer_start: match_start]) # <<<<<<<<<<<<<< - * except Exception: - * self.mark_error() + /* "streaming_form_data/_parser.pyx":244 + * self.active_part = None + * + * def on_body(self, bytes value): # <<<<<<<<<<<<<< + * if self.active_part and len(value) > 0: + * self.active_part.data_received(value) */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_body); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 369, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_chunk == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 369, __pyx_L36_error) - } - __pyx_t_6 = PySequence_GetSlice(__pyx_v_chunk, __pyx_v_buffer_start, __pyx_v_match_start); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 369, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; - __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "streaming_form_data/_parser.pyx":368 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.on_body", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_19streaming_form_data_7_parser_7_Parser_18generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "streaming_form_data/_parser.pyx":248 + * self.active_part.data_received(value) * - * if match_start >= buffer_start: - * try: # <<<<<<<<<<<<<< - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: + * async def async_on_body(self, bytes value): # <<<<<<<<<<<<<< + * if self.active_part and len(value) > 0: + * await self.active_part.data_received(value) */ - } - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L43_try_end; - __pyx_L36_error:; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "streaming_form_data/_parser.pyx":370 - * try: - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: # <<<<<<<<<<<<<< - * self.mark_error() - * raise - */ - __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_8) { - __Pyx_AddTraceback("streaming_form_data._parser._Parser._parse", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 370, __pyx_L38_except_error) - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_6); +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_17async_on_body(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_17async_on_body = {"async_on_body", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_17async_on_body, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_17async_on_body(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_value = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("async_on_body (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "async_on_body") < 0)) __PYX_ERR(0, 248, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_value = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("async_on_body", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 248, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser._Parser.async_on_body", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyBytes_Type), 1, "value", 1))) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_16async_on_body(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_value); - /* "streaming_form_data/_parser.pyx":371 - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: - * self.mark_error() # <<<<<<<<<<<<<< - * raise - * else: - */ - __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 371, __pyx_L38_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":372 - * except Exception: - * self.mark_error() - * raise # <<<<<<<<<<<<<< - * else: - * self.mark_error() - */ - __Pyx_GIVEREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_5, __pyx_t_6); - __pyx_t_7 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; - __PYX_ERR(0, 372, __pyx_L38_except_error) - } - goto __pyx_L38_except_error; +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_16async_on_body(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_value) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("async_on_body", 0); + __pyx_cur_scope = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 248, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_value = __pyx_v_value; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value); + { + __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_19streaming_form_data_7_parser_7_Parser_18generator5, __pyx_codeobj__10, (PyObject *) __pyx_cur_scope, __pyx_n_s_async_on_body, __pyx_n_s_Parser_async_on_body, __pyx_n_s_streaming_form_data__parser); if (unlikely(!gen)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } - /* "streaming_form_data/_parser.pyx":368 - * - * if match_start >= buffer_start: - * try: # <<<<<<<<<<<<<< - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: - */ - __pyx_L38_except_error:; - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11); - goto __pyx_L1_error; - __pyx_L43_try_end:; - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("streaming_form_data._parser._Parser.async_on_body", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":367 - * match_start = idx + 1 - self.ender_length - * - * if match_start >= buffer_start: # <<<<<<<<<<<<<< - * try: - * self.on_body(chunk[buffer_start: match_start]) - */ - goto __pyx_L35; - } +static PyObject *__pyx_gb_19streaming_form_data_7_parser_7_Parser_18generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body *__pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("async_on_body", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L7_resume_from_await; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 248, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":374 - * raise - * else: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Internal + 4 + /* "streaming_form_data/_parser.pyx":249 + * + * async def async_on_body(self, bytes value): + * if self.active_part and len(value) > 0: # <<<<<<<<<<<<<< + * await self.active_part.data_received(value) * */ - /*else*/ { - __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_self->active_part); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 249, __pyx_L1_error) + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + if (unlikely(__pyx_cur_scope->__pyx_v_value == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 249, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_value); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 249, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_3 > 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + if (__pyx_t_1) { - /* "streaming_form_data/_parser.pyx":375 - * else: - * self.mark_error() - * return ErrorGroup.Internal + 4 # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":250 + * async def async_on_body(self, bytes value): + * if self.active_part and len(value) > 0: + * await self.active_part.data_received(value) # <<<<<<<<<<<<<< * - * buffer_start = idx + 1 + * cdef _part_for(self, str name): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 375, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - } - __pyx_L35:; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->active_part, __pyx_n_s_data_received); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_value}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L7_resume_from_await:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 250, __pyx_L1_error) + } else { + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear(); + else __PYX_ERR(0, 250, __pyx_L1_error) + } + } - /* "streaming_form_data/_parser.pyx":377 - * return ErrorGroup.Internal + 4 + /* "streaming_form_data/_parser.pyx":249 * - * buffer_start = idx + 1 # <<<<<<<<<<<<<< + * async def async_on_body(self, bytes value): + * if self.active_part and len(value) > 0: # <<<<<<<<<<<<<< + * await self.active_part.data_received(value) * - * self.unset_active_part() */ - __pyx_v_buffer_start = (__pyx_v_idx + 1); + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "streaming_form_data/_parser.pyx":379 - * buffer_start = idx + 1 + /* "streaming_form_data/_parser.pyx":248 + * self.active_part.data_received(value) * - * self.unset_active_part() # <<<<<<<<<<<<<< - * self.ender_finder.reset() + * async def async_on_body(self, bytes value): # <<<<<<<<<<<<<< + * if self.active_part and len(value) > 0: + * await self.active_part.data_received(value) + */ + + /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_Generator_Replace_StopIteration(0); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("async_on_body", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "streaming_form_data/_parser.pyx":252 + * await self.active_part.data_received(value) * + * cdef _part_for(self, str name): # <<<<<<<<<<<<<< + * for part in self.expected_parts: + * if part.name == name: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unset_active_part); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; - __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "streaming_form_data/_parser.pyx":380 - * - * self.unset_active_part() - * self.ender_finder.reset() # <<<<<<<<<<<<<< - * - * else: - */ - __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->reset(__pyx_v_self->ender_finder); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; +static PyObject *__pyx_f_19streaming_form_data_7_parser_7_Parser__part_for(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_name) { + PyObject *__pyx_v_part = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_part_for", 1); - /* "streaming_form_data/_parser.pyx":359 - * self.delimiter_finder.reset() - * - * elif self.ender_finder.found(): # <<<<<<<<<<<<<< - * self.state = ParserState.PS_END + /* "streaming_form_data/_parser.pyx":253 * + * cdef _part_for(self, str name): + * for part in self.expected_parts: # <<<<<<<<<<<<<< + * if part.name == name: + * return part */ - goto __pyx_L21; + if (likely(PyList_CheckExact(__pyx_v_self->expected_parts)) || PyTuple_CheckExact(__pyx_v_self->expected_parts)) { + __pyx_t_1 = __pyx_v_self->expected_parts; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->expected_parts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 253, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 253, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __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, 253, __pyx_L1_error) + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 253, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __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, 253, __pyx_L1_error) + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif } - - /* "streaming_form_data/_parser.pyx":388 - * # middle of a potential delimiter. - * - * if self.delimiter_finder.inactive(): # <<<<<<<<<<<<<< - * skip_count = self.rewind_fast_forward( - * chunk_ptr, idx + 1, chunk_len - 1 - */ - /*else*/ { - __pyx_t_9 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->inactive(__pyx_v_self->delimiter_finder, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 388, __pyx_L1_error) - if (__pyx_t_9) { - - /* "streaming_form_data/_parser.pyx":389 - * - * if self.delimiter_finder.inactive(): - * skip_count = self.rewind_fast_forward( # <<<<<<<<<<<<<< - * chunk_ptr, idx + 1, chunk_len - 1 - * ) - */ - __pyx_t_14 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->rewind_fast_forward(__pyx_v_self, __pyx_v_chunk_ptr, (__pyx_v_idx + 1), (__pyx_v_chunk_len - 1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L1_error) - __pyx_v_skip_count = __pyx_t_14; - - /* "streaming_form_data/_parser.pyx":392 - * chunk_ptr, idx + 1, chunk_len - 1 - * ) - * idx += skip_count # <<<<<<<<<<<<<< - * - * elif self.state == ParserState.PS_END: - */ - __pyx_v_idx = (__pyx_v_idx + __pyx_v_skip_count); - - /* "streaming_form_data/_parser.pyx":388 - * # middle of a potential delimiter. - * - * if self.delimiter_finder.inactive(): # <<<<<<<<<<<<<< - * skip_count = self.rewind_fast_forward( - * chunk_ptr, idx + 1, chunk_len - 1 - */ + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 253, __pyx_L1_error) } + break; } - __pyx_L21:; + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_part, __pyx_t_4); + __pyx_t_4 = 0; - /* "streaming_form_data/_parser.pyx":331 + /* "streaming_form_data/_parser.pyx":254 + * cdef _part_for(self, str name): + * for part in self.expected_parts: + * if part.name == name: # <<<<<<<<<<<<<< + * return part * - * self.state = ParserState.PS_READING_BODY - * elif self.state == ParserState.PS_READING_BODY: # <<<<<<<<<<<<<< - * self.delimiter_finder.feed(byte) - * self.ender_finder.feed(byte) */ - break; - case __pyx_e_19streaming_form_data_7_parser_PS_END: + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_part, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_v_name, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { - /* "streaming_form_data/_parser.pyx":395 + /* "streaming_form_data/_parser.pyx":255 + * for part in self.expected_parts: + * if part.name == name: + * return part # <<<<<<<<<<<<<< * - * elif self.state == ParserState.PS_END: - * return 0 # <<<<<<<<<<<<<< - * else: - * self.mark_error() + * def data_received(self, bytes data): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_0); - __pyx_r = __pyx_int_0; + __Pyx_INCREF(__pyx_v_part); + __pyx_r = __pyx_v_part; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "streaming_form_data/_parser.pyx":394 - * idx += skip_count - * - * elif self.state == ParserState.PS_END: # <<<<<<<<<<<<<< - * return 0 - * else: - */ - break; - default: - - /* "streaming_form_data/_parser.pyx":397 - * return 0 - * else: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Internal + 5 - * - */ - __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 397, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "streaming_form_data/_parser.pyx":398 - * else: - * self.mark_error() - * return ErrorGroup.Internal + 5 # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":254 + * cdef _part_for(self, str name): + * for part in self.expected_parts: + * if part.name == name: # <<<<<<<<<<<<<< + * return part * - * idx += 1 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - break; } - /* "streaming_form_data/_parser.pyx":400 - * return ErrorGroup.Internal + 5 - * - * idx += 1 # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":253 * - * if idx != chunk_len: + * cdef _part_for(self, str name): + * for part in self.expected_parts: # <<<<<<<<<<<<<< + * if part.name == name: + * return part */ - __pyx_v_idx = (__pyx_v_idx + 1); } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "streaming_form_data/_parser.pyx":402 - * idx += 1 - * - * if idx != chunk_len: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Internal + 6 - */ - __pyx_t_9 = (__pyx_v_idx != __pyx_v_chunk_len); - if (__pyx_t_9) { - - /* "streaming_form_data/_parser.pyx":403 - * - * if idx != chunk_len: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Internal + 6 + /* "streaming_form_data/_parser.pyx":252 + * await self.active_part.data_received(value) * + * cdef _part_for(self, str name): # <<<<<<<<<<<<<< + * for part in self.expected_parts: + * if part.name == name: */ - __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 403, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "streaming_form_data/_parser.pyx":404 - * if idx != chunk_len: - * self.mark_error() - * return ErrorGroup.Internal + 6 # <<<<<<<<<<<<<< - * - * if buffer_start > chunk_len: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 6)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 404, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("streaming_form_data._parser._Parser._part_for", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_part); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":402 - * idx += 1 +/* "streaming_form_data/_parser.pyx":257 + * return part * - * if idx != chunk_len: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Internal + 6 + * def data_received(self, bytes data): # <<<<<<<<<<<<<< + * if not data: + * return 0 */ - } - /* "streaming_form_data/_parser.pyx":406 - * return ErrorGroup.Internal + 6 - * - * if buffer_start > chunk_len: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Internal + 7 - */ - __pyx_t_9 = (__pyx_v_buffer_start > __pyx_v_chunk_len); - if (__pyx_t_9) { +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_20data_received(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_20data_received = {"data_received", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_20data_received, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_20data_received(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_data = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("data_received (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "data_received") < 0)) __PYX_ERR(0, 257, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_data = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("data_received", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 257, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser._Parser.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_19data_received(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_data); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_19data_received(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_data) { + PyObject *__pyx_v_chunk = 0; + size_t __pyx_v_index; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *(*__pyx_t_7)(PyObject *); + size_t __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("data_received", 1); - /* "streaming_form_data/_parser.pyx":407 + /* "streaming_form_data/_parser.pyx":258 * - * if buffer_start > chunk_len: - * self.mark_error() # <<<<<<<<<<<<<< - * return ErrorGroup.Internal + 7 + * def data_received(self, bytes data): + * if not data: # <<<<<<<<<<<<<< + * return 0 * */ - __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = (__pyx_v_data != Py_None)&&(PyBytes_GET_SIZE(__pyx_v_data) != 0); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "streaming_form_data/_parser.pyx":408 - * if buffer_start > chunk_len: - * self.mark_error() - * return ErrorGroup.Internal + 7 # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":259 + * def data_received(self, bytes data): + * if not data: + * return 0 # <<<<<<<<<<<<<< * - * if self.state == ParserState.PS_READING_BODY: + * cdef bytes chunk */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 7)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 408, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_int_0); + __pyx_r = __pyx_int_0; goto __pyx_L0; - /* "streaming_form_data/_parser.pyx":406 - * return ErrorGroup.Internal + 6 + /* "streaming_form_data/_parser.pyx":258 + * + * def data_received(self, bytes data): + * if not data: # <<<<<<<<<<<<<< + * return 0 * - * if buffer_start > chunk_len: # <<<<<<<<<<<<<< - * self.mark_error() - * return ErrorGroup.Internal + 7 */ } - /* "streaming_form_data/_parser.pyx":410 - * return ErrorGroup.Internal + 7 + /* "streaming_form_data/_parser.pyx":264 + * cdef size_t index * - * if self.state == ParserState.PS_READING_BODY: # <<<<<<<<<<<<<< - * matched_length = max( - * self.delimiter_finder.matched_length(), - */ - __pyx_t_9 = (__pyx_v_self->state == __pyx_e_19streaming_form_data_7_parser_PS_READING_BODY); - if (__pyx_t_9) { - - /* "streaming_form_data/_parser.pyx":413 - * matched_length = max( - * self.delimiter_finder.matched_length(), - * self.ender_finder.matched_length() # <<<<<<<<<<<<<< - * ) - * match_start = idx - matched_length - */ - __pyx_t_14 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->matched_length(__pyx_v_self->ender_finder); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 413, __pyx_L1_error) - - /* "streaming_form_data/_parser.pyx":412 - * if self.state == ParserState.PS_READING_BODY: - * matched_length = max( - * self.delimiter_finder.matched_length(), # <<<<<<<<<<<<<< - * self.ender_finder.matched_length() - * ) - */ - __pyx_t_15 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->matched_length(__pyx_v_self->delimiter_finder); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 412, __pyx_L1_error) - - /* "streaming_form_data/_parser.pyx":413 - * matched_length = max( - * self.delimiter_finder.matched_length(), - * self.ender_finder.matched_length() # <<<<<<<<<<<<<< - * ) - * match_start = idx - matched_length + * chunk, index = self.include_leftover_buffer(data) # <<<<<<<<<<<<<< + * + * return self._parse(chunk, index) */ - __pyx_t_9 = (__pyx_t_14 > __pyx_t_15); - if (__pyx_t_9) { - __pyx_t_16 = __pyx_t_14; + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->include_leftover_buffer(__pyx_v_self, __pyx_v_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 264, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); } else { - __pyx_t_16 = __pyx_t_15; + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_5 = PyList_GET_ITEM(sequence, 1); } - __pyx_v_matched_length = __pyx_t_16; + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + #else + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); + index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 264, __pyx_L1_error) + __pyx_t_7 = NULL; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L5_unpacking_done; + __pyx_L4_unpacking_failed:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 264, __pyx_L1_error) + __pyx_L5_unpacking_done:; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(0, 264, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_5); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_chunk = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + __pyx_v_index = __pyx_t_8; - /* "streaming_form_data/_parser.pyx":415 - * self.ender_finder.matched_length() - * ) - * match_start = idx - matched_length # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":266 + * chunk, index = self.include_leftover_buffer(data) * - * if match_start >= buffer_start + c_min_file_body_chunk_size: - */ - __pyx_v_match_start = (__pyx_v_idx - __pyx_v_matched_length); - - /* "streaming_form_data/_parser.pyx":417 - * match_start = idx - matched_length + * return self._parse(chunk, index) # <<<<<<<<<<<<<< * - * if match_start >= buffer_start + c_min_file_body_chunk_size: # <<<<<<<<<<<<<< - * try: - * self.on_body(chunk[buffer_start: match_start]) + * async def async_data_received(self, bytes data): */ - __pyx_t_9 = (__pyx_v_match_start >= (__pyx_v_buffer_start + __pyx_v_19streaming_form_data_7_parser_c_min_file_body_chunk_size)); - if (__pyx_t_9) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_parse); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_chunk, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 2+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "streaming_form_data/_parser.pyx":418 + /* "streaming_form_data/_parser.pyx":257 + * return part * - * if match_start >= buffer_start + c_min_file_body_chunk_size: - * try: # <<<<<<<<<<<<<< - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: + * def data_received(self, bytes data): # <<<<<<<<<<<<<< + * if not data: + * return 0 */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - /*try:*/ { - /* "streaming_form_data/_parser.pyx":419 - * if match_start >= buffer_start + c_min_file_body_chunk_size: - * try: - * self.on_body(chunk[buffer_start: match_start]) # <<<<<<<<<<<<<< - * except Exception: - * self.mark_error() - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_body); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 419, __pyx_L51_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_chunk == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 419, __pyx_L51_error) - } - __pyx_t_7 = PySequence_GetSlice(__pyx_v_chunk, __pyx_v_buffer_start, __pyx_v_match_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 419, __pyx_L51_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; - __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 419, __pyx_L51_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_chunk); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_19streaming_form_data_7_parser_7_Parser_23generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ - /* "streaming_form_data/_parser.pyx":418 +/* "streaming_form_data/_parser.pyx":268 + * return self._parse(chunk, index) * - * if match_start >= buffer_start + c_min_file_body_chunk_size: - * try: # <<<<<<<<<<<<<< - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: + * async def async_data_received(self, bytes data): # <<<<<<<<<<<<<< + * if not data: + * return 0 */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_22async_data_received(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_22async_data_received = {"async_data_received", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_22async_data_received, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_22async_data_received(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_data = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("async_data_received (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - goto __pyx_L56_try_end; - __pyx_L51_error:; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 268, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "async_data_received") < 0)) __PYX_ERR(0, 268, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_data = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("async_data_received", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 268, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser._Parser.async_data_received", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) __PYX_ERR(0, 268, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_21async_data_received(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_data); - /* "streaming_form_data/_parser.pyx":420 - * try: - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: # <<<<<<<<<<<<<< - * self.mark_error() - * raise - */ - __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_8) { - __Pyx_AddTraceback("streaming_form_data._parser._Parser._parse", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L53_except_error) - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_7); + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":421 - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: - * self.mark_error() # <<<<<<<<<<<<<< - * raise - * - */ - __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 421, __pyx_L53_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_21async_data_received(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_data) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("async_data_received", 0); + __pyx_cur_scope = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 268, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_data = __pyx_v_data; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_data); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_data); + { + __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_19streaming_form_data_7_parser_7_Parser_23generator6, __pyx_codeobj__11, (PyObject *) __pyx_cur_scope, __pyx_n_s_async_data_received, __pyx_n_s_Parser_async_data_received, __pyx_n_s_streaming_form_data__parser); if (unlikely(!gen)) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } - /* "streaming_form_data/_parser.pyx":422 - * except Exception: - * self.mark_error() - * raise # <<<<<<<<<<<<<< - * - * buffer_start = match_start - */ - __Pyx_GIVEREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_5, __pyx_t_7); - __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_7 = 0; - __PYX_ERR(0, 422, __pyx_L53_except_error) - } - goto __pyx_L53_except_error; + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("streaming_form_data._parser._Parser.async_data_received", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":418 - * - * if match_start >= buffer_start + c_min_file_body_chunk_size: - * try: # <<<<<<<<<<<<<< - * self.on_body(chunk[buffer_start: match_start]) - * except Exception: - */ - __pyx_L53_except_error:; - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); - goto __pyx_L1_error; - __pyx_L56_try_end:; - } +static PyObject *__pyx_gb_19streaming_form_data_7_parser_7_Parser_23generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received *__pyx_cur_scope = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *(*__pyx_t_7)(PyObject *); + size_t __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("async_data_received", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L7_resume_from_await; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 268, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":424 - * raise + /* "streaming_form_data/_parser.pyx":269 * - * buffer_start = match_start # <<<<<<<<<<<<<< + * async def async_data_received(self, bytes data): + * if not data: # <<<<<<<<<<<<<< + * return 0 * - * if idx - buffer_start > 0: */ - __pyx_v_buffer_start = __pyx_v_match_start; + __pyx_t_1 = (__pyx_cur_scope->__pyx_v_data != Py_None)&&(PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data) != 0); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "streaming_form_data/_parser.pyx":417 - * match_start = idx - matched_length + /* "streaming_form_data/_parser.pyx":270 + * async def async_data_received(self, bytes data): + * if not data: + * return 0 # <<<<<<<<<<<<<< * - * if match_start >= buffer_start + c_min_file_body_chunk_size: # <<<<<<<<<<<<<< - * try: - * self.on_body(chunk[buffer_start: match_start]) + * cdef bytes chunk */ - } + __Pyx_XDECREF(__pyx_r); + __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_int_0); + goto __pyx_L0; - /* "streaming_form_data/_parser.pyx":410 - * return ErrorGroup.Internal + 7 + /* "streaming_form_data/_parser.pyx":269 + * + * async def async_data_received(self, bytes data): + * if not data: # <<<<<<<<<<<<<< + * return 0 * - * if self.state == ParserState.PS_READING_BODY: # <<<<<<<<<<<<<< - * matched_length = max( - * self.delimiter_finder.matched_length(), */ } - /* "streaming_form_data/_parser.pyx":426 - * buffer_start = match_start + /* "streaming_form_data/_parser.pyx":275 + * cdef size_t index * - * if idx - buffer_start > 0: # <<<<<<<<<<<<<< - * self._leftover_buffer = chunk[buffer_start: idx] - * - */ - __pyx_t_9 = ((__pyx_v_idx - __pyx_v_buffer_start) > 0); - if (__pyx_t_9) { - - /* "streaming_form_data/_parser.pyx":427 - * - * if idx - buffer_start > 0: - * self._leftover_buffer = chunk[buffer_start: idx] # <<<<<<<<<<<<<< + * chunk, index = self.include_leftover_buffer(data) # <<<<<<<<<<<<<< * - * return 0 + * return await self._parse(chunk, index) */ - if (unlikely(__pyx_v_chunk == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 427, __pyx_L1_error) + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->include_leftover_buffer(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 275, __pyx_L1_error) } - __pyx_t_7 = PySequence_GetSlice(__pyx_v_chunk, __pyx_v_buffer_start, __pyx_v_idx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_v_self->_leftover_buffer); - __Pyx_DECREF(__pyx_v_self->_leftover_buffer); - __pyx_v_self->_leftover_buffer = ((PyObject*)__pyx_t_7); - __pyx_t_7 = 0; - - /* "streaming_form_data/_parser.pyx":426 - * buffer_start = match_start - * - * if idx - buffer_start > 0: # <<<<<<<<<<<<<< - * self._leftover_buffer = chunk[buffer_start: idx] - * - */ + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_5 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + #else + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); + index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_7 = NULL; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_L6_unpacking_done:; } + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_5); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_chunk = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + __pyx_cur_scope->__pyx_v_index = __pyx_t_8; - /* "streaming_form_data/_parser.pyx":429 - * self._leftover_buffer = chunk[buffer_start: idx] + /* "streaming_form_data/_parser.pyx":277 + * chunk, index = self.include_leftover_buffer(data) * - * return 0 # <<<<<<<<<<<<<< + * return await self._parse(chunk, index) # <<<<<<<<<<<<<< * - * # rewind_fast_forward searches for the '\r\n--' sequence in the provided + * cdef include_leftover_buffer(self, bytes data): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_0); - __pyx_r = __pyx_int_0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_parse); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_chunk, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 2+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L7_resume_from_await:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 277, __pyx_L1_error) + __pyx_t_3 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_3 = NULL; + if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_3) < 0) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "streaming_form_data/_parser.pyx":224 + /* "streaming_form_data/_parser.pyx":268 * return self._parse(chunk, index) * - * def _parse(self, bytes chunk, size_t index): # <<<<<<<<<<<<<< - * cdef size_t idx, buffer_start, chunk_len - * cdef size_t match_start, skip_count, matched_length + * async def async_data_received(self, bytes data): # <<<<<<<<<<<<<< + * if not data: + * return 0 */ /* function exit code */ __pyx_L1_error:; + __Pyx_Generator_Replace_StopIteration(0); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("streaming_form_data._parser._Parser._parse", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("async_data_received", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_message); - __Pyx_XDECREF(__pyx_v_params); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_part); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "streaming_form_data/_parser.pyx":436 - * # update Finder object states. +/* "streaming_form_data/_parser.pyx":279 + * return await self._parse(chunk, index) * - * cdef size_t rewind_fast_forward( # <<<<<<<<<<<<<< - * self, const Byte *chunk_ptr, size_t pos_first, size_t pos_last - * ): + * cdef include_leftover_buffer(self, bytes data): # <<<<<<<<<<<<<< + * """ + * Include any leftover buffer from the previous call in the current data and */ -static size_t __pyx_f_19streaming_form_data_7_parser_7_Parser_rewind_fast_forward(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_v_chunk_ptr, size_t __pyx_v_pos_first, size_t __pyx_v_pos_last) { - __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_v_ptr; - __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_v_ptr_end; - size_t __pyx_v_skipped; - size_t __pyx_r; +static PyObject *__pyx_f_19streaming_form_data_7_parser_7_Parser_include_leftover_buffer(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_data) { + PyObject *__pyx_v_chunk = 0; + size_t __pyx_v_index; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("rewind_fast_forward", 1); + __Pyx_RefNannySetupContext("include_leftover_buffer", 1); - /* "streaming_form_data/_parser.pyx":444 - * - * # we need at least 4 characters in buffer - * if pos_first + 3 > pos_last: # <<<<<<<<<<<<<< - * return 0 + /* "streaming_form_data/_parser.pyx":288 + * cdef size_t index * + * if self._leftover_buffer: # <<<<<<<<<<<<<< + * chunk = self._leftover_buffer + data + * index = len(self._leftover_buffer) */ - __pyx_t_1 = ((__pyx_v_pos_first + 3) > __pyx_v_pos_last); + __pyx_t_1 = (__pyx_v_self->_leftover_buffer != Py_None)&&(PyBytes_GET_SIZE(__pyx_v_self->_leftover_buffer) != 0); if (__pyx_t_1) { - /* "streaming_form_data/_parser.pyx":445 - * # we need at least 4 characters in buffer - * if pos_first + 3 > pos_last: - * return 0 # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":289 * - * # calculate pointer to the first character of the buffer and the + * if self._leftover_buffer: + * chunk = self._leftover_buffer + data # <<<<<<<<<<<<<< + * index = len(self._leftover_buffer) + * self._leftover_buffer = None */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_2 = PyNumber_Add(__pyx_v_self->_leftover_buffer, __pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_chunk = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "streaming_form_data/_parser.pyx":444 - * - * # we need at least 4 characters in buffer - * if pos_first + 3 > pos_last: # <<<<<<<<<<<<<< - * return 0 - * + /* "streaming_form_data/_parser.pyx":290 + * if self._leftover_buffer: + * chunk = self._leftover_buffer + data + * index = len(self._leftover_buffer) # <<<<<<<<<<<<<< + * self._leftover_buffer = None + * else: */ - } + __pyx_t_2 = __pyx_v_self->_leftover_buffer; + __Pyx_INCREF(__pyx_t_2); + if (unlikely(__pyx_t_2 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 290, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_index = __pyx_t_3; - /* "streaming_form_data/_parser.pyx":449 - * # calculate pointer to the first character of the buffer and the - * # pointer to a character after the end of the buffer - * ptr = chunk_ptr + pos_first + 3 # <<<<<<<<<<<<<< - * ptr_end = chunk_ptr + pos_last + 1 - * skipped = 0 + /* "streaming_form_data/_parser.pyx":291 + * chunk = self._leftover_buffer + data + * index = len(self._leftover_buffer) + * self._leftover_buffer = None # <<<<<<<<<<<<<< + * else: + * chunk = data */ - __pyx_v_ptr = ((__pyx_v_chunk_ptr + __pyx_v_pos_first) + 3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_leftover_buffer); + __Pyx_DECREF(__pyx_v_self->_leftover_buffer); + __pyx_v_self->_leftover_buffer = ((PyObject*)Py_None); - /* "streaming_form_data/_parser.pyx":450 - * # pointer to a character after the end of the buffer - * ptr = chunk_ptr + pos_first + 3 - * ptr_end = chunk_ptr + pos_last + 1 # <<<<<<<<<<<<<< - * skipped = 0 + /* "streaming_form_data/_parser.pyx":288 + * cdef size_t index * + * if self._leftover_buffer: # <<<<<<<<<<<<<< + * chunk = self._leftover_buffer + data + * index = len(self._leftover_buffer) */ - __pyx_v_ptr_end = ((__pyx_v_chunk_ptr + __pyx_v_pos_last) + 1); + goto __pyx_L3; + } - /* "streaming_form_data/_parser.pyx":451 - * ptr = chunk_ptr + pos_first + 3 - * ptr_end = chunk_ptr + pos_last + 1 - * skipped = 0 # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":293 + * self._leftover_buffer = None + * else: + * chunk = data # <<<<<<<<<<<<<< + * index = 0 * - * # try to match starting from the 4th character of the multipart */ - __pyx_v_skipped = 0; + /*else*/ { + __Pyx_INCREF(__pyx_v_data); + __pyx_v_chunk = __pyx_v_data; - /* "streaming_form_data/_parser.pyx":458 - * # is found. + /* "streaming_form_data/_parser.pyx":294 + * else: + * chunk = data + * index = 0 # <<<<<<<<<<<<<< * - * while True: # <<<<<<<<<<<<<< - * if ptr >= ptr_end: - * # normalize pointer value because we could jump few characters + * return (chunk, index) */ - while (1) { + __pyx_v_index = 0; + } + __pyx_L3:; - /* "streaming_form_data/_parser.pyx":459 + /* "streaming_form_data/_parser.pyx":296 + * index = 0 * - * while True: - * if ptr >= ptr_end: # <<<<<<<<<<<<<< - * # normalize pointer value because we could jump few characters - * # past the buffer end - */ - __pyx_t_1 = (__pyx_v_ptr >= __pyx_v_ptr_end); - if (__pyx_t_1) { - - /* "streaming_form_data/_parser.pyx":462 - * # normalize pointer value because we could jump few characters - * # past the buffer end - * ptr = ptr_end - 1 # <<<<<<<<<<<<<< + * return (chunk, index) # <<<<<<<<<<<<<< * - * # if we iterated till the end of the buffer, we may need to + * def _parse(self, bytes chunk, size_t index): */ - __pyx_v_ptr = (__pyx_v_ptr_end - 1); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_chunk); + __Pyx_GIVEREF(__pyx_v_chunk); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_chunk)) __PYX_ERR(0, 296, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "streaming_form_data/_parser.pyx":467 - * # keep up to 3 characters in the buffer until next chunk - * # guess we will skip all characters in the buffer - * skipped = pos_last - pos_first + 1 # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":279 + * return await self._parse(chunk, index) * - * if ptr[0] == c_cr: + * cdef include_leftover_buffer(self, bytes data): # <<<<<<<<<<<<<< + * """ + * Include any leftover buffer from the previous call in the current data and */ - __pyx_v_skipped = ((__pyx_v_pos_last - __pyx_v_pos_first) + 1); - /* "streaming_form_data/_parser.pyx":469 - * skipped = pos_last - pos_first + 1 - * - * if ptr[0] == c_cr: # <<<<<<<<<<<<<< - * skipped = skipped - 1 - * elif ptr[0] == c_lf and ptr[-1] == c_cr: - */ - __pyx_t_1 = ((__pyx_v_ptr[0]) == __pyx_v_19streaming_form_data_7_parser_c_cr); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.include_leftover_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_chunk); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":470 +/* "streaming_form_data/_parser.pyx":298 + * return (chunk, index) * - * if ptr[0] == c_cr: - * skipped = skipped - 1 # <<<<<<<<<<<<<< - * elif ptr[0] == c_lf and ptr[-1] == c_cr: - * skipped = skipped - 2 + * def _parse(self, bytes chunk, size_t index): # <<<<<<<<<<<<<< + * cdef size_t idx, buffer_start, chunk_len + * cdef size_t match_start, skip_count, matched_length */ - __pyx_v_skipped = (__pyx_v_skipped - 1); - /* "streaming_form_data/_parser.pyx":469 - * skipped = pos_last - pos_first + 1 - * - * if ptr[0] == c_cr: # <<<<<<<<<<<<<< - * skipped = skipped - 1 - * elif ptr[0] == c_lf and ptr[-1] == c_cr: - */ - goto __pyx_L7; - } - - /* "streaming_form_data/_parser.pyx":471 - * if ptr[0] == c_cr: - * skipped = skipped - 1 - * elif ptr[0] == c_lf and ptr[-1] == c_cr: # <<<<<<<<<<<<<< - * skipped = skipped - 2 - * elif ( - */ - __pyx_t_2 = ((__pyx_v_ptr[0]) == __pyx_v_19streaming_form_data_7_parser_c_lf); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L8_bool_binop_done; +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_25_parse(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_25_parse = {"_parse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_25_parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_25_parse(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_chunk = 0; + size_t __pyx_v_index; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_parse (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chunk,&__pyx_n_s_index,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - __pyx_t_2 = ((__pyx_v_ptr[-1L]) == __pyx_v_19streaming_form_data_7_parser_c_cr); - __pyx_t_1 = __pyx_t_2; - __pyx_L8_bool_binop_done:; - if (__pyx_t_1) { - - /* "streaming_form_data/_parser.pyx":472 - * skipped = skipped - 1 - * elif ptr[0] == c_lf and ptr[-1] == c_cr: - * skipped = skipped - 2 # <<<<<<<<<<<<<< - * elif ( - * ptr[0] == c_hyphen - */ - __pyx_v_skipped = (__pyx_v_skipped - 2); - - /* "streaming_form_data/_parser.pyx":471 - * if ptr[0] == c_cr: - * skipped = skipped - 1 - * elif ptr[0] == c_lf and ptr[-1] == c_cr: # <<<<<<<<<<<<<< - * skipped = skipped - 2 - * elif ( - */ - goto __pyx_L7; + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chunk)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_index)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("_parse", 1, 2, 2, 1); __PYX_ERR(0, 298, __pyx_L3_error) + } } - - /* "streaming_form_data/_parser.pyx":474 - * skipped = skipped - 2 - * elif ( - * ptr[0] == c_hyphen # <<<<<<<<<<<<<< - * and ptr[-1] == c_lf - * and ptr[-2] == c_cr - */ - __pyx_t_2 = ((__pyx_v_ptr[0]) == __pyx_v_19streaming_form_data_7_parser_c_hyphen); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L10_bool_binop_done; + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_parse") < 0)) __PYX_ERR(0, 298, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_chunk = ((PyObject*)values[0]); + __pyx_v_index = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_index == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_parse", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 298, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser._Parser._parse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chunk), (&PyBytes_Type), 1, "chunk", 1))) __PYX_ERR(0, 298, __pyx_L1_error) + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_24_parse(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v_chunk, __pyx_v_index); - /* "streaming_form_data/_parser.pyx":475 - * elif ( - * ptr[0] == c_hyphen - * and ptr[-1] == c_lf # <<<<<<<<<<<<<< - * and ptr[-2] == c_cr - * ): - */ - __pyx_t_2 = ((__pyx_v_ptr[-1L]) == __pyx_v_19streaming_form_data_7_parser_c_lf); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L10_bool_binop_done; - } + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "streaming_form_data/_parser.pyx":476 - * ptr[0] == c_hyphen - * and ptr[-1] == c_lf - * and ptr[-2] == c_cr # <<<<<<<<<<<<<< - * ): - * skipped = skipped - 3 - */ - __pyx_t_2 = ((__pyx_v_ptr[-2L]) == __pyx_v_19streaming_form_data_7_parser_c_cr); - __pyx_t_1 = __pyx_t_2; - __pyx_L10_bool_binop_done:; +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_24_parse(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_chunk, size_t __pyx_v_index) { + size_t __pyx_v_idx; + size_t __pyx_v_buffer_start; + size_t __pyx_v_chunk_len; + size_t __pyx_v_match_start; + size_t __pyx_v_skip_count; + size_t __pyx_v_matched_length; + __pyx_t_19streaming_form_data_7_parser_Byte __pyx_v_byte; + __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_v_chunk_ptr; + PyObject *__pyx_v_message = NULL; + PyObject *__pyx_v_params = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_part = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_t_1; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + size_t __pyx_t_14; + size_t __pyx_t_15; + size_t __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_parse", 1); - /* "streaming_form_data/_parser.pyx":473 - * elif ptr[0] == c_lf and ptr[-1] == c_cr: - * skipped = skipped - 2 - * elif ( # <<<<<<<<<<<<<< - * ptr[0] == c_hyphen - * and ptr[-1] == c_lf + /* "streaming_form_data/_parser.pyx":304 + * cdef const Byte *chunk_ptr + * + * chunk_ptr = chunk # <<<<<<<<<<<<<< + * chunk_len = len(chunk) + * buffer_start = 0 */ - if (__pyx_t_1) { + if (unlikely(__pyx_v_chunk == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(0, 304, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyBytes_AsUString(__pyx_v_chunk); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 304, __pyx_L1_error) + __pyx_v_chunk_ptr = __pyx_t_1; - /* "streaming_form_data/_parser.pyx":478 - * and ptr[-2] == c_cr - * ): - * skipped = skipped - 3 # <<<<<<<<<<<<<< - * break + /* "streaming_form_data/_parser.pyx":305 + * + * chunk_ptr = chunk + * chunk_len = len(chunk) # <<<<<<<<<<<<<< + * buffer_start = 0 * */ - __pyx_v_skipped = (__pyx_v_skipped - 3); + if (unlikely(__pyx_v_chunk == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 305, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyBytes_GET_SIZE(__pyx_v_chunk); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 305, __pyx_L1_error) + __pyx_v_chunk_len = __pyx_t_2; - /* "streaming_form_data/_parser.pyx":473 - * elif ptr[0] == c_lf and ptr[-1] == c_cr: - * skipped = skipped - 2 - * elif ( # <<<<<<<<<<<<<< - * ptr[0] == c_hyphen - * and ptr[-1] == c_lf + /* "streaming_form_data/_parser.pyx":306 + * chunk_ptr = chunk + * chunk_len = len(chunk) + * buffer_start = 0 # <<<<<<<<<<<<<< + * + * idx = index */ - } - __pyx_L7:; + __pyx_v_buffer_start = 0; - /* "streaming_form_data/_parser.pyx":479 - * ): - * skipped = skipped - 3 - * break # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":308 + * buffer_start = 0 * - * if ptr[0] != c_hyphen: + * idx = index # <<<<<<<<<<<<<< + * while idx < chunk_len: + * byte = chunk_ptr[idx] */ - goto __pyx_L5_break; + __pyx_v_idx = __pyx_v_index; - /* "streaming_form_data/_parser.pyx":459 + /* "streaming_form_data/_parser.pyx":309 + * + * idx = index + * while idx < chunk_len: # <<<<<<<<<<<<<< + * byte = chunk_ptr[idx] * - * while True: - * if ptr >= ptr_end: # <<<<<<<<<<<<<< - * # normalize pointer value because we could jump few characters - * # past the buffer end */ - } + while (1) { + __pyx_t_3 = (__pyx_v_idx < __pyx_v_chunk_len); + if (!__pyx_t_3) break; - /* "streaming_form_data/_parser.pyx":481 - * break + /* "streaming_form_data/_parser.pyx":310 + * idx = index + * while idx < chunk_len: + * byte = chunk_ptr[idx] # <<<<<<<<<<<<<< * - * if ptr[0] != c_hyphen: # <<<<<<<<<<<<<< - * ptr += 2 - * else: + * if self.state == ParserState.PS_START: */ - __pyx_t_1 = ((__pyx_v_ptr[0]) != __pyx_v_19streaming_form_data_7_parser_c_hyphen); - if (__pyx_t_1) { + __pyx_v_byte = (__pyx_v_chunk_ptr[__pyx_v_idx]); - /* "streaming_form_data/_parser.pyx":482 + /* "streaming_form_data/_parser.pyx":312 + * byte = chunk_ptr[idx] * - * if ptr[0] != c_hyphen: - * ptr += 2 # <<<<<<<<<<<<<< - * else: - * if ptr[-1] != c_hyphen: + * if self.state == ParserState.PS_START: # <<<<<<<<<<<<<< + * if byte == c_hyphen: + * buffer_start = idx */ - __pyx_v_ptr = (__pyx_v_ptr + 2); + switch (__pyx_v_self->state) { + case __pyx_e_19streaming_form_data_7_parser_PS_START: - /* "streaming_form_data/_parser.pyx":481 - * break + /* "streaming_form_data/_parser.pyx":313 * - * if ptr[0] != c_hyphen: # <<<<<<<<<<<<<< - * ptr += 2 - * else: + * if self.state == ParserState.PS_START: + * if byte == c_hyphen: # <<<<<<<<<<<<<< + * buffer_start = idx + * self.state = ParserState.PS_STARTING_BOUNDARY */ - goto __pyx_L13; - } + __pyx_t_3 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_hyphen); + if (__pyx_t_3) { - /* "streaming_form_data/_parser.pyx":484 - * ptr += 2 - * else: - * if ptr[-1] != c_hyphen: # <<<<<<<<<<<<<< - * ptr += 1 - * else: + /* "streaming_form_data/_parser.pyx":314 + * if self.state == ParserState.PS_START: + * if byte == c_hyphen: + * buffer_start = idx # <<<<<<<<<<<<<< + * self.state = ParserState.PS_STARTING_BOUNDARY + * elif byte == c_cr: */ - /*else*/ { - __pyx_t_1 = ((__pyx_v_ptr[-1L]) != __pyx_v_19streaming_form_data_7_parser_c_hyphen); - if (__pyx_t_1) { + __pyx_v_buffer_start = __pyx_v_idx; - /* "streaming_form_data/_parser.pyx":485 - * else: - * if ptr[-1] != c_hyphen: - * ptr += 1 # <<<<<<<<<<<<<< - * else: - * if ptr[-2] == c_lf and ptr[-3] == c_cr: + /* "streaming_form_data/_parser.pyx":315 + * if byte == c_hyphen: + * buffer_start = idx + * self.state = ParserState.PS_STARTING_BOUNDARY # <<<<<<<<<<<<<< + * elif byte == c_cr: + * self.state = ParserState.PS_START_CR */ - __pyx_v_ptr = (__pyx_v_ptr + 1); + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_STARTING_BOUNDARY; - /* "streaming_form_data/_parser.pyx":484 - * ptr += 2 - * else: - * if ptr[-1] != c_hyphen: # <<<<<<<<<<<<<< - * ptr += 1 - * else: + /* "streaming_form_data/_parser.pyx":313 + * + * if self.state == ParserState.PS_START: + * if byte == c_hyphen: # <<<<<<<<<<<<<< + * buffer_start = idx + * self.state = ParserState.PS_STARTING_BOUNDARY */ - goto __pyx_L14; + goto __pyx_L5; } - /* "streaming_form_data/_parser.pyx":487 - * ptr += 1 + /* "streaming_form_data/_parser.pyx":316 + * buffer_start = idx + * self.state = ParserState.PS_STARTING_BOUNDARY + * elif byte == c_cr: # <<<<<<<<<<<<<< + * self.state = ParserState.PS_START_CR * else: - * if ptr[-2] == c_lf and ptr[-3] == c_cr: # <<<<<<<<<<<<<< - * self.delimiter_finder.reset() - * self.delimiter_finder.feed(c_cr) */ - /*else*/ { - __pyx_t_2 = ((__pyx_v_ptr[-2L]) == __pyx_v_19streaming_form_data_7_parser_c_lf); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L16_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_ptr[-3L]) == __pyx_v_19streaming_form_data_7_parser_c_cr); - __pyx_t_1 = __pyx_t_2; - __pyx_L16_bool_binop_done:; - if (__pyx_t_1) { + __pyx_t_3 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_cr); + if (__pyx_t_3) { - /* "streaming_form_data/_parser.pyx":488 + /* "streaming_form_data/_parser.pyx":317 + * self.state = ParserState.PS_STARTING_BOUNDARY + * elif byte == c_cr: + * self.state = ParserState.PS_START_CR # <<<<<<<<<<<<<< * else: - * if ptr[-2] == c_lf and ptr[-3] == c_cr: - * self.delimiter_finder.reset() # <<<<<<<<<<<<<< - * self.delimiter_finder.feed(c_cr) - * self.delimiter_finder.feed(c_lf) - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->reset(__pyx_v_self->delimiter_finder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "streaming_form_data/_parser.pyx":489 - * if ptr[-2] == c_lf and ptr[-3] == c_cr: - * self.delimiter_finder.reset() - * self.delimiter_finder.feed(c_cr) # <<<<<<<<<<<<<< - * self.delimiter_finder.feed(c_lf) - * self.delimiter_finder.feed(c_hyphen) + * self.mark_error() */ - __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->feed(__pyx_v_self->delimiter_finder, __pyx_v_19streaming_form_data_7_parser_c_cr, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_START_CR; - /* "streaming_form_data/_parser.pyx":490 - * self.delimiter_finder.reset() - * self.delimiter_finder.feed(c_cr) - * self.delimiter_finder.feed(c_lf) # <<<<<<<<<<<<<< - * self.delimiter_finder.feed(c_hyphen) - * self.delimiter_finder.feed(c_hyphen) + /* "streaming_form_data/_parser.pyx":316 + * buffer_start = idx + * self.state = ParserState.PS_STARTING_BOUNDARY + * elif byte == c_cr: # <<<<<<<<<<<<<< + * self.state = ParserState.PS_START_CR + * else: */ - __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->feed(__pyx_v_self->delimiter_finder, __pyx_v_19streaming_form_data_7_parser_c_lf, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L5; + } - /* "streaming_form_data/_parser.pyx":491 - * self.delimiter_finder.feed(c_cr) - * self.delimiter_finder.feed(c_lf) - * self.delimiter_finder.feed(c_hyphen) # <<<<<<<<<<<<<< - * self.delimiter_finder.feed(c_hyphen) + /* "streaming_form_data/_parser.pyx":319 + * self.state = ParserState.PS_START_CR + * else: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Delimiting + 1 * */ - __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->feed(__pyx_v_self->delimiter_finder, __pyx_v_19streaming_form_data_7_parser_c_hyphen, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 491, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /*else*/ { + __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "streaming_form_data/_parser.pyx":492 - * self.delimiter_finder.feed(c_lf) - * self.delimiter_finder.feed(c_hyphen) - * self.delimiter_finder.feed(c_hyphen) # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":320 + * else: + * self.mark_error() + * return ErrorGroup.Delimiting + 1 # <<<<<<<<<<<<<< * - * self.ender_finder.reset() + * elif self.state == ParserState.PS_START_CR: */ - __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->feed(__pyx_v_self->delimiter_finder, __pyx_v_19streaming_form_data_7_parser_c_hyphen, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Delimiting + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + __pyx_L5:; - /* "streaming_form_data/_parser.pyx":494 - * self.delimiter_finder.feed(c_hyphen) + /* "streaming_form_data/_parser.pyx":312 + * byte = chunk_ptr[idx] * - * self.ender_finder.reset() # <<<<<<<<<<<<<< - * self.ender_finder.feed(c_cr) - * self.ender_finder.feed(c_lf) + * if self.state == ParserState.PS_START: # <<<<<<<<<<<<<< + * if byte == c_hyphen: + * buffer_start = idx */ - __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->reset(__pyx_v_self->ender_finder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + break; + case __pyx_e_19streaming_form_data_7_parser_PS_START_CR: - /* "streaming_form_data/_parser.pyx":495 + /* "streaming_form_data/_parser.pyx":323 * - * self.ender_finder.reset() - * self.ender_finder.feed(c_cr) # <<<<<<<<<<<<<< - * self.ender_finder.feed(c_lf) - * self.ender_finder.feed(c_hyphen) + * elif self.state == ParserState.PS_START_CR: + * if byte == c_lf: # <<<<<<<<<<<<<< + * self.state = ParserState.PS_START + * else: */ - __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->feed(__pyx_v_self->ender_finder, __pyx_v_19streaming_form_data_7_parser_c_cr, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 495, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_lf); + if (__pyx_t_3) { - /* "streaming_form_data/_parser.pyx":496 - * self.ender_finder.reset() - * self.ender_finder.feed(c_cr) - * self.ender_finder.feed(c_lf) # <<<<<<<<<<<<<< - * self.ender_finder.feed(c_hyphen) - * self.ender_finder.feed(c_hyphen) + /* "streaming_form_data/_parser.pyx":324 + * elif self.state == ParserState.PS_START_CR: + * if byte == c_lf: + * self.state = ParserState.PS_START # <<<<<<<<<<<<<< + * else: + * self.mark_error() */ - __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->feed(__pyx_v_self->ender_finder, __pyx_v_19streaming_form_data_7_parser_c_lf, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_START; - /* "streaming_form_data/_parser.pyx":497 - * self.ender_finder.feed(c_cr) - * self.ender_finder.feed(c_lf) - * self.ender_finder.feed(c_hyphen) # <<<<<<<<<<<<<< - * self.ender_finder.feed(c_hyphen) + /* "streaming_form_data/_parser.pyx":323 * + * elif self.state == ParserState.PS_START_CR: + * if byte == c_lf: # <<<<<<<<<<<<<< + * self.state = ParserState.PS_START + * else: */ - __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->feed(__pyx_v_self->ender_finder, __pyx_v_19streaming_form_data_7_parser_c_hyphen, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6; + } - /* "streaming_form_data/_parser.pyx":498 - * self.ender_finder.feed(c_lf) - * self.ender_finder.feed(c_hyphen) - * self.ender_finder.feed(c_hyphen) # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":326 + * self.state = ParserState.PS_START + * else: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Delimiting + 4 * - * skipped = (ptr - chunk_ptr) - pos_first + 1 */ - __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->feed(__pyx_v_self->ender_finder, __pyx_v_19streaming_form_data_7_parser_c_hyphen, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 498, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /*else*/ { + __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "streaming_form_data/_parser.pyx":500 - * self.ender_finder.feed(c_hyphen) - * - * skipped = (ptr - chunk_ptr) - pos_first + 1 # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":327 + * else: + * self.mark_error() + * return ErrorGroup.Delimiting + 4 # <<<<<<<<<<<<<< * - * break + * elif self.state == ParserState.PS_STARTING_BOUNDARY: */ - __pyx_v_skipped = (((__pyx_v_ptr - __pyx_v_chunk_ptr) - __pyx_v_pos_first) + 1); + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Delimiting + 4)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + __pyx_L6:; - /* "streaming_form_data/_parser.pyx":502 - * skipped = (ptr - chunk_ptr) - pos_first + 1 + /* "streaming_form_data/_parser.pyx":322 + * return ErrorGroup.Delimiting + 1 * - * break # <<<<<<<<<<<<<< - * ptr += 4 + * elif self.state == ParserState.PS_START_CR: # <<<<<<<<<<<<<< + * if byte == c_lf: + * self.state = ParserState.PS_START + */ + break; + case __pyx_e_19streaming_form_data_7_parser_PS_STARTING_BOUNDARY: + + /* "streaming_form_data/_parser.pyx":330 * + * elif self.state == ParserState.PS_STARTING_BOUNDARY: + * if byte != c_hyphen: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Delimiting + 2 */ - goto __pyx_L5_break; + __pyx_t_3 = (__pyx_v_byte != __pyx_v_19streaming_form_data_7_parser_c_hyphen); + if (__pyx_t_3) { - /* "streaming_form_data/_parser.pyx":487 - * ptr += 1 - * else: - * if ptr[-2] == c_lf and ptr[-3] == c_cr: # <<<<<<<<<<<<<< - * self.delimiter_finder.reset() - * self.delimiter_finder.feed(c_cr) + /* "streaming_form_data/_parser.pyx":331 + * elif self.state == ParserState.PS_STARTING_BOUNDARY: + * if byte != c_hyphen: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Delimiting + 2 + * */ - } + __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "streaming_form_data/_parser.pyx":503 + /* "streaming_form_data/_parser.pyx":332 + * if byte != c_hyphen: + * self.mark_error() + * return ErrorGroup.Delimiting + 2 # <<<<<<<<<<<<<< * - * break - * ptr += 4 # <<<<<<<<<<<<<< + * self.state = ParserState.PS_READING_BOUNDARY + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Delimiting + 2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "streaming_form_data/_parser.pyx":330 * - * return skipped + * elif self.state == ParserState.PS_STARTING_BOUNDARY: + * if byte != c_hyphen: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Delimiting + 2 */ - __pyx_v_ptr = (__pyx_v_ptr + 4); } - __pyx_L14:; - } - __pyx_L13:; - } - __pyx_L5_break:; - /* "streaming_form_data/_parser.pyx":505 - * ptr += 4 - * - * return skipped # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":334 + * return ErrorGroup.Delimiting + 2 * - * cdef mark_error(self): + * self.state = ParserState.PS_READING_BOUNDARY # <<<<<<<<<<<<<< + * elif self.state == ParserState.PS_READING_BOUNDARY: + * if byte == c_cr: */ - __pyx_r = __pyx_v_skipped; - goto __pyx_L0; + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_READING_BOUNDARY; - /* "streaming_form_data/_parser.pyx":436 - * # update Finder object states. + /* "streaming_form_data/_parser.pyx":329 + * return ErrorGroup.Delimiting + 4 * - * cdef size_t rewind_fast_forward( # <<<<<<<<<<<<<< - * self, const Byte *chunk_ptr, size_t pos_first, size_t pos_last - * ): + * elif self.state == ParserState.PS_STARTING_BOUNDARY: # <<<<<<<<<<<<<< + * if byte != c_hyphen: + * self.mark_error() */ + break; + case __pyx_e_19streaming_form_data_7_parser_PS_READING_BOUNDARY: - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("streaming_form_data._parser._Parser.rewind_fast_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "streaming_form_data/_parser.pyx":507 - * return skipped - * - * cdef mark_error(self): # <<<<<<<<<<<<<< - * self.state = ParserState.PS_ERROR + /* "streaming_form_data/_parser.pyx":336 + * self.state = ParserState.PS_READING_BOUNDARY + * elif self.state == ParserState.PS_READING_BOUNDARY: + * if byte == c_cr: # <<<<<<<<<<<<<< + * self.state = ParserState.PS_ENDING_BOUNDARY * */ + __pyx_t_3 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_cr); + if (__pyx_t_3) { -static PyObject *__pyx_f_19streaming_form_data_7_parser_7_Parser_mark_error(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("mark_error", 1); + /* "streaming_form_data/_parser.pyx":337 + * elif self.state == ParserState.PS_READING_BOUNDARY: + * if byte == c_cr: + * self.state = ParserState.PS_ENDING_BOUNDARY # <<<<<<<<<<<<<< + * + * elif self.state == ParserState.PS_ENDING_BOUNDARY: + */ + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_ENDING_BOUNDARY; - /* "streaming_form_data/_parser.pyx":508 + /* "streaming_form_data/_parser.pyx":336 + * self.state = ParserState.PS_READING_BOUNDARY + * elif self.state == ParserState.PS_READING_BOUNDARY: + * if byte == c_cr: # <<<<<<<<<<<<<< + * self.state = ParserState.PS_ENDING_BOUNDARY * - * cdef mark_error(self): - * self.state = ParserState.PS_ERROR # <<<<<<<<<<<<<< + */ + } + + /* "streaming_form_data/_parser.pyx":335 * - * if self.active_part: + * self.state = ParserState.PS_READING_BOUNDARY + * elif self.state == ParserState.PS_READING_BOUNDARY: # <<<<<<<<<<<<<< + * if byte == c_cr: + * self.state = ParserState.PS_ENDING_BOUNDARY */ - __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_ERROR; + break; + case __pyx_e_19streaming_form_data_7_parser_PS_ENDING_BOUNDARY: - /* "streaming_form_data/_parser.pyx":510 - * self.state = ParserState.PS_ERROR + /* "streaming_form_data/_parser.pyx":340 * - * if self.active_part: # <<<<<<<<<<<<<< - * self.active_part.finish() + * elif self.state == ParserState.PS_ENDING_BOUNDARY: + * if byte != c_lf: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Delimiting + 3 */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->active_part); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 510, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_t_3 = (__pyx_v_byte != __pyx_v_19streaming_form_data_7_parser_c_lf); + if (__pyx_t_3) { - /* "streaming_form_data/_parser.pyx":511 + /* "streaming_form_data/_parser.pyx":341 + * elif self.state == ParserState.PS_ENDING_BOUNDARY: + * if byte != c_lf: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Delimiting + 3 * - * if self.active_part: - * self.active_part.finish() # <<<<<<<<<<<<<< */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_finish); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; - __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "streaming_form_data/_parser.pyx":510 - * self.state = ParserState.PS_ERROR + /* "streaming_form_data/_parser.pyx":342 + * if byte != c_lf: + * self.mark_error() + * return ErrorGroup.Delimiting + 3 # <<<<<<<<<<<<<< * - * if self.active_part: # <<<<<<<<<<<<<< - * self.active_part.finish() + * # ensure we have read correct starting delimiter */ - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Delimiting + 3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "streaming_form_data/_parser.pyx":507 - * return skipped + /* "streaming_form_data/_parser.pyx":340 * - * cdef mark_error(self): # <<<<<<<<<<<<<< - * self.state = ParserState.PS_ERROR + * elif self.state == ParserState.PS_ENDING_BOUNDARY: + * if byte != c_lf: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Delimiting + 3 + */ + } + + /* "streaming_form_data/_parser.pyx":345 * + * # ensure we have read correct starting delimiter + * if b'\r\n' + chunk[buffer_start: idx + 1] != \ # <<<<<<<<<<<<<< + * self.delimiter_finder.target: + * self.mark_error() */ + if (unlikely(__pyx_v_chunk == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 345, __pyx_L1_error) + } + __pyx_t_4 = PySequence_GetSlice(__pyx_v_chunk, __pyx_v_buffer_start, (__pyx_v_idx + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyNumber_Add(__pyx_kp_b__12, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("streaming_form_data._parser._Parser.mark_error", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":346 + * # ensure we have read correct starting delimiter + * if b'\r\n' + chunk[buffer_start: idx + 1] != \ + * self.delimiter_finder.target: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Delimiting + 5 + */ + __pyx_t_3 = (__Pyx_PyBytes_Equals(__pyx_t_5, __pyx_v_self->delimiter_finder->target, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; -/* "streaming_form_data/_parser.pyx":159 + /* "streaming_form_data/_parser.pyx":345 * - * cdef bint strict - * cdef public str unexpected_part_name # <<<<<<<<<<<<<< + * # ensure we have read correct starting delimiter + * if b'\r\n' + chunk[buffer_start: idx + 1] != \ # <<<<<<<<<<<<<< + * self.delimiter_finder.target: + * self.mark_error() + */ + if (__pyx_t_3) { + + /* "streaming_form_data/_parser.pyx":347 + * if b'\r\n' + chunk[buffer_start: idx + 1] != \ + * self.delimiter_finder.target: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Delimiting + 5 * - * def __init__(self, bytes delimiter, bytes ender, bint strict): */ + __pyx_t_5 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name___get__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name___get__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 1); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->unexpected_part_name); - __pyx_r = __pyx_v_self->unexpected_part_name; - goto __pyx_L0; - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_2__set__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + /* "streaming_form_data/_parser.pyx":348 + * self.delimiter_finder.target: + * self.mark_error() + * return ErrorGroup.Delimiting + 5 # <<<<<<<<<<<<<< + * + * buffer_start = idx + 1 + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Delimiting + 5)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":345 + * + * # ensure we have read correct starting delimiter + * if b'\r\n' + chunk[buffer_start: idx + 1] != \ # <<<<<<<<<<<<<< + * self.delimiter_finder.target: + * self.mark_error() + */ + } -static int __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_2__set__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 1); - if (!(likely(PyUnicode_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_value))) __PYX_ERR(0, 159, __pyx_L1_error) - __pyx_t_1 = __pyx_v_value; - __Pyx_INCREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->unexpected_part_name); - __Pyx_DECREF(__pyx_v_self->unexpected_part_name); - __pyx_v_self->unexpected_part_name = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + /* "streaming_form_data/_parser.pyx":350 + * return ErrorGroup.Delimiting + 5 + * + * buffer_start = idx + 1 # <<<<<<<<<<<<<< + * + * self.state = ParserState.PS_READING_HEADER + */ + __pyx_v_buffer_start = (__pyx_v_idx + 1); - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("streaming_form_data._parser._Parser.unexpected_part_name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":352 + * buffer_start = idx + 1 + * + * self.state = ParserState.PS_READING_HEADER # <<<<<<<<<<<<<< + * elif self.state == ParserState.PS_READING_HEADER: + * if byte == c_cr: + */ + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_READING_HEADER; -/* Python wrapper */ -static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_5__del__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_4__del__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self)); + /* "streaming_form_data/_parser.pyx":339 + * self.state = ParserState.PS_ENDING_BOUNDARY + * + * elif self.state == ParserState.PS_ENDING_BOUNDARY: # <<<<<<<<<<<<<< + * if byte != c_lf: + * self.mark_error() + */ + break; + case __pyx_e_19streaming_form_data_7_parser_PS_READING_HEADER: - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":354 + * self.state = ParserState.PS_READING_HEADER + * elif self.state == ParserState.PS_READING_HEADER: + * if byte == c_cr: # <<<<<<<<<<<<<< + * self.state = ParserState.PS_ENDING_HEADER + * + */ + __pyx_t_3 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_cr); + if (__pyx_t_3) { -static int __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_4__del__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 1); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->unexpected_part_name); - __Pyx_DECREF(__pyx_v_self->unexpected_part_name); - __pyx_v_self->unexpected_part_name = ((PyObject*)Py_None); + /* "streaming_form_data/_parser.pyx":355 + * elif self.state == ParserState.PS_READING_HEADER: + * if byte == c_cr: + * self.state = ParserState.PS_ENDING_HEADER # <<<<<<<<<<<<<< + * + * elif self.state == ParserState.PS_ENDING_HEADER: + */ + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_ENDING_HEADER; - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":354 + * self.state = ParserState.PS_READING_HEADER + * elif self.state == ParserState.PS_READING_HEADER: + * if byte == c_cr: # <<<<<<<<<<<<<< + * self.state = ParserState.PS_ENDING_HEADER + * + */ + } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "streaming_form_data/_parser.pyx":353 + * + * self.state = ParserState.PS_READING_HEADER + * elif self.state == ParserState.PS_READING_HEADER: # <<<<<<<<<<<<<< + * if byte == c_cr: + * self.state = ParserState.PS_ENDING_HEADER */ + break; + case __pyx_e_19streaming_form_data_7_parser_PS_ENDING_HEADER: -/* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_15__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_15__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_14__reduce_cython__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self)); + /* "streaming_form_data/_parser.pyx":358 + * + * elif self.state == ParserState.PS_ENDING_HEADER: + * if byte != c_lf: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.PartHeaders + 1 + */ + __pyx_t_3 = (__pyx_v_byte != __pyx_v_19streaming_form_data_7_parser_c_lf); + if (__pyx_t_3) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":359 + * elif self.state == ParserState.PS_ENDING_HEADER: + * if byte != c_lf: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.PartHeaders + 1 + * + */ + __pyx_t_5 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_14__reduce_cython__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 1); + /* "streaming_form_data/_parser.pyx":360 + * if byte != c_lf: + * self.mark_error() + * return ErrorGroup.PartHeaders + 1 # <<<<<<<<<<<<<< + * + * message = Parser(policy=HTTP).parsestr(chunk[buffer_start: idx + 1].decode('utf-8')) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_PartHeaders + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self._leftover_buffer, self.active_part, self.default_part, self.delimiter_finder, self.delimiter_length, self.ender_finder, self.ender_length, self.expected_parts, self.state, self.strict, self.unexpected_part_name) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: + /* "streaming_form_data/_parser.pyx":358 + * + * elif self.state == ParserState.PS_ENDING_HEADER: + * if byte != c_lf: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.PartHeaders + 1 */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->delimiter_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->ender_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_enum____pyx_t_19streaming_form_data_7_parser_ParserState(__pyx_v_self->state); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->strict); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(11); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_self->_leftover_buffer); - __Pyx_GIVEREF(__pyx_v_self->_leftover_buffer); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self->_leftover_buffer)) __PYX_ERR(1, 5, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_self->active_part); - __Pyx_GIVEREF(__pyx_v_self->active_part); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_self->active_part)) __PYX_ERR(1, 5, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_self->default_part); - __Pyx_GIVEREF(__pyx_v_self->default_part); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_self->default_part)) __PYX_ERR(1, 5, __pyx_L1_error); - __Pyx_INCREF((PyObject *)__pyx_v_self->delimiter_finder); - __Pyx_GIVEREF((PyObject *)__pyx_v_self->delimiter_finder); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_self->delimiter_finder))) __PYX_ERR(1, 5, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error); - __Pyx_INCREF((PyObject *)__pyx_v_self->ender_finder); - __Pyx_GIVEREF((PyObject *)__pyx_v_self->ender_finder); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 5, ((PyObject *)__pyx_v_self->ender_finder))) __PYX_ERR(1, 5, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_self->expected_parts); - __Pyx_GIVEREF(__pyx_v_self->expected_parts); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 7, __pyx_v_self->expected_parts)) __PYX_ERR(1, 5, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 8, __pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 9, __pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_self->unexpected_part_name); - __Pyx_GIVEREF(__pyx_v_self->unexpected_part_name); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 10, __pyx_v_self->unexpected_part_name)) __PYX_ERR(1, 5, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_v_state = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; + } - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self._leftover_buffer, self.active_part, self.default_part, self.delimiter_finder, self.delimiter_length, self.ender_finder, self.ender_length, self.expected_parts, self.state, self.strict, self.unexpected_part_name) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) + /* "streaming_form_data/_parser.pyx":362 + * return ErrorGroup.PartHeaders + 1 + * + * message = Parser(policy=HTTP).parsestr(chunk[buffer_start: idx + 1].decode('utf-8')) # <<<<<<<<<<<<<< + * + * if 'content-disposition' in message: */ - __pyx_t_5 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_v__dict = __pyx_t_5; - __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Parser); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_HTTP); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_policy, __pyx_t_7) < 0) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_parsestr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(__pyx_v_chunk == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 362, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_decode_bytes(__pyx_v_chunk, __pyx_v_buffer_start, (__pyx_v_idx + 1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_XDECREF_SET(__pyx_v_message, __pyx_t_5); + __pyx_t_5 = 0; - /* "(tree fragment)":7 - * state = (self._leftover_buffer, self.active_part, self.default_part, self.delimiter_finder, self.delimiter_length, self.ender_finder, self.ender_length, self.expected_parts, self.state, self.strict, self.unexpected_part_name) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* "streaming_form_data/_parser.pyx":364 + * message = Parser(policy=HTTP).parsestr(chunk[buffer_start: idx + 1].decode('utf-8')) + * + * if 'content-disposition' in message: # <<<<<<<<<<<<<< + * if not message.get_content_disposition() == 'form-data': + * self.mark_error() */ - __pyx_t_6 = (__pyx_v__dict != Py_None); - if (__pyx_t_6) { + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_content_disposition, __pyx_v_message, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 364, __pyx_L1_error) + if (__pyx_t_3) { - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: + /* "streaming_form_data/_parser.pyx":365 + * + * if 'content-disposition' in message: + * if not message.get_content_disposition() == 'form-data': # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.PartHeaders + 1 */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v__dict)) __PYX_ERR(1, 8, __pyx_L1_error); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); - __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_n_s_get_content_disposition); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_kp_u_form_data, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_9 = (!__pyx_t_3); + if (__pyx_t_9) { - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self._leftover_buffer is not None or self.active_part is not None or self.default_part is not None or self.delimiter_finder is not None or self.ender_finder is not None or self.expected_parts is not None or self.unexpected_part_name is not None + /* "streaming_form_data/_parser.pyx":366 + * if 'content-disposition' in message: + * if not message.get_content_disposition() == 'form-data': + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.PartHeaders + 1 + * */ - __pyx_v_use_setstate = 1; + __pyx_t_5 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "(tree fragment)":7 - * state = (self._leftover_buffer, self.active_part, self.default_part, self.delimiter_finder, self.delimiter_length, self.ender_finder, self.ender_length, self.expected_parts, self.state, self.strict, self.unexpected_part_name) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* "streaming_form_data/_parser.pyx":367 + * if not message.get_content_disposition() == 'form-data': + * self.mark_error() + * return ErrorGroup.PartHeaders + 1 # <<<<<<<<<<<<<< + * + * params = message['content-disposition'].params */ - goto __pyx_L3; - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_PartHeaders + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "(tree fragment)":11 - * use_setstate = True - * else: - * use_setstate = self._leftover_buffer is not None or self.active_part is not None or self.default_part is not None or self.delimiter_finder is not None or self.ender_finder is not None or self.expected_parts is not None or self.unexpected_part_name is not None # <<<<<<<<<<<<<< - * if use_setstate: - * return __pyx_unpickle__Parser, (type(self), 0x428af85, None), state + /* "streaming_form_data/_parser.pyx":365 + * + * if 'content-disposition' in message: + * if not message.get_content_disposition() == 'form-data': # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.PartHeaders + 1 */ - /*else*/ { - __pyx_t_7 = (__pyx_v_self->_leftover_buffer != ((PyObject*)Py_None)); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = (__pyx_v_self->active_part != Py_None); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = (__pyx_v_self->default_part != Py_None); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = (((PyObject *)__pyx_v_self->delimiter_finder) != Py_None); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = (((PyObject *)__pyx_v_self->ender_finder) != Py_None); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = (__pyx_v_self->expected_parts != Py_None); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = (__pyx_v_self->unexpected_part_name != ((PyObject*)Py_None)); - __pyx_t_6 = __pyx_t_7; - __pyx_L4_bool_binop_done:; - __pyx_v_use_setstate = __pyx_t_6; - } - __pyx_L3:; + } - /* "(tree fragment)":12 - * else: - * use_setstate = self._leftover_buffer is not None or self.active_part is not None or self.default_part is not None or self.delimiter_finder is not None or self.ender_finder is not None or self.expected_parts is not None or self.unexpected_part_name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle__Parser, (type(self), 0x428af85, None), state - * else: + /* "streaming_form_data/_parser.pyx":369 + * return ErrorGroup.PartHeaders + 1 + * + * params = message['content-disposition'].params # <<<<<<<<<<<<<< + * name = params.get('name') + * */ - if (__pyx_v_use_setstate) { - - /* "(tree fragment)":13 - * use_setstate = self._leftover_buffer is not None or self.active_part is not None or self.default_part is not None or self.delimiter_finder is not None or self.ender_finder is not None or self.expected_parts is not None or self.unexpected_part_name is not None - * if use_setstate: - * return __pyx_unpickle__Parser, (type(self), 0x428af85, None), state # <<<<<<<<<<<<<< - * else: - * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle__Parser); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 13, __pyx_L1_error); - __Pyx_INCREF(__pyx_int_69775237); - __Pyx_GIVEREF(__pyx_int_69775237); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_69775237)) __PYX_ERR(1, 13, __pyx_L1_error); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None)) __PYX_ERR(1, 13, __pyx_L1_error); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_5); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state)) __PYX_ERR(1, 13, __pyx_L1_error); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_message, __pyx_kp_u_content_disposition); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_params); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_params, __pyx_t_6); + __pyx_t_6 = 0; - /* "(tree fragment)":12 - * else: - * use_setstate = self._leftover_buffer is not None or self.active_part is not None or self.default_part is not None or self.delimiter_finder is not None or self.ender_finder is not None or self.expected_parts is not None or self.unexpected_part_name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle__Parser, (type(self), 0x428af85, None), state - * else: + /* "streaming_form_data/_parser.pyx":370 + * + * params = message['content-disposition'].params + * name = params.get('name') # <<<<<<<<<<<<<< + * + * if name: */ - } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_params, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_n_u_name}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6); + __pyx_t_6 = 0; - /* "(tree fragment)":15 - * return __pyx_unpickle__Parser, (type(self), 0x428af85, None), state - * else: - * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle__Parser__set_state(self, __pyx_state) + /* "streaming_form_data/_parser.pyx":372 + * name = params.get('name') + * + * if name: # <<<<<<<<<<<<<< + * part = self._part_for(name) + * if part is None: */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle__Parser); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 15, __pyx_L1_error); - __Pyx_INCREF(__pyx_int_69775237); - __Pyx_GIVEREF(__pyx_int_69775237); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_69775237)) __PYX_ERR(1, 15, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state)) __PYX_ERR(1, 15, __pyx_L1_error); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_5); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error); - __pyx_t_3 = 0; - __pyx_t_5 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 372, __pyx_L1_error) + if (__pyx_t_9) { - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "streaming_form_data/_parser.pyx":373 + * + * if name: + * part = self._part_for(name) # <<<<<<<<<<<<<< + * if part is None: + * part = self.default_part */ + if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_name))) __PYX_ERR(0, 373, __pyx_L1_error) + __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->_part_for(__pyx_v_self, ((PyObject*)__pyx_v_name)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_part, __pyx_t_6); + __pyx_t_6 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("streaming_form_data._parser._Parser.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v__dict); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":374 + * if name: + * part = self._part_for(name) + * if part is None: # <<<<<<<<<<<<<< + * part = self.default_part + * if self.strict: + */ + __pyx_t_9 = (__pyx_v_part == Py_None); + if (__pyx_t_9) { -/* "(tree fragment)":16 - * else: - * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle__Parser__set_state(self, __pyx_state) + /* "streaming_form_data/_parser.pyx":375 + * part = self._part_for(name) + * if part is None: + * part = self.default_part # <<<<<<<<<<<<<< + * if self.strict: + * self.unexpected_part_name = name */ + __pyx_t_6 = __pyx_v_self->default_part; + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF_SET(__pyx_v_part, __pyx_t_6); + __pyx_t_6 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_17__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_17__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[1] = {0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v___pyx_state = values[0]; - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("streaming_form_data._parser._Parser.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_16__setstate_cython__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v___pyx_state); + /* "streaming_form_data/_parser.pyx":376 + * if part is None: + * part = self.default_part + * if self.strict: # <<<<<<<<<<<<<< + * self.unexpected_part_name = name + * self.mark_error() + */ + if (__pyx_v_self->strict) { - /* function exit code */ - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":377 + * part = self.default_part + * if self.strict: + * self.unexpected_part_name = name # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.UnexpectedPart + */ + if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_name))) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_6 = __pyx_v_name; + __Pyx_INCREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_v_self->unexpected_part_name); + __Pyx_DECREF(__pyx_v_self->unexpected_part_name); + __pyx_v_self->unexpected_part_name = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; -static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_16__setstate_cython__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 1); + /* "streaming_form_data/_parser.pyx":378 + * if self.strict: + * self.unexpected_part_name = name + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.UnexpectedPart + * + */ + __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "(tree fragment)":17 - * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle__Parser__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":379 + * self.unexpected_part_name = name + * self.mark_error() + * return ErrorGroup.UnexpectedPart # <<<<<<<<<<<<<< + * + * self.set_active_part(part, params.get('filename')) */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_f_19streaming_form_data_7_parser___pyx_unpickle__Parser__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __Pyx_Enum_54f4e2__19streaming_form_data_7_parser_enum__dunderpyx_t_19streaming_form_data_7_parser_ErrorGroup__etc_to_py(__pyx_e_19streaming_form_data_7_parser_UnexpectedPart); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle__Parser__set_state(self, __pyx_state) + /* "streaming_form_data/_parser.pyx":376 + * if part is None: + * part = self.default_part + * if self.strict: # <<<<<<<<<<<<<< + * self.unexpected_part_name = name + * self.mark_error() */ + } - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("streaming_form_data._parser._Parser.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":374 + * if name: + * part = self._part_for(name) + * if part is None: # <<<<<<<<<<<<<< + * part = self.default_part + * if self.strict: + */ + } -/* "(tree fragment)":1 - * def __pyx_unpickle_Finder(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "streaming_form_data/_parser.pyx":381 + * return ErrorGroup.UnexpectedPart + * + * self.set_active_part(part, params.get('filename')) # <<<<<<<<<<<<<< + * elif 'content-type' in message: + * if self.active_part: */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_active_part); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_params, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_n_u_filename}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_4 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_part, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_1__pyx_unpickle_Finder(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_1__pyx_unpickle_Finder = {"__pyx_unpickle_Finder", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_1__pyx_unpickle_Finder, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19streaming_form_data_7_parser_1__pyx_unpickle_Finder(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[3] = {0,0,0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_Finder (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Finder", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Finder", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + /* "streaming_form_data/_parser.pyx":372 + * name = params.get('name') + * + * if name: # <<<<<<<<<<<<<< + * part = self._part_for(name) + * if part is None: + */ } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Finder") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 3)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - } - __pyx_v___pyx_type = values[0]; - __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) - __pyx_v___pyx_state = values[2]; - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Finder", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Finder", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19streaming_form_data_7_parser___pyx_unpickle_Finder(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); - /* function exit code */ - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19streaming_form_data_7_parser___pyx_unpickle_Finder(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Finder", 1); - - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x0855a7d, 0x0c6065b, 0x0cd0b9a): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum + /* "streaming_form_data/_parser.pyx":364 + * message = Parser(policy=HTTP).parsestr(chunk[buffer_start: idx + 1].decode('utf-8')) + * + * if 'content-disposition' in message: # <<<<<<<<<<<<<< + * if not message.get_content_disposition() == 'form-data': + * self.mark_error() */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__6, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + goto __pyx_L13; + } - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0x0855a7d, 0x0c6065b, 0x0cd0b9a): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum - * __pyx_result = Finder.__new__(__pyx_type) + /* "streaming_form_data/_parser.pyx":382 + * + * self.set_active_part(part, params.get('filename')) + * elif 'content-type' in message: # <<<<<<<<<<<<<< + * if self.active_part: + * self.active_part.set_multipart_content_type( */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_content_type, __pyx_v_message, Py_EQ)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 382, __pyx_L1_error) + if (__pyx_t_9) { - /* "(tree fragment)":6 - * if __pyx_checksum not in (0x0855a7d, 0x0c6065b, 0x0cd0b9a): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum # <<<<<<<<<<<<<< - * __pyx_result = Finder.__new__(__pyx_type) - * if __pyx_state is not None: + /* "streaming_form_data/_parser.pyx":383 + * self.set_active_part(part, params.get('filename')) + * elif 'content-type' in message: + * if self.active_part: # <<<<<<<<<<<<<< + * self.active_part.set_multipart_content_type( + * message.get_content_type() */ - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 6, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_self->active_part); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 383, __pyx_L1_error) + if (__pyx_t_9) { - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x0855a7d, 0x0c6065b, 0x0cd0b9a): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum + /* "streaming_form_data/_parser.pyx":384 + * elif 'content-type' in message: + * if self.active_part: + * self.active_part.set_multipart_content_type( # <<<<<<<<<<<<<< + * message.get_content_type() + * ) */ - } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_set_multipart_content_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum - * __pyx_result = Finder.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) + /* "streaming_form_data/_parser.pyx":385 + * if self.active_part: + * self.active_part.set_multipart_content_type( + * message.get_content_type() # <<<<<<<<<<<<<< + * ) + * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_v___pyx_result = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_n_s_get_content_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 385, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 385, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_4 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "(tree fragment)":8 - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum - * __pyx_result = Finder.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "streaming_form_data/_parser.pyx":383 + * self.set_active_part(part, params.get('filename')) + * elif 'content-type' in message: + * if self.active_part: # <<<<<<<<<<<<<< + * self.active_part.set_multipart_content_type( + * message.get_content_type() */ - __pyx_t_2 = (__pyx_v___pyx_state != Py_None); - if (__pyx_t_2) { + } - /* "(tree fragment)":9 - * __pyx_result = Finder.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): + /* "streaming_form_data/_parser.pyx":382 + * + * self.set_active_part(part, params.get('filename')) + * elif 'content-type' in message: # <<<<<<<<<<<<<< + * if self.active_part: + * self.active_part.set_multipart_content_type( */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) - __pyx_t_1 = __pyx_f_19streaming_form_data_7_parser___pyx_unpickle_Finder__set_state(((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L13:; - /* "(tree fragment)":8 - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum - * __pyx_result = Finder.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "streaming_form_data/_parser.pyx":388 + * ) + * + * buffer_start = idx + 1 # <<<<<<<<<<<<<< + * + * self.state = ParserState.PS_ENDED_HEADER */ - } + __pyx_v_buffer_start = (__pyx_v_idx + 1); - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): - * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] + /* "streaming_form_data/_parser.pyx":390 + * buffer_start = idx + 1 + * + * self.state = ParserState.PS_ENDED_HEADER # <<<<<<<<<<<<<< + * elif self.state == ParserState.PS_ENDED_HEADER: + * if byte == c_cr: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; - goto __pyx_L0; + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_ENDED_HEADER; - /* "(tree fragment)":1 - * def __pyx_unpickle_Finder(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "streaming_form_data/_parser.pyx":357 + * self.state = ParserState.PS_ENDING_HEADER + * + * elif self.state == ParserState.PS_ENDING_HEADER: # <<<<<<<<<<<<<< + * if byte != c_lf: + * self.mark_error() */ + break; + case __pyx_e_19streaming_form_data_7_parser_PS_ENDED_HEADER: - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Finder", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":11 - * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] - * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): + /* "streaming_form_data/_parser.pyx":392 + * self.state = ParserState.PS_ENDED_HEADER + * elif self.state == ParserState.PS_ENDED_HEADER: + * if byte == c_cr: # <<<<<<<<<<<<<< + * self.state = ParserState.PS_ENDING_ALL_HEADERS + * else: */ + __pyx_t_9 = (__pyx_v_byte == __pyx_v_19streaming_form_data_7_parser_c_cr); + if (__pyx_t_9) { -static PyObject *__pyx_f_19streaming_form_data_7_parser___pyx_unpickle_Finder__set_state(struct __pyx_obj_19streaming_form_data_7_parser_Finder *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - size_t __pyx_t_2; - enum __pyx_t_19streaming_form_data_7_parser_FinderState __pyx_t_3; - __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_t_4; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Finder__set_state", 1); - - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): - * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[5]) + /* "streaming_form_data/_parser.pyx":393 + * elif self.state == ParserState.PS_ENDED_HEADER: + * if byte == c_cr: + * self.state = ParserState.PS_ENDING_ALL_HEADERS # <<<<<<<<<<<<<< + * else: + * self.state = ParserState.PS_READING_HEADER */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __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) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result->index = __pyx_t_2; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = ((enum __pyx_t_19streaming_form_data_7_parser_FinderState)__Pyx_PyInt_As_enum____pyx_t_19streaming_form_data_7_parser_FinderState(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result->state = __pyx_t_3; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->target); - __Pyx_DECREF(__pyx_v___pyx_result->target); - __pyx_v___pyx_result->target = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result->target_len = __pyx_t_2; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_AsUString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __pyx_v___pyx_result->target_ptr = __pyx_t_4; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_ENDING_ALL_HEADERS; - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): - * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] - * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[5]) + /* "streaming_form_data/_parser.pyx":392 + * self.state = ParserState.PS_ENDED_HEADER + * elif self.state == ParserState.PS_ENDED_HEADER: + * if byte == c_cr: # <<<<<<<<<<<<<< + * self.state = ParserState.PS_ENDING_ALL_HEADERS + * else: */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 13, __pyx_L1_error) - } - __pyx_t_6 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_7 = (__pyx_t_6 > 5); - if (__pyx_t_7) { - } else { - __pyx_t_5 = __pyx_t_7; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_5 = __pyx_t_7; - __pyx_L4_bool_binop_done:; - if (__pyx_t_5) { + goto __pyx_L19; + } - /* "(tree fragment)":14 - * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] - * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[5]) # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":395 + * self.state = ParserState.PS_ENDING_ALL_HEADERS + * else: + * self.state = ParserState.PS_READING_HEADER # <<<<<<<<<<<<<< + * + * elif self.state == ParserState.PS_ENDING_ALL_HEADERS: */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 14, __pyx_L1_error) - } - __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = NULL; - __pyx_t_11 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_11 = 1; + /*else*/ { + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_READING_HEADER; } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_L19:; - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): - * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] - * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[5]) + /* "streaming_form_data/_parser.pyx":391 + * + * self.state = ParserState.PS_ENDED_HEADER + * elif self.state == ParserState.PS_ENDED_HEADER: # <<<<<<<<<<<<<< + * if byte == c_cr: + * self.state = ParserState.PS_ENDING_ALL_HEADERS */ - } + break; + case __pyx_e_19streaming_form_data_7_parser_PS_ENDING_ALL_HEADERS: - /* "(tree fragment)":11 - * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] - * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): + /* "streaming_form_data/_parser.pyx":398 + * + * elif self.state == ParserState.PS_ENDING_ALL_HEADERS: + * if byte != c_lf: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.PartHeaders + 2 */ + __pyx_t_9 = (__pyx_v_byte != __pyx_v_19streaming_form_data_7_parser_c_lf); + if (__pyx_t_9) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Finder__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":399 + * elif self.state == ParserState.PS_ENDING_ALL_HEADERS: + * if byte != c_lf: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.PartHeaders + 2 + * + */ + __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; -/* "(tree fragment)":1 - * def __pyx_unpickle_Part(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "streaming_form_data/_parser.pyx":400 + * if byte != c_lf: + * self.mark_error() + * return ErrorGroup.PartHeaders + 2 # <<<<<<<<<<<<<< + * + * buffer_start = idx + 1 */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_PartHeaders + 2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; -/* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_3__pyx_unpickle_Part(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_3__pyx_unpickle_Part = {"__pyx_unpickle_Part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_3__pyx_unpickle_Part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19streaming_form_data_7_parser_3__pyx_unpickle_Part(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[3] = {0,0,0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_Part (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Part", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Part", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Part") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + /* "streaming_form_data/_parser.pyx":398 + * + * elif self.state == ParserState.PS_ENDING_ALL_HEADERS: + * if byte != c_lf: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.PartHeaders + 2 + */ } - } else if (unlikely(__pyx_nargs != 3)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - } - __pyx_v___pyx_type = values[0]; - __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) - __pyx_v___pyx_state = values[2]; - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Part", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Part", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_2__pyx_unpickle_Part(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); - /* function exit code */ - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":402 + * return ErrorGroup.PartHeaders + 2 + * + * buffer_start = idx + 1 # <<<<<<<<<<<<<< + * + * self.state = ParserState.PS_READING_BODY + */ + __pyx_v_buffer_start = (__pyx_v_idx + 1); -static PyObject *__pyx_pf_19streaming_form_data_7_parser_2__pyx_unpickle_Part(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Part", 1); + /* "streaming_form_data/_parser.pyx":404 + * buffer_start = idx + 1 + * + * self.state = ParserState.PS_READING_BODY # <<<<<<<<<<<<<< + * elif self.state == ParserState.PS_READING_BODY: + * self.delimiter_finder.feed(byte) + */ + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_READING_BODY; - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + /* "streaming_form_data/_parser.pyx":397 + * self.state = ParserState.PS_READING_HEADER + * + * elif self.state == ParserState.PS_ENDING_ALL_HEADERS: # <<<<<<<<<<<<<< + * if byte != c_lf: + * self.mark_error() */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__7, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + break; + case __pyx_e_19streaming_form_data_7_parser_PS_READING_BODY: - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum - * __pyx_result = Part.__new__(__pyx_type) + /* "streaming_form_data/_parser.pyx":406 + * self.state = ParserState.PS_READING_BODY + * elif self.state == ParserState.PS_READING_BODY: + * self.delimiter_finder.feed(byte) # <<<<<<<<<<<<<< + * self.ender_finder.feed(byte) + * */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->feed(__pyx_v_self->delimiter_finder, __pyx_v_byte, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "(tree fragment)":6 - * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum # <<<<<<<<<<<<<< - * __pyx_result = Part.__new__(__pyx_type) - * if __pyx_state is not None: + /* "streaming_form_data/_parser.pyx":407 + * elif self.state == ParserState.PS_READING_BODY: + * self.delimiter_finder.feed(byte) + * self.ender_finder.feed(byte) # <<<<<<<<<<<<<< + * + * if self.delimiter_finder.found(): */ - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_3, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 6, __pyx_L1_error) + __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->feed(__pyx_v_self->ender_finder, __pyx_v_byte, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + /* "streaming_form_data/_parser.pyx":409 + * self.ender_finder.feed(byte) + * + * if self.delimiter_finder.found(): # <<<<<<<<<<<<<< + * self.state = ParserState.PS_READING_HEADER + * */ - } + __pyx_t_9 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->found(__pyx_v_self->delimiter_finder, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 409, __pyx_L1_error) + if (__pyx_t_9) { - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum - * __pyx_result = Part.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) + /* "streaming_form_data/_parser.pyx":410 + * + * if self.delimiter_finder.found(): + * self.state = ParserState.PS_READING_HEADER # <<<<<<<<<<<<<< + * + * if idx + 1 < self.delimiter_length: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_v___pyx_result = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_READING_HEADER; - /* "(tree fragment)":8 - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum - * __pyx_result = Part.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "streaming_form_data/_parser.pyx":412 + * self.state = ParserState.PS_READING_HEADER + * + * if idx + 1 < self.delimiter_length: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Internal + 1 */ - __pyx_t_2 = (__pyx_v___pyx_state != Py_None); - if (__pyx_t_2) { + __pyx_t_9 = ((__pyx_v_idx + 1) < __pyx_v_self->delimiter_length); + if (__pyx_t_9) { - /* "(tree fragment)":9 - * __pyx_result = Part.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): + /* "streaming_form_data/_parser.pyx":413 + * + * if idx + 1 < self.delimiter_length: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Internal + 1 + * */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) - __pyx_t_1 = __pyx_f_19streaming_form_data_7_parser___pyx_unpickle_Part__set_state(((struct __pyx_obj_19streaming_form_data_7_parser_Part *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "(tree fragment)":8 - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum - * __pyx_result = Part.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "streaming_form_data/_parser.pyx":414 + * if idx + 1 < self.delimiter_length: + * self.mark_error() + * return ErrorGroup.Internal + 1 # <<<<<<<<<<<<<< + * + * match_start = idx + 1 - self.delimiter_length */ - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + /* "streaming_form_data/_parser.pyx":412 + * self.state = ParserState.PS_READING_HEADER + * + * if idx + 1 < self.delimiter_length: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Internal + 1 */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; - goto __pyx_L0; + } - /* "(tree fragment)":1 - * def __pyx_unpickle_Part(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "streaming_form_data/_parser.pyx":416 + * return ErrorGroup.Internal + 1 + * + * match_start = idx + 1 - self.delimiter_length # <<<<<<<<<<<<<< + * + * if match_start >= buffer_start: */ + __pyx_v_match_start = ((__pyx_v_idx + 1) - __pyx_v_self->delimiter_length); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Part", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":11 - * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + /* "streaming_form_data/_parser.pyx":418 + * match_start = idx + 1 - self.delimiter_length + * + * if match_start >= buffer_start: # <<<<<<<<<<<<<< + * try: + * self.on_body(chunk[buffer_start: match_start]) */ + __pyx_t_9 = (__pyx_v_match_start >= __pyx_v_buffer_start); + if (__pyx_t_9) { -static PyObject *__pyx_f_19streaming_form_data_7_parser___pyx_unpickle_Part__set_state(struct __pyx_obj_19streaming_form_data_7_parser_Part *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Part__set_state", 1); + /* "streaming_form_data/_parser.pyx":419 + * + * if match_start >= buffer_start: + * try: # <<<<<<<<<<<<<< + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + /*try:*/ { - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[2]) + /* "streaming_form_data/_parser.pyx":420 + * if match_start >= buffer_start: + * try: + * self.on_body(chunk[buffer_start: match_start]) # <<<<<<<<<<<<<< + * except Exception: + * self.mark_error() */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __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) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->name); - __Pyx_DECREF(__pyx_v___pyx_result->name); - __pyx_v___pyx_result->name = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->targets); - __Pyx_DECREF(__pyx_v___pyx_result->targets); - __pyx_v___pyx_result->targets = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_body); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 420, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__pyx_v_chunk == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 420, __pyx_L24_error) + } + __pyx_t_7 = PySequence_GetSlice(__pyx_v_chunk, __pyx_v_buffer_start, __pyx_v_match_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 420, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[2]) + /* "streaming_form_data/_parser.pyx":419 + * + * if match_start >= buffer_start: + * try: # <<<<<<<<<<<<<< + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 13, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 > 2); - if (__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __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) - __pyx_t_2 = __pyx_t_4; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { + } + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L31_try_end; + __pyx_L24_error:; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "(tree fragment)":14 - * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[2]) # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":421 + * try: + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: # <<<<<<<<<<<<<< + * self.mark_error() + * raise */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 14, __pyx_L1_error) - } - __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_8) { + __Pyx_AddTraceback("streaming_form_data._parser._Parser._parse", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 421, __pyx_L26_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_7); - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[2]) + /* "streaming_form_data/_parser.pyx":422 + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: + * self.mark_error() # <<<<<<<<<<<<<< + * raise + * */ - } + __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L26_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "(tree fragment)":11 - * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + /* "streaming_form_data/_parser.pyx":423 + * except Exception: + * self.mark_error() + * raise # <<<<<<<<<<<<<< + * + * buffer_start = idx + 1 */ + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_5, __pyx_t_7); + __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_7 = 0; + __PYX_ERR(0, 423, __pyx_L26_except_error) + } + goto __pyx_L26_except_error; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Part__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "streaming_form_data/_parser.pyx":419 + * + * if match_start >= buffer_start: + * try: # <<<<<<<<<<<<<< + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: + */ + __pyx_L26_except_error:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + goto __pyx_L1_error; + __pyx_L31_try_end:; + } -/* "(tree fragment)":1 - * def __pyx_unpickle__Parser(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "streaming_form_data/_parser.pyx":425 + * raise + * + * buffer_start = idx + 1 # <<<<<<<<<<<<<< + * else: + * self.mark_error() */ + __pyx_v_buffer_start = (__pyx_v_idx + 1); -/* Python wrapper */ -static PyObject *__pyx_pw_19streaming_form_data_7_parser_5__pyx_unpickle__Parser(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_5__pyx_unpickle__Parser = {"__pyx_unpickle__Parser", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_5__pyx_unpickle__Parser, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19streaming_form_data_7_parser_5__pyx_unpickle__Parser(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[3] = {0,0,0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle__Parser (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; + /* "streaming_form_data/_parser.pyx":418 + * match_start = idx + 1 - self.delimiter_length + * + * if match_start >= buffer_start: # <<<<<<<<<<<<<< + * try: + * self.on_body(chunk[buffer_start: match_start]) + */ + goto __pyx_L23; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Parser", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + + /* "streaming_form_data/_parser.pyx":427 + * buffer_start = idx + 1 + * else: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Internal + 2 + * + */ + /*else*/ { + __pyx_t_7 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "streaming_form_data/_parser.pyx":428 + * else: + * self.mark_error() + * return ErrorGroup.Internal + 2 # <<<<<<<<<<<<<< + * + * self.unset_active_part() + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 2)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); - kw_args--; + __pyx_L23:; + + /* "streaming_form_data/_parser.pyx":430 + * return ErrorGroup.Internal + 2 + * + * self.unset_active_part() # <<<<<<<<<<<<<< + * self.delimiter_finder.reset() + * + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unset_active_part); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Parser", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "streaming_form_data/_parser.pyx":431 + * + * self.unset_active_part() + * self.delimiter_finder.reset() # <<<<<<<<<<<<<< + * + * elif self.ender_finder.found(): + */ + __pyx_t_7 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->reset(__pyx_v_self->delimiter_finder); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "streaming_form_data/_parser.pyx":409 + * self.ender_finder.feed(byte) + * + * if self.delimiter_finder.found(): # <<<<<<<<<<<<<< + * self.state = ParserState.PS_READING_HEADER + * + */ + goto __pyx_L21; } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle__Parser") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 3)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - } - __pyx_v___pyx_type = values[0]; - __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) - __pyx_v___pyx_state = values[2]; - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Parser", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle__Parser", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19streaming_form_data_7_parser_4__pyx_unpickle__Parser(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); - - /* function exit code */ - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19streaming_form_data_7_parser_4__pyx_unpickle__Parser(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle__Parser", 1); - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x428af85, 0xaf18744, 0x7bae3b8): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum + /* "streaming_form_data/_parser.pyx":433 + * self.delimiter_finder.reset() + * + * elif self.ender_finder.found(): # <<<<<<<<<<<<<< + * self.state = ParserState.PS_END + * */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_9 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->found(__pyx_v_self->ender_finder, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 433, __pyx_L1_error) + if (__pyx_t_9) { - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0x428af85, 0xaf18744, 0x7bae3b8): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum - * __pyx_result = _Parser.__new__(__pyx_type) + /* "streaming_form_data/_parser.pyx":434 + * + * elif self.ender_finder.found(): + * self.state = ParserState.PS_END # <<<<<<<<<<<<<< + * + * if idx + 1 < self.ender_length: */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_END; - /* "(tree fragment)":6 - * if __pyx_checksum not in (0x428af85, 0xaf18744, 0x7bae3b8): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum # <<<<<<<<<<<<<< - * __pyx_result = _Parser.__new__(__pyx_type) - * if __pyx_state is not None: + /* "streaming_form_data/_parser.pyx":436 + * self.state = ParserState.PS_END + * + * if idx + 1 < self.ender_length: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Internal + 3 */ - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 6, __pyx_L1_error) + __pyx_t_9 = ((__pyx_v_idx + 1) < __pyx_v_self->ender_length); + if (__pyx_t_9) { - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x428af85, 0xaf18744, 0x7bae3b8): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum + /* "streaming_form_data/_parser.pyx":437 + * + * if idx + 1 < self.ender_length: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Internal + 3 + * match_start = idx + 1 - self.ender_length */ - } + __pyx_t_7 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum - * __pyx_result = _Parser.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) + /* "streaming_form_data/_parser.pyx":438 + * if idx + 1 < self.ender_length: + * self.mark_error() + * return ErrorGroup.Internal + 3 # <<<<<<<<<<<<<< + * match_start = idx + 1 - self.ender_length + * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_v___pyx_result = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 3)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; - /* "(tree fragment)":8 - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum - * __pyx_result = _Parser.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) - * return __pyx_result + /* "streaming_form_data/_parser.pyx":436 + * self.state = ParserState.PS_END + * + * if idx + 1 < self.ender_length: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Internal + 3 */ - __pyx_t_2 = (__pyx_v___pyx_state != Py_None); - if (__pyx_t_2) { + } - /* "(tree fragment)":9 - * __pyx_result = _Parser.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): + /* "streaming_form_data/_parser.pyx":439 + * self.mark_error() + * return ErrorGroup.Internal + 3 + * match_start = idx + 1 - self.ender_length # <<<<<<<<<<<<<< + * + * if match_start >= buffer_start: */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) - __pyx_t_1 = __pyx_f_19streaming_form_data_7_parser___pyx_unpickle__Parser__set_state(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_match_start = ((__pyx_v_idx + 1) - __pyx_v_self->ender_length); - /* "(tree fragment)":8 - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum - * __pyx_result = _Parser.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) - * return __pyx_result + /* "streaming_form_data/_parser.pyx":441 + * match_start = idx + 1 - self.ender_length + * + * if match_start >= buffer_start: # <<<<<<<<<<<<<< + * try: + * self.on_body(chunk[buffer_start: match_start]) */ - } + __pyx_t_9 = (__pyx_v_match_start >= __pyx_v_buffer_start); + if (__pyx_t_9) { - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): - * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] + /* "streaming_form_data/_parser.pyx":442 + * + * if match_start >= buffer_start: + * try: # <<<<<<<<<<<<<< + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; - goto __pyx_L0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_11); + /*try:*/ { - /* "(tree fragment)":1 - * def __pyx_unpickle__Parser(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "streaming_form_data/_parser.pyx":443 + * if match_start >= buffer_start: + * try: + * self.on_body(chunk[buffer_start: match_start]) # <<<<<<<<<<<<<< + * except Exception: + * self.mark_error() */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_body); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 443, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__pyx_v_chunk == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 443, __pyx_L36_error) + } + __pyx_t_6 = PySequence_GetSlice(__pyx_v_chunk, __pyx_v_buffer_start, __pyx_v_match_start); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 443, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle__Parser", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":11 - * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] - * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): + /* "streaming_form_data/_parser.pyx":442 + * + * if match_start >= buffer_start: + * try: # <<<<<<<<<<<<<< + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: */ + } + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L43_try_end; + __pyx_L36_error:; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; -static PyObject *__pyx_f_19streaming_form_data_7_parser___pyx_unpickle__Parser__set_state(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - size_t __pyx_t_2; - enum __pyx_t_19streaming_form_data_7_parser_ParserState __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle__Parser__set_state", 1); - - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): - * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[11]) + /* "streaming_form_data/_parser.pyx":444 + * try: + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: # <<<<<<<<<<<<<< + * self.mark_error() + * raise */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __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) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->_leftover_buffer); - __Pyx_DECREF(__pyx_v___pyx_result->_leftover_buffer); - __pyx_v___pyx_result->_leftover_buffer = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->active_part); - __Pyx_DECREF(__pyx_v___pyx_result->active_part); - __pyx_v___pyx_result->active_part = __pyx_t_1; - __pyx_t_1 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->default_part); - __Pyx_DECREF(__pyx_v___pyx_result->default_part); - __pyx_v___pyx_result->default_part = __pyx_t_1; - __pyx_t_1 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19streaming_form_data_7_parser_Finder))))) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->delimiter_finder); - __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->delimiter_finder); - __pyx_v___pyx_result->delimiter_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)__pyx_t_1); - __pyx_t_1 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result->delimiter_length = __pyx_t_2; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19streaming_form_data_7_parser_Finder))))) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->ender_finder); - __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->ender_finder); - __pyx_v___pyx_result->ender_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)__pyx_t_1); - __pyx_t_1 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result->ender_length = __pyx_t_2; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->expected_parts); - __Pyx_DECREF(__pyx_v___pyx_result->expected_parts); - __pyx_v___pyx_result->expected_parts = __pyx_t_1; - __pyx_t_1 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = ((enum __pyx_t_19streaming_form_data_7_parser_ParserState)__Pyx_PyInt_As_enum____pyx_t_19streaming_form_data_7_parser_ParserState(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result->state = __pyx_t_3; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result->strict = __pyx_t_4; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->unexpected_part_name); - __Pyx_DECREF(__pyx_v___pyx_result->unexpected_part_name); - __pyx_v___pyx_result->unexpected_part_name = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_8) { + __Pyx_AddTraceback("streaming_form_data._parser._Parser._parse", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 444, __pyx_L38_except_error) + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); - /* "(tree fragment)":13 - * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): - * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] - * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[11]) + /* "streaming_form_data/_parser.pyx":445 + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: + * self.mark_error() # <<<<<<<<<<<<<< + * raise + * else: */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 13, __pyx_L1_error) - } - __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_6 = (__pyx_t_5 > 11); - if (__pyx_t_6) { - } else { - __pyx_t_4 = __pyx_t_6; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_6 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_4 = __pyx_t_6; - __pyx_L4_bool_binop_done:; - if (__pyx_t_4) { + __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 445, __pyx_L38_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "(tree fragment)":14 - * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] - * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[11]) # <<<<<<<<<<<<<< + /* "streaming_form_data/_parser.pyx":446 + * except Exception: + * self.mark_error() + * raise # <<<<<<<<<<<<<< + * else: + * self.mark_error() */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 14, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = NULL; - __pyx_t_10 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_10 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_5, __pyx_t_6); + __pyx_t_7 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; + __PYX_ERR(0, 446, __pyx_L38_except_error) + } + goto __pyx_L38_except_error; - /* "(tree fragment)":13 - * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): - * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] - * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[11]) + /* "streaming_form_data/_parser.pyx":442 + * + * if match_start >= buffer_start: + * try: # <<<<<<<<<<<<<< + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: */ - } + __pyx_L38_except_error:; + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11); + goto __pyx_L1_error; + __pyx_L43_try_end:; + } - /* "(tree fragment)":11 - * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] - * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): + /* "streaming_form_data/_parser.pyx":441 + * match_start = idx + 1 - self.ender_length + * + * if match_start >= buffer_start: # <<<<<<<<<<<<<< + * try: + * self.on_body(chunk[buffer_start: match_start]) */ + goto __pyx_L35; + } - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle__Parser__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder __pyx_vtable_19streaming_form_data_7_parser_Finder; + /* "streaming_form_data/_parser.pyx":448 + * raise + * else: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Internal + 4 + * + */ + /*else*/ { + __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; -static PyObject *__pyx_tp_new_19streaming_form_data_7_parser_Finder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_19streaming_form_data_7_parser_Finder *p; - PyObject *o; - #if CYTHON_COMPILING_IN_LIMITED_API - allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); - o = alloc_func(t, 0); - #else - if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - #endif - p = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)o); - p->__pyx_vtab = __pyx_vtabptr_19streaming_form_data_7_parser_Finder; - p->target = ((PyObject*)Py_None); Py_INCREF(Py_None); - return o; -} + /* "streaming_form_data/_parser.pyx":449 + * else: + * self.mark_error() + * return ErrorGroup.Internal + 4 # <<<<<<<<<<<<<< + * + * buffer_start = idx + 1 + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + } + __pyx_L35:; -static void __pyx_tp_dealloc_19streaming_form_data_7_parser_Finder(PyObject *o) { - struct __pyx_obj_19streaming_form_data_7_parser_Finder *p = (struct __pyx_obj_19streaming_form_data_7_parser_Finder *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { - if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser_Finder) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - } - #endif - Py_CLEAR(p->target); - #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY - (*Py_TYPE(o)->tp_free)(o); - #else - { - freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); - if (tp_free) tp_free(o); - } - #endif -} + /* "streaming_form_data/_parser.pyx":451 + * return ErrorGroup.Internal + 4 + * + * buffer_start = idx + 1 # <<<<<<<<<<<<<< + * + * self.unset_active_part() + */ + __pyx_v_buffer_start = (__pyx_v_idx + 1); -static PyObject *__pyx_getprop_19streaming_form_data_7_parser_6Finder_target(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19streaming_form_data_7_parser_6Finder_6target_1__get__(o); -} + /* "streaming_form_data/_parser.pyx":453 + * buffer_start = idx + 1 + * + * self.unset_active_part() # <<<<<<<<<<<<<< + * self.ender_finder.reset() + * + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unset_active_part); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; -static PyMethodDef __pyx_methods_19streaming_form_data_7_parser_Finder[] = { - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_6Finder_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_6Finder_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; + /* "streaming_form_data/_parser.pyx":454 + * + * self.unset_active_part() + * self.ender_finder.reset() # <<<<<<<<<<<<<< + * + * else: + */ + __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->reset(__pyx_v_self->ender_finder); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; -static struct PyGetSetDef __pyx_getsets_19streaming_form_data_7_parser_Finder[] = { - {(char *)"target", __pyx_getprop_19streaming_form_data_7_parser_6Finder_target, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __pyx_type_19streaming_form_data_7_parser_Finder_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser_Finder}, - {Py_tp_methods, (void *)__pyx_methods_19streaming_form_data_7_parser_Finder}, - {Py_tp_getset, (void *)__pyx_getsets_19streaming_form_data_7_parser_Finder}, - {Py_tp_init, (void *)__pyx_pw_19streaming_form_data_7_parser_6Finder_1__init__}, - {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser_Finder}, - {0, 0}, -}; -static PyType_Spec __pyx_type_19streaming_form_data_7_parser_Finder_spec = { - "streaming_form_data._parser.Finder", - sizeof(struct __pyx_obj_19streaming_form_data_7_parser_Finder), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, - __pyx_type_19streaming_form_data_7_parser_Finder_slots, -}; -#else + /* "streaming_form_data/_parser.pyx":433 + * self.delimiter_finder.reset() + * + * elif self.ender_finder.found(): # <<<<<<<<<<<<<< + * self.state = ParserState.PS_END + * + */ + goto __pyx_L21; + } -static PyTypeObject __pyx_type_19streaming_form_data_7_parser_Finder = { - PyVarObject_HEAD_INIT(0, 0) - "streaming_form_data._parser.""Finder", /*tp_name*/ - sizeof(struct __pyx_obj_19streaming_form_data_7_parser_Finder), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19streaming_form_data_7_parser_Finder, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19streaming_form_data_7_parser_Finder, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_19streaming_form_data_7_parser_Finder, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - #if !CYTHON_USE_TYPE_SPECS - 0, /*tp_dictoffset*/ - #endif - __pyx_pw_19streaming_form_data_7_parser_6Finder_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19streaming_form_data_7_parser_Finder, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if __PYX_NEED_TP_PRINT_SLOT == 1 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030C0000 - 0, /*tp_watched*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, /*tp_pypy_flags*/ - #endif -}; -#endif + /* "streaming_form_data/_parser.pyx":462 + * # middle of a potential delimiter. + * + * if self.delimiter_finder.inactive(): # <<<<<<<<<<<<<< + * skip_count = self.rewind_fast_forward( + * chunk_ptr, idx + 1, chunk_len - 1 + */ + /*else*/ { + __pyx_t_9 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->inactive(__pyx_v_self->delimiter_finder, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 462, __pyx_L1_error) + if (__pyx_t_9) { -static PyObject *__pyx_tp_new_19streaming_form_data_7_parser_Part(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_19streaming_form_data_7_parser_Part *p; - PyObject *o; - #if CYTHON_COMPILING_IN_LIMITED_API - allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); - o = alloc_func(t, 0); - #else - if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - #endif - p = ((struct __pyx_obj_19streaming_form_data_7_parser_Part *)o); - p->name = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->targets = ((PyObject*)Py_None); Py_INCREF(Py_None); - return o; -} + /* "streaming_form_data/_parser.pyx":463 + * + * if self.delimiter_finder.inactive(): + * skip_count = self.rewind_fast_forward( # <<<<<<<<<<<<<< + * chunk_ptr, idx + 1, chunk_len - 1 + * ) + */ + __pyx_t_14 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->rewind_fast_forward(__pyx_v_self, __pyx_v_chunk_ptr, (__pyx_v_idx + 1), (__pyx_v_chunk_len - 1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error) + __pyx_v_skip_count = __pyx_t_14; -static void __pyx_tp_dealloc_19streaming_form_data_7_parser_Part(PyObject *o) { - struct __pyx_obj_19streaming_form_data_7_parser_Part *p = (struct __pyx_obj_19streaming_form_data_7_parser_Part *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { - if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser_Part) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + /* "streaming_form_data/_parser.pyx":466 + * chunk_ptr, idx + 1, chunk_len - 1 + * ) + * idx += skip_count # <<<<<<<<<<<<<< + * + * elif self.state == ParserState.PS_END: + */ + __pyx_v_idx = (__pyx_v_idx + __pyx_v_skip_count); + + /* "streaming_form_data/_parser.pyx":462 + * # middle of a potential delimiter. + * + * if self.delimiter_finder.inactive(): # <<<<<<<<<<<<<< + * skip_count = self.rewind_fast_forward( + * chunk_ptr, idx + 1, chunk_len - 1 + */ + } + } + __pyx_L21:; + + /* "streaming_form_data/_parser.pyx":405 + * + * self.state = ParserState.PS_READING_BODY + * elif self.state == ParserState.PS_READING_BODY: # <<<<<<<<<<<<<< + * self.delimiter_finder.feed(byte) + * self.ender_finder.feed(byte) + */ + break; + case __pyx_e_19streaming_form_data_7_parser_PS_END: + + /* "streaming_form_data/_parser.pyx":469 + * + * elif self.state == ParserState.PS_END: + * return 0 # <<<<<<<<<<<<<< + * else: + * self.mark_error() + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_0); + __pyx_r = __pyx_int_0; + goto __pyx_L0; + + /* "streaming_form_data/_parser.pyx":468 + * idx += skip_count + * + * elif self.state == ParserState.PS_END: # <<<<<<<<<<<<<< + * return 0 + * else: + */ + break; + default: + + /* "streaming_form_data/_parser.pyx":471 + * return 0 + * else: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Internal + 5 + * + */ + __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "streaming_form_data/_parser.pyx":472 + * else: + * self.mark_error() + * return ErrorGroup.Internal + 5 # <<<<<<<<<<<<<< + * + * idx += 1 + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + break; } - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->name); - Py_CLEAR(p->targets); - #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY - (*Py_TYPE(o)->tp_free)(o); - #else - { - freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); - if (tp_free) tp_free(o); - } - #endif -} -static int __pyx_tp_traverse_19streaming_form_data_7_parser_Part(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19streaming_form_data_7_parser_Part *p = (struct __pyx_obj_19streaming_form_data_7_parser_Part *)o; - if (p->targets) { - e = (*v)(p->targets, a); if (e) return e; + /* "streaming_form_data/_parser.pyx":474 + * return ErrorGroup.Internal + 5 + * + * idx += 1 # <<<<<<<<<<<<<< + * + * if idx != chunk_len: + */ + __pyx_v_idx = (__pyx_v_idx + 1); } - return 0; -} -static int __pyx_tp_clear_19streaming_form_data_7_parser_Part(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19streaming_form_data_7_parser_Part *p = (struct __pyx_obj_19streaming_form_data_7_parser_Part *)o; - tmp = ((PyObject*)p->targets); - p->targets = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} + /* "streaming_form_data/_parser.pyx":476 + * idx += 1 + * + * if idx != chunk_len: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Internal + 6 + */ + __pyx_t_9 = (__pyx_v_idx != __pyx_v_chunk_len); + if (__pyx_t_9) { -static PyObject *__pyx_getprop_19streaming_form_data_7_parser_4Part_name(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19streaming_form_data_7_parser_4Part_4name_1__get__(o); -} + /* "streaming_form_data/_parser.pyx":477 + * + * if idx != chunk_len: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Internal + 6 + * + */ + __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; -static int __pyx_setprop_19streaming_form_data_7_parser_4Part_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_19streaming_form_data_7_parser_4Part_4name_3__set__(o, v); - } - else { - return __pyx_pw_19streaming_form_data_7_parser_4Part_4name_5__del__(o); + /* "streaming_form_data/_parser.pyx":478 + * if idx != chunk_len: + * self.mark_error() + * return ErrorGroup.Internal + 6 # <<<<<<<<<<<<<< + * + * if buffer_start > chunk_len: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 6)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 478, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "streaming_form_data/_parser.pyx":476 + * idx += 1 + * + * if idx != chunk_len: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Internal + 6 + */ } -} -static PyMethodDef __pyx_methods_19streaming_form_data_7_parser_Part[] = { - {"add_target", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_3add_target, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"set_multipart_filename", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_5set_multipart_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"set_multipart_content_type", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_7set_multipart_content_type, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"start", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_9start, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"data_received", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_11data_received, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"finish", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_13finish, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; + /* "streaming_form_data/_parser.pyx":480 + * return ErrorGroup.Internal + 6 + * + * if buffer_start > chunk_len: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Internal + 7 + */ + __pyx_t_9 = (__pyx_v_buffer_start > __pyx_v_chunk_len); + if (__pyx_t_9) { -static struct PyGetSetDef __pyx_getsets_19streaming_form_data_7_parser_Part[] = { - {(char *)"name", __pyx_getprop_19streaming_form_data_7_parser_4Part_name, __pyx_setprop_19streaming_form_data_7_parser_4Part_name, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __pyx_type_19streaming_form_data_7_parser_Part_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser_Part}, - {Py_tp_doc, (void *)PyDoc_STR("One part of a multipart/form-data request\n ")}, - {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser_Part}, - {Py_tp_clear, (void *)__pyx_tp_clear_19streaming_form_data_7_parser_Part}, - {Py_tp_methods, (void *)__pyx_methods_19streaming_form_data_7_parser_Part}, - {Py_tp_getset, (void *)__pyx_getsets_19streaming_form_data_7_parser_Part}, - {Py_tp_init, (void *)__pyx_pw_19streaming_form_data_7_parser_4Part_1__init__}, - {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser_Part}, - {0, 0}, -}; -static PyType_Spec __pyx_type_19streaming_form_data_7_parser_Part_spec = { - "streaming_form_data._parser.Part", - sizeof(struct __pyx_obj_19streaming_form_data_7_parser_Part), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, - __pyx_type_19streaming_form_data_7_parser_Part_slots, -}; -#else - -static PyTypeObject __pyx_type_19streaming_form_data_7_parser_Part = { - PyVarObject_HEAD_INIT(0, 0) - "streaming_form_data._parser.""Part", /*tp_name*/ - sizeof(struct __pyx_obj_19streaming_form_data_7_parser_Part), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19streaming_form_data_7_parser_Part, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - PyDoc_STR("One part of a multipart/form-data request\n "), /*tp_doc*/ - __pyx_tp_traverse_19streaming_form_data_7_parser_Part, /*tp_traverse*/ - __pyx_tp_clear_19streaming_form_data_7_parser_Part, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19streaming_form_data_7_parser_Part, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_19streaming_form_data_7_parser_Part, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - #if !CYTHON_USE_TYPE_SPECS - 0, /*tp_dictoffset*/ - #endif - __pyx_pw_19streaming_form_data_7_parser_4Part_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19streaming_form_data_7_parser_Part, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if __PYX_NEED_TP_PRINT_SLOT == 1 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030C0000 - 0, /*tp_watched*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, /*tp_pypy_flags*/ - #endif -}; -#endif -static struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser __pyx_vtable_19streaming_form_data_7_parser__Parser; - -static PyObject *__pyx_tp_new_19streaming_form_data_7_parser__Parser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_19streaming_form_data_7_parser__Parser *p; - PyObject *o; - #if CYTHON_COMPILING_IN_LIMITED_API - allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); - o = alloc_func(t, 0); - #else - if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - #endif - p = ((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)o); - p->__pyx_vtab = __pyx_vtabptr_19streaming_form_data_7_parser__Parser; - p->delimiter_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)Py_None); Py_INCREF(Py_None); - p->ender_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)Py_None); Py_INCREF(Py_None); - p->expected_parts = Py_None; Py_INCREF(Py_None); - p->active_part = Py_None; Py_INCREF(Py_None); - p->default_part = Py_None; Py_INCREF(Py_None); - p->_leftover_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->unexpected_part_name = ((PyObject*)Py_None); Py_INCREF(Py_None); - return o; -} + /* "streaming_form_data/_parser.pyx":481 + * + * if buffer_start > chunk_len: + * self.mark_error() # <<<<<<<<<<<<<< + * return ErrorGroup.Internal + 7 + * + */ + __pyx_t_6 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; -static void __pyx_tp_dealloc_19streaming_form_data_7_parser__Parser(PyObject *o) { - struct __pyx_obj_19streaming_form_data_7_parser__Parser *p = (struct __pyx_obj_19streaming_form_data_7_parser__Parser *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { - if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser__Parser) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->delimiter_finder); - Py_CLEAR(p->ender_finder); - Py_CLEAR(p->expected_parts); - Py_CLEAR(p->active_part); - Py_CLEAR(p->default_part); - Py_CLEAR(p->_leftover_buffer); - Py_CLEAR(p->unexpected_part_name); - #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY - (*Py_TYPE(o)->tp_free)(o); - #else - { - freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); - if (tp_free) tp_free(o); - } - #endif -} + /* "streaming_form_data/_parser.pyx":482 + * if buffer_start > chunk_len: + * self.mark_error() + * return ErrorGroup.Internal + 7 # <<<<<<<<<<<<<< + * + * if self.state == ParserState.PS_READING_BODY: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_e_19streaming_form_data_7_parser_Internal + 7)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; -static int __pyx_tp_traverse_19streaming_form_data_7_parser__Parser(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19streaming_form_data_7_parser__Parser *p = (struct __pyx_obj_19streaming_form_data_7_parser__Parser *)o; - if (p->delimiter_finder) { - e = (*v)(((PyObject *)p->delimiter_finder), a); if (e) return e; - } - if (p->ender_finder) { - e = (*v)(((PyObject *)p->ender_finder), a); if (e) return e; - } - if (p->expected_parts) { - e = (*v)(p->expected_parts, a); if (e) return e; - } - if (p->active_part) { - e = (*v)(p->active_part, a); if (e) return e; - } - if (p->default_part) { - e = (*v)(p->default_part, a); if (e) return e; + /* "streaming_form_data/_parser.pyx":480 + * return ErrorGroup.Internal + 6 + * + * if buffer_start > chunk_len: # <<<<<<<<<<<<<< + * self.mark_error() + * return ErrorGroup.Internal + 7 + */ } - return 0; -} -static int __pyx_tp_clear_19streaming_form_data_7_parser__Parser(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19streaming_form_data_7_parser__Parser *p = (struct __pyx_obj_19streaming_form_data_7_parser__Parser *)o; - tmp = ((PyObject*)p->delimiter_finder); - p->delimiter_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->ender_finder); - p->ender_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->expected_parts); - p->expected_parts = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->active_part); - p->active_part = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->default_part); - p->default_part = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} + /* "streaming_form_data/_parser.pyx":484 + * return ErrorGroup.Internal + 7 + * + * if self.state == ParserState.PS_READING_BODY: # <<<<<<<<<<<<<< + * matched_length = max( + * self.delimiter_finder.matched_length(), + */ + __pyx_t_9 = (__pyx_v_self->state == __pyx_e_19streaming_form_data_7_parser_PS_READING_BODY); + if (__pyx_t_9) { -static PyObject *__pyx_getprop_19streaming_form_data_7_parser_7_Parser_unexpected_part_name(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_1__get__(o); -} + /* "streaming_form_data/_parser.pyx":487 + * matched_length = max( + * self.delimiter_finder.matched_length(), + * self.ender_finder.matched_length() # <<<<<<<<<<<<<< + * ) + * match_start = idx - matched_length + */ + __pyx_t_14 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->matched_length(__pyx_v_self->ender_finder); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 487, __pyx_L1_error) -static int __pyx_setprop_19streaming_form_data_7_parser_7_Parser_unexpected_part_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_3__set__(o, v); - } - else { - return __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_5__del__(o); - } -} + /* "streaming_form_data/_parser.pyx":486 + * if self.state == ParserState.PS_READING_BODY: + * matched_length = max( + * self.delimiter_finder.matched_length(), # <<<<<<<<<<<<<< + * self.ender_finder.matched_length() + * ) + */ + __pyx_t_15 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->matched_length(__pyx_v_self->delimiter_finder); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 486, __pyx_L1_error) -static PyMethodDef __pyx_methods_19streaming_form_data_7_parser__Parser[] = { - {"register", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_3register, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"set_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_5set_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"unset_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_7unset_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"on_body", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_9on_body, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"data_received", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_11data_received, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"_parse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_13_parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_19streaming_form_data_7_parser__Parser[] = { - {(char *)"unexpected_part_name", __pyx_getprop_19streaming_form_data_7_parser_7_Parser_unexpected_part_name, __pyx_setprop_19streaming_form_data_7_parser_7_Parser_unexpected_part_name, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __pyx_type_19streaming_form_data_7_parser__Parser_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser__Parser}, - {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser__Parser}, - {Py_tp_clear, (void *)__pyx_tp_clear_19streaming_form_data_7_parser__Parser}, - {Py_tp_methods, (void *)__pyx_methods_19streaming_form_data_7_parser__Parser}, - {Py_tp_getset, (void *)__pyx_getsets_19streaming_form_data_7_parser__Parser}, - {Py_tp_init, (void *)__pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__}, - {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser__Parser}, - {0, 0}, -}; -static PyType_Spec __pyx_type_19streaming_form_data_7_parser__Parser_spec = { - "streaming_form_data._parser._Parser", - sizeof(struct __pyx_obj_19streaming_form_data_7_parser__Parser), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, - __pyx_type_19streaming_form_data_7_parser__Parser_slots, -}; -#else + /* "streaming_form_data/_parser.pyx":487 + * matched_length = max( + * self.delimiter_finder.matched_length(), + * self.ender_finder.matched_length() # <<<<<<<<<<<<<< + * ) + * match_start = idx - matched_length + */ + __pyx_t_9 = (__pyx_t_14 > __pyx_t_15); + if (__pyx_t_9) { + __pyx_t_16 = __pyx_t_14; + } else { + __pyx_t_16 = __pyx_t_15; + } + __pyx_v_matched_length = __pyx_t_16; -static PyTypeObject __pyx_type_19streaming_form_data_7_parser__Parser = { - PyVarObject_HEAD_INIT(0, 0) - "streaming_form_data._parser.""_Parser", /*tp_name*/ - sizeof(struct __pyx_obj_19streaming_form_data_7_parser__Parser), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19streaming_form_data_7_parser__Parser, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_19streaming_form_data_7_parser__Parser, /*tp_traverse*/ - __pyx_tp_clear_19streaming_form_data_7_parser__Parser, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19streaming_form_data_7_parser__Parser, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_19streaming_form_data_7_parser__Parser, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - #if !CYTHON_USE_TYPE_SPECS - 0, /*tp_dictoffset*/ - #endif - __pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19streaming_form_data_7_parser__Parser, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if __PYX_NEED_TP_PRINT_SLOT == 1 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030C0000 - 0, /*tp_watched*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, /*tp_pypy_flags*/ - #endif -}; -#endif + /* "streaming_form_data/_parser.pyx":489 + * self.ender_finder.matched_length() + * ) + * match_start = idx - matched_length # <<<<<<<<<<<<<< + * + * if match_start >= buffer_start + c_min_file_body_chunk_size: + */ + __pyx_v_match_start = (__pyx_v_idx - __pyx_v_matched_length); -static int __pyx_tp_traverse___Pyx_EnumMeta(PyObject *o, visitproc v, void *a) { - int e; - if (!(&PyType_Type)->tp_traverse); else { e = (&PyType_Type)->tp_traverse(o,v,a); if (e) return e; } - return 0; -} + /* "streaming_form_data/_parser.pyx":491 + * match_start = idx - matched_length + * + * if match_start >= buffer_start + c_min_file_body_chunk_size: # <<<<<<<<<<<<<< + * try: + * self.on_body(chunk[buffer_start: match_start]) + */ + __pyx_t_9 = (__pyx_v_match_start >= (__pyx_v_buffer_start + __pyx_v_19streaming_form_data_7_parser_c_min_file_body_chunk_size)); + if (__pyx_t_9) { -static int __pyx_tp_clear___Pyx_EnumMeta(PyObject *o) { - if (!(&PyType_Type)->tp_clear); else (&PyType_Type)->tp_clear(o); - return 0; -} -static PyObject *__pyx_sq_item___Pyx_EnumMeta(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} + /* "streaming_form_data/_parser.pyx":492 + * + * if match_start >= buffer_start + c_min_file_body_chunk_size: + * try: # <<<<<<<<<<<<<< + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + /*try:*/ { -static PyMethodDef __pyx_methods___Pyx_EnumMeta[] = { - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __Pyx_EnumMeta_slots[] = { - {Py_sq_item, (void *)__pyx_sq_item___Pyx_EnumMeta}, - {Py_mp_subscript, (void *)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_5__getitem__}, - {Py_tp_traverse, (void *)__pyx_tp_traverse___Pyx_EnumMeta}, - {Py_tp_clear, (void *)__pyx_tp_clear___Pyx_EnumMeta}, - {Py_tp_iter, (void *)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_3__iter__}, - {Py_tp_methods, (void *)__pyx_methods___Pyx_EnumMeta}, - {Py_tp_init, (void *)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_1__init__}, - {0, 0}, -}; -static PyType_Spec __Pyx_EnumMeta_spec = { - "streaming_form_data._parser.__Pyx_EnumMeta", - sizeof(struct __pyx_obj___Pyx_EnumMeta), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, - __Pyx_EnumMeta_slots, -}; -#else + /* "streaming_form_data/_parser.pyx":493 + * if match_start >= buffer_start + c_min_file_body_chunk_size: + * try: + * self.on_body(chunk[buffer_start: match_start]) # <<<<<<<<<<<<<< + * except Exception: + * self.mark_error() + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_body); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 493, __pyx_L51_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__pyx_v_chunk == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 493, __pyx_L51_error) + } + __pyx_t_7 = PySequence_GetSlice(__pyx_v_chunk, __pyx_v_buffer_start, __pyx_v_match_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 493, __pyx_L51_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 493, __pyx_L51_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; -static PySequenceMethods __pyx_tp_as_sequence___Pyx_EnumMeta = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item___Pyx_EnumMeta, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; + /* "streaming_form_data/_parser.pyx":492 + * + * if match_start >= buffer_start + c_min_file_body_chunk_size: + * try: # <<<<<<<<<<<<<< + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: + */ + } + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L56_try_end; + __pyx_L51_error:; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; -static PyMappingMethods __pyx_tp_as_mapping___Pyx_EnumMeta = { + /* "streaming_form_data/_parser.pyx":494 + * try: + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: # <<<<<<<<<<<<<< + * self.mark_error() + * raise + */ + __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_8) { + __Pyx_AddTraceback("streaming_form_data._parser._Parser._parse", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 494, __pyx_L53_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_7); + + /* "streaming_form_data/_parser.pyx":495 + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: + * self.mark_error() # <<<<<<<<<<<<<< + * raise + * + */ + __pyx_t_4 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser *)__pyx_v_self->__pyx_vtab)->mark_error(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 495, __pyx_L53_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "streaming_form_data/_parser.pyx":496 + * except Exception: + * self.mark_error() + * raise # <<<<<<<<<<<<<< + * + * buffer_start = match_start + */ + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_5, __pyx_t_7); + __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_7 = 0; + __PYX_ERR(0, 496, __pyx_L53_except_error) + } + goto __pyx_L53_except_error; + + /* "streaming_form_data/_parser.pyx":492 + * + * if match_start >= buffer_start + c_min_file_body_chunk_size: + * try: # <<<<<<<<<<<<<< + * self.on_body(chunk[buffer_start: match_start]) + * except Exception: + */ + __pyx_L53_except_error:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + goto __pyx_L1_error; + __pyx_L56_try_end:; + } + + /* "streaming_form_data/_parser.pyx":498 + * raise + * + * buffer_start = match_start # <<<<<<<<<<<<<< + * + * if idx - buffer_start > 0: + */ + __pyx_v_buffer_start = __pyx_v_match_start; + + /* "streaming_form_data/_parser.pyx":491 + * match_start = idx - matched_length + * + * if match_start >= buffer_start + c_min_file_body_chunk_size: # <<<<<<<<<<<<<< + * try: + * self.on_body(chunk[buffer_start: match_start]) + */ + } + + /* "streaming_form_data/_parser.pyx":484 + * return ErrorGroup.Internal + 7 + * + * if self.state == ParserState.PS_READING_BODY: # <<<<<<<<<<<<<< + * matched_length = max( + * self.delimiter_finder.matched_length(), + */ + } + + /* "streaming_form_data/_parser.pyx":500 + * buffer_start = match_start + * + * if idx - buffer_start > 0: # <<<<<<<<<<<<<< + * self._leftover_buffer = chunk[buffer_start: idx] + * + */ + __pyx_t_9 = ((__pyx_v_idx - __pyx_v_buffer_start) > 0); + if (__pyx_t_9) { + + /* "streaming_form_data/_parser.pyx":501 + * + * if idx - buffer_start > 0: + * self._leftover_buffer = chunk[buffer_start: idx] # <<<<<<<<<<<<<< + * + * return 0 + */ + if (unlikely(__pyx_v_chunk == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 501, __pyx_L1_error) + } + __pyx_t_7 = PySequence_GetSlice(__pyx_v_chunk, __pyx_v_buffer_start, __pyx_v_idx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_v_self->_leftover_buffer); + __Pyx_DECREF(__pyx_v_self->_leftover_buffer); + __pyx_v_self->_leftover_buffer = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; + + /* "streaming_form_data/_parser.pyx":500 + * buffer_start = match_start + * + * if idx - buffer_start > 0: # <<<<<<<<<<<<<< + * self._leftover_buffer = chunk[buffer_start: idx] + * + */ + } + + /* "streaming_form_data/_parser.pyx":503 + * self._leftover_buffer = chunk[buffer_start: idx] + * + * return 0 # <<<<<<<<<<<<<< + * + * # rewind_fast_forward searches for the '\r\n--' sequence in the provided + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_0); + __pyx_r = __pyx_int_0; + goto __pyx_L0; + + /* "streaming_form_data/_parser.pyx":298 + * return (chunk, index) + * + * def _parse(self, bytes chunk, size_t index): # <<<<<<<<<<<<<< + * cdef size_t idx, buffer_start, chunk_len + * cdef size_t match_start, skip_count, matched_length + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("streaming_form_data._parser._Parser._parse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_message); + __Pyx_XDECREF(__pyx_v_params); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_part); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "streaming_form_data/_parser.pyx":510 + * # update Finder object states. + * + * cdef size_t rewind_fast_forward( # <<<<<<<<<<<<<< + * self, const Byte *chunk_ptr, size_t pos_first, size_t pos_last + * ): + */ + +static size_t __pyx_f_19streaming_form_data_7_parser_7_Parser_rewind_fast_forward(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_v_chunk_ptr, size_t __pyx_v_pos_first, size_t __pyx_v_pos_last) { + __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_v_ptr; + __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_v_ptr_end; + size_t __pyx_v_skipped; + size_t __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("rewind_fast_forward", 1); + + /* "streaming_form_data/_parser.pyx":518 + * + * # we need at least 4 characters in buffer + * if pos_first + 3 > pos_last: # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_1 = ((__pyx_v_pos_first + 3) > __pyx_v_pos_last); + if (__pyx_t_1) { + + /* "streaming_form_data/_parser.pyx":519 + * # we need at least 4 characters in buffer + * if pos_first + 3 > pos_last: + * return 0 # <<<<<<<<<<<<<< + * + * # calculate pointer to the first character of the buffer and the + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "streaming_form_data/_parser.pyx":518 + * + * # we need at least 4 characters in buffer + * if pos_first + 3 > pos_last: # <<<<<<<<<<<<<< + * return 0 + * + */ + } + + /* "streaming_form_data/_parser.pyx":523 + * # calculate pointer to the first character of the buffer and the + * # pointer to a character after the end of the buffer + * ptr = chunk_ptr + pos_first + 3 # <<<<<<<<<<<<<< + * ptr_end = chunk_ptr + pos_last + 1 + * skipped = 0 + */ + __pyx_v_ptr = ((__pyx_v_chunk_ptr + __pyx_v_pos_first) + 3); + + /* "streaming_form_data/_parser.pyx":524 + * # pointer to a character after the end of the buffer + * ptr = chunk_ptr + pos_first + 3 + * ptr_end = chunk_ptr + pos_last + 1 # <<<<<<<<<<<<<< + * skipped = 0 + * + */ + __pyx_v_ptr_end = ((__pyx_v_chunk_ptr + __pyx_v_pos_last) + 1); + + /* "streaming_form_data/_parser.pyx":525 + * ptr = chunk_ptr + pos_first + 3 + * ptr_end = chunk_ptr + pos_last + 1 + * skipped = 0 # <<<<<<<<<<<<<< + * + * # try to match starting from the 4th character of the multipart + */ + __pyx_v_skipped = 0; + + /* "streaming_form_data/_parser.pyx":532 + * # is found. + * + * while True: # <<<<<<<<<<<<<< + * if ptr >= ptr_end: + * # normalize pointer value because we could jump few characters + */ + while (1) { + + /* "streaming_form_data/_parser.pyx":533 + * + * while True: + * if ptr >= ptr_end: # <<<<<<<<<<<<<< + * # normalize pointer value because we could jump few characters + * # past the buffer end + */ + __pyx_t_1 = (__pyx_v_ptr >= __pyx_v_ptr_end); + if (__pyx_t_1) { + + /* "streaming_form_data/_parser.pyx":536 + * # normalize pointer value because we could jump few characters + * # past the buffer end + * ptr = ptr_end - 1 # <<<<<<<<<<<<<< + * + * # if we iterated till the end of the buffer, we may need to + */ + __pyx_v_ptr = (__pyx_v_ptr_end - 1); + + /* "streaming_form_data/_parser.pyx":541 + * # keep up to 3 characters in the buffer until next chunk + * # guess we will skip all characters in the buffer + * skipped = pos_last - pos_first + 1 # <<<<<<<<<<<<<< + * + * if ptr[0] == c_cr: + */ + __pyx_v_skipped = ((__pyx_v_pos_last - __pyx_v_pos_first) + 1); + + /* "streaming_form_data/_parser.pyx":543 + * skipped = pos_last - pos_first + 1 + * + * if ptr[0] == c_cr: # <<<<<<<<<<<<<< + * skipped = skipped - 1 + * elif ptr[0] == c_lf and ptr[-1] == c_cr: + */ + __pyx_t_1 = ((__pyx_v_ptr[0]) == __pyx_v_19streaming_form_data_7_parser_c_cr); + if (__pyx_t_1) { + + /* "streaming_form_data/_parser.pyx":544 + * + * if ptr[0] == c_cr: + * skipped = skipped - 1 # <<<<<<<<<<<<<< + * elif ptr[0] == c_lf and ptr[-1] == c_cr: + * skipped = skipped - 2 + */ + __pyx_v_skipped = (__pyx_v_skipped - 1); + + /* "streaming_form_data/_parser.pyx":543 + * skipped = pos_last - pos_first + 1 + * + * if ptr[0] == c_cr: # <<<<<<<<<<<<<< + * skipped = skipped - 1 + * elif ptr[0] == c_lf and ptr[-1] == c_cr: + */ + goto __pyx_L7; + } + + /* "streaming_form_data/_parser.pyx":545 + * if ptr[0] == c_cr: + * skipped = skipped - 1 + * elif ptr[0] == c_lf and ptr[-1] == c_cr: # <<<<<<<<<<<<<< + * skipped = skipped - 2 + * elif ( + */ + __pyx_t_2 = ((__pyx_v_ptr[0]) == __pyx_v_19streaming_form_data_7_parser_c_lf); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_ptr[-1L]) == __pyx_v_19streaming_form_data_7_parser_c_cr); + __pyx_t_1 = __pyx_t_2; + __pyx_L8_bool_binop_done:; + if (__pyx_t_1) { + + /* "streaming_form_data/_parser.pyx":546 + * skipped = skipped - 1 + * elif ptr[0] == c_lf and ptr[-1] == c_cr: + * skipped = skipped - 2 # <<<<<<<<<<<<<< + * elif ( + * ptr[0] == c_hyphen + */ + __pyx_v_skipped = (__pyx_v_skipped - 2); + + /* "streaming_form_data/_parser.pyx":545 + * if ptr[0] == c_cr: + * skipped = skipped - 1 + * elif ptr[0] == c_lf and ptr[-1] == c_cr: # <<<<<<<<<<<<<< + * skipped = skipped - 2 + * elif ( + */ + goto __pyx_L7; + } + + /* "streaming_form_data/_parser.pyx":548 + * skipped = skipped - 2 + * elif ( + * ptr[0] == c_hyphen # <<<<<<<<<<<<<< + * and ptr[-1] == c_lf + * and ptr[-2] == c_cr + */ + __pyx_t_2 = ((__pyx_v_ptr[0]) == __pyx_v_19streaming_form_data_7_parser_c_hyphen); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L10_bool_binop_done; + } + + /* "streaming_form_data/_parser.pyx":549 + * elif ( + * ptr[0] == c_hyphen + * and ptr[-1] == c_lf # <<<<<<<<<<<<<< + * and ptr[-2] == c_cr + * ): + */ + __pyx_t_2 = ((__pyx_v_ptr[-1L]) == __pyx_v_19streaming_form_data_7_parser_c_lf); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L10_bool_binop_done; + } + + /* "streaming_form_data/_parser.pyx":550 + * ptr[0] == c_hyphen + * and ptr[-1] == c_lf + * and ptr[-2] == c_cr # <<<<<<<<<<<<<< + * ): + * skipped = skipped - 3 + */ + __pyx_t_2 = ((__pyx_v_ptr[-2L]) == __pyx_v_19streaming_form_data_7_parser_c_cr); + __pyx_t_1 = __pyx_t_2; + __pyx_L10_bool_binop_done:; + + /* "streaming_form_data/_parser.pyx":547 + * elif ptr[0] == c_lf and ptr[-1] == c_cr: + * skipped = skipped - 2 + * elif ( # <<<<<<<<<<<<<< + * ptr[0] == c_hyphen + * and ptr[-1] == c_lf + */ + if (__pyx_t_1) { + + /* "streaming_form_data/_parser.pyx":552 + * and ptr[-2] == c_cr + * ): + * skipped = skipped - 3 # <<<<<<<<<<<<<< + * break + * + */ + __pyx_v_skipped = (__pyx_v_skipped - 3); + + /* "streaming_form_data/_parser.pyx":547 + * elif ptr[0] == c_lf and ptr[-1] == c_cr: + * skipped = skipped - 2 + * elif ( # <<<<<<<<<<<<<< + * ptr[0] == c_hyphen + * and ptr[-1] == c_lf + */ + } + __pyx_L7:; + + /* "streaming_form_data/_parser.pyx":553 + * ): + * skipped = skipped - 3 + * break # <<<<<<<<<<<<<< + * + * if ptr[0] != c_hyphen: + */ + goto __pyx_L5_break; + + /* "streaming_form_data/_parser.pyx":533 + * + * while True: + * if ptr >= ptr_end: # <<<<<<<<<<<<<< + * # normalize pointer value because we could jump few characters + * # past the buffer end + */ + } + + /* "streaming_form_data/_parser.pyx":555 + * break + * + * if ptr[0] != c_hyphen: # <<<<<<<<<<<<<< + * ptr += 2 + * else: + */ + __pyx_t_1 = ((__pyx_v_ptr[0]) != __pyx_v_19streaming_form_data_7_parser_c_hyphen); + if (__pyx_t_1) { + + /* "streaming_form_data/_parser.pyx":556 + * + * if ptr[0] != c_hyphen: + * ptr += 2 # <<<<<<<<<<<<<< + * else: + * if ptr[-1] != c_hyphen: + */ + __pyx_v_ptr = (__pyx_v_ptr + 2); + + /* "streaming_form_data/_parser.pyx":555 + * break + * + * if ptr[0] != c_hyphen: # <<<<<<<<<<<<<< + * ptr += 2 + * else: + */ + goto __pyx_L13; + } + + /* "streaming_form_data/_parser.pyx":558 + * ptr += 2 + * else: + * if ptr[-1] != c_hyphen: # <<<<<<<<<<<<<< + * ptr += 1 + * else: + */ + /*else*/ { + __pyx_t_1 = ((__pyx_v_ptr[-1L]) != __pyx_v_19streaming_form_data_7_parser_c_hyphen); + if (__pyx_t_1) { + + /* "streaming_form_data/_parser.pyx":559 + * else: + * if ptr[-1] != c_hyphen: + * ptr += 1 # <<<<<<<<<<<<<< + * else: + * if ptr[-2] == c_lf and ptr[-3] == c_cr: + */ + __pyx_v_ptr = (__pyx_v_ptr + 1); + + /* "streaming_form_data/_parser.pyx":558 + * ptr += 2 + * else: + * if ptr[-1] != c_hyphen: # <<<<<<<<<<<<<< + * ptr += 1 + * else: + */ + goto __pyx_L14; + } + + /* "streaming_form_data/_parser.pyx":561 + * ptr += 1 + * else: + * if ptr[-2] == c_lf and ptr[-3] == c_cr: # <<<<<<<<<<<<<< + * self.delimiter_finder.reset() + * self.delimiter_finder.feed(c_cr) + */ + /*else*/ { + __pyx_t_2 = ((__pyx_v_ptr[-2L]) == __pyx_v_19streaming_form_data_7_parser_c_lf); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_ptr[-3L]) == __pyx_v_19streaming_form_data_7_parser_c_cr); + __pyx_t_1 = __pyx_t_2; + __pyx_L16_bool_binop_done:; + if (__pyx_t_1) { + + /* "streaming_form_data/_parser.pyx":562 + * else: + * if ptr[-2] == c_lf and ptr[-3] == c_cr: + * self.delimiter_finder.reset() # <<<<<<<<<<<<<< + * self.delimiter_finder.feed(c_cr) + * self.delimiter_finder.feed(c_lf) + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->reset(__pyx_v_self->delimiter_finder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "streaming_form_data/_parser.pyx":563 + * if ptr[-2] == c_lf and ptr[-3] == c_cr: + * self.delimiter_finder.reset() + * self.delimiter_finder.feed(c_cr) # <<<<<<<<<<<<<< + * self.delimiter_finder.feed(c_lf) + * self.delimiter_finder.feed(c_hyphen) + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->feed(__pyx_v_self->delimiter_finder, __pyx_v_19streaming_form_data_7_parser_c_cr, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "streaming_form_data/_parser.pyx":564 + * self.delimiter_finder.reset() + * self.delimiter_finder.feed(c_cr) + * self.delimiter_finder.feed(c_lf) # <<<<<<<<<<<<<< + * self.delimiter_finder.feed(c_hyphen) + * self.delimiter_finder.feed(c_hyphen) + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->feed(__pyx_v_self->delimiter_finder, __pyx_v_19streaming_form_data_7_parser_c_lf, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "streaming_form_data/_parser.pyx":565 + * self.delimiter_finder.feed(c_cr) + * self.delimiter_finder.feed(c_lf) + * self.delimiter_finder.feed(c_hyphen) # <<<<<<<<<<<<<< + * self.delimiter_finder.feed(c_hyphen) + * + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->feed(__pyx_v_self->delimiter_finder, __pyx_v_19streaming_form_data_7_parser_c_hyphen, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "streaming_form_data/_parser.pyx":566 + * self.delimiter_finder.feed(c_lf) + * self.delimiter_finder.feed(c_hyphen) + * self.delimiter_finder.feed(c_hyphen) # <<<<<<<<<<<<<< + * + * self.ender_finder.reset() + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->delimiter_finder->__pyx_vtab)->feed(__pyx_v_self->delimiter_finder, __pyx_v_19streaming_form_data_7_parser_c_hyphen, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "streaming_form_data/_parser.pyx":568 + * self.delimiter_finder.feed(c_hyphen) + * + * self.ender_finder.reset() # <<<<<<<<<<<<<< + * self.ender_finder.feed(c_cr) + * self.ender_finder.feed(c_lf) + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->reset(__pyx_v_self->ender_finder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "streaming_form_data/_parser.pyx":569 + * + * self.ender_finder.reset() + * self.ender_finder.feed(c_cr) # <<<<<<<<<<<<<< + * self.ender_finder.feed(c_lf) + * self.ender_finder.feed(c_hyphen) + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->feed(__pyx_v_self->ender_finder, __pyx_v_19streaming_form_data_7_parser_c_cr, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "streaming_form_data/_parser.pyx":570 + * self.ender_finder.reset() + * self.ender_finder.feed(c_cr) + * self.ender_finder.feed(c_lf) # <<<<<<<<<<<<<< + * self.ender_finder.feed(c_hyphen) + * self.ender_finder.feed(c_hyphen) + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->feed(__pyx_v_self->ender_finder, __pyx_v_19streaming_form_data_7_parser_c_lf, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "streaming_form_data/_parser.pyx":571 + * self.ender_finder.feed(c_cr) + * self.ender_finder.feed(c_lf) + * self.ender_finder.feed(c_hyphen) # <<<<<<<<<<<<<< + * self.ender_finder.feed(c_hyphen) + * + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->feed(__pyx_v_self->ender_finder, __pyx_v_19streaming_form_data_7_parser_c_hyphen, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "streaming_form_data/_parser.pyx":572 + * self.ender_finder.feed(c_lf) + * self.ender_finder.feed(c_hyphen) + * self.ender_finder.feed(c_hyphen) # <<<<<<<<<<<<<< + * + * skipped = (ptr - chunk_ptr) - pos_first + 1 + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder *)__pyx_v_self->ender_finder->__pyx_vtab)->feed(__pyx_v_self->ender_finder, __pyx_v_19streaming_form_data_7_parser_c_hyphen, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "streaming_form_data/_parser.pyx":574 + * self.ender_finder.feed(c_hyphen) + * + * skipped = (ptr - chunk_ptr) - pos_first + 1 # <<<<<<<<<<<<<< + * + * break + */ + __pyx_v_skipped = (((__pyx_v_ptr - __pyx_v_chunk_ptr) - __pyx_v_pos_first) + 1); + + /* "streaming_form_data/_parser.pyx":576 + * skipped = (ptr - chunk_ptr) - pos_first + 1 + * + * break # <<<<<<<<<<<<<< + * ptr += 4 + * + */ + goto __pyx_L5_break; + + /* "streaming_form_data/_parser.pyx":561 + * ptr += 1 + * else: + * if ptr[-2] == c_lf and ptr[-3] == c_cr: # <<<<<<<<<<<<<< + * self.delimiter_finder.reset() + * self.delimiter_finder.feed(c_cr) + */ + } + + /* "streaming_form_data/_parser.pyx":577 + * + * break + * ptr += 4 # <<<<<<<<<<<<<< + * + * return skipped + */ + __pyx_v_ptr = (__pyx_v_ptr + 4); + } + __pyx_L14:; + } + __pyx_L13:; + } + __pyx_L5_break:; + + /* "streaming_form_data/_parser.pyx":579 + * ptr += 4 + * + * return skipped # <<<<<<<<<<<<<< + * + * cdef mark_error(self): + */ + __pyx_r = __pyx_v_skipped; + goto __pyx_L0; + + /* "streaming_form_data/_parser.pyx":510 + * # update Finder object states. + * + * cdef size_t rewind_fast_forward( # <<<<<<<<<<<<<< + * self, const Byte *chunk_ptr, size_t pos_first, size_t pos_last + * ): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.rewind_fast_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "streaming_form_data/_parser.pyx":581 + * return skipped + * + * cdef mark_error(self): # <<<<<<<<<<<<<< + * self.state = ParserState.PS_ERROR + * + */ + +static PyObject *__pyx_f_19streaming_form_data_7_parser_7_Parser_mark_error(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("mark_error", 1); + + /* "streaming_form_data/_parser.pyx":582 + * + * cdef mark_error(self): + * self.state = ParserState.PS_ERROR # <<<<<<<<<<<<<< + * + * if self.active_part: + */ + __pyx_v_self->state = __pyx_e_19streaming_form_data_7_parser_PS_ERROR; + + /* "streaming_form_data/_parser.pyx":584 + * self.state = ParserState.PS_ERROR + * + * if self.active_part: # <<<<<<<<<<<<<< + * self.active_part.finish() + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->active_part); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 584, __pyx_L1_error) + if (__pyx_t_1) { + + /* "streaming_form_data/_parser.pyx":585 + * + * if self.active_part: + * self.active_part.finish() # <<<<<<<<<<<<<< + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->active_part, __pyx_n_s_finish); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "streaming_form_data/_parser.pyx":584 + * self.state = ParserState.PS_ERROR + * + * if self.active_part: # <<<<<<<<<<<<<< + * self.active_part.finish() + */ + } + + /* "streaming_form_data/_parser.pyx":581 + * return skipped + * + * cdef mark_error(self): # <<<<<<<<<<<<<< + * self.state = ParserState.PS_ERROR + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.mark_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "streaming_form_data/_parser.pyx":194 + * + * cdef bint strict + * cdef public str unexpected_part_name # <<<<<<<<<<<<<< + * + * def __init__(self, bytes delimiter, bytes ender, bint strict): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name___get__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name___get__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 1); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->unexpected_part_name); + __pyx_r = __pyx_v_self->unexpected_part_name; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_2__set__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_2__set__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 1); + if (!(likely(PyUnicode_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_value))) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_1 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->unexpected_part_name); + __Pyx_DECREF(__pyx_v_self->unexpected_part_name); + __pyx_v_self->unexpected_part_name = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.unexpected_part_name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_4__del__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_4__del__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 1); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->unexpected_part_name); + __Pyx_DECREF(__pyx_v_self->unexpected_part_name); + __pyx_v_self->unexpected_part_name = ((PyObject*)Py_None); + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_27__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_27__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_27__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_27__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_26__reduce_cython__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_26__reduce_cython__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 1); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self._leftover_buffer, self.active_part, self.default_part, self.delimiter_finder, self.delimiter_length, self.ender_finder, self.ender_length, self.expected_parts, self.state, self.strict, self.unexpected_part_name) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + */ + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->delimiter_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->ender_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_From_enum____pyx_t_19streaming_form_data_7_parser_ParserState(__pyx_v_self->state); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->strict); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(11); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_self->_leftover_buffer); + __Pyx_GIVEREF(__pyx_v_self->_leftover_buffer); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self->_leftover_buffer)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->active_part); + __Pyx_GIVEREF(__pyx_v_self->active_part); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_self->active_part)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->default_part); + __Pyx_GIVEREF(__pyx_v_self->default_part); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_self->default_part)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_self->delimiter_finder); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->delimiter_finder); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_self->delimiter_finder))) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_self->ender_finder); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->ender_finder); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 5, ((PyObject *)__pyx_v_self->ender_finder))) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->expected_parts); + __Pyx_GIVEREF(__pyx_v_self->expected_parts); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 7, __pyx_v_self->expected_parts)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 8, __pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 9, __pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->unexpected_part_name); + __Pyx_GIVEREF(__pyx_v_self->unexpected_part_name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 10, __pyx_v_self->unexpected_part_name)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_v_state = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self._leftover_buffer, self.active_part, self.default_part, self.delimiter_finder, self.delimiter_length, self.ender_finder, self.ender_length, self.expected_parts, self.state, self.strict, self.unexpected_part_name) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) + */ + __pyx_t_5 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v__dict = __pyx_t_5; + __pyx_t_5 = 0; + + /* "(tree fragment)":7 + * state = (self._leftover_buffer, self.active_part, self.default_part, self.delimiter_finder, self.delimiter_length, self.ender_finder, self.ender_length, self.expected_parts, self.state, self.strict, self.unexpected_part_name) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True + */ + __pyx_t_6 = (__pyx_v__dict != Py_None); + if (__pyx_t_6) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v__dict)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self._leftover_buffer is not None or self.active_part is not None or self.default_part is not None or self.delimiter_finder is not None or self.ender_finder is not None or self.expected_parts is not None or self.unexpected_part_name is not None + */ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self._leftover_buffer, self.active_part, self.default_part, self.delimiter_finder, self.delimiter_length, self.ender_finder, self.ender_length, self.expected_parts, self.state, self.strict, self.unexpected_part_name) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True + */ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = self._leftover_buffer is not None or self.active_part is not None or self.default_part is not None or self.delimiter_finder is not None or self.ender_finder is not None or self.expected_parts is not None or self.unexpected_part_name is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle__Parser, (type(self), 0x428af85, None), state + */ + /*else*/ { + __pyx_t_7 = (__pyx_v_self->_leftover_buffer != ((PyObject*)Py_None)); + if (!__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_7 = (__pyx_v_self->active_part != Py_None); + if (!__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_7 = (__pyx_v_self->default_part != Py_None); + if (!__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_7 = (((PyObject *)__pyx_v_self->delimiter_finder) != Py_None); + if (!__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_7 = (((PyObject *)__pyx_v_self->ender_finder) != Py_None); + if (!__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_7 = (__pyx_v_self->expected_parts != Py_None); + if (!__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_7 = (__pyx_v_self->unexpected_part_name != ((PyObject*)Py_None)); + __pyx_t_6 = __pyx_t_7; + __pyx_L4_bool_binop_done:; + __pyx_v_use_setstate = __pyx_t_6; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = self._leftover_buffer is not None or self.active_part is not None or self.default_part is not None or self.delimiter_finder is not None or self.ender_finder is not None or self.expected_parts is not None or self.unexpected_part_name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle__Parser, (type(self), 0x428af85, None), state + * else: + */ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = self._leftover_buffer is not None or self.active_part is not None or self.default_part is not None or self.delimiter_finder is not None or self.ender_finder is not None or self.expected_parts is not None or self.unexpected_part_name is not None + * if use_setstate: + * return __pyx_unpickle__Parser, (type(self), 0x428af85, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle__Parser); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_69775237); + __Pyx_GIVEREF(__pyx_int_69775237); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_69775237)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = self._leftover_buffer is not None or self.active_part is not None or self.default_part is not None or self.delimiter_finder is not None or self.ender_finder is not None or self.expected_parts is not None or self.unexpected_part_name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle__Parser, (type(self), 0x428af85, None), state + * else: + */ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle__Parser, (type(self), 0x428af85, None), state + * else: + * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle__Parser__set_state(self, __pyx_state) + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle__Parser); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_69775237); + __Pyx_GIVEREF(__pyx_int_69775237); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_69775237)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle__Parser__set_state(self, __pyx_state) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_29__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7_Parser_29__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_29__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7_Parser_29__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser._Parser.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_7_Parser_28__setstate_cython__(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser_7_Parser_28__setstate_cython__(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 1); + + /* "(tree fragment)":17 + * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle__Parser__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_f_19streaming_form_data_7_parser___pyx_unpickle__Parser__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle__Parser__set_state(self, __pyx_state) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("streaming_form_data._parser._Parser.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __pyx_unpickle_Finder(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_1__pyx_unpickle_Finder(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_1__pyx_unpickle_Finder = {"__pyx_unpickle_Finder", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_1__pyx_unpickle_Finder, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_1__pyx_unpickle_Finder(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_Finder (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Finder", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Finder", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Finder") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __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) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Finder", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Finder", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser___pyx_unpickle_Finder(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser___pyx_unpickle_Finder(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Finder", 1); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x0855a7d, 0x0c6065b, 0x0cd0b9a): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum + */ + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__13, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x0855a7d, 0x0c6065b, 0x0cd0b9a): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum + * __pyx_result = Finder.__new__(__pyx_type) + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x0855a7d, 0x0c6065b, 0x0cd0b9a): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = Finder.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x0855a7d, 0x0c6065b, 0x0cd0b9a): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum + */ + } + + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum + * __pyx_result = Finder.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum + * __pyx_result = Finder.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { + + /* "(tree fragment)":9 + * __pyx_result = Finder.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_f_19streaming_form_data_7_parser___pyx_unpickle_Finder__set_state(((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum + * __pyx_result = Finder.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): + * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":1 + * def __pyx_unpickle_Finder(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Finder", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): + */ + +static PyObject *__pyx_f_19streaming_form_data_7_parser___pyx_unpickle_Finder__set_state(struct __pyx_obj_19streaming_form_data_7_parser_Finder *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + enum __pyx_t_19streaming_form_data_7_parser_FinderState __pyx_t_3; + __pyx_t_19streaming_form_data_7_parser_Byte const *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Finder__set_state", 1); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): + * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[5]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __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) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v___pyx_result->index = __pyx_t_2; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((enum __pyx_t_19streaming_form_data_7_parser_FinderState)__Pyx_PyInt_As_enum____pyx_t_19streaming_form_data_7_parser_FinderState(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v___pyx_result->state = __pyx_t_3; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->target); + __Pyx_DECREF(__pyx_v___pyx_result->target); + __pyx_v___pyx_result->target = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v___pyx_result->target_len = __pyx_t_2; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_AsUString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->target_ptr = __pyx_t_4; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): + * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[5]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_6 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_7 = (__pyx_t_6 > 5); + if (__pyx_t_7) { + } else { + __pyx_t_5 = __pyx_t_7; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_7 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_5 = __pyx_t_7; + __pyx_L4_bool_binop_done:; + if (__pyx_t_5) { + + /* "(tree fragment)":14 + * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[5]) # <<<<<<<<<<<<<< + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_11 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): + * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[5]) + */ + } + + /* "(tree fragment)":11 + * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Finder__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __pyx_unpickle_Part(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_3__pyx_unpickle_Part(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_3__pyx_unpickle_Part = {"__pyx_unpickle_Part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_3__pyx_unpickle_Part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_3__pyx_unpickle_Part(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_Part (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Part", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Part", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Part") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __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) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Part", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_2__pyx_unpickle_Part(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser_2__pyx_unpickle_Part(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Part", 1); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + */ + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__14, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + * __pyx_result = Part.__new__(__pyx_type) + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = Part.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_3, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + */ + } + + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + * __pyx_result = Part.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + * __pyx_result = Part.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { + + /* "(tree fragment)":9 + * __pyx_result = Part.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_f_19streaming_form_data_7_parser___pyx_unpickle_Part__set_state(((struct __pyx_obj_19streaming_form_data_7_parser_Part *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + * __pyx_result = Part.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":1 + * def __pyx_unpickle_Part(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Part", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + */ + +static PyObject *__pyx_f_19streaming_form_data_7_parser___pyx_unpickle_Part__set_state(struct __pyx_obj_19streaming_form_data_7_parser_Part *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Part__set_state", 1); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[2]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __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) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->targets); + __Pyx_DECREF(__pyx_v___pyx_result->targets); + __pyx_v___pyx_result->targets = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[2]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 > 2); + if (__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __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) + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":14 + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[2]) # <<<<<<<<<<<<<< + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[2]) + */ + } + + /* "(tree fragment)":11 + * __pyx_unpickle_Part__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Part__set_state(Part __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_Part__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __pyx_unpickle_AsyncPart(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_5__pyx_unpickle_AsyncPart(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_5__pyx_unpickle_AsyncPart = {"__pyx_unpickle_AsyncPart", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_5__pyx_unpickle_AsyncPart, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_5__pyx_unpickle_AsyncPart(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_AsyncPart (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_AsyncPart", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_AsyncPart", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_AsyncPart") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __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) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_AsyncPart", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_AsyncPart", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_4__pyx_unpickle_AsyncPart(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser_4__pyx_unpickle_AsyncPart(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_AsyncPart", 1); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + */ + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__14, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + * __pyx_result = AsyncPart.__new__(__pyx_type) + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = AsyncPart.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_3, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x73c2615, 0x0c26682, 0xec97593): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + */ + } + + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + * __pyx_result = AsyncPart.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_AsyncPart__set_state( __pyx_result, __pyx_state) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_AsyncPart), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + * __pyx_result = AsyncPart.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_AsyncPart__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { + + /* "(tree fragment)":9 + * __pyx_result = AsyncPart.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_AsyncPart__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_AsyncPart__set_state(AsyncPart __pyx_result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_f_19streaming_form_data_7_parser___pyx_unpickle_AsyncPart__set_state(((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x73c2615, 0x0c26682, 0xec97593) = (name, targets))" % __pyx_checksum + * __pyx_result = AsyncPart.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_AsyncPart__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_AsyncPart__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_AsyncPart__set_state(AsyncPart __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":1 + * def __pyx_unpickle_AsyncPart(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_AsyncPart", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_AsyncPart__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_AsyncPart__set_state(AsyncPart __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + */ + +static PyObject *__pyx_f_19streaming_form_data_7_parser___pyx_unpickle_AsyncPart__set_state(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_AsyncPart__set_state", 1); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_AsyncPart__set_state(AsyncPart __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[2]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __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) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->targets); + __Pyx_DECREF(__pyx_v___pyx_result->targets); + __pyx_v___pyx_result->targets = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_AsyncPart__set_state(AsyncPart __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[2]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 > 2); + if (__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __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) + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":14 + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[2]) # <<<<<<<<<<<<<< + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_AsyncPart__set_state(AsyncPart __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[2]) + */ + } + + /* "(tree fragment)":11 + * __pyx_unpickle_AsyncPart__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_AsyncPart__set_state(AsyncPart __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle_AsyncPart__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __pyx_unpickle__Parser(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7__pyx_unpickle__Parser(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_19streaming_form_data_7_parser_7__pyx_unpickle__Parser = {"__pyx_unpickle__Parser", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7__pyx_unpickle__Parser, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19streaming_form_data_7_parser_7__pyx_unpickle__Parser(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle__Parser (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Parser", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Parser", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle__Parser") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __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) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Parser", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle__Parser", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19streaming_form_data_7_parser_6__pyx_unpickle__Parser(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19streaming_form_data_7_parser_6__pyx_unpickle__Parser(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle__Parser", 1); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x428af85, 0xaf18744, 0x7bae3b8): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum + */ + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__15, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x428af85, 0xaf18744, 0x7bae3b8): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum + * __pyx_result = _Parser.__new__(__pyx_type) + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x428af85, 0xaf18744, 0x7bae3b8): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = _Parser.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x428af85, 0xaf18744, 0x7bae3b8): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum + */ + } + + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum + * __pyx_result = _Parser.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum + * __pyx_result = _Parser.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) + * return __pyx_result + */ + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { + + /* "(tree fragment)":9 + * __pyx_result = _Parser.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_f_19streaming_form_data_7_parser___pyx_unpickle__Parser__set_state(((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x428af85, 0xaf18744, 0x7bae3b8) = (_leftover_buffer, active_part, default_part, delimiter_finder, delimiter_length, ender_finder, ender_length, expected_parts, state, strict, unexpected_part_name))" % __pyx_checksum + * __pyx_result = _Parser.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) + * return __pyx_result + */ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): + * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":1 + * def __pyx_unpickle__Parser(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle__Parser", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] + * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): + */ + +static PyObject *__pyx_f_19streaming_form_data_7_parser___pyx_unpickle__Parser__set_state(struct __pyx_obj_19streaming_form_data_7_parser__Parser *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + enum __pyx_t_19streaming_form_data_7_parser_ParserState __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle__Parser__set_state", 1); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): + * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[11]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __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) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->_leftover_buffer); + __Pyx_DECREF(__pyx_v___pyx_result->_leftover_buffer); + __pyx_v___pyx_result->_leftover_buffer = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->active_part); + __Pyx_DECREF(__pyx_v___pyx_result->active_part); + __pyx_v___pyx_result->active_part = __pyx_t_1; + __pyx_t_1 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->default_part); + __Pyx_DECREF(__pyx_v___pyx_result->default_part); + __pyx_v___pyx_result->default_part = __pyx_t_1; + __pyx_t_1 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19streaming_form_data_7_parser_Finder))))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->delimiter_finder); + __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->delimiter_finder); + __pyx_v___pyx_result->delimiter_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)__pyx_t_1); + __pyx_t_1 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v___pyx_result->delimiter_length = __pyx_t_2; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19streaming_form_data_7_parser_Finder))))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->ender_finder); + __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->ender_finder); + __pyx_v___pyx_result->ender_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)__pyx_t_1); + __pyx_t_1 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v___pyx_result->ender_length = __pyx_t_2; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->expected_parts); + __Pyx_DECREF(__pyx_v___pyx_result->expected_parts); + __pyx_v___pyx_result->expected_parts = __pyx_t_1; + __pyx_t_1 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((enum __pyx_t_19streaming_form_data_7_parser_ParserState)__Pyx_PyInt_As_enum____pyx_t_19streaming_form_data_7_parser_ParserState(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v___pyx_result->state = __pyx_t_3; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v___pyx_result->strict = __pyx_t_4; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->unexpected_part_name); + __Pyx_DECREF(__pyx_v___pyx_result->unexpected_part_name); + __pyx_v___pyx_result->unexpected_part_name = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): + * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] + * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[11]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_6 = (__pyx_t_5 > 11); + if (__pyx_t_6) { + } else { + __pyx_t_4 = __pyx_t_6; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_6 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_4 = __pyx_t_6; + __pyx_L4_bool_binop_done:; + if (__pyx_t_4) { + + /* "(tree fragment)":14 + * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] + * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[11]) # <<<<<<<<<<<<<< + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): + * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] + * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[11]) + */ + } + + /* "(tree fragment)":11 + * __pyx_unpickle__Parser__set_state(<_Parser> __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle__Parser__set_state(_Parser __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result._leftover_buffer = __pyx_state[0]; __pyx_result.active_part = __pyx_state[1]; __pyx_result.default_part = __pyx_state[2]; __pyx_result.delimiter_finder = __pyx_state[3]; __pyx_result.delimiter_length = __pyx_state[4]; __pyx_result.ender_finder = __pyx_state[5]; __pyx_result.ender_length = __pyx_state[6]; __pyx_result.expected_parts = __pyx_state[7]; __pyx_result.state = __pyx_state[8]; __pyx_result.strict = __pyx_state[9]; __pyx_result.unexpected_part_name = __pyx_state[10] + * if len(__pyx_state) > 11 and hasattr(__pyx_result, '__dict__'): + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("streaming_form_data._parser.__pyx_unpickle__Parser__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_19streaming_form_data_7_parser_Finder __pyx_vtable_19streaming_form_data_7_parser_Finder; + +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser_Finder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_19streaming_form_data_7_parser_Finder *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)o); + p->__pyx_vtab = __pyx_vtabptr_19streaming_form_data_7_parser_Finder; + p->target = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19streaming_form_data_7_parser_Finder(PyObject *o) { + struct __pyx_obj_19streaming_form_data_7_parser_Finder *p = (struct __pyx_obj_19streaming_form_data_7_parser_Finder *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser_Finder) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + Py_CLEAR(p->target); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} + +static PyObject *__pyx_getprop_19streaming_form_data_7_parser_6Finder_target(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19streaming_form_data_7_parser_6Finder_6target_1__get__(o); +} + +static PyMethodDef __pyx_methods_19streaming_form_data_7_parser_Finder[] = { + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_6Finder_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_6Finder_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_19streaming_form_data_7_parser_Finder[] = { + {(char *)"target", __pyx_getprop_19streaming_form_data_7_parser_6Finder_target, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_19streaming_form_data_7_parser_Finder_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser_Finder}, + {Py_tp_methods, (void *)__pyx_methods_19streaming_form_data_7_parser_Finder}, + {Py_tp_getset, (void *)__pyx_getsets_19streaming_form_data_7_parser_Finder}, + {Py_tp_init, (void *)__pyx_pw_19streaming_form_data_7_parser_6Finder_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser_Finder}, + {0, 0}, +}; +static PyType_Spec __pyx_type_19streaming_form_data_7_parser_Finder_spec = { + "streaming_form_data._parser.Finder", + sizeof(struct __pyx_obj_19streaming_form_data_7_parser_Finder), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_19streaming_form_data_7_parser_Finder_slots, +}; +#else + +static PyTypeObject __pyx_type_19streaming_form_data_7_parser_Finder = { + PyVarObject_HEAD_INIT(0, 0) + "streaming_form_data._parser.""Finder", /*tp_name*/ + sizeof(struct __pyx_obj_19streaming_form_data_7_parser_Finder), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19streaming_form_data_7_parser_Finder, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19streaming_form_data_7_parser_Finder, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_19streaming_form_data_7_parser_Finder, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_19streaming_form_data_7_parser_6Finder_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19streaming_form_data_7_parser_Finder, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser_Part(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_19streaming_form_data_7_parser_Part *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_obj_19streaming_form_data_7_parser_Part *)o); + p->name = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->targets = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19streaming_form_data_7_parser_Part(PyObject *o) { + struct __pyx_obj_19streaming_form_data_7_parser_Part *p = (struct __pyx_obj_19streaming_form_data_7_parser_Part *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser_Part) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + Py_CLEAR(p->targets); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} + +static int __pyx_tp_traverse_19streaming_form_data_7_parser_Part(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19streaming_form_data_7_parser_Part *p = (struct __pyx_obj_19streaming_form_data_7_parser_Part *)o; + if (p->targets) { + e = (*v)(p->targets, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19streaming_form_data_7_parser_Part(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19streaming_form_data_7_parser_Part *p = (struct __pyx_obj_19streaming_form_data_7_parser_Part *)o; + tmp = ((PyObject*)p->targets); + p->targets = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_19streaming_form_data_7_parser_4Part_name(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19streaming_form_data_7_parser_4Part_4name_1__get__(o); +} + +static int __pyx_setprop_19streaming_form_data_7_parser_4Part_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_19streaming_form_data_7_parser_4Part_4name_3__set__(o, v); + } + else { + return __pyx_pw_19streaming_form_data_7_parser_4Part_4name_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_19streaming_form_data_7_parser_Part[] = { + {"add_target", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_3add_target, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"set_multipart_filename", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_5set_multipart_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"set_multipart_content_type", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_7set_multipart_content_type, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"start", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_9start, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"data_received", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_11data_received, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"finish", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_13finish, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_4Part_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_19streaming_form_data_7_parser_Part[] = { + {(char *)"name", __pyx_getprop_19streaming_form_data_7_parser_4Part_name, __pyx_setprop_19streaming_form_data_7_parser_4Part_name, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_19streaming_form_data_7_parser_Part_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser_Part}, + {Py_tp_doc, (void *)PyDoc_STR("One part of a multipart/form-data request\n ")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser_Part}, + {Py_tp_clear, (void *)__pyx_tp_clear_19streaming_form_data_7_parser_Part}, + {Py_tp_methods, (void *)__pyx_methods_19streaming_form_data_7_parser_Part}, + {Py_tp_getset, (void *)__pyx_getsets_19streaming_form_data_7_parser_Part}, + {Py_tp_init, (void *)__pyx_pw_19streaming_form_data_7_parser_4Part_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser_Part}, + {0, 0}, +}; +static PyType_Spec __pyx_type_19streaming_form_data_7_parser_Part_spec = { + "streaming_form_data._parser.Part", + sizeof(struct __pyx_obj_19streaming_form_data_7_parser_Part), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_19streaming_form_data_7_parser_Part_slots, +}; +#else + +static PyTypeObject __pyx_type_19streaming_form_data_7_parser_Part = { + PyVarObject_HEAD_INIT(0, 0) + "streaming_form_data._parser.""Part", /*tp_name*/ + sizeof(struct __pyx_obj_19streaming_form_data_7_parser_Part), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19streaming_form_data_7_parser_Part, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + PyDoc_STR("One part of a multipart/form-data request\n "), /*tp_doc*/ + __pyx_tp_traverse_19streaming_form_data_7_parser_Part, /*tp_traverse*/ + __pyx_tp_clear_19streaming_form_data_7_parser_Part, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19streaming_form_data_7_parser_Part, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_19streaming_form_data_7_parser_Part, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_19streaming_form_data_7_parser_4Part_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19streaming_form_data_7_parser_Part, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser_AsyncPart(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)o); + p->name = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->targets = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19streaming_form_data_7_parser_AsyncPart(PyObject *o) { + struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *p = (struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser_AsyncPart) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + Py_CLEAR(p->targets); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} + +static int __pyx_tp_traverse_19streaming_form_data_7_parser_AsyncPart(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *p = (struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)o; + if (p->targets) { + e = (*v)(p->targets, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19streaming_form_data_7_parser_AsyncPart(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *p = (struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart *)o; + tmp = ((PyObject*)p->targets); + p->targets = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_19streaming_form_data_7_parser_9AsyncPart_name(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19streaming_form_data_7_parser_9AsyncPart_4name_1__get__(o); +} + +static int __pyx_setprop_19streaming_form_data_7_parser_9AsyncPart_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_19streaming_form_data_7_parser_9AsyncPart_4name_3__set__(o, v); + } + else { + return __pyx_pw_19streaming_form_data_7_parser_9AsyncPart_4name_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_19streaming_form_data_7_parser_AsyncPart[] = { + {"add_target", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_3add_target, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"set_multipart_filename", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_5set_multipart_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"set_multipart_content_type", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_7set_multipart_content_type, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"start", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_9start, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"data_received", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_12data_received, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"finish", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_15finish, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_18__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_20__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_19streaming_form_data_7_parser_AsyncPart[] = { + {(char *)"name", __pyx_getprop_19streaming_form_data_7_parser_9AsyncPart_name, __pyx_setprop_19streaming_form_data_7_parser_9AsyncPart_name, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_19streaming_form_data_7_parser_AsyncPart_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser_AsyncPart}, + {Py_tp_doc, (void *)PyDoc_STR("One part of a multipart/form-data request\n ")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser_AsyncPart}, + {Py_tp_clear, (void *)__pyx_tp_clear_19streaming_form_data_7_parser_AsyncPart}, + {Py_tp_methods, (void *)__pyx_methods_19streaming_form_data_7_parser_AsyncPart}, + {Py_tp_getset, (void *)__pyx_getsets_19streaming_form_data_7_parser_AsyncPart}, + {Py_tp_init, (void *)__pyx_pw_19streaming_form_data_7_parser_9AsyncPart_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser_AsyncPart}, + {0, 0}, +}; +static PyType_Spec __pyx_type_19streaming_form_data_7_parser_AsyncPart_spec = { + "streaming_form_data._parser.AsyncPart", + sizeof(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_19streaming_form_data_7_parser_AsyncPart_slots, +}; +#else + +static PyTypeObject __pyx_type_19streaming_form_data_7_parser_AsyncPart = { + PyVarObject_HEAD_INIT(0, 0) + "streaming_form_data._parser.""AsyncPart", /*tp_name*/ + sizeof(struct __pyx_obj_19streaming_form_data_7_parser_AsyncPart), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19streaming_form_data_7_parser_AsyncPart, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + PyDoc_STR("One part of a multipart/form-data request\n "), /*tp_doc*/ + __pyx_tp_traverse_19streaming_form_data_7_parser_AsyncPart, /*tp_traverse*/ + __pyx_tp_clear_19streaming_form_data_7_parser_AsyncPart, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19streaming_form_data_7_parser_AsyncPart, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_19streaming_form_data_7_parser_AsyncPart, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_19streaming_form_data_7_parser_9AsyncPart_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19streaming_form_data_7_parser_AsyncPart, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct_19streaming_form_data_7_parser__Parser __pyx_vtable_19streaming_form_data_7_parser__Parser; + +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser__Parser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_19streaming_form_data_7_parser__Parser *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_obj_19streaming_form_data_7_parser__Parser *)o); + p->__pyx_vtab = __pyx_vtabptr_19streaming_form_data_7_parser__Parser; + p->delimiter_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)Py_None); Py_INCREF(Py_None); + p->ender_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)Py_None); Py_INCREF(Py_None); + p->expected_parts = Py_None; Py_INCREF(Py_None); + p->active_part = Py_None; Py_INCREF(Py_None); + p->default_part = Py_None; Py_INCREF(Py_None); + p->_leftover_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->unexpected_part_name = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19streaming_form_data_7_parser__Parser(PyObject *o) { + struct __pyx_obj_19streaming_form_data_7_parser__Parser *p = (struct __pyx_obj_19streaming_form_data_7_parser__Parser *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser__Parser) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->delimiter_finder); + Py_CLEAR(p->ender_finder); + Py_CLEAR(p->expected_parts); + Py_CLEAR(p->active_part); + Py_CLEAR(p->default_part); + Py_CLEAR(p->_leftover_buffer); + Py_CLEAR(p->unexpected_part_name); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} + +static int __pyx_tp_traverse_19streaming_form_data_7_parser__Parser(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19streaming_form_data_7_parser__Parser *p = (struct __pyx_obj_19streaming_form_data_7_parser__Parser *)o; + if (p->delimiter_finder) { + e = (*v)(((PyObject *)p->delimiter_finder), a); if (e) return e; + } + if (p->ender_finder) { + e = (*v)(((PyObject *)p->ender_finder), a); if (e) return e; + } + if (p->expected_parts) { + e = (*v)(p->expected_parts, a); if (e) return e; + } + if (p->active_part) { + e = (*v)(p->active_part, a); if (e) return e; + } + if (p->default_part) { + e = (*v)(p->default_part, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19streaming_form_data_7_parser__Parser(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19streaming_form_data_7_parser__Parser *p = (struct __pyx_obj_19streaming_form_data_7_parser__Parser *)o; + tmp = ((PyObject*)p->delimiter_finder); + p->delimiter_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->ender_finder); + p->ender_finder = ((struct __pyx_obj_19streaming_form_data_7_parser_Finder *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->expected_parts); + p->expected_parts = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->active_part); + p->active_part = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->default_part); + p->default_part = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_19streaming_form_data_7_parser_7_Parser_unexpected_part_name(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_1__get__(o); +} + +static int __pyx_setprop_19streaming_form_data_7_parser_7_Parser_unexpected_part_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_3__set__(o, v); + } + else { + return __pyx_pw_19streaming_form_data_7_parser_7_Parser_20unexpected_part_name_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_19streaming_form_data_7_parser__Parser[] = { + {"register", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_3register, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"set_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_5set_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"async_set_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_7async_set_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"unset_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_10unset_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"async_unset_active_part", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_12async_unset_active_part, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"on_body", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_15on_body, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"async_on_body", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_17async_on_body, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"data_received", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_20data_received, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"async_data_received", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_22async_data_received, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"_parse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_25_parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_27__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_19streaming_form_data_7_parser_7_Parser_29__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_19streaming_form_data_7_parser__Parser[] = { + {(char *)"unexpected_part_name", __pyx_getprop_19streaming_form_data_7_parser_7_Parser_unexpected_part_name, __pyx_setprop_19streaming_form_data_7_parser_7_Parser_unexpected_part_name, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_19streaming_form_data_7_parser__Parser_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser__Parser}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser__Parser}, + {Py_tp_clear, (void *)__pyx_tp_clear_19streaming_form_data_7_parser__Parser}, + {Py_tp_methods, (void *)__pyx_methods_19streaming_form_data_7_parser__Parser}, + {Py_tp_getset, (void *)__pyx_getsets_19streaming_form_data_7_parser__Parser}, + {Py_tp_init, (void *)__pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser__Parser}, + {0, 0}, +}; +static PyType_Spec __pyx_type_19streaming_form_data_7_parser__Parser_spec = { + "streaming_form_data._parser._Parser", + sizeof(struct __pyx_obj_19streaming_form_data_7_parser__Parser), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_19streaming_form_data_7_parser__Parser_slots, +}; +#else + +static PyTypeObject __pyx_type_19streaming_form_data_7_parser__Parser = { + PyVarObject_HEAD_INIT(0, 0) + "streaming_form_data._parser.""_Parser", /*tp_name*/ + sizeof(struct __pyx_obj_19streaming_form_data_7_parser__Parser), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19streaming_form_data_7_parser__Parser, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_19streaming_form_data_7_parser__Parser, /*tp_traverse*/ + __pyx_tp_clear_19streaming_form_data_7_parser__Parser, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19streaming_form_data_7_parser__Parser, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_19streaming_form_data_7_parser__Parser, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_19streaming_form_data_7_parser_7_Parser_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19streaming_form_data_7_parser__Parser, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start *__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct__start[8]; +static int __pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct__start = 0; + +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct__start(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + #if CYTHON_COMPILING_IN_CPYTHON + if (likely((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct__start > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start)))) { + o = (PyObject*)__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct__start[--__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct__start]; + memset(o, 0, sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else + #endif + { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + #endif + return o; +} + +static void __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct__start(PyObject *o) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct__start) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_target); + Py_CLEAR(p->__pyx_t_0); + #if CYTHON_COMPILING_IN_CPYTHON + if (((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct__start < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start)))) { + __pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct__start[__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct__start++] = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start *)o); + } else + #endif + { + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + } +} + +static int __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct__start(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_v_target) { + e = (*v)(p->__pyx_v_target, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct__start}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct__start}, + {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct__start}, + {0, 0}, +}; +static PyType_Spec __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start_spec = { + "streaming_form_data._parser.__pyx_scope_struct__start", + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start_slots, +}; +#else + +static PyTypeObject __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start = { + PyVarObject_HEAD_INIT(0, 0) + "streaming_form_data._parser.""__pyx_scope_struct__start", /*tp_name*/ + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct__start), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct__start, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct__start, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct__start, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received *__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received[8]; +static int __pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received = 0; + +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + #if CYTHON_COMPILING_IN_CPYTHON + if (likely((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received)))) { + o = (PyObject*)__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received[--__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received]; + memset(o, 0, sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else + #endif + { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + #endif + return o; +} + +static void __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received(PyObject *o) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_chunk); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_target); + Py_CLEAR(p->__pyx_t_0); + #if CYTHON_COMPILING_IN_CPYTHON + if (((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received)))) { + __pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received[__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received++] = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received *)o); + } else + #endif + { + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + } +} + +static int __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_v_target) { + e = (*v)(p->__pyx_v_target, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received}, + {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received}, + {0, 0}, +}; +static PyType_Spec __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received_spec = { + "streaming_form_data._parser.__pyx_scope_struct_1_data_received", + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received_slots, +}; +#else + +static PyTypeObject __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received = { + PyVarObject_HEAD_INIT(0, 0) + "streaming_form_data._parser.""__pyx_scope_struct_1_data_received", /*tp_name*/ + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish *__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_2_finish[8]; +static int __pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_2_finish = 0; + +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_2_finish(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + #if CYTHON_COMPILING_IN_CPYTHON + if (likely((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_2_finish > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish)))) { + o = (PyObject*)__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_2_finish[--__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_2_finish]; + memset(o, 0, sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else + #endif + { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + #endif + return o; +} + +static void __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_2_finish(PyObject *o) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_2_finish) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_target); + Py_CLEAR(p->__pyx_t_0); + #if CYTHON_COMPILING_IN_CPYTHON + if (((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_2_finish < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish)))) { + __pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_2_finish[__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_2_finish++] = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish *)o); + } else + #endif + { + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + } +} + +static int __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_2_finish(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_v_target) { + e = (*v)(p->__pyx_v_target, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_2_finish}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_2_finish}, + {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_2_finish}, + {0, 0}, +}; +static PyType_Spec __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish_spec = { + "streaming_form_data._parser.__pyx_scope_struct_2_finish", + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish_slots, +}; +#else + +static PyTypeObject __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish = { + PyVarObject_HEAD_INIT(0, 0) + "streaming_form_data._parser.""__pyx_scope_struct_2_finish", /*tp_name*/ + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_2_finish), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_2_finish, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_2_finish, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_2_finish, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part *__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part[8]; +static int __pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part = 0; + +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + #if CYTHON_COMPILING_IN_CPYTHON + if (likely((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part)))) { + o = (PyObject*)__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part[--__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part]; + memset(o, 0, sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else + #endif + { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + #endif + return o; +} + +static void __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part(PyObject *o) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_filename); + Py_CLEAR(p->__pyx_v_part); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_COMPILING_IN_CPYTHON + if (((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part)))) { + __pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part[__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part++] = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part *)o); + } else + #endif + { + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + } +} + +static int __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part *)o; + if (p->__pyx_v_part) { + e = (*v)(p->__pyx_v_part, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part}, + {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part}, + {0, 0}, +}; +static PyType_Spec __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part_spec = { + "streaming_form_data._parser.__pyx_scope_struct_3_async_set_active_part", + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part_slots, +}; +#else + +static PyTypeObject __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part = { + PyVarObject_HEAD_INIT(0, 0) + "streaming_form_data._parser.""__pyx_scope_struct_3_async_set_active_part", /*tp_name*/ + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part *__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part[8]; +static int __pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part = 0; + +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + #if CYTHON_COMPILING_IN_CPYTHON + if (likely((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part)))) { + o = (PyObject*)__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part[--__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part]; + memset(o, 0, sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else + #endif + { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + #endif + return o; +} + +static void __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part(PyObject *o) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_COMPILING_IN_CPYTHON + if (((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part)))) { + __pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part[__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part++] = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part *)o); + } else + #endif + { + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + } +} + +static int __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part}, + {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part}, + {0, 0}, +}; +static PyType_Spec __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part_spec = { + "streaming_form_data._parser.__pyx_scope_struct_4_async_unset_active_part", + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part_slots, +}; +#else + +static PyTypeObject __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part = { + PyVarObject_HEAD_INIT(0, 0) + "streaming_form_data._parser.""__pyx_scope_struct_4_async_unset_active_part", /*tp_name*/ + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body *__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body[8]; +static int __pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body = 0; + +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + #if CYTHON_COMPILING_IN_CPYTHON + if (likely((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body)))) { + o = (PyObject*)__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body[--__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body]; + memset(o, 0, sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else + #endif + { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + #endif + return o; +} + +static void __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body(PyObject *o) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_value); + #if CYTHON_COMPILING_IN_CPYTHON + if (((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body)))) { + __pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body[__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body++] = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body *)o); + } else + #endif + { + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + } +} + +static int __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body}, + {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body}, + {0, 0}, +}; +static PyType_Spec __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body_spec = { + "streaming_form_data._parser.__pyx_scope_struct_5_async_on_body", + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body_slots, +}; +#else + +static PyTypeObject __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body = { + PyVarObject_HEAD_INIT(0, 0) + "streaming_form_data._parser.""__pyx_scope_struct_5_async_on_body", /*tp_name*/ + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received *__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received[8]; +static int __pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received = 0; + +static PyObject *__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + #if CYTHON_COMPILING_IN_CPYTHON + if (likely((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received)))) { + o = (PyObject*)__pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received[--__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received]; + memset(o, 0, sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else + #endif + { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + #endif + return o; +} + +static void __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received(PyObject *o) { + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_chunk); + Py_CLEAR(p->__pyx_v_data); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_COMPILING_IN_CPYTHON + if (((int)(__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received)))) { + __pyx_freelist_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received[__pyx_freecount_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received++] = ((struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received *)o); + } else + #endif + { + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + } +} + +static int __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received *p = (struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received}, + {Py_tp_new, (void *)__pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received}, + {0, 0}, +}; +static PyType_Spec __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received_spec = { + "streaming_form_data._parser.__pyx_scope_struct_6_async_data_received", + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received_slots, +}; +#else + +static PyTypeObject __pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received = { + PyVarObject_HEAD_INIT(0, 0) + "streaming_form_data._parser.""__pyx_scope_struct_6_async_data_received", /*tp_name*/ + sizeof(struct __pyx_obj_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static int __pyx_tp_traverse___Pyx_EnumMeta(PyObject *o, visitproc v, void *a) { + int e; + if (!(&PyType_Type)->tp_traverse); else { e = (&PyType_Type)->tp_traverse(o,v,a); if (e) return e; } + return 0; +} + +static int __pyx_tp_clear___Pyx_EnumMeta(PyObject *o) { + if (!(&PyType_Type)->tp_clear); else (&PyType_Type)->tp_clear(o); + return 0; +} +static PyObject *__pyx_sq_item___Pyx_EnumMeta(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyMethodDef __pyx_methods___Pyx_EnumMeta[] = { + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __Pyx_EnumMeta_slots[] = { + {Py_sq_item, (void *)__pyx_sq_item___Pyx_EnumMeta}, + {Py_mp_subscript, (void *)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_5__getitem__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse___Pyx_EnumMeta}, + {Py_tp_clear, (void *)__pyx_tp_clear___Pyx_EnumMeta}, + {Py_tp_iter, (void *)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_3__iter__}, + {Py_tp_methods, (void *)__pyx_methods___Pyx_EnumMeta}, + {Py_tp_init, (void *)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_1__init__}, + {0, 0}, +}; +static PyType_Spec __Pyx_EnumMeta_spec = { + "streaming_form_data._parser.__Pyx_EnumMeta", + sizeof(struct __pyx_obj___Pyx_EnumMeta), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __Pyx_EnumMeta_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence___Pyx_EnumMeta = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item___Pyx_EnumMeta, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___Pyx_EnumMeta = { 0, /*mp_length*/ __pyx_pw_8EnumBase_14__Pyx_EnumMeta_5__getitem__, /*mp_subscript*/ 0, /*mp_ass_subscript*/ @@ -17841,6 +23524,15 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_n_s_AsyncPart, __pyx_k_AsyncPart, sizeof(__pyx_k_AsyncPart), 0, 0, 1, 1}, + {&__pyx_n_s_AsyncPart___reduce_cython, __pyx_k_AsyncPart___reduce_cython, sizeof(__pyx_k_AsyncPart___reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_AsyncPart___setstate_cython, __pyx_k_AsyncPart___setstate_cython, sizeof(__pyx_k_AsyncPart___setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_AsyncPart_add_target, __pyx_k_AsyncPart_add_target, sizeof(__pyx_k_AsyncPart_add_target), 0, 0, 1, 1}, + {&__pyx_n_s_AsyncPart_data_received, __pyx_k_AsyncPart_data_received, sizeof(__pyx_k_AsyncPart_data_received), 0, 0, 1, 1}, + {&__pyx_n_s_AsyncPart_finish, __pyx_k_AsyncPart_finish, sizeof(__pyx_k_AsyncPart_finish), 0, 0, 1, 1}, + {&__pyx_n_s_AsyncPart_set_multipart_content, __pyx_k_AsyncPart_set_multipart_content, sizeof(__pyx_k_AsyncPart_set_multipart_content), 0, 0, 1, 1}, + {&__pyx_n_s_AsyncPart_set_multipart_filename, __pyx_k_AsyncPart_set_multipart_filename, sizeof(__pyx_k_AsyncPart_set_multipart_filename), 0, 0, 1, 1}, + {&__pyx_n_s_AsyncPart_start, __pyx_k_AsyncPart_start, sizeof(__pyx_k_AsyncPart_start), 0, 0, 1, 1}, {&__pyx_n_s_Delimiting, __pyx_k_Delimiting, sizeof(__pyx_k_Delimiting), 0, 0, 1, 1}, {&__pyx_kp_u_Empty_values_not_allowed, __pyx_k_Empty_values_not_allowed, sizeof(__pyx_k_Empty_values_not_allowed), 0, 1, 0, 0}, {&__pyx_n_s_EnumBase, __pyx_k_EnumBase, sizeof(__pyx_k_EnumBase), 0, 0, 1, 1}, @@ -17868,6 +23560,10 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_Parser___reduce_cython, __pyx_k_Parser___reduce_cython, sizeof(__pyx_k_Parser___reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_Parser___setstate_cython, __pyx_k_Parser___setstate_cython, sizeof(__pyx_k_Parser___setstate_cython), 0, 0, 1, 1}, {&__pyx_n_s_Parser__parse, __pyx_k_Parser__parse, sizeof(__pyx_k_Parser__parse), 0, 0, 1, 1}, + {&__pyx_n_s_Parser_async_data_received, __pyx_k_Parser_async_data_received, sizeof(__pyx_k_Parser_async_data_received), 0, 0, 1, 1}, + {&__pyx_n_s_Parser_async_on_body, __pyx_k_Parser_async_on_body, sizeof(__pyx_k_Parser_async_on_body), 0, 0, 1, 1}, + {&__pyx_n_s_Parser_async_set_active_part, __pyx_k_Parser_async_set_active_part, sizeof(__pyx_k_Parser_async_set_active_part), 0, 0, 1, 1}, + {&__pyx_n_s_Parser_async_unset_active_part, __pyx_k_Parser_async_unset_active_part, sizeof(__pyx_k_Parser_async_unset_active_part), 0, 0, 1, 1}, {&__pyx_n_s_Parser_data_received, __pyx_k_Parser_data_received, sizeof(__pyx_k_Parser_data_received), 0, 0, 1, 1}, {&__pyx_n_s_Parser_on_body, __pyx_k_Parser_on_body, sizeof(__pyx_k_Parser_on_body), 0, 0, 1, 1}, {&__pyx_n_s_Parser_register, __pyx_k_Parser_register, sizeof(__pyx_k_Parser_register), 0, 0, 1, 1}, @@ -17897,13 +23593,19 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_UnexpectedPart, __pyx_k_UnexpectedPart, sizeof(__pyx_k_UnexpectedPart), 0, 0, 1, 1}, {&__pyx_kp_s_Unknown_enum_value_s, __pyx_k_Unknown_enum_value_s, sizeof(__pyx_k_Unknown_enum_value_s), 0, 0, 1, 0}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_kp_b__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 0, 0, 0}, {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0}, - {&__pyx_kp_b__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 0, 0}, - {&__pyx_n_s__58, __pyx_k__58, sizeof(__pyx_k__58), 0, 0, 1, 1}, + {&__pyx_n_s__71, __pyx_k__71, sizeof(__pyx_k__71), 0, 0, 1, 1}, {&__pyx_n_s_active, __pyx_k_active, sizeof(__pyx_k_active), 0, 0, 1, 1}, {&__pyx_n_s_add_target, __pyx_k_add_target, sizeof(__pyx_k_add_target), 0, 0, 1, 1}, {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, + {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, + {&__pyx_n_s_async_data_received, __pyx_k_async_data_received, sizeof(__pyx_k_async_data_received), 0, 0, 1, 1}, + {&__pyx_n_s_async_on_body, __pyx_k_async_on_body, sizeof(__pyx_k_async_on_body), 0, 0, 1, 1}, + {&__pyx_n_s_async_set_active_part, __pyx_k_async_set_active_part, sizeof(__pyx_k_async_set_active_part), 0, 0, 1, 1}, + {&__pyx_n_s_async_unset_active_part, __pyx_k_async_unset_active_part, sizeof(__pyx_k_async_unset_active_part), 0, 0, 1, 1}, {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_await, __pyx_k_await, sizeof(__pyx_k_await), 0, 0, 1, 1}, {&__pyx_n_s_buffer_start, __pyx_k_buffer_start, sizeof(__pyx_k_buffer_start), 0, 0, 1, 1}, {&__pyx_n_s_byte, __pyx_k_byte, sizeof(__pyx_k_byte), 0, 0, 1, 1}, {&__pyx_n_s_chunk, __pyx_k_chunk, sizeof(__pyx_k_chunk), 0, 0, 1, 1}, @@ -17912,6 +23614,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, {&__pyx_n_s_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1}, {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, {&__pyx_kp_u_content_disposition, __pyx_k_content_disposition, sizeof(__pyx_k_content_disposition), 0, 1, 0, 0}, @@ -17947,6 +23650,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, {&__pyx_n_s_init_subclass, __pyx_k_init_subclass, sizeof(__pyx_k_init_subclass), 0, 0, 1, 1}, + {&__pyx_n_s_is_async_target, __pyx_k_is_async_target, sizeof(__pyx_k_is_async_target), 0, 0, 1, 1}, {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, @@ -17971,6 +23675,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_parse, __pyx_k_parse, sizeof(__pyx_k_parse), 0, 0, 1, 1}, {&__pyx_n_s_parsestr, __pyx_k_parsestr, sizeof(__pyx_k_parsestr), 0, 0, 1, 1}, {&__pyx_n_s_part, __pyx_k_part, sizeof(__pyx_k_part), 0, 0, 1, 1}, + {&__pyx_n_s_part_cls, __pyx_k_part_cls, sizeof(__pyx_k_part_cls), 0, 0, 1, 1}, {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, {&__pyx_n_s_policy, __pyx_k_policy, sizeof(__pyx_k_policy), 0, 0, 1, 1}, {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, @@ -17979,6 +23684,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_AsyncPart, __pyx_k_pyx_unpickle_AsyncPart, sizeof(__pyx_k_pyx_unpickle_AsyncPart), 0, 0, 1, 1}, {&__pyx_n_s_pyx_unpickle_Finder, __pyx_k_pyx_unpickle_Finder, sizeof(__pyx_k_pyx_unpickle_Finder), 0, 0, 1, 1}, {&__pyx_n_s_pyx_unpickle_Part, __pyx_k_pyx_unpickle_Part, sizeof(__pyx_k_pyx_unpickle_Part), 0, 0, 1, 1}, {&__pyx_n_s_pyx_unpickle__Parser, __pyx_k_pyx_unpickle__Parser, sizeof(__pyx_k_pyx_unpickle__Parser), 0, 0, 1, 1}, @@ -17994,6 +23700,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0}, {&__pyx_kp_s_s_s_d, __pyx_k_s_s_d, sizeof(__pyx_k_s_s_d), 0, 0, 1, 0}, {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, {&__pyx_n_s_set_active_part, __pyx_k_set_active_part, sizeof(__pyx_k_set_active_part), 0, 0, 1, 1}, {&__pyx_n_s_set_multipart_content_type, __pyx_k_set_multipart_content_type, sizeof(__pyx_k_set_multipart_content_type), 0, 0, 1, 1}, {&__pyx_n_s_set_multipart_filename, __pyx_k_set_multipart_filename, sizeof(__pyx_k_set_multipart_filename), 0, 0, 1, 1}, @@ -18004,7 +23711,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1}, {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1}, - {&__pyx_kp_s_streaming_form_data__parser, __pyx_k_streaming_form_data__parser, sizeof(__pyx_k_streaming_form_data__parser), 0, 0, 1, 0}, + {&__pyx_n_s_streaming_form_data__parser, __pyx_k_streaming_form_data__parser, sizeof(__pyx_k_streaming_form_data__parser), 0, 0, 1, 1}, {&__pyx_kp_s_streaming_form_data__parser_pyx, __pyx_k_streaming_form_data__parser_pyx, sizeof(__pyx_k_streaming_form_data__parser_pyx), 0, 0, 1, 0}, {&__pyx_n_s_streaming_form_data_targets, __pyx_k_streaming_form_data_targets, sizeof(__pyx_k_streaming_form_data_targets), 0, 0, 1, 1}, {&__pyx_n_s_strict, __pyx_k_strict, sizeof(__pyx_k_strict), 0, 0, 1, 1}, @@ -18012,6 +23719,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, {&__pyx_n_s_target, __pyx_k_target, sizeof(__pyx_k_target), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, {&__pyx_n_s_unset_active_part, __pyx_k_unset_active_part, sizeof(__pyx_k_unset_active_part), 0, 0, 1, 1}, {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, {&__pyx_n_s_use_setstate, __pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 0, 1, 1}, @@ -18064,25 +23772,25 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x0855a7d, 0x0c6065b, 0x0cd0b9a) = (index, state, target, target_len, target_ptr))" % __pyx_checksum */ - __pyx_tuple__6 = PyTuple_Pack(3, __pyx_int_8739453, __pyx_int_12977755, __pyx_int_13437850); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_tuple__7 = PyTuple_Pack(3, __pyx_int_121382421, __pyx_int_12740226, __pyx_int_248083859); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_tuple__8 = PyTuple_Pack(3, __pyx_int_69775237, __pyx_int_183600964, __pyx_int_129688504); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__13 = PyTuple_Pack(3, __pyx_int_8739453, __pyx_int_12977755, __pyx_int_13437850); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_tuple__14 = PyTuple_Pack(3, __pyx_int_121382421, __pyx_int_12740226, __pyx_int_248083859); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_tuple__15 = PyTuple_Pack(3, __pyx_int_69775237, __pyx_int_183600964, __pyx_int_129688504); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * cdef tuple state * cdef object _dict */ - __pyx_tuple__9 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_state, __pyx_n_s_dict_2, __pyx_n_s_use_setstate); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_state, __pyx_n_s_dict_2, __pyx_n_s_use_setstate); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(1, 1, __pyx_L1_error) /* "(tree fragment)":16 * else: @@ -18090,10 +23798,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state) */ - __pyx_tuple__11 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(1, 16, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(1, 16, __pyx_L1_error) /* "EnumBase":28 * cdef object __Pyx_EnumBase @@ -18102,13 +23810,13 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * for v in cls: * if v == value: */ - __pyx_tuple__13 = PyTuple_Pack(5, __pyx_n_s_cls, __pyx_n_s_value, __pyx_n_s_name, __pyx_n_s_v, __pyx_n_s_res); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_new, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(1, 28, __pyx_L1_error) - __pyx_tuple__15 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_tuple__20 = PyTuple_Pack(5, __pyx_n_s_cls, __pyx_n_s_value, __pyx_n_s_name, __pyx_n_s_v, __pyx_n_s_res); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_new, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(1, 28, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); /* "EnumBase":39 * cls.__members__[name] = res @@ -18117,10 +23825,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) * def __str__(self): */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_repr, 39, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(1, 39, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_repr, 39, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(1, 39, __pyx_L1_error) /* "EnumBase":41 * def __repr__(self): @@ -18129,7 +23837,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return "%s.%s" % (self.__class__.__name__, self.name) * */ - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_str, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(1, 41, __pyx_L1_error) + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_str, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(1, 41, __pyx_L1_error) /* "EnumBase":49 * cdef object __Pyx_FlagBase @@ -18138,7 +23846,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * for v in cls: * if v == value: */ - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_new, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(1, 49, __pyx_L1_error) + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_new, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(1, 49, __pyx_L1_error) /* "EnumBase":62 * cls.__members__[name] = res @@ -18147,7 +23855,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) * def __str__(self): */ - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_repr, 62, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(1, 62, __pyx_L1_error) + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_repr, 62, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(1, 62, __pyx_L1_error) /* "EnumBase":64 * def __repr__(self): @@ -18156,17 +23864,17 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return "%s.%s" % (self.__class__.__name__, self.name) * */ - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_str, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(1, 64, __pyx_L1_error) + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_str, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(1, 64, __pyx_L1_error) /* "(tree fragment)":1 * def __pyx_unpickle___Pyx_EnumMeta(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ - __pyx_tuple__22 = 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__22)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_tuple__29 = 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__29)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(1, 1, __pyx_L1_error) /* "streaming_form_data/_parser.pyx":51 * self.state = FinderState.FS_START @@ -18175,10 +23883,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * if byte != self.target_ptr[self.index]: * if self.state != FinderState.FS_START: */ - __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_byte); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_feed, 51, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_byte); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_feed, 51, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 51, __pyx_L1_error) /* "streaming_form_data/_parser.pyx":79 * return self.target @@ -18187,7 +23895,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.state == FinderState.FS_START * */ - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_inactive, 79, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_inactive, 79, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 79, __pyx_L1_error) /* "streaming_form_data/_parser.pyx":82 * return self.state == FinderState.FS_START @@ -18196,7 +23904,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.state == FinderState.FS_WORKING * */ - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_active, 82, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_active, 82, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 82, __pyx_L1_error) /* "streaming_form_data/_parser.pyx":85 * return self.state == FinderState.FS_WORKING @@ -18205,14 +23913,14 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.state == FinderState.FS_END * */ - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_found, 85, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_found, 85, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 85, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * cdef tuple state * cdef object _dict */ - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(1, 1, __pyx_L1_error) /* "(tree fragment)":16 * else: @@ -18220,7 +23928,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle_Finder__set_state(self, __pyx_state) */ - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(1, 16, __pyx_L1_error) + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(1, 16, __pyx_L1_error) /* "streaming_form_data/_parser.pyx":103 * self.targets = [target] @@ -18229,10 +23937,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * self.targets.append(target) * */ - __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_target); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_add_target, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_tuple__38 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_target); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_add_target, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 103, __pyx_L1_error) /* "streaming_form_data/_parser.pyx":106 * self.targets.append(target) @@ -18241,10 +23949,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * for target in self.targets: * target.multipart_filename = value */ - __pyx_tuple__33 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_target); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_set_multipart_filename, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_tuple__40 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_target); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_set_multipart_filename, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 106, __pyx_L1_error) /* "streaming_form_data/_parser.pyx":110 * target.multipart_filename = value @@ -18253,7 +23961,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * for target in self.targets: * target.multipart_content_type = value */ - __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_set_multipart_content_type, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_set_multipart_content_type, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 110, __pyx_L1_error) /* "streaming_form_data/_parser.pyx":114 * target.multipart_content_type = value @@ -18262,7 +23970,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * for target in self.targets: * target.start() */ - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_start, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_start, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 114, __pyx_L1_error) /* "streaming_form_data/_parser.pyx":118 * target.start() @@ -18271,10 +23979,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * for target in self.targets: * target.data_received(chunk) */ - __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_chunk, __pyx_n_s_target); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_data_received, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_chunk, __pyx_n_s_target); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_data_received, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 118, __pyx_L1_error) /* "streaming_form_data/_parser.pyx":122 * target.data_received(chunk) @@ -18283,14 +23991,14 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * for target in self.targets: * target.finish() */ - __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_finish, 122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_finish, 122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 122, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * cdef tuple state * cdef object _dict */ - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(1, 1, __pyx_L1_error) /* "(tree fragment)":16 * else: @@ -18298,83 +24006,188 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle_Part__set_state(self, __pyx_state) */ - __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(1, 16, __pyx_L1_error) + __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(1, 16, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":138 + * self.targets = [target] + * + * def add_target(self, object target): # <<<<<<<<<<<<<< + * self.targets.append(target) + * + */ + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_add_target, 138, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 138, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":141 + * self.targets.append(target) + * + * def set_multipart_filename(self, str value): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.multipart_filename = value + */ + __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_set_multipart_filename, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 141, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":145 + * target.multipart_filename = value + * + * def set_multipart_content_type(self, str value): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.multipart_content_type = value + */ + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_set_multipart_content_type, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 145, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":149 + * target.multipart_content_type = value + * + * async def start(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.start() + */ + __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_start, 149, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 149, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":153 + * await target.start() + * + * async def data_received(self, bytes chunk): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.data_received(chunk) + */ + __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_data_received, 153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 153, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":157 + * await target.data_received(chunk) + * + * async def finish(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.finish() + */ + __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_finish, 157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 157, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_AsyncPart__set_state(self, __pyx_state) + */ + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(1, 16, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":180 + /* "streaming_form_data/_parser.pyx":215 * self.unexpected_part_name = '' * * def register(self, str name, object target): # <<<<<<<<<<<<<< * part = self._part_for(name) * */ - __pyx_tuple__42 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_target, __pyx_n_s_part); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); - __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_register, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_tuple__54 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_target, __pyx_n_s_part, __pyx_n_s_part_cls); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_register, 215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 215, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":188 - * self.expected_parts.append(Part(name, target)) + /* "streaming_form_data/_parser.pyx":224 + * self.expected_parts.append(part_cls(name, target)) * * def set_active_part(self, part, str filename): # <<<<<<<<<<<<<< * self.active_part = part * self.active_part.set_multipart_filename(filename) */ - __pyx_tuple__44 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_part, __pyx_n_s_filename); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_set_active_part, 188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 188, __pyx_L1_error) + __pyx_tuple__56 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_part, __pyx_n_s_filename); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); + __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_set_active_part, 224, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 224, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":193 + /* "streaming_form_data/_parser.pyx":229 * self.active_part.start() * + * async def async_set_active_part(self, part, str filename): # <<<<<<<<<<<<<< + * self.active_part = part + * self.active_part.set_multipart_filename(filename) + */ + __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_async_set_active_part, 229, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 229, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":234 + * await self.active_part.start() + * * def unset_active_part(self): # <<<<<<<<<<<<<< * if self.active_part: * self.active_part.finish() */ - __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_unset_active_part, 193, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_unset_active_part, 234, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 234, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":198 + /* "streaming_form_data/_parser.pyx":239 + * self.active_part = None + * + * async def async_unset_active_part(self): # <<<<<<<<<<<<<< + * if self.active_part: + * await self.active_part.finish() + */ + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_async_unset_active_part, 239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 239, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":244 * self.active_part = None * * def on_body(self, bytes value): # <<<<<<<<<<<<<< * if self.active_part and len(value) > 0: * self.active_part.data_received(value) */ - __pyx_tuple__47 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__47); - __Pyx_GIVEREF(__pyx_tuple__47); - __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_on_body, 198, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_tuple__59 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__59); + __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_on_body, 244, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 244, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":207 + /* "streaming_form_data/_parser.pyx":248 + * self.active_part.data_received(value) + * + * async def async_on_body(self, bytes value): # <<<<<<<<<<<<<< + * if self.active_part and len(value) > 0: + * await self.active_part.data_received(value) + */ + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_async_on_body, 248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 248, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":257 * return part * * def data_received(self, bytes data): # <<<<<<<<<<<<<< * if not data: * return 0 */ - __pyx_tuple__49 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_chunk, __pyx_n_s_index); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__49); - __Pyx_GIVEREF(__pyx_tuple__49); - __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_data_received, 207, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_tuple__61 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_chunk, __pyx_n_s_index); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__61); + __Pyx_GIVEREF(__pyx_tuple__61); + __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_data_received, 257, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 257, __pyx_L1_error) - /* "streaming_form_data/_parser.pyx":224 + /* "streaming_form_data/_parser.pyx":268 * return self._parse(chunk, index) * + * async def async_data_received(self, bytes data): # <<<<<<<<<<<<<< + * if not data: + * return 0 + */ + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_async_data_received, 268, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 268, __pyx_L1_error) + + /* "streaming_form_data/_parser.pyx":298 + * return (chunk, index) + * * def _parse(self, bytes chunk, size_t index): # <<<<<<<<<<<<<< * cdef size_t idx, buffer_start, chunk_len * cdef size_t match_start, skip_count, matched_length */ - __pyx_tuple__51 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_chunk, __pyx_n_s_index, __pyx_n_s_idx, __pyx_n_s_buffer_start, __pyx_n_s_chunk_len, __pyx_n_s_match_start, __pyx_n_s_skip_count, __pyx_n_s_matched_length, __pyx_n_s_byte, __pyx_n_s_chunk_ptr, __pyx_n_s_message, __pyx_n_s_params, __pyx_n_s_name, __pyx_n_s_part); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__51); - __Pyx_GIVEREF(__pyx_tuple__51); - __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_parse, 224, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_tuple__63 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_chunk, __pyx_n_s_index, __pyx_n_s_idx, __pyx_n_s_buffer_start, __pyx_n_s_chunk_len, __pyx_n_s_match_start, __pyx_n_s_skip_count, __pyx_n_s_matched_length, __pyx_n_s_byte, __pyx_n_s_chunk_ptr, __pyx_n_s_message, __pyx_n_s_params, __pyx_n_s_name, __pyx_n_s_part); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__63); + __Pyx_GIVEREF(__pyx_tuple__63); + __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_streaming_form_data__parser_pyx, __pyx_n_s_parse, 298, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 298, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * cdef tuple state * cdef object _dict */ - __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(1, 1, __pyx_L1_error) /* "(tree fragment)":16 * else: @@ -18382,16 +24195,17 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle__Parser__set_state(self, __pyx_state) */ - __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(1, 16, __pyx_L1_error) + __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(1, 16, __pyx_L1_error) /* "(tree fragment)":1 * def __pyx_unpickle_Finder(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ - __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Finder, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Part, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__Parser, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Finder, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Part, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_AsyncPart, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__Parser, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -18480,85 +24294,242 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_vtable_19streaming_form_data_7_parser_Finder.found = (int (*)(struct __pyx_obj_19streaming_form_data_7_parser_Finder *, int __pyx_skip_dispatch))__pyx_f_19streaming_form_data_7_parser_6Finder_found; __pyx_vtable_19streaming_form_data_7_parser_Finder.matched_length = (size_t (*)(struct __pyx_obj_19streaming_form_data_7_parser_Finder *))__pyx_f_19streaming_form_data_7_parser_6Finder_matched_length; #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_19streaming_form_data_7_parser_Finder = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser_Finder_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser_Finder)) __PYX_ERR(0, 35, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser_Finder_spec, __pyx_ptype_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_ptype_19streaming_form_data_7_parser_Finder = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser_Finder_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser_Finder)) __PYX_ERR(0, 35, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser_Finder_spec, __pyx_ptype_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + #else + __pyx_ptype_19streaming_form_data_7_parser_Finder = &__pyx_type_19streaming_form_data_7_parser_Finder; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_19streaming_form_data_7_parser_Finder->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser_Finder->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser_Finder->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_19streaming_form_data_7_parser_Finder->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_vtabptr_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_ptype_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Finder, (PyObject *) __pyx_ptype_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_19streaming_form_data_7_parser_Part = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser_Part_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser_Part)) __PYX_ERR(0, 92, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser_Part_spec, __pyx_ptype_19streaming_form_data_7_parser_Part) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + #else + __pyx_ptype_19streaming_form_data_7_parser_Part = &__pyx_type_19streaming_form_data_7_parser_Part; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser_Part) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_19streaming_form_data_7_parser_Part->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser_Part->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser_Part->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_19streaming_form_data_7_parser_Part->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Part, (PyObject *) __pyx_ptype_19streaming_form_data_7_parser_Part) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_19streaming_form_data_7_parser_Part) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_19streaming_form_data_7_parser_AsyncPart = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser_AsyncPart_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser_AsyncPart)) __PYX_ERR(0, 127, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser_AsyncPart_spec, __pyx_ptype_19streaming_form_data_7_parser_AsyncPart) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + #else + __pyx_ptype_19streaming_form_data_7_parser_AsyncPart = &__pyx_type_19streaming_form_data_7_parser_AsyncPart; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser_AsyncPart) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_19streaming_form_data_7_parser_AsyncPart->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser_AsyncPart->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser_AsyncPart->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_19streaming_form_data_7_parser_AsyncPart->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_AsyncPart, (PyObject *) __pyx_ptype_19streaming_form_data_7_parser_AsyncPart) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_19streaming_form_data_7_parser_AsyncPart) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + #endif + __pyx_vtabptr_19streaming_form_data_7_parser__Parser = &__pyx_vtable_19streaming_form_data_7_parser__Parser; + __pyx_vtable_19streaming_form_data_7_parser__Parser._part_for = (PyObject *(*)(struct __pyx_obj_19streaming_form_data_7_parser__Parser *, PyObject *))__pyx_f_19streaming_form_data_7_parser_7_Parser__part_for; + __pyx_vtable_19streaming_form_data_7_parser__Parser.include_leftover_buffer = (PyObject *(*)(struct __pyx_obj_19streaming_form_data_7_parser__Parser *, PyObject *))__pyx_f_19streaming_form_data_7_parser_7_Parser_include_leftover_buffer; + __pyx_vtable_19streaming_form_data_7_parser__Parser.rewind_fast_forward = (size_t (*)(struct __pyx_obj_19streaming_form_data_7_parser__Parser *, __pyx_t_19streaming_form_data_7_parser_Byte const *, size_t, size_t))__pyx_f_19streaming_form_data_7_parser_7_Parser_rewind_fast_forward; + __pyx_vtable_19streaming_form_data_7_parser__Parser.mark_error = (PyObject *(*)(struct __pyx_obj_19streaming_form_data_7_parser__Parser *))__pyx_f_19streaming_form_data_7_parser_7_Parser_mark_error; + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_19streaming_form_data_7_parser__Parser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser__Parser_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser__Parser)) __PYX_ERR(0, 182, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser__Parser_spec, __pyx_ptype_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 182, __pyx_L1_error) + #else + __pyx_ptype_19streaming_form_data_7_parser__Parser = &__pyx_type_19streaming_form_data_7_parser__Parser; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 182, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_19streaming_form_data_7_parser__Parser->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser__Parser->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser__Parser->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_19streaming_form_data_7_parser__Parser->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_vtabptr_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 182, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_ptype_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 182, __pyx_L1_error) + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Parser_2, (PyObject *) __pyx_ptype_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 182, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 182, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start)) __PYX_ERR(0, 149, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start_spec, __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start) < 0) __PYX_ERR(0, 149, __pyx_L1_error) + #else + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start = &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct__start; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start) < 0) __PYX_ERR(0, 149, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct__start->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received)) __PYX_ERR(0, 153, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received_spec, __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received) < 0) __PYX_ERR(0, 153, __pyx_L1_error) #else - __pyx_ptype_19streaming_form_data_7_parser_Finder = &__pyx_type_19streaming_form_data_7_parser_Finder; + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received = &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received) < 0) __PYX_ERR(0, 153, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 - __pyx_ptype_19streaming_form_data_7_parser_Finder->tp_print = 0; + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received->tp_print = 0; #endif #if !CYTHON_COMPILING_IN_LIMITED_API - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser_Finder->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser_Finder->tp_getattro == PyObject_GenericGetAttr)) { - __pyx_ptype_19streaming_form_data_7_parser_Finder->tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_1_data_received->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } #endif - if (__Pyx_SetVtable(__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_vtabptr_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish)) __PYX_ERR(0, 157, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish_spec, __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish) < 0) __PYX_ERR(0, 157, __pyx_L1_error) + #else + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish = &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_2_finish; + #endif #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_MergeVtables(__pyx_ptype_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) #endif - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Finder, (PyObject *) __pyx_ptype_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish) < 0) __PYX_ERR(0, 157, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish->tp_print = 0; + #endif #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_19streaming_form_data_7_parser_Finder) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_2_finish->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_19streaming_form_data_7_parser_Part = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser_Part_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser_Part)) __PYX_ERR(0, 92, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser_Part_spec, __pyx_ptype_19streaming_form_data_7_parser_Part) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part)) __PYX_ERR(0, 229, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part_spec, __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part) < 0) __PYX_ERR(0, 229, __pyx_L1_error) #else - __pyx_ptype_19streaming_form_data_7_parser_Part = &__pyx_type_19streaming_form_data_7_parser_Part; + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part = &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser_Part) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part) < 0) __PYX_ERR(0, 229, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 - __pyx_ptype_19streaming_form_data_7_parser_Part->tp_print = 0; + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part->tp_print = 0; #endif #if !CYTHON_COMPILING_IN_LIMITED_API - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser_Part->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser_Part->tp_getattro == PyObject_GenericGetAttr)) { - __pyx_ptype_19streaming_form_data_7_parser_Part->tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_3_async_set_active_part->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } #endif - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Part, (PyObject *) __pyx_ptype_19streaming_form_data_7_parser_Part) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part)) __PYX_ERR(0, 239, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part_spec, __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part) < 0) __PYX_ERR(0, 239, __pyx_L1_error) + #else + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part = &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part; + #endif #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_19streaming_form_data_7_parser_Part) < 0) __PYX_ERR(0, 92, __pyx_L1_error) #endif - __pyx_vtabptr_19streaming_form_data_7_parser__Parser = &__pyx_vtable_19streaming_form_data_7_parser__Parser; - __pyx_vtable_19streaming_form_data_7_parser__Parser._part_for = (PyObject *(*)(struct __pyx_obj_19streaming_form_data_7_parser__Parser *, PyObject *))__pyx_f_19streaming_form_data_7_parser_7_Parser__part_for; - __pyx_vtable_19streaming_form_data_7_parser__Parser.rewind_fast_forward = (size_t (*)(struct __pyx_obj_19streaming_form_data_7_parser__Parser *, __pyx_t_19streaming_form_data_7_parser_Byte const *, size_t, size_t))__pyx_f_19streaming_form_data_7_parser_7_Parser_rewind_fast_forward; - __pyx_vtable_19streaming_form_data_7_parser__Parser.mark_error = (PyObject *(*)(struct __pyx_obj_19streaming_form_data_7_parser__Parser *))__pyx_f_19streaming_form_data_7_parser_7_Parser_mark_error; + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part) < 0) __PYX_ERR(0, 239, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_4_async_unset_active_part->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + #endif #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_19streaming_form_data_7_parser__Parser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser__Parser_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser__Parser)) __PYX_ERR(0, 147, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser__Parser_spec, __pyx_ptype_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body)) __PYX_ERR(0, 248, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body_spec, __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body) < 0) __PYX_ERR(0, 248, __pyx_L1_error) #else - __pyx_ptype_19streaming_form_data_7_parser__Parser = &__pyx_type_19streaming_form_data_7_parser__Parser; + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body = &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 147, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body) < 0) __PYX_ERR(0, 248, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 - __pyx_ptype_19streaming_form_data_7_parser__Parser->tp_print = 0; + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body->tp_print = 0; #endif #if !CYTHON_COMPILING_IN_LIMITED_API - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser__Parser->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser__Parser->tp_getattro == PyObject_GenericGetAttr)) { - __pyx_ptype_19streaming_form_data_7_parser__Parser->tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_5_async_on_body->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } #endif - if (__Pyx_SetVtable(__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_vtabptr_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 147, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received_spec, NULL); if (unlikely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received)) __PYX_ERR(0, 268, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received_spec, __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received) < 0) __PYX_ERR(0, 268, __pyx_L1_error) + #else + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received = &__pyx_type_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received; + #endif #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_MergeVtables(__pyx_ptype_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 147, __pyx_L1_error) #endif - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Parser_2, (PyObject *) __pyx_ptype_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 147, __pyx_L1_error) + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received) < 0) __PYX_ERR(0, 268, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received->tp_print = 0; + #endif #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_19streaming_form_data_7_parser__Parser) < 0) __PYX_ERR(0, 147, __pyx_L1_error) + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received->tp_dictoffset && __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_19streaming_form_data_7_parser___pyx_scope_struct_6_async_data_received->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } #endif #if CYTHON_USE_TYPE_SPECS __pyx_t_1 = PyTuple_Pack(1, (PyObject *)(&PyType_Type)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 16, __pyx_L1_error) @@ -18968,7 +24939,7 @@ if (!__Pyx_RefNanny) { * cdef tuple state * cdef object _dict */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Pyx_EnumMeta___reduce_cython, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Pyx_EnumMeta___reduce_cython, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype___Pyx_EnumMeta, __pyx_n_s_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -18980,7 +24951,7 @@ if (!__Pyx_RefNanny) { * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state) */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Pyx_EnumMeta___setstate_cython, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Pyx_EnumMeta___setstate_cython, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype___Pyx_EnumMeta, __pyx_n_s_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(1, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -19016,9 +24987,9 @@ if (!__Pyx_RefNanny) { * for v in cls: * if v == value: */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Pyx_EnumBase___new, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 28, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Pyx_EnumBase___new, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__15); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__22); if (__Pyx_SetNewInClass(__pyx_t_6, __pyx_n_s_new, __pyx_t_4) < 0) __PYX_ERR(1, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -19029,7 +25000,7 @@ if (!__Pyx_RefNanny) { * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) * def __str__(self): */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_3__repr__, 0, __pyx_n_s_Pyx_EnumBase___repr, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 39, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_3__repr__, 0, __pyx_n_s_Pyx_EnumBase___repr, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_repr, __pyx_t_4) < 0) __PYX_ERR(1, 39, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -19041,7 +25012,7 @@ if (!__Pyx_RefNanny) { * return "%s.%s" % (self.__class__.__name__, self.name) * */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_5__str__, 0, __pyx_n_s_Pyx_EnumBase___str, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 41, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_5__str__, 0, __pyx_n_s_Pyx_EnumBase___str, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_str, __pyx_t_4) < 0) __PYX_ERR(1, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -19136,9 +25107,9 @@ if (!__Pyx_RefNanny) { * for v in cls: * if v == value: */ - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_FlagBase_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Pyx_FlagBase___new, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 49, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_FlagBase_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Pyx_FlagBase___new, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__15); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__22); if (__Pyx_SetNewInClass(__pyx_t_4, __pyx_n_s_new, __pyx_t_5) < 0) __PYX_ERR(1, 49, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -19149,7 +25120,7 @@ if (!__Pyx_RefNanny) { * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) * def __str__(self): */ - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_FlagBase_3__repr__, 0, __pyx_n_s_Pyx_FlagBase___repr, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 62, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_FlagBase_3__repr__, 0, __pyx_n_s_Pyx_FlagBase___repr, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_repr, __pyx_t_5) < 0) __PYX_ERR(1, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -19161,7 +25132,7 @@ if (!__Pyx_RefNanny) { * return "%s.%s" % (self.__class__.__name__, self.name) * */ - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_FlagBase_5__str__, 0, __pyx_n_s_Pyx_FlagBase___str, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 64, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_FlagBase_5__str__, 0, __pyx_n_s_Pyx_FlagBase___str, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_str, __pyx_t_5) < 0) __PYX_ERR(1, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -19230,7 +25201,7 @@ if (!__Pyx_RefNanny) { * cdef object __pyx_PickleError * cdef object __pyx_result */ - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta, 0, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta, 0, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta, __pyx_t_6) < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -19375,7 +25346,7 @@ if (!__Pyx_RefNanny) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(1, 86, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__Pyx_globals, __pyx_n_s_module, __pyx_kp_s_streaming_form_data__parser); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 86, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__Pyx_globals, __pyx_n_s_module, __pyx_n_s_streaming_form_data__parser); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_module_2, __pyx_t_5) < 0) __PYX_ERR(1, 86, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -19698,7 +25669,7 @@ if (!__Pyx_RefNanny) { * from email.policy import HTTP * from email.parser import Parser # <<<<<<<<<<<<<< * - * from streaming_form_data.targets import NullTarget + * from streaming_form_data.targets import NullTarget, is_async_target */ __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); @@ -19717,15 +25688,18 @@ if (!__Pyx_RefNanny) { /* "streaming_form_data/_parser.pyx":6 * from email.parser import Parser * - * from streaming_form_data.targets import NullTarget # <<<<<<<<<<<<<< + * from streaming_form_data.targets import NullTarget, is_async_target # <<<<<<<<<<<<<< * * */ - __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 6, __pyx_L1_error) + __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_n_s_NullTarget); __Pyx_GIVEREF(__pyx_n_s_NullTarget); if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_NullTarget)) __PYX_ERR(0, 6, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_is_async_target); + __Pyx_GIVEREF(__pyx_n_s_is_async_target); + if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_is_async_target)) __PYX_ERR(0, 6, __pyx_L1_error); __pyx_t_4 = __Pyx_Import(__pyx_n_s_streaming_form_data_targets, __pyx_t_7, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -19733,6 +25707,10 @@ if (!__Pyx_RefNanny) { __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_d, __pyx_n_s_NullTarget, __pyx_t_7) < 0) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_is_async_target); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_async_target, __pyx_t_7) < 0) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "streaming_form_data/_parser.pyx":14 @@ -19778,7 +25756,7 @@ if (!__Pyx_RefNanny) { * if byte != self.target_ptr[self.index]: * if self.state != FinderState.FS_START: */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_3feed, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder_feed, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_3feed, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder_feed, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_n_s_feed, __pyx_t_4) < 0) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -19791,7 +25769,7 @@ if (!__Pyx_RefNanny) { * return self.state == FinderState.FS_START * */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_5inactive, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder_inactive, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_5inactive, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder_inactive, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_n_s_inactive, __pyx_t_4) < 0) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -19800,2155 +25778,3985 @@ if (!__Pyx_RefNanny) { /* "streaming_form_data/_parser.pyx":82 * return self.state == FinderState.FS_START * - * cpdef bint active(self): # <<<<<<<<<<<<<< - * return self.state == FinderState.FS_WORKING + * cpdef bint active(self): # <<<<<<<<<<<<<< + * return self.state == FinderState.FS_WORKING + * + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_7active, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder_active, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_n_s_active, __pyx_t_4) < 0) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Finder); + + /* "streaming_form_data/_parser.pyx":85 + * return self.state == FinderState.FS_WORKING + * + * cpdef bint found(self): # <<<<<<<<<<<<<< + * return self.state == FinderState.FS_END + * + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_9found, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder_found, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_n_s_found, __pyx_t_4) < 0) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Finder); + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_11__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder___reduce_cython, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_n_s_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Finder); + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Finder, (type(self), 0x0855a7d, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Finder__set_state(self, __pyx_state) + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_13__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder___setstate_cython, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_n_s_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Finder); + + /* "streaming_form_data/_parser.pyx":103 + * self.targets = [target] + * + * def add_target(self, object target): # <<<<<<<<<<<<<< + * self.targets.append(target) + * + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_3add_target, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_add_target, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_add_target, __pyx_t_4) < 0) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + + /* "streaming_form_data/_parser.pyx":106 + * self.targets.append(target) + * + * def set_multipart_filename(self, str value): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.multipart_filename = value + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_5set_multipart_filename, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_set_multipart_filename, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_set_multipart_filename, __pyx_t_4) < 0) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + + /* "streaming_form_data/_parser.pyx":110 + * target.multipart_filename = value + * + * def set_multipart_content_type(self, str value): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.multipart_content_type = value + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_7set_multipart_content_type, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_set_multipart_content_type, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_set_multipart_content_type, __pyx_t_4) < 0) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + + /* "streaming_form_data/_parser.pyx":114 + * target.multipart_content_type = value + * + * def start(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.start() + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_9start, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_start, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_start, __pyx_t_4) < 0) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + + /* "streaming_form_data/_parser.pyx":118 + * target.start() + * + * def data_received(self, bytes chunk): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.data_received(chunk) + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_11data_received, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_data_received, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_data_received, __pyx_t_4) < 0) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + + /* "streaming_form_data/_parser.pyx":122 + * target.data_received(chunk) + * + * def finish(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.finish() + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_13finish, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_finish, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_finish, __pyx_t_4) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part___reduce_cython, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Part, (type(self), 0x73c2615, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Part__set_state(self, __pyx_state) + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part___setstate_cython, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + + /* "streaming_form_data/_parser.pyx":138 + * self.targets = [target] + * + * def add_target(self, object target): # <<<<<<<<<<<<<< + * self.targets.append(target) + * + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_3add_target, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncPart_add_target, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_AsyncPart, __pyx_n_s_add_target, __pyx_t_4) < 0) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + + /* "streaming_form_data/_parser.pyx":141 + * self.targets.append(target) + * + * def set_multipart_filename(self, str value): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.multipart_filename = value + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_5set_multipart_filename, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncPart_set_multipart_filename, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_AsyncPart, __pyx_n_s_set_multipart_filename, __pyx_t_4) < 0) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + + /* "streaming_form_data/_parser.pyx":145 + * target.multipart_filename = value + * + * def set_multipart_content_type(self, str value): # <<<<<<<<<<<<<< + * for target in self.targets: + * target.multipart_content_type = value + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_7set_multipart_content_type, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncPart_set_multipart_content, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_AsyncPart, __pyx_n_s_set_multipart_content_type, __pyx_t_4) < 0) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + + /* "streaming_form_data/_parser.pyx":149 + * target.multipart_content_type = value + * + * async def start(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.start() + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_9start, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_AsyncPart_start, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_AsyncPart, __pyx_n_s_start, __pyx_t_4) < 0) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + + /* "streaming_form_data/_parser.pyx":153 + * await target.start() + * + * async def data_received(self, bytes chunk): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.data_received(chunk) + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_12data_received, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_AsyncPart_data_received, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_AsyncPart, __pyx_n_s_data_received, __pyx_t_4) < 0) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + + /* "streaming_form_data/_parser.pyx":157 + * await target.data_received(chunk) + * + * async def finish(self): # <<<<<<<<<<<<<< + * for target in self.targets: + * await target.finish() + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_15finish, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_AsyncPart_finish, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_AsyncPart, __pyx_n_s_finish, __pyx_t_4) < 0) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_18__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncPart___reduce_cython, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_AsyncPart, __pyx_n_s_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_AsyncPart, (type(self), 0x73c2615, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_AsyncPart__set_state(self, __pyx_state) + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_9AsyncPart_20__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncPart___setstate_cython, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_AsyncPart, __pyx_n_s_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_AsyncPart); + + /* "streaming_form_data/_parser.pyx":215 + * self.unexpected_part_name = '' + * + * def register(self, str name, object target): # <<<<<<<<<<<<<< + * part = self._part_for(name) * */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_7active, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder_active, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_3register, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser_register, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_n_s_active, __pyx_t_4) < 0) __PYX_ERR(0, 82, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_register, __pyx_t_4) < 0) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Finder); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); - /* "streaming_form_data/_parser.pyx":85 - * return self.state == FinderState.FS_WORKING - * - * cpdef bint found(self): # <<<<<<<<<<<<<< - * return self.state == FinderState.FS_END + /* "streaming_form_data/_parser.pyx":224 + * self.expected_parts.append(part_cls(name, target)) * + * def set_active_part(self, part, str filename): # <<<<<<<<<<<<<< + * self.active_part = part + * self.active_part.set_multipart_filename(filename) */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_9found, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder_found, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_5set_active_part, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser_set_active_part, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_n_s_found, __pyx_t_4) < 0) __PYX_ERR(0, 85, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_set_active_part, __pyx_t_4) < 0) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Finder); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "streaming_form_data/_parser.pyx":229 + * self.active_part.start() + * + * async def async_set_active_part(self, part, str filename): # <<<<<<<<<<<<<< + * self.active_part = part + * self.active_part.set_multipart_filename(filename) */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_11__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder___reduce_cython, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_7async_set_active_part, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_Parser_async_set_active_part, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_n_s_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_async_set_active_part, __pyx_t_4) < 0) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Finder); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Finder, (type(self), 0x0855a7d, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Finder__set_state(self, __pyx_state) + /* "streaming_form_data/_parser.pyx":234 + * await self.active_part.start() + * + * def unset_active_part(self): # <<<<<<<<<<<<<< + * if self.active_part: + * self.active_part.finish() */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_6Finder_13__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Finder___setstate_cython, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_10unset_active_part, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser_unset_active_part, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Finder, __pyx_n_s_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(1, 16, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_unset_active_part, __pyx_t_4) < 0) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Finder); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); - /* "streaming_form_data/_parser.pyx":103 - * self.targets = [target] - * - * def add_target(self, object target): # <<<<<<<<<<<<<< - * self.targets.append(target) + /* "streaming_form_data/_parser.pyx":239 + * self.active_part = None * + * async def async_unset_active_part(self): # <<<<<<<<<<<<<< + * if self.active_part: + * await self.active_part.finish() */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_3add_target, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_add_target, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_12async_unset_active_part, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_Parser_async_unset_active_part, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_add_target, __pyx_t_4) < 0) __PYX_ERR(0, 103, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_async_unset_active_part, __pyx_t_4) < 0) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); - /* "streaming_form_data/_parser.pyx":106 - * self.targets.append(target) + /* "streaming_form_data/_parser.pyx":244 + * self.active_part = None * - * def set_multipart_filename(self, str value): # <<<<<<<<<<<<<< - * for target in self.targets: - * target.multipart_filename = value + * def on_body(self, bytes value): # <<<<<<<<<<<<<< + * if self.active_part and len(value) > 0: + * self.active_part.data_received(value) */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_5set_multipart_filename, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_set_multipart_filename, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_15on_body, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser_on_body, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_set_multipart_filename, __pyx_t_4) < 0) __PYX_ERR(0, 106, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_on_body, __pyx_t_4) < 0) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); - /* "streaming_form_data/_parser.pyx":110 - * target.multipart_filename = value + /* "streaming_form_data/_parser.pyx":248 + * self.active_part.data_received(value) * - * def set_multipart_content_type(self, str value): # <<<<<<<<<<<<<< - * for target in self.targets: - * target.multipart_content_type = value + * async def async_on_body(self, bytes value): # <<<<<<<<<<<<<< + * if self.active_part and len(value) > 0: + * await self.active_part.data_received(value) */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_7set_multipart_content_type, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_set_multipart_content_type, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_17async_on_body, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_Parser_async_on_body, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_set_multipart_content_type, __pyx_t_4) < 0) __PYX_ERR(0, 110, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_async_on_body, __pyx_t_4) < 0) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); - /* "streaming_form_data/_parser.pyx":114 - * target.multipart_content_type = value + /* "streaming_form_data/_parser.pyx":257 + * return part * - * def start(self): # <<<<<<<<<<<<<< - * for target in self.targets: - * target.start() + * def data_received(self, bytes data): # <<<<<<<<<<<<<< + * if not data: + * return 0 */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_9start, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_start, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_20data_received, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser_data_received, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_start, __pyx_t_4) < 0) __PYX_ERR(0, 114, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_data_received, __pyx_t_4) < 0) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); - /* "streaming_form_data/_parser.pyx":118 - * target.start() + /* "streaming_form_data/_parser.pyx":268 + * return self._parse(chunk, index) * - * def data_received(self, bytes chunk): # <<<<<<<<<<<<<< - * for target in self.targets: - * target.data_received(chunk) + * async def async_data_received(self, bytes data): # <<<<<<<<<<<<<< + * if not data: + * return 0 */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_11data_received, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_data_received, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_22async_data_received, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_Parser_async_data_received, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_data_received, __pyx_t_4) < 0) __PYX_ERR(0, 118, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_async_data_received, __pyx_t_4) < 0) __PYX_ERR(0, 268, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); - /* "streaming_form_data/_parser.pyx":122 - * target.data_received(chunk) + /* "streaming_form_data/_parser.pyx":298 + * return (chunk, index) * - * def finish(self): # <<<<<<<<<<<<<< - * for target in self.targets: - * target.finish() + * def _parse(self, bytes chunk, size_t index): # <<<<<<<<<<<<<< + * cdef size_t idx, buffer_start, chunk_len + * cdef size_t match_start, skip_count, matched_length */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_13finish, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part_finish, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_25_parse, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser__parse, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_finish, __pyx_t_4) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_parse, __pyx_t_4) < 0) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * cdef tuple state * cdef object _dict */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part___reduce_cython, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_27__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser___reduce_cython, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); /* "(tree fragment)":16 * else: - * return __pyx_unpickle_Part, (type(self), 0x73c2615, state) + * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Part__set_state(self, __pyx_state) + * __pyx_unpickle__Parser__set_state(self, __pyx_state) */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_4Part_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Part___setstate_cython, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_29__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser___setstate_cython, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser_Part, __pyx_n_s_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(1, 16, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(1, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser_Part); + PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); - /* "streaming_form_data/_parser.pyx":180 - * self.unexpected_part_name = '' - * - * def register(self, str name, object target): # <<<<<<<<<<<<<< - * part = self._part_for(name) + /* "(tree fragment)":1 + * def __pyx_unpickle_Finder(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_1__pyx_unpickle_Finder, 0, __pyx_n_s_pyx_unpickle_Finder, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Finder, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":11 + * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_3__pyx_unpickle_Part, 0, __pyx_n_s_pyx_unpickle_Part, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Part, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":1 + * def __pyx_unpickle_AsyncPart(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_5__pyx_unpickle_AsyncPart, 0, __pyx_n_s_pyx_unpickle_AsyncPart, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_AsyncPart, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":11 + * __pyx_unpickle_AsyncPart__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_AsyncPart__set_state(AsyncPart __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0]; __pyx_result.targets = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7__pyx_unpickle__Parser, 0, __pyx_n_s_pyx_unpickle__Parser, NULL, __pyx_n_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle__Parser, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "streaming_form_data/_parser.pyx":1 + * # cython: language_level=3 # <<<<<<<<<<<<<< * + * from email.policy import HTTP */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_3register, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser_register, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_register, __pyx_t_4) < 0) __PYX_ERR(0, 180, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); - /* "streaming_form_data/_parser.pyx":188 - * self.expected_parts.append(Part(name, target)) - * - * def set_active_part(self, part, str filename): # <<<<<<<<<<<<<< - * self.active_part = part - * self.active_part.set_multipart_filename(filename) - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_5set_active_part, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser_set_active_part, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_set_active_part, __pyx_t_4) < 0) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + if (__pyx_m) { + if (__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init streaming_form_data._parser", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init streaming_form_data._parser"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif - /* "streaming_form_data/_parser.pyx":193 - * self.active_part.start() - * - * def unset_active_part(self): # <<<<<<<<<<<<<< - * if self.active_part: - * self.active_part.finish() - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_7unset_active_part, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser_unset_active_part, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_unset_active_part, __pyx_t_4) < 0) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif - /* "streaming_form_data/_parser.pyx":198 - * self.active_part = None - * - * def on_body(self, bytes value): # <<<<<<<<<<<<<< - * if self.active_part and len(value) > 0: - * self.active_part.data_received(value) - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_9on_body, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser_on_body, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_on_body, __pyx_t_4) < 0) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); +/* PyObjectGetAttrStrNoError */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} - /* "streaming_form_data/_parser.pyx":207 - * return part - * - * def data_received(self, bytes data): # <<<<<<<<<<<<<< - * if not data: - * return 0 - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_11data_received, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser_data_received, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_data_received, __pyx_t_4) < 0) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} - /* "streaming_form_data/_parser.pyx":224 - * return self._parse(chunk, index) - * - * def _parse(self, bytes chunk, size_t index): # <<<<<<<<<<<<<< - * cdef size_t idx, buffer_start, chunk_len - * cdef size_t match_start, skip_count, matched_length - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_13_parse, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser__parse, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_parse, __pyx_t_4) < 0) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser___reduce_cython, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle__Parser, (type(self), 0x428af85, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle__Parser__set_state(self, __pyx_state) - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_7_Parser_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Parser___setstate_cython, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_19streaming_form_data_7_parser__Parser, __pyx_n_s_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(1, 16, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_19streaming_form_data_7_parser__Parser); +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { + return NULL; + } + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) { + return NULL; + } + #endif + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif - /* "(tree fragment)":1 - * def __pyx_unpickle_Finder(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_1__pyx_unpickle_Finder, 0, __pyx_n_s_pyx_unpickle_Finder, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Finder, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + #endif + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif - /* "(tree fragment)":11 - * __pyx_unpickle_Finder__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Finder__set_state(Finder __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.index = __pyx_state[0]; __pyx_result.state = __pyx_state[1]; __pyx_result.target = __pyx_state[2]; __pyx_result.target_len = __pyx_state[3]; __pyx_result.target_ptr = __pyx_state[4] - * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_3__pyx_unpickle_Part, 0, __pyx_n_s_pyx_unpickle_Part, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Part, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + #endif + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if PY_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, NULL); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, NULL); + } + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} - /* "(tree fragment)":1 - * def __pyx_unpickle__Parser(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_19streaming_form_data_7_parser_5__pyx_unpickle__Parser, 0, __pyx_n_s_pyx_unpickle__Parser, NULL, __pyx_kp_s_streaming_form_data__parser, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle__Parser, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif - /* "streaming_form_data/_parser.pyx":1 - * # cython: language_level=3 # <<<<<<<<<<<<<< - * - * from email.policy import HTTP - */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} - /*--- Wrapped vars code ---*/ +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - if (__pyx_m) { - if (__pyx_d && stringtab_initialized) { - __Pyx_AddTraceback("init streaming_form_data._parser", __pyx_clineno, __pyx_lineno, __pyx_filename); +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; } - #if !CYTHON_USE_MODULE_STATE - Py_CLEAR(__pyx_m); - #else - Py_DECREF(__pyx_m); - if (pystate_addmodule_run) { - PyObject *tp, *value, *tb; - PyErr_Fetch(&tp, &value, &tb); - PyState_RemoveModule(&__pyx_moduledef); - PyErr_Restore(tp, value, tb); + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; + return kwvalues[i]; + } } - #endif - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init streaming_form_data._parser"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 +CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames); + PyObject *dict; + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; i= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} -/* #### Code section: utility_code_def ### */ +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); + Py_DECREF(key); +#endif + key = NULL; + value = NULL; + continue; + } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = ( + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key) + ); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + Py_XDECREF(key); + Py_XDECREF(value); + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + Py_XDECREF(key); + Py_XDECREF(value); + return -1; +} -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; +/* PyObjectSetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); } #endif -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 0x030C00A6 - PyObject *current_exception = tstate->current_exception; - if (unlikely(!current_exception)) return 0; - exc_type = (PyObject*) Py_TYPE(current_exception); - if (exc_type == err) return 1; +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else - exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; + return PySequence_GetItem(o, i); #endif - #if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(exc_type); - #endif - if (unlikely(PyTuple_Check(err))) { - result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } else { - result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); } - #if CYTHON_AVOID_BORROWED_REFS - Py_DECREF(exc_type); - #endif - return result; -} #endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject *tmp_value; - assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); - if (value) { - #if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) - #endif - PyException_SetTraceback(value, tb); +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); } - tmp_value = tstate->current_exception; - tstate->current_exception = value; - Py_XDECREF(tmp_value); - Py_XDECREF(type); - Py_XDECREF(tb); -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#endif + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; } -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject* exc_value; - exc_value = tstate->current_exception; - tstate->current_exception = 0; - *value = exc_value; - *type = NULL; - *tb = NULL; - if (exc_value) { - *type = (PyObject*) Py_TYPE(exc_value); - Py_INCREF(*type); - #if CYTHON_COMPILING_IN_CPYTHON - *tb = ((PyBaseExceptionObject*) exc_value)->traceback; - Py_XINCREF(*tb); - #else - *tb = PyException_GetTraceback(exc_value); - #endif +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + Py_ssize_t kwsize; +#if CYTHON_ASSUME_SAFE_MACROS + kwsize = PyTuple_GET_SIZE(kw); +#else + kwsize = PyTuple_Size(kw); + if (kwsize < 0) return 0; +#endif + if (unlikely(kwsize == 0)) + return 1; + if (!kw_allowed) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, 0); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + goto invalid_keyword; + } +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < kwsize; pos++) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); #else - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; #endif -} + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } #endif - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); + return 1; + } + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; #endif - return PyObject_GetAttr(obj, attr_name); +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; } -#endif -/* PyObjectGetAttrStrNoError */ +/* GetAttr3 */ #if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; } #endif -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 - (void) PyObject_GetOptionalAttr(obj, attr_name, &result); - return result; + int res = PyObject_GetOptionalAttr(o, n, &r); + return (res != 0) ? r : __Pyx_NewRef(d); #else -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + #if CYTHON_USE_TYPE_SLOTS + if (likely(PyString_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; } - return result; + #endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); #endif } -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); - if (unlikely(!result) && !PyErr_Occurred()) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; } -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } #endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; } -#endif - -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) #else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#elif CYTHON_COMPILING_IN_LIMITED_API - if (unlikely(!__pyx_m)) { - return NULL; +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; } - result = PyObject_GetAttr(__pyx_m, name); - if (likely(result)) { - return result; + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); } -#endif + PyErr_SetObject(type, value); + if (tb) { + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } #else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); #endif - return __Pyx_GetBuiltinName(name); -} - -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; +bad: + Py_XDECREF(owned_instance); + return; } -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; #endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; #if PY_MAJOR_VERSION < 3 - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { - return NULL; - } - #else - if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) { - return NULL; + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) + goto bad; + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) + goto bad; + from_list = empty_list; } #endif - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.') != NULL) { + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); + } + } + level = 0; } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif } } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + return module; +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__3); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); } - else { - d = NULL; - nd = 0; + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif } + return value; +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS #if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); + if (likely(PyUnicode_Check(n))) #else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); + if (likely(PyString_Check(n))) #endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} + return __Pyx_PyObject_GetAttrStr(o, n); #endif - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - #if PY_MAJOR_VERSION < 3 - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - #else - if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) - return NULL; - #endif - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; + return PyObject_GetAttr(o, n); } -#endif -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); - self = __Pyx_CyOrPyCFunction_GET_SELF(func); - #if PY_MAJOR_VERSION < 3 - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - #else - if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) - return NULL; - #endif - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); +/* HasAttr */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_GetAttr(o, n); + if (!r) { + PyErr_Clear(); + return 0; + } else { + Py_DECREF(r); + return 1; } - return result; } #endif -/* PyObjectFastCall */ -#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API -static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { - PyObject *argstuple; - PyObject *result = 0; - size_t i; - argstuple = PyTuple_New((Py_ssize_t)nargs); - if (unlikely(!argstuple)) return NULL; - for (i = 0; i < nargs; i++) { - Py_INCREF(args[i]); - if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; } - result = __Pyx_PyObject_Call(func, argstuple, kwargs); - bad: - Py_DECREF(argstuple); - return result; -} -#endif -static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { - Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); -#if CYTHON_COMPILING_IN_CPYTHON - if (nargs == 0 && kwargs == NULL) { - if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) - return __Pyx_PyObject_CallMethO(func, NULL); + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif } - else if (nargs == 1 && kwargs == NULL) { - if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) - return __Pyx_PyObject_CallMethO(func, args[0]); + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* FixUpExtensionType */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const #endif - #if PY_VERSION_HEX < 0x030800B1 - #if CYTHON_FAST_PYCCALL - if (PyCFunction_Check(func)) { - if (kwargs) { - return _PyCFunction_FastCallDict(func, args, nargs, kwargs); - } else { - return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; } + if (changed) + PyType_Modified(type); } - #if PY_VERSION_HEX >= 0x030700A1 - if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { - return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); - } - #endif - #endif - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); - } - #endif - #endif - if (kwargs == NULL) { - #if CYTHON_VECTORCALL - #if PY_VERSION_HEX < 0x03090000 - vectorcallfunc f = _PyVectorcall_Function(func); - #else - vectorcallfunc f = PyVectorcall_Function(func); - #endif - if (f) { - return f(func, args, (size_t)nargs, NULL); - } - #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL - if (__Pyx_CyFunction_CheckExact(func)) { - __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); - if (f) return f(func, args, (size_t)nargs, NULL); - } - #endif +#endif + return 0; +} +#endif + +/* FetchSharedCythonModule */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType */ +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; } - if (nargs == 0) { - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; } - #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API - return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); - #else - return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); - #endif + return 0; } - -/* TupleAndListFromArray */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { - PyObject *v; - Py_ssize_t i; - for (i = 0; i < length; i++) { - v = dest[i] = src[i]; - Py_INCREF(v); +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { + goto bad; + } + goto done; } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; } -static CYTHON_INLINE PyObject * -__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) -{ - PyObject *res; - if (n <= 0) { - Py_INCREF(__pyx_empty_tuple); - return __pyx_empty_tuple; +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { + goto bad; + } + goto done; } - res = PyTuple_New(n); - if (unlikely(res == NULL)) return NULL; - __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); - return res; + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; +done: + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; } -static CYTHON_INLINE PyObject * -__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +#endif + +/* GetTopmostException */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { - PyObject *res; - if (n <= 0) { - return PyList_New(0); + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; } - res = PyList_New(n); - if (unlikely(res == NULL)) return NULL; - __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); - return res; + return exc_info; } #endif -/* BytesEquals */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} #endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); + +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} #endif + +/* PyObjectCall2Args */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } -/* UnicodeEquals */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; +/* PyObjectGetMethod */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } -#if CYTHON_USE_UNICODE_INTERNALS - { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } - } #endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; + { + meth_found = 1; } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - -/* fastcall */ -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) -{ - Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); - for (i = 0; i < n; i++) - { - if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; } - for (i = 0; i < n; i++) - { - int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); - if (unlikely(eq != 0)) { - if (unlikely(eq < 0)) return NULL; - return kwvalues[i]; + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; } + Py_DECREF(dict); } - return NULL; -} -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 -CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { - Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames); - PyObject *dict; - dict = PyDict_New(); - if (unlikely(!dict)) - return NULL; - for (i=0; i= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); #endif + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; #endif - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif +#endif + *method = attr; + return 0; } -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject *const *kwvalues, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); - while (1) { - Py_XDECREF(key); key = NULL; - Py_XDECREF(value); value = NULL; - if (kwds_is_tuple) { - Py_ssize_t size; -#if CYTHON_ASSUME_SAFE_MACROS - size = PyTuple_GET_SIZE(kwds); -#else - size = PyTuple_Size(kwds); - if (size < 0) goto bad; +/* PyObjectCallMethod1 */ +#if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} #endif - if (pos >= size) break; -#if CYTHON_AVOID_BORROWED_REFS - key = __Pyx_PySequence_ITEM(kwds, pos); - if (!key) goto bad; -#elif CYTHON_ASSUME_SAFE_MACROS - key = PyTuple_GET_ITEM(kwds, pos); +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2 + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_GetMethod; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); #else - key = PyTuple_GetItem(kwds, pos); - if (!key) goto bad; + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); #endif - value = kwvalues[pos]; - pos++; - } - else - { - if (!PyDict_Next(kwds, &pos, &key, &value)) break; -#if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(key); +} + +/* PyObjectCallNoArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg[2] = {NULL, NULL}; + return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* CoroutineBase */ +#include +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" #endif +#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + CYTHON_UNUSED_VAR(__pyx_tstate); + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (likely(et == PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + value = Py_None; } - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; -#if CYTHON_AVOID_BORROWED_REFS +#if PY_VERSION_HEX >= 0x030300A0 + else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) { + value = ((PyStopIterationObject *)ev)->value; Py_INCREF(value); - Py_DECREF(key); -#endif - key = NULL; - value = NULL; - continue; + Py_DECREF(ev); } -#if !CYTHON_AVOID_BORROWED_REFS - Py_INCREF(key); -#endif - Py_INCREF(value); - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; -#if CYTHON_AVOID_BORROWED_REFS - value = NULL; #endif - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = ( - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key) - ); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; -#if CYTHON_AVOID_BORROWED_REFS - value = NULL; + else if (unlikely(PyTuple_Check(ev))) { + if (PyTuple_GET_SIZE(ev) >= 1) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); +#else + value = PySequence_ITEM(ev, 0); #endif - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } + } else { + Py_INCREF(Py_None); + value = Py_None; } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + Py_DECREF(ev); + } + else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { + value = ev; + } + if (likely(value)) { + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; } + } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; } - Py_XDECREF(key); - Py_XDECREF(value); + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if PY_VERSION_HEX >= 0x030300A0 + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); +#else + { + PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args); + Py_DECREF(ev); + if (likely(args)) { + value = PySequence_GetItem(args, 0); + Py_DECREF(args); + } + if (unlikely(!value)) { + __Pyx_ErrRestore(NULL, NULL, NULL); + Py_INCREF(Py_None); + value = Py_None; + } + } +#endif + *pvalue = value; return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - #if PY_MAJOR_VERSION < 3 - PyErr_Format(PyExc_TypeError, - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - PyErr_Format(PyExc_TypeError, - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - Py_XDECREF(key); - Py_XDECREF(value); - return -1; } - -/* PyObjectSetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +static CYTHON_INLINE +void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_CLEAR(exc_state->exc_value); +#else + PyObject *t, *v, *tb; + t = exc_state->exc_type; + v = exc_state->exc_value; + tb = exc_state->exc_traceback; + exc_state->exc_type = NULL; + exc_state->exc_value = NULL; + exc_state->exc_traceback = NULL; + Py_XDECREF(t); + Py_XDECREF(v); + Py_XDECREF(tb); #endif - return PyObject_SetAttr(obj, attr_name, value); } -#endif - -/* GetItemInt */ -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (unlikely(!j)) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; +#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) { + const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { + msg = "coroutine already executing"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { + msg = "async generator already executing"; + #endif + } else { + msg = "generator already executing"; + } + PyErr_SetString(PyExc_ValueError, msg); +} +#define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_NotStartedError(PyObject *gen) { + const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(gen)) { + msg = "can't send non-None value to a just-started coroutine"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(gen)) { + msg = "can't send non-None value to a just-started async generator"; + #endif + } else { + msg = "can't send non-None value to a just-started generator"; + } + PyErr_SetString(PyExc_TypeError, msg); } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); +#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) { + CYTHON_MAYBE_UNUSED_VAR(gen); + CYTHON_MAYBE_UNUSED_VAR(closing); + #ifdef __Pyx_Coroutine_USED + if (!closing && __Pyx_Coroutine_Check(gen)) { + PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); + } else + #endif + if (value) { + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration); + else + #endif + PyErr_SetNone(PyExc_StopIteration); } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; +} +static +PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) { + __Pyx_PyThreadState_declare + PyThreadState *tstate; + __Pyx_ExcInfoStruct *exc_state; + PyObject *retval; + assert(!self->is_running); + if (unlikely(self->resume_label == 0)) { + if (unlikely(value && value != Py_None)) { + return __Pyx_Coroutine_NotStartedError((PyObject*)self); + } + } + if (unlikely(self->resume_label == -1)) { + return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); + } +#if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + tstate = __pyx_tstate; +#else + tstate = __Pyx_PyThreadState_Current; +#endif + exc_state = &self->gi_exc_state; + if (exc_state->exc_value) { + #if CYTHON_COMPILING_IN_PYPY + #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #elif PY_VERSION_HEX >= 0x030B00a4 + exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback; + #else + exc_tb = exc_state->exc_traceback; + #endif + if (exc_tb) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + assert(f->f_back == NULL); + #if PY_VERSION_HEX >= 0x030B00A1 + f->f_back = PyThreadState_GetFrame(tstate); + #else + Py_XINCREF(tstate->frame); + f->f_back = tstate->frame; + #endif + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + Py_DECREF(exc_tb); + #endif + } + #endif } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#if CYTHON_USE_EXC_INFO_STACK + exc_state->previous_item = tstate->exc_info; + tstate->exc_info = exc_state; #else - return PySequence_GetItem(o, i); + if (exc_state->exc_type) { + __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } else { + __Pyx_Coroutine_ExceptionClear(exc_state); + __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } +#endif + self->is_running = 1; + retval = self->body(self, tstate, value); + self->is_running = 0; +#if CYTHON_USE_EXC_INFO_STACK + exc_state = &self->gi_exc_state; + tstate->exc_info = exc_state->previous_item; + exc_state->previous_item = NULL; + __Pyx_Coroutine_ResetFrameBackpointer(exc_state); #endif + return retval; } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyTuple_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { +#if CYTHON_COMPILING_IN_PYPY + CYTHON_UNUSED_VAR(exc_state); #else - return PySequence_GetItem(o, i); + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 + if (!exc_state->exc_value) return; + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #else + exc_tb = exc_state->exc_traceback; + #endif + if (likely(exc_tb)) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + #if PY_VERSION_HEX >= 0x030B00a4 + Py_DECREF(exc_tb); + #endif + } #endif } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; +static CYTHON_INLINE +PyObject *__Pyx_Coroutine_MethodReturn(PyObject* gen, PyObject *retval) { + CYTHON_MAYBE_UNUSED_VAR(gen); + if (unlikely(!retval)) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (!__Pyx_PyErr_Occurred()) { + PyObject *exc = PyExc_StopIteration; + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + exc = __Pyx_PyExc_StopAsyncIteration; + #endif + __Pyx_PyErr_SetNone(exc); } } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; + return retval; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) +static CYTHON_INLINE +PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { +#if PY_VERSION_HEX <= 0x030A00A1 + return _PyGen_Send(gen, arg); +#else + PyObject *result; + if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { + if (PyAsyncGen_CheckExact(gen)) { + assert(result == Py_None); + PyErr_SetNone(PyExc_StopAsyncIteration); } - } else { - PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; - PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; - if (mm && mm->mp_subscript) { - PyObject *r, *key = PyInt_FromSsize_t(i); - if (unlikely(!key)) return NULL; - r = mm->mp_subscript(o, key); - Py_DECREF(key); - return r; + else if (result == Py_None) { + PyErr_SetNone(PyExc_StopIteration); } - if (likely(sm && sm->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { - Py_ssize_t l = sm->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); + else { +#if PY_VERSION_HEX < 0x030d00A1 + _PyGen_SetStopIterationValue(result); +#else + if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) { + PyErr_SetObject(PyExc_StopIteration, result); + } else { + PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result); + if (likely(exc != NULL)) { + PyErr_SetObject(PyExc_StopIteration, exc); + Py_DECREF(exc); } } - return sm->sq_item(o, i); +#endif } + Py_DECREF(result); + result = NULL; } -#else - if (is_list || !PyMapping_Check(o)) { - return PySequence_GetItem(o, i); - } + return result; #endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } - -/* PyObjectCallOneArg */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *args[2] = {NULL, arg}; - return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +#endif +static CYTHON_INLINE +PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { + PyObject *ret; + PyObject *val = NULL; + __Pyx_Coroutine_Undelegate(gen); + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); + ret = __Pyx_Coroutine_SendEx(gen, val, 0); + Py_XDECREF(val); + return ret; } - -/* ObjectGetItem */ -#if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { - PyObject *runerr = NULL; - Py_ssize_t key_value; - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, - "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); - __Pyx_DECREF_TypeName(index_type_name); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + gen->is_running = 1; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + ret = __Pyx_async_gen_asend_send(yf, value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyCoro_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + { + if (value == Py_None) + ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf); + else + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); + } + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + retval = __Pyx_Coroutine_FinishDelegation(gen); + } else { + retval = __Pyx_Coroutine_SendEx(gen, value, 0); } - return NULL; + return __Pyx_Coroutine_MethodReturn(self, retval); } -static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { - __Pyx_TypeName obj_type_name; - if (likely(PyType_Check(obj))) { - PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); - if (!meth) { - PyErr_Clear(); +static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { + PyObject *retval = NULL; + int err = 0; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + retval = __Pyx_Coroutine_Close(yf); + if (!retval) + return -1; + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + retval = __Pyx_Coroutine_Close(yf); + if (!retval) + return -1; + } else + if (__Pyx_CoroutineAwait_CheckExact(yf)) { + retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL); + if (!retval) + return -1; + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + retval = __Pyx_async_gen_asend_close(yf, NULL); + } else + if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { + retval = __Pyx_async_gen_athrow_close(yf, NULL); + } else + #endif + { + PyObject *meth; + gen->is_running = 1; + meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_close); + if (unlikely(!meth)) { + if (unlikely(PyErr_Occurred())) { + PyErr_WriteUnraisable(yf); + } } else { - PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + retval = __Pyx_PyObject_CallNoArg(meth); Py_DECREF(meth); - return result; + if (unlikely(!retval)) + err = -1; } - } - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, - "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { - PyTypeObject *tp = Py_TYPE(obj); - PyMappingMethods *mm = tp->tp_as_mapping; - PySequenceMethods *sm = tp->tp_as_sequence; - if (likely(mm && mm->mp_subscript)) { - return mm->mp_subscript(obj, key); - } - if (likely(sm && sm->sq_item)) { - return __Pyx_PyObject_GetIndex(obj, key); - } - return __Pyx_PyObject_GetItem_Slow(obj, key); -} -#endif - -/* KeywordStringCheck */ -static int __Pyx_CheckKeywordStrings( - PyObject *kw, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { - Py_ssize_t kwsize; -#if CYTHON_ASSUME_SAFE_MACROS - kwsize = PyTuple_GET_SIZE(kw); -#else - kwsize = PyTuple_Size(kw); - if (kwsize < 0) return 0; -#endif - if (unlikely(kwsize == 0)) - return 1; - if (!kw_allowed) { -#if CYTHON_ASSUME_SAFE_MACROS - key = PyTuple_GET_ITEM(kw, 0); -#else - key = PyTuple_GetItem(kw, pos); - if (!key) return 0; -#endif - goto invalid_keyword; + gen->is_running = 0; + } + Py_XDECREF(retval); + return err; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + gen->is_running = 1; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Next(yf); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, Py_None); + } else + #endif + ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf); + gen->is_running = 0; + if (likely(ret)) { + return ret; } -#if PY_VERSION_HEX < 0x03090000 - for (pos = 0; pos < kwsize; pos++) { -#if CYTHON_ASSUME_SAFE_MACROS - key = PyTuple_GET_ITEM(kw, pos); + return __Pyx_Coroutine_FinishDelegation(gen); + } + return __Pyx_Coroutine_SendEx(gen, Py_None, 0); +} +static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + return __Pyx_Coroutine_Close(self); +} +static PyObject *__Pyx_Coroutine_Close(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *retval, *raised_exception; + PyObject *yf = gen->yieldfrom; + int err = 0; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + Py_INCREF(yf); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); + retval = __Pyx_Coroutine_SendEx(gen, NULL, 1); + if (unlikely(retval)) { + const char *msg; + Py_DECREF(retval); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(self)) { + msg = "coroutine ignored GeneratorExit"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(self)) { +#if PY_VERSION_HEX < 0x03060000 + msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)"; #else - key = PyTuple_GetItem(kw, pos); - if (!key) return 0; + msg = "async generator ignored GeneratorExit"; #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; + #endif + } else { + msg = "generator ignored GeneratorExit"; } -#endif - return 1; + PyErr_SetString(PyExc_RuntimeError, msg); + return NULL; } - while (PyDict_Next(kw, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_Check(key))) + raised_exception = PyErr_Occurred(); + if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) { + if (raised_exception) PyErr_Clear(); + Py_INCREF(Py_None); + return Py_None; + } + return NULL; +} +static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, + PyObject *args, int close_on_genexit) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + Py_INCREF(yf); + if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { + int err = __Pyx_Coroutine_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Coroutine_Undelegate(gen); + if (err < 0) + return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); + goto throw_here; + } + gen->is_running = 1; + if (0 + #ifdef __Pyx_Generator_USED + || __Pyx_Generator_CheckExact(yf) #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; + #ifdef __Pyx_Coroutine_USED + || __Pyx_Coroutine_Check(yf) + #endif + ) { + ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { + ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); + #endif + } else { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (unlikely(PyErr_Occurred())) { + gen->is_running = 0; + return NULL; + } + __Pyx_Coroutine_Undelegate(gen); + gen->is_running = 0; + goto throw_here; + } + if (likely(args)) { + ret = __Pyx_PyObject_Call(meth, args, NULL); + } else { + PyObject *cargs[4] = {NULL, typ, val, tb}; + ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } + Py_DECREF(meth); + } + gen->is_running = 0; + Py_DECREF(yf); + if (!ret) { + ret = __Pyx_Coroutine_FinishDelegation(gen); + } + return __Pyx_Coroutine_MethodReturn(self, ret); } - if (!kw_allowed && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; -#endif -invalid_keyword: - #if PY_MAJOR_VERSION < 3 - PyErr_Format(PyExc_TypeError, - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - PyErr_Format(PyExc_TypeError, - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; +throw_here: + __Pyx_Raise(typ, val, tb, NULL); + return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); } - -/* GetAttr3 */ -#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 -static PyObject *__Pyx_GetAttr3Default(PyObject *d) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) +static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + PyObject *typ; + PyObject *val = NULL; + PyObject *tb = NULL; + if (unlikely(!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))) return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(d); - return d; + return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); } +static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_VISIT(exc_state->exc_value); +#else + Py_VISIT(exc_state->exc_type); + Py_VISIT(exc_state->exc_value); + Py_VISIT(exc_state->exc_traceback); #endif -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r; -#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 - int res = PyObject_GetOptionalAttr(o, n, &r); - return (res != 0) ? r : __Pyx_NewRef(d); + return 0; +} +static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); +} +static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + Py_CLEAR(gen->yieldfrom); + __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); + } +#endif + Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_frame); + Py_CLEAR(gen->gi_name); + Py_CLEAR(gen->gi_qualname); + Py_CLEAR(gen->gi_modulename); + return 0; +} +static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject_GC_UnTrack(gen); + if (gen->gi_weakreflist != NULL) + PyObject_ClearWeakRefs(self); + if (gen->resume_label >= 0) { + PyObject_GC_Track(self); +#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE + if (unlikely(PyObject_CallFinalizerFromDealloc(self))) #else - #if CYTHON_USE_TYPE_SLOTS - if (likely(PyString_Check(n))) { - r = __Pyx_PyObject_GetAttrStrNoError(o, n); - if (unlikely(!r) && likely(!PyErr_Occurred())) { - r = __Pyx_NewRef(d); + Py_TYPE(gen)->tp_del(self); + if (unlikely(Py_REFCNT(self) > 0)) +#endif + { + return; } - return r; + PyObject_GC_UnTrack(self); + } +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + /* We have to handle this case for asynchronous generators + right here, because this code has to be between UNTRACK + and GC_Del. */ + Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); } - #endif - r = PyObject_GetAttr(o, n); - return (likely(r)) ? r : __Pyx_GetAttr3Default(d); #endif + __Pyx_Coroutine_clear(self); + __Pyx_PyHeapTypeObject_GC_Del(gen); } - -/* RaiseUnexpectedTypeError */ -static int -__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) -{ - __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, - expected, obj_type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; -} - -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { +static void __Pyx_Coroutine_del(PyObject *self) { + PyObject *error_type, *error_value, *error_traceback; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; __Pyx_PyThreadState_declare - CYTHON_UNUSED_VAR(cause); - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; + if (gen->resume_label < 0) { + return; + } +#if !CYTHON_USE_TP_FINALIZE + assert(self->ob_refcnt == 0); + __Pyx_SET_REFCNT(self, 1); +#endif + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; + PyObject *finalizer = agen->ag_finalizer; + if (finalizer && !agen->ag_closed) { + PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); + if (unlikely(!res)) { + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + return; } } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; +#endif + if (unlikely(gen->resume_label == 0 && !error_value)) { +#ifdef __Pyx_Coroutine_USED +#ifdef __Pyx_Generator_USED + if (!__Pyx_Generator_CheckExact(self)) +#endif + { + PyObject_GC_UnTrack(self); +#if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat) + if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) + PyErr_WriteUnraisable(self); +#else + {PyObject *msg; + char *cmsg; + #if CYTHON_COMPILING_IN_PYPY + msg = NULL; + cmsg = (char*) "coroutine was never awaited"; + #else + char *cname; + PyObject *qualname; + qualname = gen->gi_qualname; + cname = PyString_AS_STRING(qualname); + msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname); + if (unlikely(!msg)) { + PyErr_Clear(); + cmsg = (char*) "coroutine was never awaited"; + } else { + cmsg = PyString_AS_STRING(msg); } + #endif + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0)) + PyErr_WriteUnraisable(self); + Py_XDECREF(msg);} #endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; + PyObject_GC_Track(self); } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; +#endif + } else { + PyObject *res = __Pyx_Coroutine_Close(self); + if (unlikely(!res)) { + if (PyErr_Occurred()) + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); } } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; + __Pyx_ErrRestore(error_type, error_value, error_traceback); +#if !CYTHON_USE_TP_FINALIZE + assert(Py_REFCNT(self) > 0); + if (likely(--self->ob_refcnt == 0)) { + return; + } + { + Py_ssize_t refcnt = Py_REFCNT(self); + _Py_NewReference(self); + __Pyx_SET_REFCNT(self, refcnt); + } +#if CYTHON_COMPILING_IN_CPYTHON + assert(PyType_IS_GC(Py_TYPE(self)) && + _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); + _Py_DEC_REFTOTAL; +#endif +#ifdef COUNT_ALLOCS + --Py_TYPE(self)->tp_frees; + --Py_TYPE(self)->tp_allocs; +#endif +#endif +} +static PyObject * +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_name; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; } +static int +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) #else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; + "__name__ must be set to a string object"); + return -1; } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(self->gi_name, value); + return 0; +} +static PyObject * +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_qualname; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; + "__qualname__ must be set to a string object"); + return -1; } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(self->gi_qualname, value); + return 0; +} +static PyObject * +__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) +{ + PyObject *frame = self->gi_frame; + CYTHON_UNUSED_VAR(context); + if (!frame) { + if (unlikely(!self->gi_code)) { + Py_RETURN_NONE; } - PyException_SetCause(value, fixed_cause); + frame = (PyObject *) PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (unlikely(!frame)) + return NULL; + self->gi_frame = frame; } - PyErr_SetObject(type, value); - if (tb) { - #if PY_VERSION_HEX >= 0x030C00A6 - PyException_SetTraceback(value, tb); - #elif CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } + Py_INCREF(frame); + return frame; +} +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (unlikely(!gen)) + return NULL; + return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + #if PY_VERSION_HEX >= 0x030B00a4 + gen->gi_exc_state.exc_value = NULL; + #else + gen->gi_exc_state.exc_type = NULL; + gen->gi_exc_state.exc_value = NULL; + gen->gi_exc_state.exc_traceback = NULL; + #endif +#if CYTHON_USE_EXC_INFO_STACK + gen->gi_exc_state.previous_item = NULL; +#endif + gen->gi_weakreflist = NULL; + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + Py_XINCREF(module_name); + gen->gi_modulename = module_name; + Py_XINCREF(code); + gen->gi_code = code; + gen->gi_frame = NULL; + PyObject_GC_Track(gen); + return gen; +} + +/* PyObject_GenericGetAttrNoDict */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif - } -bad: - Py_XDECREF(owned_instance); - return; + __Pyx_DECREF_TypeName(type_name); + return NULL; } -#endif - -/* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *module = 0; - PyObject *empty_dict = 0; - PyObject *empty_list = 0; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (unlikely(!py_import)) - goto bad; - if (!from_list) { - empty_list = PyList_New(0); - if (unlikely(!empty_list)) - goto bad; - from_list = empty_list; +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); + } + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); } + Py_INCREF(descr); + #if PY_MAJOR_VERSION < 3 + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) #endif - empty_dict = PyDict_New(); - if (unlikely(!empty_dict)) - goto bad; { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.') != NULL) { - module = PyImport_ImportModuleLevelObject( - name, __pyx_d, empty_dict, from_list, 1); - if (unlikely(!module)) { - if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (unlikely(!py_level)) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, __pyx_d, empty_dict, from_list, level); - #endif + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; } } -bad: - Py_XDECREF(empty_dict); - Py_XDECREF(empty_list); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); + return descr; +} +#endif + +/* PatchModuleWithCoroutine */ +static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + int result; + PyObject *globals, *result_obj; + globals = PyDict_New(); if (unlikely(!globals)) goto ignore; + result = PyDict_SetItemString(globals, "_cython_coroutine_type", + #ifdef __Pyx_Coroutine_USED + (PyObject*)__pyx_CoroutineType); + #else + Py_None); + #endif + if (unlikely(result < 0)) goto ignore; + result = PyDict_SetItemString(globals, "_cython_generator_type", + #ifdef __Pyx_Generator_USED + (PyObject*)__pyx_GeneratorType); + #else + Py_None); #endif + if (unlikely(result < 0)) goto ignore; + if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore; + if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore; + result_obj = PyRun_String(py_code, Py_file_input, globals, globals); + if (unlikely(!result_obj)) goto ignore; + Py_DECREF(result_obj); + Py_DECREF(globals); + return module; +ignore: + Py_XDECREF(globals); + PyErr_WriteUnraisable(module); + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) { + Py_DECREF(module); + module = NULL; + } +#else + py_code++; +#endif return module; } -/* ImportFrom */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - const char* module_name_str = 0; - PyObject* module_name = 0; - PyObject* module_dot = 0; - PyObject* full_name = 0; - PyErr_Clear(); - module_name_str = PyModule_GetName(module); - if (unlikely(!module_name_str)) { goto modbad; } - module_name = PyUnicode_FromString(module_name_str); - if (unlikely(!module_name)) { goto modbad; } - module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__3); - if (unlikely(!module_dot)) { goto modbad; } - full_name = PyUnicode_Concat(module_dot, name); - if (unlikely(!full_name)) { goto modbad; } - #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) - { - PyObject *modules = PyImport_GetModuleDict(); - if (unlikely(!modules)) - goto modbad; - value = PyObject_GetItem(modules, full_name); +/* PatchGeneratorABC */ +#ifndef CYTHON_REGISTER_ABCS +#define CYTHON_REGISTER_ABCS 1 +#endif +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) +static PyObject* __Pyx_patch_abc_module(PyObject *module); +static PyObject* __Pyx_patch_abc_module(PyObject *module) { + module = __Pyx_Coroutine_patch_module( + module, "" +"if _cython_generator_type is not None:\n" +" try: Generator = _module.Generator\n" +" except AttributeError: pass\n" +" else: Generator.register(_cython_generator_type)\n" +"if _cython_coroutine_type is not None:\n" +" try: Coroutine = _module.Coroutine\n" +" except AttributeError: pass\n" +" else: Coroutine.register(_cython_coroutine_type)\n" + ); + return module; +} +#endif +static int __Pyx_patch_abc(void) { +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + static int abc_patched = 0; + if (CYTHON_REGISTER_ABCS && !abc_patched) { + PyObject *module; + module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections"); + if (unlikely(!module)) { + PyErr_WriteUnraisable(NULL); + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, + ((PY_MAJOR_VERSION >= 3) ? + "Cython module failed to register with collections.abc module" : + "Cython module failed to register with collections module"), 1) < 0)) { + return -1; + } + } else { + module = __Pyx_patch_abc_module(module); + abc_patched = 1; + if (unlikely(!module)) + return -1; + Py_DECREF(module); + } + module = PyImport_ImportModule("backports_abc"); + if (module) { + module = __Pyx_patch_abc_module(module); + Py_XDECREF(module); + } + if (!module) { + PyErr_Clear(); } - #else - value = PyImport_GetModule(full_name); - #endif - modbad: - Py_XDECREF(full_name); - Py_XDECREF(module_dot); - Py_XDECREF(module_name); - } - if (unlikely(!value)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif } - return value; -} - -/* GetAttr */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) #else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); + if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL); #endif - return PyObject_GetAttr(o, n); + return 0; } -/* HasAttr */ -#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 -static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { - PyObject *r; - if (unlikely(!__Pyx_PyBaseString_Check(n))) { - PyErr_SetString(PyExc_TypeError, - "hasattr(): attribute name must be string"); - return -1; - } - r = __Pyx_GetAttr(o, n); - if (!r) { - PyErr_Clear(); - return 0; - } else { - Py_DECREF(r); - return 1; - } +/* Coroutine */ +static void __Pyx_CoroutineAwait_dealloc(PyObject *self) { + PyObject_GC_UnTrack(self); + Py_CLEAR(((__pyx_CoroutineAwaitObject*)self)->coroutine); + __Pyx_PyHeapTypeObject_GC_Del(self); +} +static int __Pyx_CoroutineAwait_traverse(__pyx_CoroutineAwaitObject *self, visitproc visit, void *arg) { + Py_VISIT(self->coroutine); + return 0; +} +static int __Pyx_CoroutineAwait_clear(__pyx_CoroutineAwaitObject *self) { + Py_CLEAR(self->coroutine); + return 0; +} +static PyObject *__Pyx_CoroutineAwait_Next(__pyx_CoroutineAwaitObject *self) { + return __Pyx_Generator_Next(self->coroutine); +} +static PyObject *__Pyx_CoroutineAwait_Send(__pyx_CoroutineAwaitObject *self, PyObject *value) { + return __Pyx_Coroutine_Send(self->coroutine, value); +} +static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args) { + return __Pyx_Coroutine_Throw(self->coroutine, args); +} +static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + return __Pyx_Coroutine_Close(self->coroutine); +} +static PyObject *__Pyx_CoroutineAwait_self(PyObject *self) { + Py_INCREF(self); + return self; +} +#if !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_CoroutineAwait_no_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { + CYTHON_UNUSED_VAR(type); + CYTHON_UNUSED_VAR(args); + CYTHON_UNUSED_VAR(kwargs); + PyErr_SetString(PyExc_TypeError, "cannot instantiate type, use 'await coroutine' instead"); + return NULL; +} +#endif +static PyObject *__Pyx_CoroutineAwait_reduce_ex(__pyx_CoroutineAwaitObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + PyErr_Format(PyExc_TypeError, "cannot pickle '%.200s' object", + Py_TYPE(self)->tp_name); + return NULL; } +static PyMethodDef __pyx_CoroutineAwait_methods[] = { + {"send", (PyCFunction) __Pyx_CoroutineAwait_Send, METH_O, + (char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_CoroutineAwait_Throw, METH_VARARGS, + (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_CoroutineAwait_Close, METH_NOARGS, + (char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")}, + {"__reduce_ex__", (PyCFunction) __Pyx_CoroutineAwait_reduce_ex, METH_O, 0}, + {"__reduce__", (PyCFunction) __Pyx_CoroutineAwait_reduce_ex, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CoroutineAwaitType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CoroutineAwait_dealloc}, + {Py_tp_traverse, (void *)__Pyx_CoroutineAwait_traverse}, + {Py_tp_clear, (void *)__Pyx_CoroutineAwait_clear}, +#if !CYTHON_COMPILING_IN_PYPY + {Py_tp_new, (void *)__Pyx_CoroutineAwait_no_new}, +#endif + {Py_tp_methods, (void *)__pyx_CoroutineAwait_methods}, + {Py_tp_iter, (void *)__Pyx_CoroutineAwait_self}, + {Py_tp_iternext, (void *)__Pyx_CoroutineAwait_Next}, + {0, 0}, +}; +static PyType_Spec __pyx_CoroutineAwaitType_spec = { + __PYX_TYPE_MODULE_PREFIX "coroutine_wrapper", + sizeof(__pyx_CoroutineAwaitObject), + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + __pyx_CoroutineAwaitType_slots +}; +#else +static PyTypeObject __pyx_CoroutineAwaitType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "coroutine_wrapper", + sizeof(__pyx_CoroutineAwaitObject), + 0, + (destructor) __Pyx_CoroutineAwait_dealloc, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + PyDoc_STR("A wrapper object implementing __await__ for coroutines."), + (traverseproc) __Pyx_CoroutineAwait_traverse, + (inquiry) __Pyx_CoroutineAwait_clear, + 0, + 0, + __Pyx_CoroutineAwait_self, + (iternextfunc) __Pyx_CoroutineAwait_Next, + __pyx_CoroutineAwait_methods, + 0 , + 0 , + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if !CYTHON_COMPILING_IN_PYPY + __Pyx_CoroutineAwait_no_new, +#else + 0, +#endif + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, #endif - -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - __Pyx_TypeName type_name; - __Pyx_TypeName obj_type_name; - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - type_name = __Pyx_PyType_GetName(type); - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME - ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); - __Pyx_DECREF_TypeName(type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; +}; +#endif +#if PY_VERSION_HEX < 0x030500B1 || defined(__Pyx_IterableCoroutine_USED) || CYTHON_USE_ASYNC_SLOTS +static CYTHON_INLINE PyObject *__Pyx__Coroutine_await(PyObject *coroutine) { + __pyx_CoroutineAwaitObject *await = PyObject_GC_New(__pyx_CoroutineAwaitObject, __pyx_CoroutineAwaitType); + if (unlikely(!await)) return NULL; + Py_INCREF(coroutine); + await->coroutine = coroutine; + PyObject_GC_Track(await); + return (PyObject*)await; } - -/* PyObjectCall2Args */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args[3] = {NULL, arg1, arg2}; - return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +#endif +#if PY_VERSION_HEX < 0x030500B1 +static PyObject *__Pyx_Coroutine_await_method(PyObject *coroutine, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + return __Pyx__Coroutine_await(coroutine); } - -/* PyObjectGetMethod */ -static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { - PyObject *attr; -#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP - __Pyx_TypeName type_name; - PyTypeObject *tp = Py_TYPE(obj); - PyObject *descr; - descrgetfunc f = NULL; - PyObject **dictptr, *dict; - int meth_found = 0; - assert (*method == NULL); - if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { - attr = __Pyx_PyObject_GetAttrStr(obj, name); - goto try_unpack; +#endif +#if defined(__Pyx_IterableCoroutine_USED) || CYTHON_USE_ASYNC_SLOTS +static PyObject *__Pyx_Coroutine_await(PyObject *coroutine) { + if (unlikely(!coroutine || !__Pyx_Coroutine_Check(coroutine))) { + PyErr_SetString(PyExc_TypeError, "invalid input, expected coroutine"); + return NULL; } - if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { - return 0; + return __Pyx__Coroutine_await(coroutine); +} +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1 +static PyObject *__Pyx_Coroutine_compare(PyObject *obj, PyObject *other, int op) { + PyObject* result; + switch (op) { + case Py_EQ: result = (other == obj) ? Py_True : Py_False; break; + case Py_NE: result = (other != obj) ? Py_True : Py_False; break; + default: + result = Py_NotImplemented; } - descr = _PyType_Lookup(tp, name); - if (likely(descr != NULL)) { - Py_INCREF(descr); -#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR - if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) -#elif PY_MAJOR_VERSION >= 3 - #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) - #else - if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) - #endif + Py_INCREF(result); + return result; +} +#endif +static PyMethodDef __pyx_Coroutine_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + (char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next iterated value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next iterated value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, + (char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")}, +#if PY_VERSION_HEX < 0x030500B1 + {"__await__", (PyCFunction) __Pyx_Coroutine_await_method, METH_NOARGS, + (char*) PyDoc_STR("__await__() -> return an iterator to be used in await expression.")}, +#endif + {0, 0, 0, 0} +}; +static PyMemberDef __pyx_Coroutine_memberlist[] = { + {(char *) "cr_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL}, + {(char*) "cr_await", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + (char*) PyDoc_STR("object being awaited, or None")}, + {(char*) "cr_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, +#if CYTHON_USE_TYPE_SPECS + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyGetSetDef __pyx_Coroutine_getsets[] = { + {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + (char*) PyDoc_STR("name of the coroutine"), 0}, + {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + (char*) PyDoc_STR("qualified name of the coroutine"), 0}, + {(char *) "cr_frame", (getter)__Pyx_Coroutine_get_frame, NULL, + (char*) PyDoc_STR("Frame of the coroutine"), 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CoroutineType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, + {Py_am_await, (void *)&__Pyx_Coroutine_await}, + {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse}, + {Py_tp_methods, (void *)__pyx_Coroutine_methods}, + {Py_tp_members, (void *)__pyx_Coroutine_memberlist}, + {Py_tp_getset, (void *)__pyx_Coroutine_getsets}, + {Py_tp_getattro, (void *) __Pyx_PyObject_GenericGetAttrNoDict}, +#if CYTHON_USE_TP_FINALIZE + {Py_tp_finalize, (void *)__Pyx_Coroutine_del}, +#endif + {0, 0}, +}; +static PyType_Spec __pyx_CoroutineType_spec = { + __PYX_TYPE_MODULE_PREFIX "coroutine", + sizeof(__pyx_CoroutineObject), + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, + __pyx_CoroutineType_slots +}; #else - #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) - #else - if (likely(PyFunction_Check(descr))) - #endif +#if CYTHON_USE_ASYNC_SLOTS +static __Pyx_PyAsyncMethodsStruct __pyx_Coroutine_as_async = { + __Pyx_Coroutine_await, + 0, + 0, +#if PY_VERSION_HEX >= 0x030A00A3 + 0, #endif - { - meth_found = 1; - } else { - f = Py_TYPE(descr)->tp_descr_get; - if (f != NULL && PyDescr_IsData(descr)) { - attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); - Py_DECREF(descr); - goto try_unpack; - } - } - } - dictptr = _PyObject_GetDictPtr(obj); - if (dictptr != NULL && (dict = *dictptr) != NULL) { - Py_INCREF(dict); - attr = __Pyx_PyDict_GetItemStr(dict, name); - if (attr != NULL) { - Py_INCREF(attr); - Py_DECREF(dict); - Py_XDECREF(descr); - goto try_unpack; - } - Py_DECREF(dict); - } - if (meth_found) { - *method = descr; - return 1; - } - if (f != NULL) { - attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); - Py_DECREF(descr); - goto try_unpack; - } - if (likely(descr != NULL)) { - *method = descr; - return 0; - } - type_name = __Pyx_PyType_GetName(tp); - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", - type_name, name); +}; +#endif +static PyTypeObject __pyx_CoroutineType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "coroutine", + sizeof(__pyx_CoroutineObject), + 0, + (destructor) __Pyx_Coroutine_dealloc, + 0, + 0, + 0, +#if CYTHON_USE_ASYNC_SLOTS + &__pyx_Coroutine_as_async, #else - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", - type_name, PyString_AS_STRING(name)); + 0, #endif - __Pyx_DECREF_TypeName(type_name); - return 0; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, + 0, + (traverseproc) __Pyx_Coroutine_traverse, + 0, +#if CYTHON_USE_ASYNC_SLOTS && CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1 + __Pyx_Coroutine_compare, #else - attr = __Pyx_PyObject_GetAttrStr(obj, name); - goto try_unpack; + 0, #endif -try_unpack: -#if CYTHON_UNPACK_METHODS - if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { - PyObject *function = PyMethod_GET_FUNCTION(attr); - Py_INCREF(function); - Py_DECREF(attr); - *method = function; - return 1; - } + offsetof(__pyx_CoroutineObject, gi_weakreflist), + 0, + 0, + __pyx_Coroutine_methods, + __pyx_Coroutine_memberlist, + __pyx_Coroutine_getsets, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if CYTHON_USE_TP_FINALIZE + 0, +#else + __Pyx_Coroutine_del, #endif - *method = attr; + 0, +#if CYTHON_USE_TP_FINALIZE + __Pyx_Coroutine_del, +#elif PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, +#endif +}; +#endif +static int __pyx_Coroutine_init(PyObject *module) { + CYTHON_MAYBE_UNUSED_VAR(module); +#if CYTHON_USE_TYPE_SPECS + __pyx_CoroutineType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CoroutineType_spec, NULL); +#else + __pyx_CoroutineType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + __pyx_CoroutineType = __Pyx_FetchCommonType(&__pyx_CoroutineType_type); +#endif + if (unlikely(!__pyx_CoroutineType)) + return -1; +#ifdef __Pyx_IterableCoroutine_USED + if (unlikely(__pyx_IterableCoroutine_init(module) == -1)) + return -1; +#endif +#if CYTHON_USE_TYPE_SPECS + __pyx_CoroutineAwaitType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CoroutineAwaitType_spec, NULL); +#else + __pyx_CoroutineAwaitType = __Pyx_FetchCommonType(&__pyx_CoroutineAwaitType_type); +#endif + if (unlikely(!__pyx_CoroutineAwaitType)) + return -1; return 0; } -/* PyObjectCallMethod1 */ -#if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2) -static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { - PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); - Py_DECREF(method); - return result; +/* GetAwaitIter */ +static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o) { +#ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(o)) { + return __Pyx_NewRef(o); + } +#endif + return __Pyx__Coroutine_GetAwaitableIter(o); } +static void __Pyx_Coroutine_AwaitableIterError(PyObject *source) { +#if PY_VERSION_HEX >= 0x030600B3 && PY_VERSION_HEX < 0x030d0000 || defined(_PyErr_FormatFromCause) + __Pyx_TypeName source_type_name = __Pyx_PyType_GetName(Py_TYPE(source)); + _PyErr_FormatFromCause(PyExc_TypeError, + "'async for' received an invalid object from __anext__: " __Pyx_FMT_TYPENAME, source_type_name); + __Pyx_DECREF_TypeName(source_type_name); +#elif PY_MAJOR_VERSION >= 3 + PyObject *exc, *val, *val2, *tb; + __Pyx_TypeName source_type_name = __Pyx_PyType_GetName(Py_TYPE(source)); + assert(PyErr_Occurred()); + PyErr_Fetch(&exc, &val, &tb); + PyErr_NormalizeException(&exc, &val, &tb); + if (tb != NULL) { + PyException_SetTraceback(val, tb); + Py_DECREF(tb); + } + Py_DECREF(exc); + assert(!PyErr_Occurred()); + PyErr_Format(PyExc_TypeError, + "'async for' received an invalid object from __anext__: " __Pyx_FMT_TYPENAME, source_type_name); + __Pyx_DECREF_TypeName(source_type_name); + PyErr_Fetch(&exc, &val2, &tb); + PyErr_NormalizeException(&exc, &val2, &tb); + Py_INCREF(val); + PyException_SetCause(val2, val); + PyException_SetContext(val2, val); + PyErr_Restore(exc, val2, tb); +#else + CYTHON_UNUSED_VAR(source); #endif -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { -#if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2 - PyObject *args[2] = {obj, arg}; - (void) __Pyx_PyObject_GetMethod; - (void) __Pyx_PyObject_CallOneArg; - (void) __Pyx_PyObject_Call2Args; - return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +} +static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) { + PyObject *res; +#if CYTHON_USE_ASYNC_SLOTS + __Pyx_PyAsyncMethodsStruct* am = __Pyx_PyType_AsAsync(obj); + if (likely(am && am->am_await)) { + res = (*am->am_await)(obj); + } else +#endif +#if PY_VERSION_HEX >= 0x030500B2 || defined(PyCoro_CheckExact) + if (PyCoro_CheckExact(obj)) { + return __Pyx_NewRef(obj); + } else +#endif +#if CYTHON_COMPILING_IN_CPYTHON && defined(CO_ITERABLE_COROUTINE) +#if PY_VERSION_HEX >= 0x030C00A6 + if (PyGen_CheckExact(obj) && (PyGen_GetCode((PyGenObject*)obj)->co_flags & CO_ITERABLE_COROUTINE)) { #else - PyObject *method = NULL, *result; - int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); - if (likely(is_method)) { - result = __Pyx_PyObject_Call2Args(method, obj, arg); + if (PyGen_CheckExact(obj) && ((PyGenObject*)obj)->gi_code && ((PyCodeObject *)((PyGenObject*)obj)->gi_code)->co_flags & CO_ITERABLE_COROUTINE) { +#endif + return __Pyx_NewRef(obj); + } else +#endif + { + PyObject *method = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, __pyx_n_s_await, &method); + if (likely(is_method)) { + res = __Pyx_PyObject_CallOneArg(method, obj); + } else if (likely(method)) { + res = __Pyx_PyObject_CallNoArg(method); + } else + goto slot_error; Py_DECREF(method); - return result; } - if (unlikely(!method)) return NULL; - return __Pyx__PyObject_CallMethod1(method, arg); -#endif -} - -/* append */ -static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; - } else { - PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); - if (unlikely(!retval)) - return -1; - Py_DECREF(retval); + if (unlikely(!res)) { + __Pyx_Coroutine_AwaitableIterError(obj); + goto bad; } - return 0; -} - -/* decode_c_bytes */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( - const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - if (unlikely((start < 0) | (stop < 0))) { - if (start < 0) { - start += length; - if (start < 0) - start = 0; + if (unlikely(!PyIter_Check(res))) { + __Pyx_TypeName res_type_name = __Pyx_PyType_GetName(Py_TYPE(res)); + PyErr_Format(PyExc_TypeError, + "__await__() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", res_type_name); + __Pyx_DECREF_TypeName(res_type_name); + Py_CLEAR(res); + } else { + int is_coroutine = 0; + #ifdef __Pyx_Coroutine_USED + is_coroutine |= __Pyx_Coroutine_Check(res); + #endif + #if PY_VERSION_HEX >= 0x030500B2 || defined(PyCoro_CheckExact) + is_coroutine |= PyCoro_CheckExact(res); + #endif + if (unlikely(is_coroutine)) { + /* __await__ must return an *iterator*, not + a coroutine or another awaitable (see PEP 492) */ + PyErr_SetString(PyExc_TypeError, + "__await__() returned a coroutine"); + Py_CLEAR(res); } - if (stop < 0) - stop += length; } - if (stop > length) - stop = length; - if (unlikely(stop <= start)) - return __Pyx_NewRef(__pyx_empty_unicode); - length = stop - start; - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); + return res; +slot_error: + { + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "object " __Pyx_FMT_TYPENAME " can't be used in 'await' expression", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); } +bad: + return NULL; } -/* DictGetItem */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - if (unlikely(PyTuple_Check(key))) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) { - PyErr_SetObject(PyExc_KeyError, args); - Py_DECREF(args); - } - } else { - PyErr_SetObject(PyExc_KeyError, key); - } - } +/* CoroutineYieldFrom */ + static PyObject* __Pyx__Coroutine_Yield_From_Generic(__pyx_CoroutineObject *gen, PyObject *source) { + PyObject *retval; + PyObject *source_gen = __Pyx__Coroutine_GetAwaitableIter(source); + if (unlikely(!source_gen)) { return NULL; } - Py_INCREF(value); - return value; -} -#endif - -/* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; + if (__Pyx_Coroutine_Check(source_gen)) { + retval = __Pyx_Generator_Next(source_gen); + } else { + retval = __Pyx_PyObject_GetIterNextFunc(source_gen)(source_gen); } - return exc_info; + if (retval) { + gen->yieldfrom = source_gen; + return retval; + } + Py_DECREF(source_gen); + return NULL; } +static CYTHON_INLINE PyObject* __Pyx_Coroutine_Yield_From(__pyx_CoroutineObject *gen, PyObject *source) { + PyObject *retval; + if (__Pyx_Coroutine_Check(source)) { + if (unlikely(((__pyx_CoroutineObject*)source)->yieldfrom)) { + PyErr_SetString( + PyExc_RuntimeError, + "coroutine is being awaited already"); + return NULL; + } + retval = __Pyx_Generator_Next(source); +#ifdef __Pyx_AsyncGen_USED + } else if (__pyx_PyAsyncGenASend_CheckExact(source)) { + retval = __Pyx_async_gen_asend_iternext(source); #endif - -/* SaveResetException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - PyObject *exc_value = exc_info->exc_value; - if (exc_value == NULL || exc_value == Py_None) { - *value = NULL; - *type = NULL; - *tb = NULL; } else { - *value = exc_value; - Py_INCREF(*value); - *type = (PyObject*) Py_TYPE(exc_value); - Py_INCREF(*type); - *tb = PyException_GetTraceback(exc_value); + return __Pyx__Coroutine_Yield_From_Generic(gen, source); } - #elif CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); - #endif -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 - _PyErr_StackItem *exc_info = tstate->exc_info; - PyObject *tmp_value = exc_info->exc_value; - exc_info->exc_value = value; - Py_XDECREF(tmp_value); - Py_XDECREF(type); - Py_XDECREF(tb); - #else - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - #endif + if (retval) { + Py_INCREF(source); + gen->yieldfrom = source; + } + return retval; } -#endif /* GetException */ -#if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) @@ -22042,8 +29850,182 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return -1; } +/* pep479 */ + static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) { + PyObject *exc, *val, *tb, *cur_exc; + __Pyx_PyThreadState_declare + #ifdef __Pyx_StopAsyncIteration_USED + int is_async_stopiteration = 0; + #endif + CYTHON_MAYBE_UNUSED_VAR(in_async_gen); + cur_exc = PyErr_Occurred(); + if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) { + #ifdef __Pyx_StopAsyncIteration_USED + if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, __Pyx_PyExc_StopAsyncIteration))) { + is_async_stopiteration = 1; + } else + #endif + return; + } + __Pyx_PyThreadState_assign + __Pyx_GetException(&exc, &val, &tb); + Py_XDECREF(exc); + Py_XDECREF(val); + Py_XDECREF(tb); + PyErr_SetString(PyExc_RuntimeError, + #ifdef __Pyx_StopAsyncIteration_USED + is_async_stopiteration ? "async generator raised StopAsyncIteration" : + in_async_gen ? "async generator raised StopIteration" : + #endif + "generator raised StopIteration"); +} + +/* append */ + static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; + } else { + PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); + if (unlikely(!retval)) + return -1; + Py_DECREF(retval); + } + return 0; +} + +/* RaiseTooManyValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* IterFinish */ + static CYTHON_INLINE int __Pyx_IterFinish(void) { + PyObject* exc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (unlikely(exc_type)) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) + return -1; + __Pyx_PyErr_Clear(); + return 0; + } + return 0; +} + +/* UnpackItemEndCheck */ + static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* ReturnWithStopIteration */ + static void __Pyx__ReturnWithStopIteration(PyObject* value) { + PyObject *exc, *args; +#if CYTHON_COMPILING_IN_CPYTHON + __Pyx_PyThreadState_declare + if (PY_VERSION_HEX >= 0x030C00A6 + || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) { + args = PyTuple_New(1); + if (unlikely(!args)) return; + Py_INCREF(value); + PyTuple_SET_ITEM(args, 0, value); + exc = PyType_Type.tp_call(PyExc_StopIteration, args, NULL); + Py_DECREF(args); + if (!exc) return; + } else { + Py_INCREF(value); + exc = value; + } + #if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + #if CYTHON_USE_EXC_INFO_STACK + if (!__pyx_tstate->exc_info->exc_value) + #else + if (!__pyx_tstate->exc_type) + #endif + { + Py_INCREF(PyExc_StopIteration); + __Pyx_ErrRestore(PyExc_StopIteration, exc, NULL); + return; + } + #endif +#else + args = PyTuple_Pack(1, value); + if (unlikely(!args)) return; + exc = PyObject_Call(PyExc_StopIteration, args, NULL); + Py_DECREF(args); + if (unlikely(!exc)) return; +#endif + PyErr_SetObject(PyExc_StopIteration, exc); + Py_DECREF(exc); +} + +/* decode_c_bytes */ + static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( + const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { + if (unlikely((start < 0) | (stop < 0))) { + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + } + if (stop > length) + stop = length; + if (unlikely(stop <= start)) + return __Pyx_NewRef(__pyx_empty_unicode); + length = stop - start; + cstring += start; + if (decode_func) { + return decode_func(cstring, length, errors); + } else { + return PyUnicode_Decode(cstring, length, encoding, errors); + } +} + +/* DictGetItem */ + #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } + } + return NULL; + } + Py_INCREF(value); + return value; +} +#endif + /* ExtTypeTest */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { __Pyx_TypeName obj_type_name; __Pyx_TypeName type_name; if (unlikely(!type)) { @@ -22062,87 +30044,8 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } -/* FixUpExtensionType */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { -#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API - CYTHON_UNUSED_VAR(spec); - CYTHON_UNUSED_VAR(type); -#else - const PyType_Slot *slot = spec->slots; - while (slot && slot->slot && slot->slot != Py_tp_members) - slot++; - if (slot && slot->slot == Py_tp_members) { - int changed = 0; -#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) - const -#endif - PyMemberDef *memb = (PyMemberDef*) slot->pfunc; - while (memb && memb->name) { - if (memb->name[0] == '_' && memb->name[1] == '_') { -#if PY_VERSION_HEX < 0x030900b1 - if (strcmp(memb->name, "__weaklistoffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); - type->tp_weaklistoffset = memb->offset; - changed = 1; - } - else if (strcmp(memb->name, "__dictoffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); - type->tp_dictoffset = memb->offset; - changed = 1; - } -#if CYTHON_METH_FASTCALL - else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); -#if PY_VERSION_HEX >= 0x030800b4 - type->tp_vectorcall_offset = memb->offset; -#else - type->tp_print = (printfunc) memb->offset; -#endif - changed = 1; - } -#endif -#else - if ((0)); -#endif -#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON - else if (strcmp(memb->name, "__module__") == 0) { - PyObject *descr; - assert(memb->type == T_OBJECT); - assert(memb->flags == 0 || memb->flags == READONLY); - descr = PyDescr_NewMember(type, memb); - if (unlikely(!descr)) - return -1; - if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { - Py_DECREF(descr); - return -1; - } - Py_DECREF(descr); - changed = 1; - } -#endif - } - memb++; - } - if (changed) - PyType_Modified(type); - } -#endif - return 0; -} -#endif - -/* PyObjectCallNoArg */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { - PyObject *arg[2] = {NULL, NULL}; - return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); -} - /* PyObjectCallMethod0 */ -static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { PyObject *method = NULL, *result = NULL; int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); if (likely(is_method)) { @@ -22158,7 +30061,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name } /* ValidateBasesTuple */ -#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS + #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { Py_ssize_t i, n; #if CYTHON_ASSUME_SAFE_MACROS @@ -22243,7 +30146,7 @@ static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffs #endif /* PyType_Ready */ -static int __Pyx_PyType_Ready(PyTypeObject *t) { + static int __Pyx_PyType_Ready(PyTypeObject *t) { #if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) (void)__Pyx_PyObject_CallMethod0; #if CYTHON_USE_TYPE_SPECS @@ -22324,50 +30227,8 @@ static int __Pyx_PyType_Ready(PyTypeObject *t) { #endif } -/* PyObject_GenericGetAttrNoDict */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { - __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", - type_name, attr_name); -#else - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", - type_name, PyString_AS_STRING(attr_name)); -#endif - __Pyx_DECREF_TypeName(type_name); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { - PyObject *descr; - PyTypeObject *tp = Py_TYPE(obj); - if (unlikely(!PyString_Check(attr_name))) { - return PyObject_GenericGetAttr(obj, attr_name); - } - assert(!tp->tp_dictoffset); - descr = _PyType_Lookup(tp, attr_name); - if (unlikely(!descr)) { - return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); - } - Py_INCREF(descr); - #if PY_MAJOR_VERSION < 3 - if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) - #endif - { - descrgetfunc f = Py_TYPE(descr)->tp_descr_get; - if (unlikely(f)) { - PyObject *res = f(descr, obj, (PyObject *)tp); - Py_DECREF(descr); - return res; - } - } - return descr; -} -#endif - /* PyObject_GenericGetAttr */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { return PyObject_GenericGetAttr(obj, attr_name); @@ -22377,7 +30238,7 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #endif /* SetVTable */ -static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { PyObject *ob = PyCapsule_New(vtable, 0, 0); if (unlikely(!ob)) goto bad; @@ -22395,7 +30256,7 @@ static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { } /* GetVTable */ -static void* __Pyx_GetVtable(PyTypeObject *type) { + static void* __Pyx_GetVtable(PyTypeObject *type) { void* ptr; #if CYTHON_COMPILING_IN_LIMITED_API PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); @@ -22415,7 +30276,7 @@ static void* __Pyx_GetVtable(PyTypeObject *type) { } /* MergeVTables */ -#if !CYTHON_COMPILING_IN_LIMITED_API + #if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_MergeVtables(PyTypeObject *type) { int i; void** base_vtables; @@ -22468,7 +30329,7 @@ static int __Pyx_MergeVtables(PyTypeObject *type) { #endif /* SetupReduce */ -#if !CYTHON_COMPILING_IN_LIMITED_API + #if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; @@ -22578,114 +30439,8 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } #endif -/* FetchSharedCythonModule */ -static PyObject *__Pyx_FetchSharedCythonABIModule(void) { - return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME); -} - -/* FetchCommonType */ -static int __Pyx_VerifyCachedType(PyObject *cached_type, - const char *name, - Py_ssize_t basicsize, - Py_ssize_t expected_basicsize) { - if (!PyType_Check(cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", name); - return -1; - } - if (basicsize != expected_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - name); - return -1; - } - return 0; -} -#if !CYTHON_USE_TYPE_SPECS -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* abi_module; - const char* object_name; - PyTypeObject *cached_type = NULL; - abi_module = __Pyx_FetchSharedCythonABIModule(); - if (!abi_module) return NULL; - object_name = strrchr(type->tp_name, '.'); - object_name = object_name ? object_name+1 : type->tp_name; - cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); - if (cached_type) { - if (__Pyx_VerifyCachedType( - (PyObject *)cached_type, - object_name, - cached_type->tp_basicsize, - type->tp_basicsize) < 0) { - goto bad; - } - goto done; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; -done: - Py_DECREF(abi_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} -#else -static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { - PyObject *abi_module, *cached_type = NULL; - const char* object_name = strrchr(spec->name, '.'); - object_name = object_name ? object_name+1 : spec->name; - abi_module = __Pyx_FetchSharedCythonABIModule(); - if (!abi_module) return NULL; - cached_type = PyObject_GetAttrString(abi_module, object_name); - if (cached_type) { - Py_ssize_t basicsize; -#if CYTHON_COMPILING_IN_LIMITED_API - PyObject *py_basicsize; - py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); - if (unlikely(!py_basicsize)) goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; -#else - basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; -#endif - if (__Pyx_VerifyCachedType( - cached_type, - object_name, - basicsize, - spec->basicsize) < 0) { - goto bad; - } - goto done; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - CYTHON_UNUSED_VAR(module); - cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); - if (unlikely(!cached_type)) goto bad; - if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; - if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; -done: - Py_DECREF(abi_module); - assert(cached_type == NULL || PyType_Check(cached_type)); - return (PyTypeObject *) cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} -#endif - /* PyVectorcallFastCallDict */ -#if CYTHON_METH_FASTCALL + #if CYTHON_METH_FASTCALL static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) { PyObject *res = NULL; @@ -22741,7 +30496,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, _ #endif /* CythonFunctionShared */ -#if CYTHON_COMPILING_IN_LIMITED_API + #if CYTHON_COMPILING_IN_LIMITED_API static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { if (__Pyx_CyFunction_Check(func)) { return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; @@ -23743,7 +31498,7 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py } /* CythonFunction */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { PyObject *op = __Pyx_CyFunction_Init( PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), @@ -23756,7 +31511,7 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qual } /* Py3UpdateBases */ -static PyObject* + static PyObject* __Pyx_PEP560_update_bases(PyObject *bases) { Py_ssize_t i, j, size_bases; @@ -23824,7 +31579,7 @@ __Pyx_PEP560_update_bases(PyObject *bases) } /* SetNewInClass */ -static int __Pyx_SetNewInClass(PyObject *ns, PyObject *name, PyObject *value) { + static int __Pyx_SetNewInClass(PyObject *ns, PyObject *name, PyObject *value) { #ifdef __Pyx_CyFunction_USED int ret; if (__Pyx_CyFunction_Check(value)) { @@ -23839,7 +31594,7 @@ static int __Pyx_SetNewInClass(PyObject *ns, PyObject *name, PyObject *value) { } /* CalculateMetaclass */ -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { Py_ssize_t i, nbases; #if CYTHON_ASSUME_SAFE_MACROS nbases = PyTuple_GET_SIZE(bases); @@ -23889,7 +31644,7 @@ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bas } /* PyObjectLookupSpecial */ -#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) { PyObject *res; PyTypeObject *tp = Py_TYPE(obj); @@ -23913,7 +31668,7 @@ static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyOb #endif /* Py3ClassCreate */ -static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, + static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { PyObject *ns; if (metaclass) { @@ -24120,12 +31875,12 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj } /* Globals */ -static PyObject* __Pyx_Globals(void) { + static PyObject* __Pyx_Globals(void) { return __Pyx_NewRef(__pyx_d); } /* UnpackUnboundCMethod */ -static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { PyObject *result; PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); if (unlikely(!selfless_args)) return NULL; @@ -24187,7 +31942,7 @@ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { } /* CallUnboundCMethod1 */ -#if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { if (likely(cfunc->func)) { int flag = cfunc->flag; @@ -24239,7 +31994,7 @@ static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObje } /* CallUnboundCMethod2 */ -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { if (likely(cfunc->func)) { PyObject *args[2] = {arg1, arg2}; @@ -24295,7 +32050,7 @@ static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObje } /* dict_getitem_default */ -static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { PyObject* value; #if PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) value = PyDict_GetItemWithError(d, key); @@ -24325,7 +32080,7 @@ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObjec } /* CLineInTraceback */ -#ifndef CYTHON_CLINE_IN_TRACEBACK + #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; @@ -24368,7 +32123,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { #endif /* CodeObjectCache */ -#if !CYTHON_COMPILING_IN_LIMITED_API + #if !CYTHON_COMPILING_IN_LIMITED_API static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { @@ -24450,7 +32205,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #endif /* AddTraceback */ -#include "compile.h" + #include "compile.h" #include "frameobject.h" #include "traceback.h" #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API @@ -24642,7 +32397,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif /* CIntFromPyVerify */ -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -24664,7 +32419,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ -static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { + static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -24937,7 +32692,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_19streaming_form_data_7_parser_FinderState(enum __pyx_t_19streaming_form_data_7_parser_FinderState value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_19streaming_form_data_7_parser_FinderState(enum __pyx_t_19streaming_form_data_7_parser_FinderState value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -25001,7 +32756,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_19streaming_form_d } /* CIntFromPy */ -static CYTHON_INLINE enum __pyx_t_19streaming_form_data_7_parser_FinderState __Pyx_PyInt_As_enum____pyx_t_19streaming_form_data_7_parser_FinderState(PyObject *x) { + static CYTHON_INLINE enum __pyx_t_19streaming_form_data_7_parser_FinderState __Pyx_PyInt_As_enum____pyx_t_19streaming_form_data_7_parser_FinderState(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -25180,7 +32935,7 @@ static CYTHON_INLINE enum __pyx_t_19streaming_form_data_7_parser_FinderState __P } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_19streaming_form_data_7_parser_ParserState(enum __pyx_t_19streaming_form_data_7_parser_ParserState value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_19streaming_form_data_7_parser_ParserState(enum __pyx_t_19streaming_form_data_7_parser_ParserState value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -25244,7 +32999,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_19streaming_form_d } /* CIntFromPy */ -static CYTHON_INLINE enum __pyx_t_19streaming_form_data_7_parser_ParserState __Pyx_PyInt_As_enum____pyx_t_19streaming_form_data_7_parser_ParserState(PyObject *x) { + static CYTHON_INLINE enum __pyx_t_19streaming_form_data_7_parser_ParserState __Pyx_PyInt_As_enum____pyx_t_19streaming_form_data_7_parser_ParserState(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -25423,7 +33178,7 @@ static CYTHON_INLINE enum __pyx_t_19streaming_form_data_7_parser_ParserState __P } /* CIntFromPy */ -static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *x) { + static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -25696,7 +33451,7 @@ static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *x) { } /* CIntFromPy */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -25969,7 +33724,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -26033,7 +33788,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char valu } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -26097,7 +33852,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_19streaming_form_data_7_parser_ErrorGroup(enum __pyx_t_19streaming_form_data_7_parser_ErrorGroup value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_19streaming_form_data_7_parser_ErrorGroup(enum __pyx_t_19streaming_form_data_7_parser_ErrorGroup value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -26161,7 +33916,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_19streaming_form_d } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -26225,7 +33980,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { } /* FormatTypeName */ -#if CYTHON_COMPILING_IN_LIMITED_API + #if CYTHON_COMPILING_IN_LIMITED_API static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp) { @@ -26234,14 +33989,14 @@ __Pyx_PyType_GetName(PyTypeObject* tp) if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { PyErr_Clear(); Py_XDECREF(name); - name = __Pyx_NewRef(__pyx_n_s__58); + name = __Pyx_NewRef(__pyx_n_s__71); } return name; } #endif /* CIntFromPy */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -26514,7 +34269,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { } /* FastTypeChecks */ -#if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); @@ -26630,7 +34385,7 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj #endif /* CheckBinaryVersion */ -static unsigned long __Pyx_get_runtime_version(void) { + static unsigned long __Pyx_get_runtime_version(void) { #if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4 return Py_Version & ~0xFFUL; #else @@ -26677,7 +34432,7 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt } /* InitStrings */ -#if PY_MAJOR_VERSION >= 3 + #if PY_MAJOR_VERSION >= 3 static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { if (t.is_unicode | t.is_str) { if (t.intern) { diff --git a/streaming_form_data/_parser.pyx b/streaming_form_data/_parser.pyx index afaf53fe..fd2ce48f 100644 --- a/streaming_form_data/_parser.pyx +++ b/streaming_form_data/_parser.pyx @@ -3,7 +3,7 @@ from email.policy import HTTP from email.parser import Parser -from streaming_form_data.targets import NullTarget +from streaming_form_data.targets import NullTarget, is_async_target ctypedef unsigned char Byte # noqa: E999 @@ -124,6 +124,41 @@ cdef class Part: target.finish() +cdef class AsyncPart: + """One part of a multipart/form-data request + """ + + cdef public str name + cdef list targets + + def __init__(self, str name, object target): + self.name = name + self.targets = [target] + + def add_target(self, object target): + self.targets.append(target) + + def set_multipart_filename(self, str value): + for target in self.targets: + target.multipart_filename = value + + def set_multipart_content_type(self, str value): + for target in self.targets: + target.multipart_content_type = value + + async def start(self): + for target in self.targets: + await target.start() + + async def data_received(self, bytes chunk): + for target in self.targets: + await target.data_received(chunk) + + async def finish(self): + for target in self.targets: + await target.finish() + + cdef enum ParserState: PS_START, PS_START_CR, @@ -183,22 +218,37 @@ cdef class _Parser: if part: part.add_target(target) else: - self.expected_parts.append(Part(name, target)) + part_cls = AsyncPart if is_async_target(target) else Part + self.expected_parts.append(part_cls(name, target)) def set_active_part(self, part, str filename): self.active_part = part self.active_part.set_multipart_filename(filename) self.active_part.start() + async def async_set_active_part(self, part, str filename): + self.active_part = part + self.active_part.set_multipart_filename(filename) + await self.active_part.start() + def unset_active_part(self): if self.active_part: self.active_part.finish() self.active_part = None + async def async_unset_active_part(self): + if self.active_part: + await self.active_part.finish() + self.active_part = None + def on_body(self, bytes value): if self.active_part and len(value) > 0: self.active_part.data_received(value) + async def async_on_body(self, bytes value): + if self.active_part and len(value) > 0: + await self.active_part.data_received(value) + cdef _part_for(self, str name): for part in self.expected_parts: if part.name == name: @@ -211,6 +261,30 @@ cdef class _Parser: cdef bytes chunk cdef size_t index + chunk, index = self.include_leftover_buffer(data) + + return self._parse(chunk, index) + + async def async_data_received(self, bytes data): + if not data: + return 0 + + cdef bytes chunk + cdef size_t index + + chunk, index = self.include_leftover_buffer(data) + + return await self._parse(chunk, index) + + cdef include_leftover_buffer(self, bytes data): + """ + Include any leftover buffer from the previous call in the current data and + return the new buffer and its index. + """ + + cdef bytes chunk + cdef size_t index + if self._leftover_buffer: chunk = self._leftover_buffer + data index = len(self._leftover_buffer) @@ -219,7 +293,7 @@ cdef class _Parser: chunk = data index = 0 - return self._parse(chunk, index) + return (chunk, index) def _parse(self, bytes chunk, size_t index): cdef size_t idx, buffer_start, chunk_len diff --git a/streaming_form_data/targets.py b/streaming_form_data/targets.py index b222eb46..23a7a327 100644 --- a/streaming_form_data/targets.py +++ b/streaming_form_data/targets.py @@ -276,3 +276,11 @@ def get_lines(self, include_partial_line: bool = False): if include_partial_line and self._previous_partial_line: lines.append(self._previous_partial_line) return lines + + +def is_async_target(target: BaseTarget) -> bool: + """ + Return true if the target is asynchronous + """ + + return isinstance(target, AsyncTarget)