From 0cad122008e67bc190d84189571d7c09aa056249 Mon Sep 17 00:00:00 2001 From: nctl144 Date: Wed, 6 Jun 2018 17:37:12 -0500 Subject: [PATCH 01/13] import urlparse in py3 --- urlparse4/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/urlparse4/__init__.py b/urlparse4/__init__.py index cb167ba..e873b8e 100644 --- a/urlparse4/__init__.py +++ b/urlparse4/__init__.py @@ -1,6 +1,7 @@ # https://github.com/python/cpython/blob/2.7/Lib/urlparse.py -from urlparse import * +import six +from six.moves.urllib.parse import urlparse, urlsplit, urljoin _original_urlsplit = urlsplit _original_urljoin = urljoin From 71a2a89e20044caf3729875af706b3205503df12 Mon Sep 17 00:00:00 2001 From: nctl144 Date: Wed, 6 Jun 2018 18:09:11 -0500 Subject: [PATCH 02/13] py3 sp in setup.py --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index ffb8a42..e3b738e 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ from Cython.Build import cythonize ext_modules = cythonize(extension, annotate=True) except: - print "urlparse4/gurl.cpp not found and Cython failed to run to recreate it. Please install/upgrade Cython and try again." + print("urlparse4/gurl.cpp not found and Cython failed to run to recreate it. Please install/upgrade Cython and try again.") raise else: ext_modules = [extension] @@ -83,6 +83,5 @@ "Topic :: Software Development :: Libraries" ], long_description=long_description, - ext_modules=ext_modules, - include_package_data=True + ext_modules=ext_modules ) From 248dd757dd94c7f410de63489a48e11444ceaae2 Mon Sep 17 00:00:00 2001 From: nctl144 Date: Thu, 7 Jun 2018 09:16:10 -0500 Subject: [PATCH 03/13] add sp for py3 in cgurl --- urlparse4/__init__.py | 4 ++++ urlparse4/cgurl.pyx | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/urlparse4/__init__.py b/urlparse4/__init__.py index e873b8e..65298c3 100644 --- a/urlparse4/__init__.py +++ b/urlparse4/__init__.py @@ -1,9 +1,13 @@ # https://github.com/python/cpython/blob/2.7/Lib/urlparse.py import six +import pyximport + from six.moves.urllib.parse import urlparse, urlsplit, urljoin + _original_urlsplit = urlsplit _original_urljoin = urljoin +pyximport.install() from cgurl import urlsplit, urljoin diff --git a/urlparse4/cgurl.pyx b/urlparse4/cgurl.pyx index bb89c08..f3729c4 100644 --- a/urlparse4/cgurl.pyx +++ b/urlparse4/cgurl.pyx @@ -1,6 +1,8 @@ from urlparse4.mozilla_url_parse cimport Component, Parsed, ParseStandardURL, ParseFileURL from chromium_gurl cimport GURL -import urlparse as stdlib_urlparse +import six +from six.moves.urllib.parse import urljoin as stdlib_urljoin +from six.moves.urllib.parse import urlunsplit as stdlib_urlunsplit cimport cython cdef bytes slice_component(bytes pyurl, Component comp): @@ -153,7 +155,7 @@ class SplitResultNamedTuple(tuple): )) def geturl(self): - return stdlib_urlparse.urlunsplit(self) + return stdlib_urlunsplit(self) def urlsplit(url): @@ -163,4 +165,4 @@ def urljoin(bytes base, bytes url, allow_fragments=True): if allow_fragments and base: return GURL(base).Resolve(url).spec() else: - return stdlib_urlparse.urljoin(base, url, allow_fragments=allow_fragments) + return stdlib_urljoin(base, url, allow_fragments=allow_fragments) From 54dc5821e8f43bb3708a8e8919f08aedac66f56d Mon Sep 17 00:00:00 2001 From: nctl144 Date: Thu, 7 Jun 2018 09:39:57 -0500 Subject: [PATCH 04/13] change to relative import --- urlparse4/__init__.py | 2 +- urlparse4/cgurl.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/urlparse4/__init__.py b/urlparse4/__init__.py index 65298c3..bb93ea8 100644 --- a/urlparse4/__init__.py +++ b/urlparse4/__init__.py @@ -10,4 +10,4 @@ _original_urljoin = urljoin pyximport.install() -from cgurl import urlsplit, urljoin +from urlparse4.cgurl import urlsplit, urljoin diff --git a/urlparse4/cgurl.pyx b/urlparse4/cgurl.pyx index f3729c4..3b7d8aa 100644 --- a/urlparse4/cgurl.pyx +++ b/urlparse4/cgurl.pyx @@ -1,4 +1,4 @@ -from urlparse4.mozilla_url_parse cimport Component, Parsed, ParseStandardURL, ParseFileURL +from urlparse4.urlparse4.mozilla_url_parse cimport Component, Parsed, ParseStandardURL, ParseFileURL from chromium_gurl cimport GURL import six from six.moves.urllib.parse import urljoin as stdlib_urljoin From 6c915a924f682d83bf6cc418c5ac68bca894fe19 Mon Sep 17 00:00:00 2001 From: nctl144 Date: Thu, 7 Jun 2018 09:58:13 -0500 Subject: [PATCH 05/13] change the name of the functions to sp py3 --- urlparse4/__init__.py | 2 +- urlparse4/cgurl.pyx | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/urlparse4/__init__.py b/urlparse4/__init__.py index bb93ea8..ca89b0a 100644 --- a/urlparse4/__init__.py +++ b/urlparse4/__init__.py @@ -10,4 +10,4 @@ _original_urljoin = urljoin pyximport.install() -from urlparse4.cgurl import urlsplit, urljoin +from urlparse4.cgurl import url_split, url_join diff --git a/urlparse4/cgurl.pyx b/urlparse4/cgurl.pyx index 3b7d8aa..837049a 100644 --- a/urlparse4/cgurl.pyx +++ b/urlparse4/cgurl.pyx @@ -1,6 +1,5 @@ from urlparse4.urlparse4.mozilla_url_parse cimport Component, Parsed, ParseStandardURL, ParseFileURL from chromium_gurl cimport GURL -import six from six.moves.urllib.parse import urljoin as stdlib_urljoin from six.moves.urllib.parse import urlunsplit as stdlib_urlunsplit cimport cython @@ -158,10 +157,10 @@ class SplitResultNamedTuple(tuple): return stdlib_urlunsplit(self) -def urlsplit(url): +def url_split(url): return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) -def urljoin(bytes base, bytes url, allow_fragments=True): +def url_join(bytes base, bytes url, allow_fragments=True): if allow_fragments and base: return GURL(base).Resolve(url).spec() else: From a2f09b0fd4f76e097bdeabc9b12768ddf8e649ef Mon Sep 17 00:00:00 2001 From: nctl144 Date: Thu, 7 Jun 2018 10:08:30 -0500 Subject: [PATCH 06/13] correct print command --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e3b738e..ac2d9c5 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ from Cython.Build import cythonize ext_modules = cythonize(extension, annotate=True) except: - print("urlparse4/gurl.cpp not found and Cython failed to run to recreate it. Please install/upgrade Cython and try again.") + print("urlparse4/cgurl.cpp not found and Cython failed to run to recreate it. Please install/upgrade Cython and try again.") raise else: ext_modules = [extension] From 9e086f6113db3b28f2a2f07435f4136a1bae5df8 Mon Sep 17 00:00:00 2001 From: nctl144 Date: Thu, 7 Jun 2018 10:13:58 -0500 Subject: [PATCH 07/13] fix the build error --- setup.py | 2 +- urlparse4/cgurl.cpp | 2629 ++++++++++++++++++++++++++++++------------- urlparse4/cgurl.pyx | 4 +- 3 files changed, 1873 insertions(+), 762 deletions(-) diff --git a/setup.py b/setup.py index ac2d9c5..afaa32e 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ VERSION = "0.1.3" extension = Extension( - name="urlparse4/cgurl", + name="cgurl", sources=["urlparse4/cgurl.pyx", "vendor/gurl/base/third_party/icu/icu_utf.cc", "vendor/gurl/base/strings/string16.cc", diff --git a/urlparse4/cgurl.cpp b/urlparse4/cgurl.cpp index c9a452c..b311b86 100644 --- a/urlparse4/cgurl.cpp +++ b/urlparse4/cgurl.cpp @@ -1,26 +1,58 @@ -/* Generated by Cython 0.24 */ +/* Generated by Cython 0.28.3 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [ - "vendor/gurl/url/gurl.h", + "vendor/gurl/url/gurl.h", "vendor/gurl/url/third_party/mozilla/url_parse.h" - ], + ], "extra_compile_args": [ - "-std=gnu++0x", - "-I./vendor/gurl/", - "-fPIC", - "-Ofast", - "-pthread", + "-std=gnu++0x", + "-I./vendor/gurl/", + "-fPIC", + "-Ofast", + "-pthread", "-w" - ], + ], "extra_link_args": [ - "-std=gnu++0x", + "-std=gnu++0x", "-w" - ], - "language": "c++" - } + ], + "include_dirs": [ + "./urlparse4" + ], + "language": "c++", + "name": "cgurl", + "sources": [ + "urlparse4/cgurl.pyx", + "vendor/gurl/base/third_party/icu/icu_utf.cc", + "vendor/gurl/base/strings/string16.cc", + "vendor/gurl/base/strings/string_piece.cc", + "vendor/gurl/base/strings/string_util.cc", + "vendor/gurl/base/strings/utf_string_conversions.cc", + "vendor/gurl/base/strings/utf_string_conversion_utils.cc", + "vendor/gurl/url/gurl.cc", + "vendor/gurl/url/url_canon_etc.cc", + "vendor/gurl/url/url_canon_filesystemurl.cc", + "vendor/gurl/url/url_canon_fileurl.cc", + "vendor/gurl/url/url_canon_host.cc", + "vendor/gurl/url/url_canon_internal.cc", + "vendor/gurl/url/url_canon_ip.cc", + "vendor/gurl/url/url_canon_mailtourl.cc", + "vendor/gurl/url/url_canon_path.cc", + "vendor/gurl/url/url_canon_pathurl.cc", + "vendor/gurl/url/url_canon_query.cc", + "vendor/gurl/url/url_canon_relative.cc", + "vendor/gurl/url/url_canon_stdstring.cc", + "vendor/gurl/url/url_canon_stdurl.cc", + "vendor/gurl/url/url_constants.cc", + "vendor/gurl/url/url_parse_file.cc", + "vendor/gurl/url/url_util.cc", + "vendor/gurl/url/third_party/mozilla/url_parse.cc" + ] + }, + "module_name": "cgurl" } END: Cython Metadata */ @@ -28,10 +60,11 @@ END: Cython Metadata */ #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. +#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_24" +#define CYTHON_ABI "0_28_3" +#define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -53,6 +86,12 @@ END: Cython Metadata */ #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif +#define __PYX_COMMA , +#ifndef HAVE_LONG_LONG + #if PY_VERSION_HEX >= 0x02070000 + #define HAVE_LONG_LONG + #endif +#endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -61,13 +100,138 @@ END: Cython Metadata */ #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 +#elif defined(PYSTON_VERSION) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 #else #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #if PY_VERSION_HEX < 0x02070000 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #if PY_MAJOR_VERSION < 3 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #if PY_VERSION_HEX < 0x02070000 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #ifndef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if PY_VERSION_HEX < 0x030300F0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #endif #endif -#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 - #define CYTHON_USE_PYLONG_INTERNALS 1 +#if !defined(CYTHON_FAST_PYCCALL) +#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" @@ -75,6 +239,117 @@ END: Cython Metadata */ #undef BASE #undef MASK #endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + #endif + #endif +#else + #include +#endif +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) && __cplusplus >= 201103L + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #elif __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__ ) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif + +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(U other) { return *ptr == other; } + template bool operator !=(U other) { return *ptr != other; } + private: + T *ptr; +}; + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif @@ -103,24 +378,116 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #define __Pyx_PyCFunctionFast _PyCFunctionFast + #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords +#endif +#if CYTHON_FAST_PYCCALL +#define __Pyx_PyFastCFunction_Check(func)\ + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) +#else +#define __Pyx_PyFastCFunction_Check(func) 0 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_PYSTON + #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x03060000 + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#elif PY_VERSION_HEX >= 0x03000000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_Current +#endif +#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) +#include "pythread.h" +#define Py_tss_NEEDS_INIT 0 +typedef int Py_tss_t; +static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { + *key = PyThread_create_key(); + return 0; // PyThread_create_key reports success always +} +static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { + Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); + *key = Py_tss_NEEDS_INIT; + return key; +} +static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { + PyObject_Free(key); +} +static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { + return *key != Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { + PyThread_delete_key(*key); + *key = Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { + return PyThread_set_key_value(*key, value); +} +static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { + return PyThread_get_key_value(*key); +} +#endif // TSS (Thread Specific Storage) API +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#else +#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 + #define PyUnicode_1BYTE_KIND 1 + #define PyUnicode_2BYTE_KIND 2 + #define PyUnicode_4BYTE_KIND 4 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -134,14 +501,12 @@ END: Cython Metadata */ #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) +#endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 @@ -158,6 +523,7 @@ END: Cython Metadata */ #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact + #define PyObject_Unicode PyObject_Str #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) @@ -169,7 +535,11 @@ END: Cython Metadata */ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) +#else + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) +#endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -204,56 +574,27 @@ END: Cython Metadata */ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif -#if PY_VERSION_HEX >= 0x030500B1 -#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods -#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) -#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; -} __Pyx_PyAsyncMethodsStruct; -#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) -#else -#define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict +#if CYTHON_USE_ASYNC_SLOTS + #if PY_VERSION_HEX >= 0x030500B1 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods + #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #else - #define CYTHON_RESTRICT + #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #endif +#else + #define __Pyx_PyType_AsAsync(obj) NULL #endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef __cplusplus - #error "Cython files generated with the C++ option must be compiled with a C++ compiler." -#endif -#ifndef CYTHON_INLINE - #define CYTHON_INLINE inline +#ifndef __Pyx_PyAsyncMethodsStruct + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + } __Pyx_PyAsyncMethodsStruct; #endif -template -void __Pyx_call_destructor(T& x) { - x.~T(); -} -template -class __Pyx_FakeReference { - public: - __Pyx_FakeReference() : ptr(NULL) { } - __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } - T *operator->() { return ptr; } - operator T&() { return *ptr; } - private: - T *ptr; -}; #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES @@ -268,6 +609,11 @@ static CYTHON_INLINE float __PYX_NAN() { return value; } #endif +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif #define __PYX_ERR(f_index, lineno, Ln_error) \ @@ -275,14 +621,6 @@ static CYTHON_INLINE float __PYX_NAN() { __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ } -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -291,44 +629,25 @@ static CYTHON_INLINE float __PYX_NAN() { #endif #endif -#define __PYX_HAVE__urlparse4__cgurl -#define __PYX_HAVE_API__urlparse4__cgurl +#define __PYX_HAVE__cgurl +#define __PYX_HAVE_API__cgurl +/* Early includes */ #include "../vendor/gurl/url/third_party/mozilla/url_parse.h" -#include "string.h" -#include +#include #include "ios" #include "new" #include "stdexcept" #include "typeinfo" +#include #include "../vendor/gurl/url/gurl.h" #ifdef _OPENMP #include #endif /* _OPENMP */ -#ifdef PYREX_WITHOUT_ASSERTIONS +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) #define CYTHON_WITHOUT_ASSERTIONS #endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; @@ -356,8 +675,8 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) @@ -365,8 +684,8 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString @@ -379,34 +698,40 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) @@ -502,10 +827,12 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } -static PyObject *__pyx_m; +static PyObject *__pyx_m = NULL; static PyObject *__pyx_d; static PyObject *__pyx_b; +static PyObject *__pyx_cython_runtime = NULL; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; @@ -521,16 +848,16 @@ static const char *__pyx_f[] = { }; /*--- Type declarations ---*/ -struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__; +struct __pyx_obj_5cgurl___pyx_scope_struct____new__; -/* "urlparse4/cgurl.pyx":111 +/* "cgurl.pyx":112 * __slots__ = () # prevent creation of instance dictionary * * def __new__(cls, bytes url): # <<<<<<<<<<<<<< * * cdef Parsed parsed */ -struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__ { +struct __pyx_obj_5cgurl___pyx_scope_struct____new__ { PyObject_HEAD struct url::Parsed __pyx_v_parsed; PyObject *__pyx_v_url; @@ -602,17 +929,8 @@ struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__ { #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) /* PyObjectGetAttrStr.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -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); -} +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif @@ -621,25 +939,37 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* PyThreadStateGet.proto */ -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() PyErr_Occurred() #endif /* PyErrFetchRestore.proto */ -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif @@ -660,8 +990,10 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ const char* function_name); /* ArgTypeTest.proto */ -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); /* IncludeStringH.proto */ #include @@ -697,13 +1029,31 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); /* None.proto */ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +#else +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#endif + +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); +#else +#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) +#endif +#endif + /* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); @@ -731,7 +1081,6 @@ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); /* CythonFunction.proto */ #define __Pyx_CyFunction_USED 1 -#include #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 @@ -784,18 +1133,9 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, static int __pyx_CyFunction_init(void); /* PyObjectSetAttrStr.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) -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); -} +#if CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); #else #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) @@ -804,18 +1144,46 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr /* GetModuleGlobalName.proto */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); +/* 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 + /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); +/* SetNameInClass.proto */ +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 +#define __Pyx_SetNameInClass(ns, name, value)\ + (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value)) +#elif CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_SetNameInClass(ns, name, value)\ + (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value)) +#else +#define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) +#endif + /* Py3ClassCreate.proto */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc); static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); +/* CLineInTraceback.proto */ +#ifdef CYTHON_CLINE_IN_TRACEBACK +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#else +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#endif + /* CodeObjectCache.proto */ typedef struct { PyCodeObject* code_object; @@ -844,6 +1212,19 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) +#endif +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) + /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); @@ -863,20 +1244,21 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cython' */ -/* Module declarations from 'urlparse4.cgurl' */ -static PyTypeObject *__pyx_ptype_9urlparse4_5cgurl___pyx_scope_struct____new__ = 0; -static PyObject *__pyx_f_9urlparse4_5cgurl_slice_component(PyObject *, struct url::Component); /*proto*/ -static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *, struct url::Parsed); /*proto*/ +/* Module declarations from 'cgurl' */ +static PyTypeObject *__pyx_ptype_5cgurl___pyx_scope_struct____new__ = 0; +static PyObject *__pyx_f_5cgurl_slice_component(PyObject *, struct url::Component); /*proto*/ +static PyObject *__pyx_f_5cgurl_build_netloc(PyObject *, struct url::Parsed); /*proto*/ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/ static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/ static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/ static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/ static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/ -#define __Pyx_MODULE_NAME "urlparse4.cgurl" -int __pyx_module_is_main_urlparse4__cgurl = 0; +#define __Pyx_MODULE_NAME "cgurl" +extern int __pyx_module_is_main_cgurl; +int __pyx_module_is_main_cgurl = 0; -/* Implementation of 'urlparse4.cgurl' */ +/* Implementation of 'cgurl' */ static PyObject *__pyx_builtin_ValueError; static const char __pyx_k_[] = ""; static const char __pyx_k_cls[] = "cls"; @@ -891,6 +1273,7 @@ static const char __pyx_k_port[] = "port"; static const char __pyx_k_prop[] = "prop"; static const char __pyx_k_self[] = "self"; static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_cgurl[] = "cgurl"; static const char __pyx_k_lower[] = "lower"; static const char __pyx_k_query[] = "query"; static const char __pyx_k_slots[] = "__slots__"; @@ -908,19 +1291,21 @@ static const char __pyx_k_get_attr[] = "_get_attr"; static const char __pyx_k_hostname[] = "hostname"; static const char __pyx_k_password[] = "password"; static const char __pyx_k_qualname[] = "__qualname__"; -static const char __pyx_k_urlparse[] = "urlparse"; -static const char __pyx_k_urlsplit[] = "urlsplit"; +static const char __pyx_k_url_join[] = "url_join"; static const char __pyx_k_username[] = "username"; static const char __pyx_k_metaclass[] = "__metaclass__"; +static const char __pyx_k_url_split[] = "url_split"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_urlunsplit[] = "urlunsplit"; +static const char __pyx_k_stdlib_urljoin[] = "stdlib_urljoin"; static const char __pyx_k_allow_fragments[] = "allow_fragments"; -static const char __pyx_k_stdlib_urlparse[] = "stdlib_urlparse"; -static const char __pyx_k_urlparse4_cgurl[] = "urlparse4.cgurl"; +static const char __pyx_k_stdlib_urlunsplit[] = "stdlib_urlunsplit"; +static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_urlparse4_cgurl_pyx[] = "urlparse4/cgurl.pyx"; static const char __pyx_k_SplitResultNamedTuple[] = "SplitResultNamedTuple"; +static const char __pyx_k_six_moves_urllib_parse[] = "six.moves.urllib.parse"; static const char __pyx_k_SplitResultNamedTuple___new[] = "SplitResultNamedTuple.__new__"; static const char __pyx_k_SplitResultNamedTuple_geturl[] = "SplitResultNamedTuple.geturl"; -static const char __pyx_k_cosr_urlparse4_urlparse4_cgurl[] = "/cosr/urlparse4/urlparse4/cgurl.pyx"; static const char __pyx_k_SplitResultNamedTuple___new___lo[] = "SplitResultNamedTuple.__new__.._get_attr"; static PyObject *__pyx_kp_b_; static PyObject *__pyx_n_s_SplitResultNamedTuple; @@ -930,8 +1315,9 @@ static PyObject *__pyx_n_s_SplitResultNamedTuple_geturl; static PyObject *__pyx_n_s_ValueError; static PyObject *__pyx_n_s_allow_fragments; static PyObject *__pyx_n_s_base; +static PyObject *__pyx_n_s_cgurl; +static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_cls; -static PyObject *__pyx_kp_s_cosr_urlparse4_urlparse4_cgurl; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_kp_b_file; static PyObject *__pyx_n_s_fragment; @@ -956,22 +1342,24 @@ static PyObject *__pyx_n_s_qualname; static PyObject *__pyx_n_s_query; static PyObject *__pyx_n_s_scheme; static PyObject *__pyx_n_s_self; +static PyObject *__pyx_n_s_six_moves_urllib_parse; static PyObject *__pyx_n_s_slots; -static PyObject *__pyx_n_s_stdlib_urlparse; +static PyObject *__pyx_n_s_stdlib_urljoin; +static PyObject *__pyx_n_s_stdlib_urlunsplit; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_url; +static PyObject *__pyx_n_s_url_join; +static PyObject *__pyx_n_s_url_split; static PyObject *__pyx_n_s_urljoin; -static PyObject *__pyx_n_s_urlparse; -static PyObject *__pyx_n_s_urlparse4_cgurl; -static PyObject *__pyx_n_s_urlsplit; +static PyObject *__pyx_kp_s_urlparse4_cgurl_pyx; static PyObject *__pyx_n_s_urlunsplit; static PyObject *__pyx_n_s_username; -static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____get_attr(PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prop); /* proto */ -static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_url); /* proto */ -static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_2geturl(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9urlparse4_5cgurl_urlsplit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_url); /* proto */ -static PyObject *__pyx_pf_9urlparse4_5cgurl_2urljoin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_base, PyObject *__pyx_v_url, PyObject *__pyx_v_allow_fragments); /* proto */ -static PyObject *__pyx_tp_new_9urlparse4_5cgurl___pyx_scope_struct____new__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_pf_5cgurl_21SplitResultNamedTuple_7__new____get_attr(PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prop); /* proto */ +static PyObject *__pyx_pf_5cgurl_21SplitResultNamedTuple___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_url); /* proto */ +static PyObject *__pyx_pf_5cgurl_21SplitResultNamedTuple_2geturl(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5cgurl_url_split(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_url); /* proto */ +static PyObject *__pyx_pf_5cgurl_2url_join(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_base, PyObject *__pyx_v_url, PyObject *__pyx_v_allow_fragments); /* proto */ +static PyObject *__pyx_tp_new_5cgurl___pyx_scope_struct____new__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_int_65535; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__4; @@ -983,8 +1371,9 @@ static PyObject *__pyx_codeobj__5; static PyObject *__pyx_codeobj__7; static PyObject *__pyx_codeobj__9; static PyObject *__pyx_codeobj__11; +/* Late includes */ -/* "urlparse4/cgurl.pyx":6 +/* "cgurl.pyx":7 * cimport cython * * cdef bytes slice_component(bytes pyurl, Component comp): # <<<<<<<<<<<<<< @@ -992,14 +1381,14 @@ static PyObject *__pyx_codeobj__11; * return b"" */ -static PyObject *__pyx_f_9urlparse4_5cgurl_slice_component(PyObject *__pyx_v_pyurl, struct url::Component __pyx_v_comp) { +static PyObject *__pyx_f_5cgurl_slice_component(PyObject *__pyx_v_pyurl, struct url::Component __pyx_v_comp) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("slice_component", 0); - /* "urlparse4/cgurl.pyx":7 + /* "cgurl.pyx":8 * * cdef bytes slice_component(bytes pyurl, Component comp): * if comp.len <= 0: # <<<<<<<<<<<<<< @@ -1009,7 +1398,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_slice_component(PyObject *__pyx_v_pyu __pyx_t_1 = ((__pyx_v_comp.len <= 0) != 0); if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":8 + /* "cgurl.pyx":9 * cdef bytes slice_component(bytes pyurl, Component comp): * if comp.len <= 0: * return b"" # <<<<<<<<<<<<<< @@ -1021,7 +1410,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_slice_component(PyObject *__pyx_v_pyu __pyx_r = __pyx_kp_b_; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":7 + /* "cgurl.pyx":8 * * cdef bytes slice_component(bytes pyurl, Component comp): * if comp.len <= 0: # <<<<<<<<<<<<<< @@ -1030,7 +1419,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_slice_component(PyObject *__pyx_v_pyu */ } - /* "urlparse4/cgurl.pyx":10 + /* "cgurl.pyx":11 * return b"" * * return pyurl[comp.begin:comp.begin + comp.len] # <<<<<<<<<<<<<< @@ -1040,15 +1429,15 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_slice_component(PyObject *__pyx_v_pyu __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_pyurl == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 10, __pyx_L1_error) + __PYX_ERR(0, 11, __pyx_L1_error) } - __pyx_t_2 = PySequence_GetSlice(__pyx_v_pyurl, __pyx_v_comp.begin, (__pyx_v_comp.begin + __pyx_v_comp.len)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_t_2 = PySequence_GetSlice(__pyx_v_pyurl, __pyx_v_comp.begin, (__pyx_v_comp.begin + __pyx_v_comp.len)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":6 + /* "cgurl.pyx":7 * cimport cython * * cdef bytes slice_component(bytes pyurl, Component comp): # <<<<<<<<<<<<<< @@ -1059,7 +1448,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_slice_component(PyObject *__pyx_v_pyu /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("urlparse4.cgurl.slice_component", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.slice_component", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1067,7 +1456,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_slice_component(PyObject *__pyx_v_pyu return __pyx_r; } -/* "urlparse4/cgurl.pyx":13 +/* "cgurl.pyx":14 * * * cdef bytes cslice_component(char * url, Component comp): # <<<<<<<<<<<<<< @@ -1075,14 +1464,14 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_slice_component(PyObject *__pyx_v_pyu * return b"" */ -static PyObject *__pyx_f_9urlparse4_5cgurl_cslice_component(char *__pyx_v_url, struct url::Component __pyx_v_comp) { +static PyObject *__pyx_f_5cgurl_cslice_component(char *__pyx_v_url, struct url::Component __pyx_v_comp) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("cslice_component", 0); - /* "urlparse4/cgurl.pyx":14 + /* "cgurl.pyx":15 * * cdef bytes cslice_component(char * url, Component comp): * if comp.len <= 0: # <<<<<<<<<<<<<< @@ -1092,7 +1481,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_cslice_component(char *__pyx_v_url, s __pyx_t_1 = ((__pyx_v_comp.len <= 0) != 0); if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":15 + /* "cgurl.pyx":16 * cdef bytes cslice_component(char * url, Component comp): * if comp.len <= 0: * return b"" # <<<<<<<<<<<<<< @@ -1104,7 +1493,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_cslice_component(char *__pyx_v_url, s __pyx_r = __pyx_kp_b_; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":14 + /* "cgurl.pyx":15 * * cdef bytes cslice_component(char * url, Component comp): * if comp.len <= 0: # <<<<<<<<<<<<<< @@ -1113,7 +1502,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_cslice_component(char *__pyx_v_url, s */ } - /* "urlparse4/cgurl.pyx":18 + /* "cgurl.pyx":19 * * # TODO: check if std::string brings any speedups * return url[comp.begin:comp.begin + comp.len] # <<<<<<<<<<<<<< @@ -1121,13 +1510,13 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_cslice_component(char *__pyx_v_url, s * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_url + __pyx_v_comp.begin, (__pyx_v_comp.begin + __pyx_v_comp.len) - __pyx_v_comp.begin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_url + __pyx_v_comp.begin, (__pyx_v_comp.begin + __pyx_v_comp.len) - __pyx_v_comp.begin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":13 + /* "cgurl.pyx":14 * * * cdef bytes cslice_component(char * url, Component comp): # <<<<<<<<<<<<<< @@ -1138,7 +1527,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_cslice_component(char *__pyx_v_url, s /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("urlparse4.cgurl.cslice_component", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.cslice_component", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1146,7 +1535,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_cslice_component(char *__pyx_v_url, s return __pyx_r; } -/* "urlparse4/cgurl.pyx":21 +/* "cgurl.pyx":22 * * * cdef bytes build_netloc(bytes url, Parsed parsed): # <<<<<<<<<<<<<< @@ -1154,7 +1543,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_cslice_component(char *__pyx_v_url, s * if parsed.host.len <= 0: */ -static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, struct url::Parsed __pyx_v_parsed) { +static PyObject *__pyx_f_5cgurl_build_netloc(PyObject *__pyx_v_url, struct url::Parsed __pyx_v_parsed) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -1162,7 +1551,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("build_netloc", 0); - /* "urlparse4/cgurl.pyx":23 + /* "cgurl.pyx":24 * cdef bytes build_netloc(bytes url, Parsed parsed): * * if parsed.host.len <= 0: # <<<<<<<<<<<<<< @@ -1172,7 +1561,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __pyx_t_1 = ((__pyx_v_parsed.host.len <= 0) != 0); if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":24 + /* "cgurl.pyx":25 * * if parsed.host.len <= 0: * return b"" # <<<<<<<<<<<<<< @@ -1184,7 +1573,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __pyx_r = __pyx_kp_b_; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":23 + /* "cgurl.pyx":24 * cdef bytes build_netloc(bytes url, Parsed parsed): * * if parsed.host.len <= 0: # <<<<<<<<<<<<<< @@ -1193,7 +1582,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s */ } - /* "urlparse4/cgurl.pyx":27 + /* "cgurl.pyx":28 * * # Nothing at all * elif parsed.username.len <= 0 and parsed.password.len <= 0 and parsed.port.len <= 0: # <<<<<<<<<<<<<< @@ -1217,7 +1606,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":28 + /* "cgurl.pyx":29 * # Nothing at all * elif parsed.username.len <= 0 and parsed.password.len <= 0 and parsed.port.len <= 0: * return url[parsed.host.begin: parsed.host.begin + parsed.host.len] # <<<<<<<<<<<<<< @@ -1227,15 +1616,15 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_url == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 28, __pyx_L1_error) + __PYX_ERR(0, 29, __pyx_L1_error) } - __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.host.begin, (__pyx_v_parsed.host.begin + __pyx_v_parsed.host.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.host.begin, (__pyx_v_parsed.host.begin + __pyx_v_parsed.host.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":27 + /* "cgurl.pyx":28 * * # Nothing at all * elif parsed.username.len <= 0 and parsed.password.len <= 0 and parsed.port.len <= 0: # <<<<<<<<<<<<<< @@ -1244,7 +1633,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s */ } - /* "urlparse4/cgurl.pyx":31 + /* "cgurl.pyx":32 * * # Only port * elif parsed.username.len <= 0 and parsed.password.len <= 0 and parsed.port.len > 0: # <<<<<<<<<<<<<< @@ -1268,7 +1657,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __pyx_L7_bool_binop_done:; if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":32 + /* "cgurl.pyx":33 * # Only port * elif parsed.username.len <= 0 and parsed.password.len <= 0 and parsed.port.len > 0: * return url[parsed.host.begin: parsed.host.begin + parsed.host.len + 1 + parsed.port.len] # <<<<<<<<<<<<<< @@ -1278,15 +1667,15 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_url == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 32, __pyx_L1_error) + __PYX_ERR(0, 33, __pyx_L1_error) } - __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.host.begin, (((__pyx_v_parsed.host.begin + __pyx_v_parsed.host.len) + 1) + __pyx_v_parsed.port.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.host.begin, (((__pyx_v_parsed.host.begin + __pyx_v_parsed.host.len) + 1) + __pyx_v_parsed.port.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":31 + /* "cgurl.pyx":32 * * # Only port * elif parsed.username.len <= 0 and parsed.password.len <= 0 and parsed.port.len > 0: # <<<<<<<<<<<<<< @@ -1295,7 +1684,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s */ } - /* "urlparse4/cgurl.pyx":35 + /* "cgurl.pyx":36 * * # Only username * elif parsed.username.len > 0 and parsed.password.len <= 0 and parsed.port.len <= 0: # <<<<<<<<<<<<<< @@ -1319,7 +1708,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __pyx_L10_bool_binop_done:; if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":36 + /* "cgurl.pyx":37 * # Only username * elif parsed.username.len > 0 and parsed.password.len <= 0 and parsed.port.len <= 0: * return url[parsed.username.begin: parsed.username.begin + parsed.host.len + 1 + parsed.username.len] # <<<<<<<<<<<<<< @@ -1329,15 +1718,15 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_url == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 36, __pyx_L1_error) + __PYX_ERR(0, 37, __pyx_L1_error) } - __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.username.begin, (((__pyx_v_parsed.username.begin + __pyx_v_parsed.host.len) + 1) + __pyx_v_parsed.username.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.username.begin, (((__pyx_v_parsed.username.begin + __pyx_v_parsed.host.len) + 1) + __pyx_v_parsed.username.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":35 + /* "cgurl.pyx":36 * * # Only username * elif parsed.username.len > 0 and parsed.password.len <= 0 and parsed.port.len <= 0: # <<<<<<<<<<<<<< @@ -1346,7 +1735,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s */ } - /* "urlparse4/cgurl.pyx":39 + /* "cgurl.pyx":40 * * # Username + password * elif parsed.username.len > 0 and parsed.password.len > 0 and parsed.port.len <= 0: # <<<<<<<<<<<<<< @@ -1370,7 +1759,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __pyx_L13_bool_binop_done:; if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":40 + /* "cgurl.pyx":41 * # Username + password * elif parsed.username.len > 0 and parsed.password.len > 0 and parsed.port.len <= 0: * return url[parsed.username.begin: parsed.username.begin + parsed.host.len + 2 + parsed.username.len + parsed.password.len] # <<<<<<<<<<<<<< @@ -1380,15 +1769,15 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_url == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 40, __pyx_L1_error) + __PYX_ERR(0, 41, __pyx_L1_error) } - __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.username.begin, ((((__pyx_v_parsed.username.begin + __pyx_v_parsed.host.len) + 2) + __pyx_v_parsed.username.len) + __pyx_v_parsed.password.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.username.begin, ((((__pyx_v_parsed.username.begin + __pyx_v_parsed.host.len) + 2) + __pyx_v_parsed.username.len) + __pyx_v_parsed.password.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":39 + /* "cgurl.pyx":40 * * # Username + password * elif parsed.username.len > 0 and parsed.password.len > 0 and parsed.port.len <= 0: # <<<<<<<<<<<<<< @@ -1397,7 +1786,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s */ } - /* "urlparse4/cgurl.pyx":43 + /* "cgurl.pyx":44 * * # Username + port * elif parsed.username.len > 0 and parsed.password.len <= 0 and parsed.port.len > 0: # <<<<<<<<<<<<<< @@ -1421,7 +1810,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __pyx_L16_bool_binop_done:; if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":44 + /* "cgurl.pyx":45 * # Username + port * elif parsed.username.len > 0 and parsed.password.len <= 0 and parsed.port.len > 0: * return url[parsed.username.begin: parsed.username.begin + parsed.host.len + 2 + parsed.username.len + parsed.port.len] # <<<<<<<<<<<<<< @@ -1431,15 +1820,15 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_url == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 44, __pyx_L1_error) + __PYX_ERR(0, 45, __pyx_L1_error) } - __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.username.begin, ((((__pyx_v_parsed.username.begin + __pyx_v_parsed.host.len) + 2) + __pyx_v_parsed.username.len) + __pyx_v_parsed.port.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.username.begin, ((((__pyx_v_parsed.username.begin + __pyx_v_parsed.host.len) + 2) + __pyx_v_parsed.username.len) + __pyx_v_parsed.port.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":43 + /* "cgurl.pyx":44 * * # Username + port * elif parsed.username.len > 0 and parsed.password.len <= 0 and parsed.port.len > 0: # <<<<<<<<<<<<<< @@ -1448,7 +1837,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s */ } - /* "urlparse4/cgurl.pyx":47 + /* "cgurl.pyx":48 * * # Username + port + password * elif parsed.username.len > 0 and parsed.password.len > 0 and parsed.port.len > 0: # <<<<<<<<<<<<<< @@ -1470,9 +1859,9 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __pyx_t_2 = ((__pyx_v_parsed.port.len > 0) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L19_bool_binop_done:; - if (__pyx_t_1) { + if (likely(__pyx_t_1)) { - /* "urlparse4/cgurl.pyx":48 + /* "cgurl.pyx":49 * # Username + port + password * elif parsed.username.len > 0 and parsed.password.len > 0 and parsed.port.len > 0: * return url[parsed.username.begin: parsed.username.begin + parsed.host.len + 3 + parsed.port.len + parsed.username.len + parsed.password.len] # <<<<<<<<<<<<<< @@ -1482,15 +1871,15 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_url == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 48, __pyx_L1_error) + __PYX_ERR(0, 49, __pyx_L1_error) } - __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.username.begin, (((((__pyx_v_parsed.username.begin + __pyx_v_parsed.host.len) + 3) + __pyx_v_parsed.port.len) + __pyx_v_parsed.username.len) + __pyx_v_parsed.password.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_3 = PySequence_GetSlice(__pyx_v_url, __pyx_v_parsed.username.begin, (((((__pyx_v_parsed.username.begin + __pyx_v_parsed.host.len) + 3) + __pyx_v_parsed.port.len) + __pyx_v_parsed.username.len) + __pyx_v_parsed.password.len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":47 + /* "cgurl.pyx":48 * * # Username + port + password * elif parsed.username.len > 0 and parsed.password.len > 0 and parsed.port.len > 0: # <<<<<<<<<<<<<< @@ -1499,7 +1888,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s */ } - /* "urlparse4/cgurl.pyx":51 + /* "cgurl.pyx":52 * * else: * raise ValueError # <<<<<<<<<<<<<< @@ -1508,10 +1897,10 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s */ /*else*/ { __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0); - __PYX_ERR(0, 51, __pyx_L1_error) + __PYX_ERR(0, 52, __pyx_L1_error) } - /* "urlparse4/cgurl.pyx":21 + /* "cgurl.pyx":22 * * * cdef bytes build_netloc(bytes url, Parsed parsed): # <<<<<<<<<<<<<< @@ -1522,7 +1911,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("urlparse4.cgurl.build_netloc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.build_netloc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1530,7 +1919,7 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s return __pyx_r; } -/* "urlparse4/cgurl.pyx":111 +/* "cgurl.pyx":112 * __slots__ = () # prevent creation of instance dictionary * * def __new__(cls, bytes url): # <<<<<<<<<<<<<< @@ -1539,9 +1928,9 @@ static PyObject *__pyx_f_9urlparse4_5cgurl_build_netloc(PyObject *__pyx_v_url, s */ /* Python wrapper */ -static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_9urlparse4_5cgurl_21SplitResultNamedTuple_1__new__ = {"__new__", (PyCFunction)__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_1__new__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_5cgurl_21SplitResultNamedTuple_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_5cgurl_21SplitResultNamedTuple_1__new__ = {"__new__", (PyCFunction)__pyx_pw_5cgurl_21SplitResultNamedTuple_1__new__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5cgurl_21SplitResultNamedTuple_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_cls = 0; PyObject *__pyx_v_url = 0; PyObject *__pyx_r = 0; @@ -1555,23 +1944,26 @@ static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_1__new__(PyO const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_url)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_url)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, 1); __PYX_ERR(0, 111, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, 1); __PYX_ERR(0, 112, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 111, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 112, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1584,14 +1976,14 @@ static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_1__new__(PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 111, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 112, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("urlparse4.cgurl.SplitResultNamedTuple.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.SplitResultNamedTuple.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_url), (&PyBytes_Type), 1, "url", 1))) __PYX_ERR(0, 111, __pyx_L1_error) - __pyx_r = __pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(__pyx_self, __pyx_v_cls, __pyx_v_url); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_url), (&PyBytes_Type), 1, "url", 1))) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_r = __pyx_pf_5cgurl_21SplitResultNamedTuple___new__(__pyx_self, __pyx_v_cls, __pyx_v_url); /* function exit code */ goto __pyx_L0; @@ -1602,7 +1994,7 @@ static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_1__new__(PyO return __pyx_r; } -/* "urlparse4/cgurl.pyx":120 +/* "cgurl.pyx":121 * ParseStandardURL(url, len(url), &parsed) * * def _get_attr(self, prop): # <<<<<<<<<<<<<< @@ -1611,9 +2003,9 @@ static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_1__new__(PyO */ /* Python wrapper */ -static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new___1_get_attr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new___1_get_attr = {"_get_attr", (PyCFunction)__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new___1_get_attr, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new___1_get_attr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_5cgurl_21SplitResultNamedTuple_7__new___1_get_attr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_5cgurl_21SplitResultNamedTuple_7__new___1_get_attr = {"_get_attr", (PyCFunction)__pyx_pw_5cgurl_21SplitResultNamedTuple_7__new___1_get_attr, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5cgurl_21SplitResultNamedTuple_7__new___1_get_attr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_prop = 0; PyObject *__pyx_r = 0; @@ -1627,23 +2019,26 @@ static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new___1_g const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_prop)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prop)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_get_attr", 1, 2, 2, 1); __PYX_ERR(0, 120, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_get_attr", 1, 2, 2, 1); __PYX_ERR(0, 121, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_get_attr") < 0)) __PYX_ERR(0, 120, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_get_attr") < 0)) __PYX_ERR(0, 121, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1656,22 +2051,22 @@ static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new___1_g } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_get_attr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 120, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_get_attr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 121, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("urlparse4.cgurl.SplitResultNamedTuple.__new__._get_attr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.SplitResultNamedTuple.__new__._get_attr", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____get_attr(__pyx_self, __pyx_v_self, __pyx_v_prop); + __pyx_r = __pyx_pf_5cgurl_21SplitResultNamedTuple_7__new____get_attr(__pyx_self, __pyx_v_self, __pyx_v_prop); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____get_attr(PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prop) { - struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__ *__pyx_cur_scope; - struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__ *__pyx_outer_scope; +static PyObject *__pyx_pf_5cgurl_21SplitResultNamedTuple_7__new____get_attr(PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prop) { + struct __pyx_obj_5cgurl___pyx_scope_struct____new__ *__pyx_cur_scope; + struct __pyx_obj_5cgurl___pyx_scope_struct____new__ *__pyx_outer_scope; PyObject *__pyx_v_port = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -1680,20 +2075,20 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("_get_attr", 0); - __pyx_outer_scope = (struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__ *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_outer_scope = (struct __pyx_obj_5cgurl___pyx_scope_struct____new__ *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "urlparse4/cgurl.pyx":121 + /* "cgurl.pyx":122 * * def _get_attr(self, prop): * if prop == "scheme": # <<<<<<<<<<<<<< * return self[0] * elif prop == "netloc": */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_scheme, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_scheme, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 122, __pyx_L1_error) if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":122 + /* "cgurl.pyx":123 * def _get_attr(self, prop): * if prop == "scheme": * return self[0] # <<<<<<<<<<<<<< @@ -1701,13 +2096,13 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge * return self[1] */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":121 + /* "cgurl.pyx":122 * * def _get_attr(self, prop): * if prop == "scheme": # <<<<<<<<<<<<<< @@ -1716,17 +2111,17 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge */ } - /* "urlparse4/cgurl.pyx":123 + /* "cgurl.pyx":124 * if prop == "scheme": * return self[0] * elif prop == "netloc": # <<<<<<<<<<<<<< * return self[1] * elif prop == "path": */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_netloc, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_netloc, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 124, __pyx_L1_error) if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":124 + /* "cgurl.pyx":125 * return self[0] * elif prop == "netloc": * return self[1] # <<<<<<<<<<<<<< @@ -1734,13 +2129,13 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge * return self[2] */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":123 + /* "cgurl.pyx":124 * if prop == "scheme": * return self[0] * elif prop == "netloc": # <<<<<<<<<<<<<< @@ -1749,17 +2144,17 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge */ } - /* "urlparse4/cgurl.pyx":125 + /* "cgurl.pyx":126 * elif prop == "netloc": * return self[1] * elif prop == "path": # <<<<<<<<<<<<<< * return self[2] * elif prop == "query": */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_path, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_path, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 126, __pyx_L1_error) if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":126 + /* "cgurl.pyx":127 * return self[1] * elif prop == "path": * return self[2] # <<<<<<<<<<<<<< @@ -1767,13 +2162,13 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge * return self[3] */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":125 + /* "cgurl.pyx":126 * elif prop == "netloc": * return self[1] * elif prop == "path": # <<<<<<<<<<<<<< @@ -1782,17 +2177,17 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge */ } - /* "urlparse4/cgurl.pyx":127 + /* "cgurl.pyx":128 * elif prop == "path": * return self[2] * elif prop == "query": # <<<<<<<<<<<<<< * return self[3] * elif prop == "fragment": */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_query, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_query, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 128, __pyx_L1_error) if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":128 + /* "cgurl.pyx":129 * return self[2] * elif prop == "query": * return self[3] # <<<<<<<<<<<<<< @@ -1800,13 +2195,13 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge * return self[4] */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":127 + /* "cgurl.pyx":128 * elif prop == "path": * return self[2] * elif prop == "query": # <<<<<<<<<<<<<< @@ -1815,17 +2210,17 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge */ } - /* "urlparse4/cgurl.pyx":129 + /* "cgurl.pyx":130 * elif prop == "query": * return self[3] * elif prop == "fragment": # <<<<<<<<<<<<<< * return self[4] * elif prop == "port": */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_fragment, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_fragment, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 130, __pyx_L1_error) if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":130 + /* "cgurl.pyx":131 * return self[3] * elif prop == "fragment": * return self[4] # <<<<<<<<<<<<<< @@ -1833,13 +2228,13 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge * if parsed.port.len > 0: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":129 + /* "cgurl.pyx":130 * elif prop == "query": * return self[3] * elif prop == "fragment": # <<<<<<<<<<<<<< @@ -1848,17 +2243,17 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge */ } - /* "urlparse4/cgurl.pyx":131 + /* "cgurl.pyx":132 * elif prop == "fragment": * return self[4] * elif prop == "port": # <<<<<<<<<<<<<< * if parsed.port.len > 0: * port = int(slice_component(url, parsed.port)) */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_port, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_port, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 132, __pyx_L1_error) if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":132 + /* "cgurl.pyx":133 * return self[4] * elif prop == "port": * if parsed.port.len > 0: # <<<<<<<<<<<<<< @@ -1868,38 +2263,38 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_parsed.port.len > 0) != 0); if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":133 + /* "cgurl.pyx":134 * elif prop == "port": * if parsed.port.len > 0: * port = int(slice_component(url, parsed.port)) # <<<<<<<<<<<<<< * if port <= 65535: * return port */ - if (unlikely(!__pyx_cur_scope->__pyx_v_url)) { __Pyx_RaiseClosureNameError("url"); __PYX_ERR(0, 133, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_url)) { __Pyx_RaiseClosureNameError("url"); __PYX_ERR(0, 134, __pyx_L1_error) } __pyx_t_2 = __pyx_cur_scope->__pyx_v_url; __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_f_9urlparse4_5cgurl_slice_component(((PyObject*)__pyx_t_2), __pyx_cur_scope->__pyx_v_parsed.port); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5cgurl_slice_component(((PyObject*)__pyx_t_2), __pyx_cur_scope->__pyx_v_parsed.port); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_port = __pyx_t_2; __pyx_t_2 = 0; - /* "urlparse4/cgurl.pyx":134 + /* "cgurl.pyx":135 * if parsed.port.len > 0: * port = int(slice_component(url, parsed.port)) * if port <= 65535: # <<<<<<<<<<<<<< * return port * */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_port, __pyx_int_65535, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_v_port, __pyx_int_65535, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":135 + /* "cgurl.pyx":136 * port = int(slice_component(url, parsed.port)) * if port <= 65535: * return port # <<<<<<<<<<<<<< @@ -1911,7 +2306,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge __pyx_r = __pyx_v_port; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":134 + /* "cgurl.pyx":135 * if parsed.port.len > 0: * port = int(slice_component(url, parsed.port)) * if port <= 65535: # <<<<<<<<<<<<<< @@ -1920,7 +2315,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge */ } - /* "urlparse4/cgurl.pyx":132 + /* "cgurl.pyx":133 * return self[4] * elif prop == "port": * if parsed.port.len > 0: # <<<<<<<<<<<<<< @@ -1929,7 +2324,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge */ } - /* "urlparse4/cgurl.pyx":131 + /* "cgurl.pyx":132 * elif prop == "fragment": * return self[4] * elif prop == "port": # <<<<<<<<<<<<<< @@ -1939,17 +2334,17 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge goto __pyx_L3; } - /* "urlparse4/cgurl.pyx":137 + /* "cgurl.pyx":138 * return port * * elif prop == "username": # <<<<<<<<<<<<<< * return slice_component(url, parsed.username) or None * elif prop == "password": */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_username, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_username, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 138, __pyx_L1_error) if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":138 + /* "cgurl.pyx":139 * * elif prop == "username": * return slice_component(url, parsed.username) or None # <<<<<<<<<<<<<< @@ -1957,13 +2352,13 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge * return slice_component(url, parsed.password) or None */ __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_url)) { __Pyx_RaiseClosureNameError("url"); __PYX_ERR(0, 138, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_url)) { __Pyx_RaiseClosureNameError("url"); __PYX_ERR(0, 139, __pyx_L1_error) } __pyx_t_3 = __pyx_cur_scope->__pyx_v_url; __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = __pyx_f_9urlparse4_5cgurl_slice_component(((PyObject*)__pyx_t_3), __pyx_cur_scope->__pyx_v_parsed.username); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_4 = __pyx_f_5cgurl_slice_component(((PyObject*)__pyx_t_3), __pyx_cur_scope->__pyx_v_parsed.username); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 139, __pyx_L1_error) if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { @@ -1979,7 +2374,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge __pyx_t_2 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":137 + /* "cgurl.pyx":138 * return port * * elif prop == "username": # <<<<<<<<<<<<<< @@ -1988,17 +2383,17 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge */ } - /* "urlparse4/cgurl.pyx":139 + /* "cgurl.pyx":140 * elif prop == "username": * return slice_component(url, parsed.username) or None * elif prop == "password": # <<<<<<<<<<<<<< * return slice_component(url, parsed.password) or None * elif prop == "hostname": */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_password, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_password, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 140, __pyx_L1_error) if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":140 + /* "cgurl.pyx":141 * return slice_component(url, parsed.username) or None * elif prop == "password": * return slice_component(url, parsed.password) or None # <<<<<<<<<<<<<< @@ -2006,13 +2401,13 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge * return slice_component(url, parsed.host).lower() */ __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_url)) { __Pyx_RaiseClosureNameError("url"); __PYX_ERR(0, 140, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_url)) { __Pyx_RaiseClosureNameError("url"); __PYX_ERR(0, 141, __pyx_L1_error) } __pyx_t_4 = __pyx_cur_scope->__pyx_v_url; __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = __pyx_f_9urlparse4_5cgurl_slice_component(((PyObject*)__pyx_t_4), __pyx_cur_scope->__pyx_v_parsed.password); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5cgurl_slice_component(((PyObject*)__pyx_t_4), __pyx_cur_scope->__pyx_v_parsed.password); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 141, __pyx_L1_error) if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { @@ -2028,7 +2423,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge __pyx_t_2 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":139 + /* "cgurl.pyx":140 * elif prop == "username": * return slice_component(url, parsed.username) or None * elif prop == "password": # <<<<<<<<<<<<<< @@ -2037,17 +2432,17 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge */ } - /* "urlparse4/cgurl.pyx":141 + /* "cgurl.pyx":142 * elif prop == "password": * return slice_component(url, parsed.password) or None * elif prop == "hostname": # <<<<<<<<<<<<<< * return slice_component(url, parsed.host).lower() * */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_hostname, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prop, __pyx_n_s_hostname, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 142, __pyx_L1_error) if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":142 + /* "cgurl.pyx":143 * return slice_component(url, parsed.password) or None * elif prop == "hostname": * return slice_component(url, parsed.host).lower() # <<<<<<<<<<<<<< @@ -2055,17 +2450,17 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge * */ __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_url)) { __Pyx_RaiseClosureNameError("url"); __PYX_ERR(0, 142, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_url)) { __Pyx_RaiseClosureNameError("url"); __PYX_ERR(0, 143, __pyx_L1_error) } __pyx_t_3 = __pyx_cur_scope->__pyx_v_url; __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = __pyx_f_9urlparse4_5cgurl_slice_component(((PyObject*)__pyx_t_3), __pyx_cur_scope->__pyx_v_parsed.host); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_4 = __pyx_f_5cgurl_slice_component(((PyObject*)__pyx_t_3), __pyx_cur_scope->__pyx_v_parsed.host); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + if (CYTHON_UNPACK_METHODS && 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); @@ -2075,10 +2470,10 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge } } if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -2086,7 +2481,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge __pyx_t_2 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":141 + /* "cgurl.pyx":142 * elif prop == "password": * return slice_component(url, parsed.password) or None * elif prop == "hostname": # <<<<<<<<<<<<<< @@ -2096,7 +2491,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge } __pyx_L3:; - /* "urlparse4/cgurl.pyx":120 + /* "cgurl.pyx":121 * ParseStandardURL(url, len(url), &parsed) * * def _get_attr(self, prop): # <<<<<<<<<<<<<< @@ -2111,7 +2506,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("urlparse4.cgurl.SplitResultNamedTuple.__new__._get_attr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.SplitResultNamedTuple.__new__._get_attr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_port); @@ -2120,7 +2515,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge return __pyx_r; } -/* "urlparse4/cgurl.pyx":111 +/* "cgurl.pyx":112 * __slots__ = () # prevent creation of instance dictionary * * def __new__(cls, bytes url): # <<<<<<<<<<<<<< @@ -2128,8 +2523,8 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new____ge * cdef Parsed parsed */ -static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_url) { - struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__ *__pyx_cur_scope; +static PyObject *__pyx_pf_5cgurl_21SplitResultNamedTuple___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_url) { + struct __pyx_obj_5cgurl___pyx_scope_struct____new__ *__pyx_cur_scope; PyObject *__pyx_v__get_attr = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2146,18 +2541,21 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; __Pyx_RefNannySetupContext("__new__", 0); - __pyx_cur_scope = (struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__ *)__pyx_tp_new_9urlparse4_5cgurl___pyx_scope_struct____new__(__pyx_ptype_9urlparse4_5cgurl___pyx_scope_struct____new__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_5cgurl___pyx_scope_struct____new__ *)__pyx_tp_new_5cgurl___pyx_scope_struct____new__(__pyx_ptype_5cgurl___pyx_scope_struct____new__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; + __pyx_cur_scope = ((struct __pyx_obj_5cgurl___pyx_scope_struct____new__ *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 112, __pyx_L1_error) + } else { + __Pyx_GOTREF(__pyx_cur_scope); } - __Pyx_GOTREF(__pyx_cur_scope); __pyx_cur_scope->__pyx_v_url = __pyx_v_url; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_url); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_url); - /* "urlparse4/cgurl.pyx":115 + /* "cgurl.pyx":116 * cdef Parsed parsed * * if url[0:5] == b"file:": # <<<<<<<<<<<<<< @@ -2166,34 +2564,38 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH */ if (unlikely(__pyx_cur_scope->__pyx_v_url == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 115, __pyx_L1_error) + __PYX_ERR(0, 116, __pyx_L1_error) } - __pyx_t_1 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_url, 0, 5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_t_1 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_url, 0, 5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_kp_b_file, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_kp_b_file, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "urlparse4/cgurl.pyx":116 + /* "cgurl.pyx":117 * * if url[0:5] == b"file:": * ParseFileURL(url, len(url), &parsed) # <<<<<<<<<<<<<< * else: * ParseStandardURL(url, len(url), &parsed) */ - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_cur_scope->__pyx_v_url); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error) + if (unlikely(__pyx_cur_scope->__pyx_v_url == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(0, 117, __pyx_L1_error) + } + __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_cur_scope->__pyx_v_url); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L1_error) __pyx_t_1 = __pyx_cur_scope->__pyx_v_url; __Pyx_INCREF(__pyx_t_1); if (unlikely(__pyx_t_1 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 116, __pyx_L1_error) + __PYX_ERR(0, 117, __pyx_L1_error) } - __pyx_t_5 = PyBytes_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_5 = PyBytes_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; url::ParseFileURL(__pyx_t_4, __pyx_t_5, (&__pyx_cur_scope->__pyx_v_parsed)); - /* "urlparse4/cgurl.pyx":115 + /* "cgurl.pyx":116 * cdef Parsed parsed * * if url[0:5] == b"file:": # <<<<<<<<<<<<<< @@ -2203,7 +2605,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH goto __pyx_L3; } - /* "urlparse4/cgurl.pyx":118 + /* "cgurl.pyx":119 * ParseFileURL(url, len(url), &parsed) * else: * ParseStandardURL(url, len(url), &parsed) # <<<<<<<<<<<<<< @@ -2211,41 +2613,45 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH * def _get_attr(self, prop): */ /*else*/ { - __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_cur_scope->__pyx_v_url); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L1_error) + if (unlikely(__pyx_cur_scope->__pyx_v_url == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(0, 119, __pyx_L1_error) + } + __pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_cur_scope->__pyx_v_url); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L1_error) __pyx_t_1 = __pyx_cur_scope->__pyx_v_url; __Pyx_INCREF(__pyx_t_1); if (unlikely(__pyx_t_1 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 118, __pyx_L1_error) + __PYX_ERR(0, 119, __pyx_L1_error) } - __pyx_t_5 = PyBytes_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_5 = PyBytes_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; url::ParseStandardURL(__pyx_t_6, __pyx_t_5, (&__pyx_cur_scope->__pyx_v_parsed)); } __pyx_L3:; - /* "urlparse4/cgurl.pyx":120 + /* "cgurl.pyx":121 * ParseStandardURL(url, len(url), &parsed) * * def _get_attr(self, prop): # <<<<<<<<<<<<<< * if prop == "scheme": * return self[0] */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9urlparse4_5cgurl_21SplitResultNamedTuple_7__new___1_get_attr, 0, __pyx_n_s_SplitResultNamedTuple___new___lo, ((PyObject*)__pyx_cur_scope), __pyx_n_s_urlparse4_cgurl, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5cgurl_21SplitResultNamedTuple_7__new___1_get_attr, 0, __pyx_n_s_SplitResultNamedTuple___new___lo, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cgurl, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v__get_attr = __pyx_t_1; __pyx_t_1 = 0; - /* "urlparse4/cgurl.pyx":145 + /* "cgurl.pyx":146 * * * cls.__getattr__ = _get_attr # <<<<<<<<<<<<<< * * return tuple.__new__(cls, ( */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_cls, __pyx_n_s_getattr, __pyx_v__get_attr) < 0) __PYX_ERR(0, 145, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_cls, __pyx_n_s_getattr, __pyx_v__get_attr) < 0) __PYX_ERR(0, 146, __pyx_L1_error) - /* "urlparse4/cgurl.pyx":147 + /* "cgurl.pyx":148 * cls.__getattr__ = _get_attr * * return tuple.__new__(cls, ( # <<<<<<<<<<<<<< @@ -2253,10 +2659,10 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH * build_netloc(url, parsed), */ __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PyTuple_Type)), __pyx_n_s_new); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PyTuple_Type)), __pyx_n_s_new); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "urlparse4/cgurl.pyx":148 + /* "cgurl.pyx":149 * * return tuple.__new__(cls, ( * slice_component(url, parsed.scheme).lower(), # <<<<<<<<<<<<<< @@ -2265,14 +2671,14 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH */ __pyx_t_9 = __pyx_cur_scope->__pyx_v_url; __Pyx_INCREF(__pyx_t_9); - __pyx_t_10 = __pyx_f_9urlparse4_5cgurl_slice_component(((PyObject*)__pyx_t_9), __pyx_cur_scope->__pyx_v_parsed.scheme); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_10 = __pyx_f_5cgurl_slice_component(((PyObject*)__pyx_t_9), __pyx_cur_scope->__pyx_v_parsed.scheme); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_lower); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_lower); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) { + if (CYTHON_UNPACK_METHODS && 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); @@ -2282,15 +2688,15 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH } } if (__pyx_t_10) { - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else { - __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "urlparse4/cgurl.pyx":149 + /* "cgurl.pyx":150 * return tuple.__new__(cls, ( * slice_component(url, parsed.scheme).lower(), * build_netloc(url, parsed), # <<<<<<<<<<<<<< @@ -2299,11 +2705,11 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH */ __pyx_t_9 = __pyx_cur_scope->__pyx_v_url; __Pyx_INCREF(__pyx_t_9); - __pyx_t_10 = __pyx_f_9urlparse4_5cgurl_build_netloc(((PyObject*)__pyx_t_9), __pyx_cur_scope->__pyx_v_parsed); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_10 = __pyx_f_5cgurl_build_netloc(((PyObject*)__pyx_t_9), __pyx_cur_scope->__pyx_v_parsed); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "urlparse4/cgurl.pyx":150 + /* "cgurl.pyx":151 * slice_component(url, parsed.scheme).lower(), * build_netloc(url, parsed), * slice_component(url, parsed.path), # <<<<<<<<<<<<<< @@ -2312,11 +2718,11 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH */ __pyx_t_9 = __pyx_cur_scope->__pyx_v_url; __Pyx_INCREF(__pyx_t_9); - __pyx_t_11 = __pyx_f_9urlparse4_5cgurl_slice_component(((PyObject*)__pyx_t_9), __pyx_cur_scope->__pyx_v_parsed.path); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_11 = __pyx_f_5cgurl_slice_component(((PyObject*)__pyx_t_9), __pyx_cur_scope->__pyx_v_parsed.path); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "urlparse4/cgurl.pyx":151 + /* "cgurl.pyx":152 * build_netloc(url, parsed), * slice_component(url, parsed.path), * slice_component(url, parsed.query), # <<<<<<<<<<<<<< @@ -2325,11 +2731,11 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH */ __pyx_t_9 = __pyx_cur_scope->__pyx_v_url; __Pyx_INCREF(__pyx_t_9); - __pyx_t_12 = __pyx_f_9urlparse4_5cgurl_slice_component(((PyObject*)__pyx_t_9), __pyx_cur_scope->__pyx_v_parsed.query); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_12 = __pyx_f_5cgurl_slice_component(((PyObject*)__pyx_t_9), __pyx_cur_scope->__pyx_v_parsed.query); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "urlparse4/cgurl.pyx":152 + /* "cgurl.pyx":153 * slice_component(url, parsed.path), * slice_component(url, parsed.query), * slice_component(url, parsed.ref) # <<<<<<<<<<<<<< @@ -2338,18 +2744,18 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH */ __pyx_t_9 = __pyx_cur_scope->__pyx_v_url; __Pyx_INCREF(__pyx_t_9); - __pyx_t_13 = __pyx_f_9urlparse4_5cgurl_slice_component(((PyObject*)__pyx_t_9), __pyx_cur_scope->__pyx_v_parsed.ref); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_13 = __pyx_f_5cgurl_slice_component(((PyObject*)__pyx_t_9), __pyx_cur_scope->__pyx_v_parsed.ref); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "urlparse4/cgurl.pyx":148 + /* "cgurl.pyx":149 * * return tuple.__new__(cls, ( * slice_component(url, parsed.scheme).lower(), # <<<<<<<<<<<<<< * build_netloc(url, parsed), * slice_component(url, parsed.path), */ - __pyx_t_9 = PyTuple_New(5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); @@ -2367,37 +2773,57 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_13 = NULL; - __pyx_t_5 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_14 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_13)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_5 = 1; + __pyx_t_14 = 1; } } - __pyx_t_12 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __pyx_t_13 = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_cls, __pyx_t_9}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_cls, __pyx_t_9}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __pyx_t_13 = NULL; + } + __Pyx_INCREF(__pyx_v_cls); + __Pyx_GIVEREF(__pyx_v_cls); + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_14, __pyx_v_cls); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_14, __pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } - __Pyx_INCREF(__pyx_v_cls); - __Pyx_GIVEREF(__pyx_v_cls); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_5, __pyx_v_cls); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_5, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":111 + /* "cgurl.pyx":112 * __slots__ = () # prevent creation of instance dictionary * * def __new__(cls, bytes url): # <<<<<<<<<<<<<< @@ -2415,7 +2841,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("urlparse4.cgurl.SplitResultNamedTuple.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.SplitResultNamedTuple.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v__get_attr); @@ -2425,29 +2851,29 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple___new__(CYTH return __pyx_r; } -/* "urlparse4/cgurl.pyx":155 +/* "cgurl.pyx":156 * )) * * def geturl(self): # <<<<<<<<<<<<<< - * return stdlib_urlparse.urlunsplit(self) + * return stdlib_urlunsplit(self) * */ /* Python wrapper */ -static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_3geturl(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_9urlparse4_5cgurl_21SplitResultNamedTuple_3geturl = {"geturl", (PyCFunction)__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_3geturl, METH_O, 0}; -static PyObject *__pyx_pw_9urlparse4_5cgurl_21SplitResultNamedTuple_3geturl(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_5cgurl_21SplitResultNamedTuple_3geturl(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_5cgurl_21SplitResultNamedTuple_3geturl = {"geturl", (PyCFunction)__pyx_pw_5cgurl_21SplitResultNamedTuple_3geturl, METH_O, 0}; +static PyObject *__pyx_pw_5cgurl_21SplitResultNamedTuple_3geturl(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("geturl (wrapper)", 0); - __pyx_r = __pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_2geturl(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_5cgurl_21SplitResultNamedTuple_2geturl(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_2geturl(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_5cgurl_21SplitResultNamedTuple_2geturl(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2456,53 +2882,68 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_2geturl(CYTH PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("geturl", 0); - /* "urlparse4/cgurl.pyx":156 + /* "cgurl.pyx":157 * * def geturl(self): - * return stdlib_urlparse.urlunsplit(self) # <<<<<<<<<<<<<< + * return stdlib_urlunsplit(self) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_stdlib_urlparse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_stdlib_urlunsplit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_urlunsplit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(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_3, function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_self); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_self}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_self}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_self); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":155 + /* "cgurl.pyx":156 * )) * * def geturl(self): # <<<<<<<<<<<<<< - * return stdlib_urlparse.urlunsplit(self) + * return stdlib_urlunsplit(self) * */ @@ -2512,7 +2953,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_2geturl(CYTH __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("urlparse4.cgurl.SplitResultNamedTuple.geturl", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.SplitResultNamedTuple.geturl", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2520,57 +2961,57 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_21SplitResultNamedTuple_2geturl(CYTH return __pyx_r; } -/* "urlparse4/cgurl.pyx":159 +/* "cgurl.pyx":160 * * - * def urlsplit(url): # <<<<<<<<<<<<<< + * def url_split(url): # <<<<<<<<<<<<<< * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * */ /* Python wrapper */ -static PyObject *__pyx_pw_9urlparse4_5cgurl_1urlsplit(PyObject *__pyx_self, PyObject *__pyx_v_url); /*proto*/ -static PyMethodDef __pyx_mdef_9urlparse4_5cgurl_1urlsplit = {"urlsplit", (PyCFunction)__pyx_pw_9urlparse4_5cgurl_1urlsplit, METH_O, 0}; -static PyObject *__pyx_pw_9urlparse4_5cgurl_1urlsplit(PyObject *__pyx_self, PyObject *__pyx_v_url) { +static PyObject *__pyx_pw_5cgurl_1url_split(PyObject *__pyx_self, PyObject *__pyx_v_url); /*proto*/ +static PyMethodDef __pyx_mdef_5cgurl_1url_split = {"url_split", (PyCFunction)__pyx_pw_5cgurl_1url_split, METH_O, 0}; +static PyObject *__pyx_pw_5cgurl_1url_split(PyObject *__pyx_self, PyObject *__pyx_v_url) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("urlsplit (wrapper)", 0); - __pyx_r = __pyx_pf_9urlparse4_5cgurl_urlsplit(__pyx_self, ((PyObject *)__pyx_v_url)); + __Pyx_RefNannySetupContext("url_split (wrapper)", 0); + __pyx_r = __pyx_pf_5cgurl_url_split(__pyx_self, ((PyObject *)__pyx_v_url)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_9urlparse4_5cgurl_urlsplit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_url) { +static PyObject *__pyx_pf_5cgurl_url_split(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_url) { 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; - Py_ssize_t __pyx_t_5; + int __pyx_t_5; PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("urlsplit", 0); + __Pyx_RefNannySetupContext("url_split", 0); - /* "urlparse4/cgurl.pyx":160 + /* "cgurl.pyx":161 * - * def urlsplit(url): + * def url_split(url): * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) # <<<<<<<<<<<<<< * - * def urljoin(bytes base, bytes url, allow_fragments=True): + * def url_join(bytes base, bytes url, allow_fragments=True): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_SplitResultNamedTuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_SplitResultNamedTuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_SplitResultNamedTuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_SplitResultNamedTuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; __pyx_t_5 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + if (CYTHON_UNPACK_METHODS && 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); @@ -2580,29 +3021,49 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_urlsplit(CYTHON_UNUSED PyObject *__p __pyx_t_5 = 1; } } - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_v_url}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_v_url}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2); + __Pyx_INCREF(__pyx_v_url); + __Pyx_GIVEREF(__pyx_v_url); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_url); + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2); - __Pyx_INCREF(__pyx_v_url); - __Pyx_GIVEREF(__pyx_v_url); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_url); - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":159 + /* "cgurl.pyx":160 * * - * def urlsplit(url): # <<<<<<<<<<<<<< + * def url_split(url): # <<<<<<<<<<<<<< * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * */ @@ -2614,7 +3075,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_urlsplit(CYTHON_UNUSED PyObject *__p __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("urlparse4.cgurl.urlsplit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.url_split", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2622,24 +3083,24 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_urlsplit(CYTHON_UNUSED PyObject *__p return __pyx_r; } -/* "urlparse4/cgurl.pyx":162 +/* "cgurl.pyx":163 * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * - * def urljoin(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< + * def url_join(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< * if allow_fragments and base: * return GURL(base).Resolve(url).spec() */ /* Python wrapper */ -static PyObject *__pyx_pw_9urlparse4_5cgurl_3urljoin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_9urlparse4_5cgurl_3urljoin = {"urljoin", (PyCFunction)__pyx_pw_9urlparse4_5cgurl_3urljoin, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_9urlparse4_5cgurl_3urljoin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_5cgurl_3url_join(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_5cgurl_3url_join = {"url_join", (PyCFunction)__pyx_pw_5cgurl_3url_join, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5cgurl_3url_join(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_base = 0; PyObject *__pyx_v_url = 0; PyObject *__pyx_v_allow_fragments = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("urljoin (wrapper)", 0); + __Pyx_RefNannySetupContext("url_join (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_base,&__pyx_n_s_url,&__pyx_n_s_allow_fragments,0}; PyObject* values[3] = {0,0,0}; @@ -2649,33 +3110,39 @@ static PyObject *__pyx_pw_9urlparse4_5cgurl_3urljoin(PyObject *__pyx_self, PyObj const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_base)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_url)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_url)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("urljoin", 0, 2, 3, 1); __PYX_ERR(0, 162, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("url_join", 0, 2, 3, 1); __PYX_ERR(0, 163, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_allow_fragments); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allow_fragments); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "urljoin") < 0)) __PYX_ERR(0, 162, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "url_join") < 0)) __PYX_ERR(0, 163, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; @@ -2688,15 +3155,15 @@ static PyObject *__pyx_pw_9urlparse4_5cgurl_3urljoin(PyObject *__pyx_self, PyObj } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("urljoin", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 162, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("url_join", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 163, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("urlparse4.cgurl.urljoin", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.url_join", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_base), (&PyBytes_Type), 1, "base", 1))) __PYX_ERR(0, 162, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_url), (&PyBytes_Type), 1, "url", 1))) __PYX_ERR(0, 162, __pyx_L1_error) - __pyx_r = __pyx_pf_9urlparse4_5cgurl_2urljoin(__pyx_self, __pyx_v_base, __pyx_v_url, __pyx_v_allow_fragments); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_base), (&PyBytes_Type), 1, "base", 1))) __PYX_ERR(0, 163, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_url), (&PyBytes_Type), 1, "url", 1))) __PYX_ERR(0, 163, __pyx_L1_error) + __pyx_r = __pyx_pf_5cgurl_2url_join(__pyx_self, __pyx_v_base, __pyx_v_url, __pyx_v_allow_fragments); /* function exit code */ goto __pyx_L0; @@ -2707,7 +3174,7 @@ static PyObject *__pyx_pw_9urlparse4_5cgurl_3urljoin(PyObject *__pyx_self, PyObj return __pyx_r; } -static PyObject *__pyx_pf_9urlparse4_5cgurl_2urljoin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_base, PyObject *__pyx_v_url, PyObject *__pyx_v_allow_fragments) { +static PyObject *__pyx_pf_5cgurl_2url_join(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_base, PyObject *__pyx_v_url, PyObject *__pyx_v_allow_fragments) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -2718,88 +3185,85 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_2urljoin(CYTHON_UNUSED PyObject *__p PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("urljoin", 0); + __Pyx_RefNannySetupContext("url_join", 0); - /* "urlparse4/cgurl.pyx":163 + /* "cgurl.pyx":164 * - * def urljoin(bytes base, bytes url, allow_fragments=True): + * def url_join(bytes base, bytes url, allow_fragments=True): * if allow_fragments and base: # <<<<<<<<<<<<<< * return GURL(base).Resolve(url).spec() * else: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_allow_fragments); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 163, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_allow_fragments); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 164, __pyx_L1_error) if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } - __pyx_t_2 = (__pyx_v_base != Py_None) && (PyBytes_GET_SIZE(__pyx_v_base) != 0); + __pyx_t_2 = (__pyx_v_base != Py_None)&&(PyBytes_GET_SIZE(__pyx_v_base) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "urlparse4/cgurl.pyx":164 - * def urljoin(bytes base, bytes url, allow_fragments=True): + /* "cgurl.pyx":165 + * def url_join(bytes base, bytes url, allow_fragments=True): * if allow_fragments and base: * return GURL(base).Resolve(url).spec() # <<<<<<<<<<<<<< * else: - * return stdlib_urlparse.urljoin(base, url, allow_fragments=allow_fragments) + * return stdlib_urljoin(base, url, allow_fragments=allow_fragments) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_base); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L1_error) - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_url); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L1_error) - __pyx_t_5 = __pyx_convert_PyBytes_string_to_py_std__in_string(GURL(__pyx_t_3).Resolve(__pyx_t_4).spec()); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_base); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_url); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_5 = __pyx_convert_PyBytes_string_to_py_std__in_string(GURL(__pyx_t_3).Resolve(__pyx_t_4).spec()); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "urlparse4/cgurl.pyx":163 + /* "cgurl.pyx":164 * - * def urljoin(bytes base, bytes url, allow_fragments=True): + * def url_join(bytes base, bytes url, allow_fragments=True): * if allow_fragments and base: # <<<<<<<<<<<<<< * return GURL(base).Resolve(url).spec() * else: */ } - /* "urlparse4/cgurl.pyx":166 + /* "cgurl.pyx":167 * return GURL(base).Resolve(url).spec() * else: - * return stdlib_urlparse.urljoin(base, url, allow_fragments=allow_fragments) # <<<<<<<<<<<<<< + * return stdlib_urljoin(base, url, allow_fragments=allow_fragments) # <<<<<<<<<<<<<< */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_stdlib_urlparse); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_stdlib_urljoin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_urljoin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 166, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_base); __Pyx_GIVEREF(__pyx_v_base); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_base); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_base); __Pyx_INCREF(__pyx_v_url); __Pyx_GIVEREF(__pyx_v_url); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_url); - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_url); + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_allow_fragments, __pyx_v_allow_fragments) < 0) __PYX_ERR(0, 166, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 166, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_allow_fragments, __pyx_v_allow_fragments) < 0) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_r = __pyx_t_8; __pyx_t_8 = 0; goto __pyx_L0; } - /* "urlparse4/cgurl.pyx":162 + /* "cgurl.pyx":163 * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * - * def urljoin(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< + * def url_join(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< * if allow_fragments and base: * return GURL(base).Resolve(url).spec() */ @@ -2810,7 +3274,7 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_2urljoin(CYTHON_UNUSED PyObject *__p __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("urlparse4.cgurl.urljoin", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.url_join", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2823,30 +3287,30 @@ static PyObject *__pyx_pf_9urlparse4_5cgurl_2urljoin(CYTHON_UNUSED PyObject *__p * @cname("__pyx_convert_string_from_py_std__in_string") * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) */ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { Py_ssize_t __pyx_v_length; - char *__pyx_v_data; + char const *__pyx_v_data; std::string __pyx_r; __Pyx_RefNannyDeclarations - char *__pyx_t_1; + char const *__pyx_t_1; __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); /* "string.from_py":15 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< * return string(data, length) * */ - __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(1, 15, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error) __pyx_v_data = __pyx_t_1; /* "string.from_py":16 * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) * return string(data, length) # <<<<<<<<<<<<<< * * @@ -2859,12 +3323,13 @@ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v * @cname("__pyx_convert_string_from_py_std__in_string") * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -2889,7 +3354,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_strin * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< * cdef extern from *: - * cdef object __Pyx_PyUnicode_FromStringAndSize(char*, size_t) + * cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t) */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error) @@ -2936,7 +3401,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_stri * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< * cdef extern from *: - * cdef object __Pyx_PyStr_FromStringAndSize(char*, size_t) + * cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t) */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error) @@ -2983,7 +3448,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(s * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< * cdef extern from *: - * cdef object __Pyx_PyBytes_FromStringAndSize(char*, size_t) + * cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t) */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error) @@ -3030,7 +3495,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< * cdef extern from *: - * cdef object __Pyx_PyByteArray_FromStringAndSize(char*, size_t) + * cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t) */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error) @@ -3104,14 +3569,14 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_st return __pyx_r; } -static struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__ *__pyx_freelist_9urlparse4_5cgurl___pyx_scope_struct____new__[8]; -static int __pyx_freecount_9urlparse4_5cgurl___pyx_scope_struct____new__ = 0; +static struct __pyx_obj_5cgurl___pyx_scope_struct____new__ *__pyx_freelist_5cgurl___pyx_scope_struct____new__[8]; +static int __pyx_freecount_5cgurl___pyx_scope_struct____new__ = 0; -static PyObject *__pyx_tp_new_9urlparse4_5cgurl___pyx_scope_struct____new__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_5cgurl___pyx_scope_struct____new__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9urlparse4_5cgurl___pyx_scope_struct____new__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__)))) { - o = (PyObject*)__pyx_freelist_9urlparse4_5cgurl___pyx_scope_struct____new__[--__pyx_freecount_9urlparse4_5cgurl___pyx_scope_struct____new__]; - memset(o, 0, sizeof(struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5cgurl___pyx_scope_struct____new__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5cgurl___pyx_scope_struct____new__)))) { + o = (PyObject*)__pyx_freelist_5cgurl___pyx_scope_struct____new__[--__pyx_freecount_5cgurl___pyx_scope_struct____new__]; + memset(o, 0, sizeof(struct __pyx_obj_5cgurl___pyx_scope_struct____new__)); (void) PyObject_INIT(o, t); } else { o = (*t->tp_alloc)(t, 0); @@ -3120,22 +3585,22 @@ static PyObject *__pyx_tp_new_9urlparse4_5cgurl___pyx_scope_struct____new__(PyTy return o; } -static void __pyx_tp_dealloc_9urlparse4_5cgurl___pyx_scope_struct____new__(PyObject *o) { - struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__ *p = (struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__ *)o; +static void __pyx_tp_dealloc_5cgurl___pyx_scope_struct____new__(PyObject *o) { + struct __pyx_obj_5cgurl___pyx_scope_struct____new__ *p = (struct __pyx_obj_5cgurl___pyx_scope_struct____new__ *)o; Py_CLEAR(p->__pyx_v_url); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9urlparse4_5cgurl___pyx_scope_struct____new__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__)))) { - __pyx_freelist_9urlparse4_5cgurl___pyx_scope_struct____new__[__pyx_freecount_9urlparse4_5cgurl___pyx_scope_struct____new__++] = ((struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__ *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5cgurl___pyx_scope_struct____new__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5cgurl___pyx_scope_struct____new__)))) { + __pyx_freelist_5cgurl___pyx_scope_struct____new__[__pyx_freecount_5cgurl___pyx_scope_struct____new__++] = ((struct __pyx_obj_5cgurl___pyx_scope_struct____new__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_type_9urlparse4_5cgurl___pyx_scope_struct____new__ = { +static PyTypeObject __pyx_type_5cgurl___pyx_scope_struct____new__ = { PyVarObject_HEAD_INIT(0, 0) - "urlparse4.cgurl.__pyx_scope_struct____new__", /*tp_name*/ - sizeof(struct __pyx_obj_9urlparse4_5cgurl___pyx_scope_struct____new__), /*tp_basicsize*/ + "cgurl.__pyx_scope_struct____new__", /*tp_name*/ + sizeof(struct __pyx_obj_5cgurl___pyx_scope_struct____new__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_9urlparse4_5cgurl___pyx_scope_struct____new__, /*tp_dealloc*/ + __pyx_tp_dealloc_5cgurl___pyx_scope_struct____new__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -3173,7 +3638,7 @@ static PyTypeObject __pyx_type_9urlparse4_5cgurl___pyx_scope_struct____new__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_9urlparse4_5cgurl___pyx_scope_struct____new__, /*tp_new*/ + __pyx_tp_new_5cgurl___pyx_scope_struct____new__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -3193,17 +3658,31 @@ static PyMethodDef __pyx_methods[] = { }; #if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_cgurl(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_cgurl}, + {0, NULL} +}; +#endif + static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else PyModuleDef_HEAD_INIT, - #endif "cgurl", 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #else -1, /* m_size */ + #endif __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else NULL, /* m_reload */ + #endif NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ @@ -3219,8 +3698,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, {&__pyx_n_s_allow_fragments, __pyx_k_allow_fragments, sizeof(__pyx_k_allow_fragments), 0, 0, 1, 1}, {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, + {&__pyx_n_s_cgurl, __pyx_k_cgurl, sizeof(__pyx_k_cgurl), 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_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1}, - {&__pyx_kp_s_cosr_urlparse4_urlparse4_cgurl, __pyx_k_cosr_urlparse4_urlparse4_cgurl, sizeof(__pyx_k_cosr_urlparse4_urlparse4_cgurl), 0, 0, 1, 0}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_kp_b_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 0, 0}, {&__pyx_n_s_fragment, __pyx_k_fragment, sizeof(__pyx_k_fragment), 0, 0, 1, 1}, @@ -3245,20 +3725,22 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_query, __pyx_k_query, sizeof(__pyx_k_query), 0, 0, 1, 1}, {&__pyx_n_s_scheme, __pyx_k_scheme, sizeof(__pyx_k_scheme), 0, 0, 1, 1}, {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_n_s_six_moves_urllib_parse, __pyx_k_six_moves_urllib_parse, sizeof(__pyx_k_six_moves_urllib_parse), 0, 0, 1, 1}, {&__pyx_n_s_slots, __pyx_k_slots, sizeof(__pyx_k_slots), 0, 0, 1, 1}, - {&__pyx_n_s_stdlib_urlparse, __pyx_k_stdlib_urlparse, sizeof(__pyx_k_stdlib_urlparse), 0, 0, 1, 1}, + {&__pyx_n_s_stdlib_urljoin, __pyx_k_stdlib_urljoin, sizeof(__pyx_k_stdlib_urljoin), 0, 0, 1, 1}, + {&__pyx_n_s_stdlib_urlunsplit, __pyx_k_stdlib_urlunsplit, sizeof(__pyx_k_stdlib_urlunsplit), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_url, __pyx_k_url, sizeof(__pyx_k_url), 0, 0, 1, 1}, + {&__pyx_n_s_url_join, __pyx_k_url_join, sizeof(__pyx_k_url_join), 0, 0, 1, 1}, + {&__pyx_n_s_url_split, __pyx_k_url_split, sizeof(__pyx_k_url_split), 0, 0, 1, 1}, {&__pyx_n_s_urljoin, __pyx_k_urljoin, sizeof(__pyx_k_urljoin), 0, 0, 1, 1}, - {&__pyx_n_s_urlparse, __pyx_k_urlparse, sizeof(__pyx_k_urlparse), 0, 0, 1, 1}, - {&__pyx_n_s_urlparse4_cgurl, __pyx_k_urlparse4_cgurl, sizeof(__pyx_k_urlparse4_cgurl), 0, 0, 1, 1}, - {&__pyx_n_s_urlsplit, __pyx_k_urlsplit, sizeof(__pyx_k_urlsplit), 0, 0, 1, 1}, + {&__pyx_kp_s_urlparse4_cgurl_pyx, __pyx_k_urlparse4_cgurl_pyx, sizeof(__pyx_k_urlparse4_cgurl_pyx), 0, 0, 1, 0}, {&__pyx_n_s_urlunsplit, __pyx_k_urlunsplit, sizeof(__pyx_k_urlunsplit), 0, 0, 1, 1}, {&__pyx_n_s_username, __pyx_k_username, sizeof(__pyx_k_username), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 52, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -3268,65 +3750,65 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "urlparse4/cgurl.pyx":120 + /* "cgurl.pyx":121 * ParseStandardURL(url, len(url), &parsed) * * def _get_attr(self, prop): # <<<<<<<<<<<<<< * if prop == "scheme": * return self[0] */ - __pyx_tuple__2 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prop, __pyx_n_s_port); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prop, __pyx_n_s_port); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cosr_urlparse4_urlparse4_cgurl, __pyx_n_s_get_attr, 120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_urlparse4_cgurl_pyx, __pyx_n_s_get_attr, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 121, __pyx_L1_error) - /* "urlparse4/cgurl.pyx":111 + /* "cgurl.pyx":112 * __slots__ = () # prevent creation of instance dictionary * * def __new__(cls, bytes url): # <<<<<<<<<<<<<< * * cdef Parsed parsed */ - __pyx_tuple__4 = PyTuple_Pack(5, __pyx_n_s_cls, __pyx_n_s_url, __pyx_n_s_parsed, __pyx_n_s_get_attr, __pyx_n_s_get_attr); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(5, __pyx_n_s_cls, __pyx_n_s_url, __pyx_n_s_parsed, __pyx_n_s_get_attr, __pyx_n_s_get_attr); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cosr_urlparse4_urlparse4_cgurl, __pyx_n_s_new, 111, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_urlparse4_cgurl_pyx, __pyx_n_s_new, 112, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 112, __pyx_L1_error) - /* "urlparse4/cgurl.pyx":155 + /* "cgurl.pyx":156 * )) * * def geturl(self): # <<<<<<<<<<<<<< - * return stdlib_urlparse.urlunsplit(self) + * return stdlib_urlunsplit(self) * */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cosr_urlparse4_urlparse4_cgurl, __pyx_n_s_geturl, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_urlparse4_cgurl_pyx, __pyx_n_s_geturl, 156, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 156, __pyx_L1_error) - /* "urlparse4/cgurl.pyx":159 + /* "cgurl.pyx":160 * * - * def urlsplit(url): # <<<<<<<<<<<<<< + * def url_split(url): # <<<<<<<<<<<<<< * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_url); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_url); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cosr_urlparse4_urlparse4_cgurl, __pyx_n_s_urlsplit, 159, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_urlparse4_cgurl_pyx, __pyx_n_s_url_split, 160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 160, __pyx_L1_error) - /* "urlparse4/cgurl.pyx":162 + /* "cgurl.pyx":163 * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * - * def urljoin(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< + * def url_join(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< * if allow_fragments and base: * return GURL(base).Resolve(url).spec() */ - __pyx_tuple__10 = PyTuple_Pack(3, __pyx_n_s_base, __pyx_n_s_url, __pyx_n_s_allow_fragments); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(3, __pyx_n_s_base, __pyx_n_s_url, __pyx_n_s_allow_fragments); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cosr_urlparse4_urlparse4_cgurl, __pyx_n_s_urljoin, 162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_urlparse4_cgurl_pyx, __pyx_n_s_url_join, 163, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -3342,12 +3824,151 @@ static int __Pyx_InitGlobals(void) { return -1; } +static int __Pyx_modinit_global_init_code(void); /*proto*/ +static int __Pyx_modinit_variable_export_code(void); /*proto*/ +static int __Pyx_modinit_function_export_code(void); /*proto*/ +static int __Pyx_modinit_type_init_code(void); /*proto*/ +static int __Pyx_modinit_type_import_code(void); /*proto*/ +static int __Pyx_modinit_variable_import_code(void); /*proto*/ +static int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_5cgurl___pyx_scope_struct____new__) < 0) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_type_5cgurl___pyx_scope_struct____new__.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5cgurl___pyx_scope_struct____new__.tp_dictoffset && __pyx_type_5cgurl___pyx_scope_struct____new__.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_5cgurl___pyx_scope_struct____new__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + __pyx_ptype_5cgurl___pyx_scope_struct____new__ = &__pyx_type_5cgurl___pyx_scope_struct____new__; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + #if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initcgurl(void); /*proto*/ -PyMODINIT_FUNC initcgurl(void) +#ifdef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC void #else -PyMODINIT_FUNC PyInit_cgurl(void); /*proto*/ -PyMODINIT_FUNC PyInit_cgurl(void) +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#endif +#else +#ifdef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#endif +#endif +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4))) + #define CYTHON_SMALL_CODE __attribute__((optimize("Os"))) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initcgurl(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initcgurl(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_cgurl(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_cgurl(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + result = PyDict_SetItemString(moddict, to_name, value); + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static int __pyx_pymod_exec_cgurl(PyObject *__pyx_pyinit_module) +#endif #endif { PyObject *__pyx_t_1 = NULL; @@ -3355,16 +3976,21 @@ PyMODINIT_FUNC PyInit_cgurl(void) PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0; + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_cgurl(void)", 0); + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_cgurl(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -3381,6 +4007,9 @@ PyMODINIT_FUNC PyInit_cgurl(void) #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif #ifdef __Pyx_StopAsyncIteration_USED if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif @@ -3392,15 +4021,21 @@ PyMODINIT_FUNC PyInit_cgurl(void) #endif #endif /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("cgurl", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif @@ -3410,14 +4045,14 @@ PyMODINIT_FUNC PyInit_cgurl(void) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - if (__pyx_module_is_main_urlparse4__cgurl) { + if (__pyx_module_is_main_cgurl) { if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "urlparse4.cgurl")) { - if (unlikely(PyDict_SetItemString(modules, "urlparse4.cgurl", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "cgurl")) { + if (unlikely(PyDict_SetItemString(modules, "cgurl", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif @@ -3425,128 +4060,156 @@ PyMODINIT_FUNC PyInit_cgurl(void) if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_9urlparse4_5cgurl___pyx_scope_struct____new__) < 0) __PYX_ERR(0, 111, __pyx_L1_error) - __pyx_type_9urlparse4_5cgurl___pyx_scope_struct____new__.tp_print = 0; - __pyx_ptype_9urlparse4_5cgurl___pyx_scope_struct____new__ = &__pyx_type_9urlparse4_5cgurl___pyx_scope_struct____new__; - /*--- Type import code ---*/ - /*--- Variable import code ---*/ - /*--- Function import code ---*/ + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error; + (void)__Pyx_modinit_type_import_code(); + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "urlparse4/cgurl.pyx":3 + /* "cgurl.pyx":3 * from urlparse4.mozilla_url_parse cimport Component, Parsed, ParseStandardURL, ParseFileURL - * from chromium_gurl cimport GURL - * import urlparse as stdlib_urlparse # <<<<<<<<<<<<<< + * from urlparse4.chromium_gurl cimport GURL + * from six.moves.urllib.parse import urljoin as stdlib_urljoin # <<<<<<<<<<<<<< + * from six.moves.urllib.parse import urlunsplit as stdlib_urlunsplit + * cimport cython + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_urljoin); + __Pyx_GIVEREF(__pyx_n_s_urljoin); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_urljoin); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_six_moves_urllib_parse, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_urljoin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_stdlib_urljoin, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cgurl.pyx":4 + * from urlparse4.chromium_gurl cimport GURL + * from six.moves.urllib.parse import urljoin as stdlib_urljoin + * from six.moves.urllib.parse import urlunsplit as stdlib_urlunsplit # <<<<<<<<<<<<<< * cimport cython * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_urlparse, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_urlunsplit); + __Pyx_GIVEREF(__pyx_n_s_urlunsplit); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_urlunsplit); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_six_moves_urllib_parse, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_stdlib_urlparse, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_urlunsplit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_stdlib_urlunsplit, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "urlparse4/cgurl.pyx":107 + /* "cgurl.pyx":108 * * * class SplitResultNamedTuple(tuple): # <<<<<<<<<<<<<< * * __slots__ = () # prevent creation of instance dictionary */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)(&PyTuple_Type))); __Pyx_GIVEREF(((PyObject *)(&PyTuple_Type))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&PyTuple_Type))); - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_SplitResultNamedTuple, __pyx_n_s_SplitResultNamedTuple, (PyObject *) NULL, __pyx_n_s_urlparse4_cgurl, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_SplitResultNamedTuple, __pyx_n_s_SplitResultNamedTuple, (PyObject *) NULL, __pyx_n_s_cgurl, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "urlparse4/cgurl.pyx":109 + /* "cgurl.pyx":110 * class SplitResultNamedTuple(tuple): * * __slots__ = () # prevent creation of instance dictionary # <<<<<<<<<<<<<< * * def __new__(cls, bytes url): */ - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_slots, __pyx_empty_tuple) < 0) __PYX_ERR(0, 109, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_slots, __pyx_empty_tuple) < 0) __PYX_ERR(0, 110, __pyx_L1_error) - /* "urlparse4/cgurl.pyx":111 + /* "cgurl.pyx":112 * __slots__ = () # prevent creation of instance dictionary * * def __new__(cls, bytes url): # <<<<<<<<<<<<<< * * cdef Parsed parsed */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9urlparse4_5cgurl_21SplitResultNamedTuple_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_SplitResultNamedTuple___new, NULL, __pyx_n_s_urlparse4_cgurl, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5cgurl_21SplitResultNamedTuple_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_SplitResultNamedTuple___new, NULL, __pyx_n_s_cgurl, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_new, __pyx_t_4) < 0) __PYX_ERR(0, 111, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_new, __pyx_t_4) < 0) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "urlparse4/cgurl.pyx":155 + /* "cgurl.pyx":156 * )) * * def geturl(self): # <<<<<<<<<<<<<< - * return stdlib_urlparse.urlunsplit(self) + * return stdlib_urlunsplit(self) * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9urlparse4_5cgurl_21SplitResultNamedTuple_3geturl, 0, __pyx_n_s_SplitResultNamedTuple_geturl, NULL, __pyx_n_s_urlparse4_cgurl, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5cgurl_21SplitResultNamedTuple_3geturl, 0, __pyx_n_s_SplitResultNamedTuple_geturl, NULL, __pyx_n_s_cgurl, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_geturl, __pyx_t_4) < 0) __PYX_ERR(0, 155, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_geturl, __pyx_t_4) < 0) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "urlparse4/cgurl.pyx":107 + /* "cgurl.pyx":108 * * * class SplitResultNamedTuple(tuple): # <<<<<<<<<<<<<< * * __slots__ = () # prevent creation of instance dictionary */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_SplitResultNamedTuple, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_SplitResultNamedTuple, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_SplitResultNamedTuple, __pyx_t_4) < 0) __PYX_ERR(0, 107, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_SplitResultNamedTuple, __pyx_t_4) < 0) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "urlparse4/cgurl.pyx":159 + /* "cgurl.pyx":160 * * - * def urlsplit(url): # <<<<<<<<<<<<<< + * def url_split(url): # <<<<<<<<<<<<<< * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9urlparse4_5cgurl_1urlsplit, NULL, __pyx_n_s_urlparse4_cgurl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cgurl_1url_split, NULL, __pyx_n_s_cgurl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_urlsplit, __pyx_t_1) < 0) __PYX_ERR(0, 159, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_url_split, __pyx_t_1) < 0) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "urlparse4/cgurl.pyx":162 + /* "cgurl.pyx":163 * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * - * def urljoin(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< + * def url_join(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< * if allow_fragments and base: * return GURL(base).Resolve(url).spec() */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9urlparse4_5cgurl_3urljoin, NULL, __pyx_n_s_urlparse4_cgurl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cgurl_3url_join, NULL, __pyx_n_s_cgurl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_urljoin, __pyx_t_1) < 0) __PYX_ERR(0, 162, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_url_join, __pyx_t_1) < 0) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "urlparse4/cgurl.pyx":1 + /* "cgurl.pyx":1 * from urlparse4.mozilla_url_parse cimport Component, Parsed, ParseStandardURL, ParseFileURL # <<<<<<<<<<<<<< - * from chromium_gurl cimport GURL - * import urlparse as stdlib_urlparse + * from urlparse4.chromium_gurl cimport GURL + * from six.moves.urllib.parse import urljoin as stdlib_urljoin */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3569,18 +4232,20 @@ PyMODINIT_FUNC PyInit_cgurl(void) __Pyx_XDECREF(__pyx_t_4); if (__pyx_m) { if (__pyx_d) { - __Pyx_AddTraceback("init urlparse4.cgurl", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init cgurl", 0, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init urlparse4.cgurl"); + PyErr_SetString(PyExc_ImportError, "init cgurl"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 return __pyx_m; + #else + return; #endif } @@ -3602,6 +4267,20 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #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)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); @@ -3617,7 +4296,7 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { } /* PyErrFetchRestore */ -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; @@ -3756,11 +4435,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "raise: exception class must be a subclass of BaseException"); goto bad; } -#if PY_VERSION_HEX >= 0x03030000 if (cause) { -#else - if (cause && cause != Py_None) { -#endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; @@ -3788,7 +4463,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #else - PyThreadState *tstate = PyThreadState_GET(); + PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); @@ -3804,7 +4479,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject #endif /* RaiseArgTupleInvalid */ - static void __Pyx_RaiseArgtupleInvalid( +static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, @@ -3830,7 +4505,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } /* RaiseDoubleKeywords */ - static void __Pyx_RaiseDoubleKeywordsError( +static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { @@ -3844,7 +4519,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } /* ParseKeywords */ - static int __Pyx_ParseOptionalKeywords( +static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, @@ -3946,34 +4621,28 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } /* ArgTypeTest */ - static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } - if (none_allowed && obj == Py_None) return 1; else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; #endif } else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; + if (likely(__Pyx_TypeCheck(obj, type))) return 1; } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } /* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -3991,7 +4660,16 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in } else if (length == 1) { return (equals == Py_EQ); } else { - int result = memcmp(ps1, ps2, (size_t)length); + int result; +#if CYTHON_USE_UNICODE_INTERNALS + 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)) { @@ -4011,7 +4689,7 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in } /* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -4051,6 +4729,21 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in 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; @@ -4095,7 +4788,7 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in } /* GetItemInt */ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -4105,10 +4798,13 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in 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_COMPILING_IN_CPYTHON - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); +#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); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } @@ -4120,10 +4816,13 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_ 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_COMPILING_IN_CPYTHON - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); +#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((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } @@ -4135,7 +4834,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize 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_COMPILING_IN_CPYTHON +#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((n >= 0) & (n < PyList_GET_SIZE(o))))) { @@ -4176,12 +4875,155 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } /* None */ - static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { +static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); } +/* PyCFunctionFastCall */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { + PyCFunctionObject *func = (PyCFunctionObject*)func_obj; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); + assert(PyCFunction_Check(func)); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + /* _PyCFunction_FastCallDict() must not be called with an exception set, + because it may clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs); + } +} +#endif + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL +#include "frameobject.h" +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 = f->f_localsplus; + 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; +} +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int 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_EnterRecursiveCall((char*)" while calling a Python object")) { + return NULL; + } + 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, nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif +#endif + /* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; ternaryfunc call = func->ob_type->tp_call; @@ -4201,7 +5043,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #endif /* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; @@ -4221,7 +5063,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject #endif /* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_New(1); @@ -4233,13 +5075,18 @@ static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { return result; } static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } #endif + if (likely(PyCFunction_Check(func))) { if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif } } return __Pyx__PyObject_CallOneArg(func, arg); @@ -4256,10 +5103,15 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec #endif /* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, NULL, 0); + } +#endif #ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { + if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) { #else if (likely(PyCFunction_Check(func))) { #endif @@ -4272,7 +5124,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #endif /* FetchCommonType */ - static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; PyTypeObject* cached_type = NULL; fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); @@ -4311,7 +5163,8 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { } /* CythonFunction */ - static PyObject * + #include +static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) { if (unlikely(op->func_doc == NULL)) { @@ -4468,7 +5321,7 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { PyObject *res = op->defaults_getter((PyObject *) op); if (unlikely(!res)) return -1; - #if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS op->defaults_tuple = PyTuple_GET_ITEM(res, 0); Py_INCREF(op->defaults_tuple); op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); @@ -4593,7 +5446,7 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = { {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, {0, 0, 0, 0, 0} }; static PyObject * @@ -4671,14 +5524,18 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) } return 0; } -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) { - PyObject_GC_UnTrack(m); if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); PyObject_GC_Del(m); } +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { Py_VISIT(m->func_closure); @@ -4727,11 +5584,9 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) PyString_AsString(op->func_qualname), (void *)op); #endif } -#if CYTHON_COMPILING_IN_PYPY -static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = f->m_ml->ml_meth; - PyObject *self = f->m_self; Py_ssize_t size; switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: @@ -4755,10 +5610,16 @@ static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); if (likely(size == 1)) { - PyObject *result, *arg0 = PySequence_ITEM(arg, 0); - if (unlikely(!arg0)) return NULL; + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) Py_DECREF(arg0); + #endif return result; } PyErr_Format(PyExc_TypeError, @@ -4777,11 +5638,32 @@ static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject f->m_ml->ml_name); return NULL; } -#else -static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return PyCFunction_Call(func, arg, kw); +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; + argc = PyTuple_GET_SIZE(args); + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; } -#endif static PyTypeObject __pyx_CyFunctionType_type = { PyVarObject_HEAD_INIT(0, 0) "cython_function_or_method", @@ -4801,7 +5683,7 @@ static PyTypeObject __pyx_CyFunctionType_type = { 0, 0, 0, - __Pyx_CyFunction_Call, + __Pyx_CyFunction_CallAsMethod, 0, 0, 0, @@ -4843,11 +5725,8 @@ static PyTypeObject __pyx_CyFunctionType_type = { #endif }; static int __pyx_CyFunction_init(void) { -#if !CYTHON_COMPILING_IN_PYPY - __pyx_CyFunctionType_type.tp_call = PyCFunction_Call; -#endif __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); - if (__pyx_CyFunctionType == NULL) { + if (unlikely(__pyx_CyFunctionType == NULL)) { return -1; } return 0; @@ -4855,7 +5734,7 @@ static int __pyx_CyFunction_init(void) { static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults = PyObject_Malloc(size); - if (!m->defaults) + if (unlikely(!m->defaults)) return PyErr_NoMemory(); memset(m->defaults, 0, size); m->defaults_pyobjects = pyobjects; @@ -4877,14 +5756,37 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py Py_INCREF(dict); } +/* 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 + /* GetModuleGlobalName */ - static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + if (likely(result)) { + Py_INCREF(result); + } else if (unlikely(PyErr_Occurred())) { + result = NULL; + } else { +#else result = PyDict_GetItem(__pyx_d, name); if (likely(result)) { Py_INCREF(result); } else { +#endif #else result = PyObject_GetItem(__pyx_d, name); if (!result) { @@ -4895,14 +5797,54 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py return result; } +/* PyObject_GenericGetAttrNoDict */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'%.50s' object has no attribute '%U'", + tp->tp_name, attr_name); +#else + "'%.50s' object has no attribute '%.400s'", + tp->tp_name, PyString_AS_STRING(attr_name)); +#endif + 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 + /* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - #if PY_VERSION_HEX < 0x03030000 + #if PY_MAJOR_VERSION < 3 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) @@ -4926,17 +5868,8 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); - #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; @@ -4947,7 +5880,7 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py } #endif if (!module) { - #if PY_VERSION_HEX < 0x03030000 + #if PY_MAJOR_VERSION < 3 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; @@ -4961,7 +5894,7 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py } } bad: - #if PY_VERSION_HEX < 0x03030000 + #if PY_MAJOR_VERSION < 3 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); @@ -4969,8 +5902,22 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py 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)) { + 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; +} + /* CalculateMetaclass */ - static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); for (i=0; i < nbases; i++) { PyTypeObject *tmptype; @@ -5009,7 +5956,7 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py } /* 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) { @@ -5075,8 +6022,48 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj return result; } +/* CLineInTraceback */ + #ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { + PyObject *use_cline; + PyObject *ptype, *pvalue, *ptraceback; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject **cython_runtime_dict; +#endif + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); +#if CYTHON_COMPILING_IN_CPYTHON + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); + } else +#endif + { + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + PyErr_Clear(); + use_cline = NULL; + } + } + if (!use_cline) { + c_line = 0; + PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + } + else if (PyObject_Not(use_cline) != 0) { + c_line = 0; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + 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) { return count; @@ -5156,7 +6143,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { } /* AddTraceback */ - #include "compile.h" + #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -5215,21 +6202,25 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); + PyThreadState *tstate = __Pyx_PyThreadState_Current; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = py_line; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); @@ -5237,7 +6228,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -5245,14 +6236,18 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif } } { @@ -5264,7 +6259,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* 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) @@ -5286,7 +6281,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -5353,8 +6348,10 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif if (sizeof(long) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif } } else { #if CYTHON_USE_PYLONG_INTERNALS @@ -5421,8 +6418,10 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif if (sizeof(long) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif } } { @@ -5471,7 +6470,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -5538,8 +6537,10 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif if (sizeof(int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif } } else { #if CYTHON_USE_PYLONG_INTERNALS @@ -5606,8 +6607,10 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif if (sizeof(int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif } } { @@ -5655,8 +6658,80 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, return (int) -1; } +/* FastTypeChecks */ + #if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = a->tp_base; + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; + if (!res) { + res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } + return res; +} +#endif +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { + if (likely(err == exc_type)) return 1; + if (likely(PyExceptionClass_Check(err))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); + } + return PyErr_GivenExceptionMatches(err, exc_type); +} +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { + if (likely(err == exc_type1 || err == exc_type2)) return 1; + if (likely(PyExceptionClass_Check(err))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); + } + return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); +} +#endif + /* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { + static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); @@ -5672,7 +6747,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { @@ -5697,6 +6772,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif if (!*t->p) return -1; + if (PyObject_Hash(*t->p) == -1) + return -1; ++t; } return 0; @@ -5705,50 +6782,57 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +#if !CYTHON_PEP393_ENABLED +static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; } } + } #endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +} #else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } #else - return PyUnicode_AsUTF8AndSize(o, length); + return PyUnicode_AsUTF8AndSize(o, length); #endif +} +#endif +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && #endif + PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) @@ -5772,43 +6856,67 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } +static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { +#if PY_MAJOR_VERSION >= 3 + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type %.200s). " + "The ability to return an instance of a strict subclass of int " + "is deprecated, and may be removed in a future version of Python.", + Py_TYPE(result)->tp_name)) { + Py_DECREF(result); + return NULL; + } + return result; + } +#endif + PyErr_Format(PyExc_TypeError, + "__%.4s__ returned non-%.4s (type %.200s)", + type_name, type_name, Py_TYPE(result)->tp_name); + Py_DECREF(result); + return NULL; +} static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; +#endif const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) + if (likely(PyInt_Check(x) || PyLong_Check(x))) #else - if (PyLong_Check(x)) + if (likely(PyLong_Check(x))) #endif return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; -#if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; - res = PyNumber_Int(x); + res = m->nb_int(x); } else if (m && m->nb_long) { name = "long"; - res = PyNumber_Long(x); + res = m->nb_long(x); } -#else - if (m && m->nb_int) { + #else + if (likely(m && m->nb_int)) { name = "int"; - res = PyNumber_Long(x); + res = m->nb_int(x); + } + #endif +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Int(x); } #endif - if (res) { + if (likely(res)) { #if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { + if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { #else - if (!PyLong_Check(res)) { + if (unlikely(!PyLong_CheckExact(res))) { #endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; + return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); } } else if (!PyErr_Occurred()) { @@ -5879,6 +6987,9 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); +} static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } diff --git a/urlparse4/cgurl.pyx b/urlparse4/cgurl.pyx index 837049a..8c7109a 100644 --- a/urlparse4/cgurl.pyx +++ b/urlparse4/cgurl.pyx @@ -1,5 +1,5 @@ -from urlparse4.urlparse4.mozilla_url_parse cimport Component, Parsed, ParseStandardURL, ParseFileURL -from chromium_gurl cimport GURL +from urlparse4.mozilla_url_parse cimport Component, Parsed, ParseStandardURL, ParseFileURL +from urlparse4.chromium_gurl cimport GURL from six.moves.urllib.parse import urljoin as stdlib_urljoin from six.moves.urllib.parse import urlunsplit as stdlib_urlunsplit cimport cython From 9c8a185323bcdd2a78a09ac2d08b5a64dc965a01 Mon Sep 17 00:00:00 2001 From: nctl144 Date: Thu, 7 Jun 2018 11:29:20 -0500 Subject: [PATCH 08/13] fix the import error --- urlparse4/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/urlparse4/__init__.py b/urlparse4/__init__.py index ca89b0a..851850d 100644 --- a/urlparse4/__init__.py +++ b/urlparse4/__init__.py @@ -1,7 +1,6 @@ # https://github.com/python/cpython/blob/2.7/Lib/urlparse.py import six -import pyximport from six.moves.urllib.parse import urlparse, urlsplit, urljoin @@ -9,5 +8,4 @@ _original_urlsplit = urlsplit _original_urljoin = urljoin -pyximport.install() -from urlparse4.cgurl import url_split, url_join +from cgurl import url_split, url_join From b40fbc74e0df3cb2ff0612da6ef5985903a3842d Mon Sep 17 00:00:00 2001 From: nctl144 Date: Thu, 7 Jun 2018 11:52:09 -0500 Subject: [PATCH 09/13] put include_package_data back --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index afaa32e..69dfde3 100644 --- a/setup.py +++ b/setup.py @@ -83,5 +83,6 @@ "Topic :: Software Development :: Libraries" ], long_description=long_description, - ext_modules=ext_modules + ext_modules=ext_modules, + include_package_data=True ) From 888a3bfe8dba7a4eb7a33e3725f712d5068c0bc8 Mon Sep 17 00:00:00 2001 From: nctl144 Date: Thu, 7 Jun 2018 12:09:29 -0500 Subject: [PATCH 10/13] change the function names back --- urlparse4/__init__.py | 2 +- urlparse4/cgurl.pyx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/urlparse4/__init__.py b/urlparse4/__init__.py index 851850d..1e39e03 100644 --- a/urlparse4/__init__.py +++ b/urlparse4/__init__.py @@ -8,4 +8,4 @@ _original_urlsplit = urlsplit _original_urljoin = urljoin -from cgurl import url_split, url_join +from cgurl import urlsplit, urljoin diff --git a/urlparse4/cgurl.pyx b/urlparse4/cgurl.pyx index 8c7109a..eaeeafe 100644 --- a/urlparse4/cgurl.pyx +++ b/urlparse4/cgurl.pyx @@ -157,10 +157,10 @@ class SplitResultNamedTuple(tuple): return stdlib_urlunsplit(self) -def url_split(url): +def urlsplit(url): return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) -def url_join(bytes base, bytes url, allow_fragments=True): +def urljoin(bytes base, bytes url, allow_fragments=True): if allow_fragments and base: return GURL(base).Resolve(url).spec() else: From 746d27184eaa2a46d6507fd78dfe24e174d7e329 Mon Sep 17 00:00:00 2001 From: nctl144 Date: Thu, 7 Jun 2018 12:09:37 -0500 Subject: [PATCH 11/13] rebuild cython --- urlparse4/cgurl.cpp | 91 ++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 47 deletions(-) diff --git a/urlparse4/cgurl.cpp b/urlparse4/cgurl.cpp index b311b86..3d9fe12 100644 --- a/urlparse4/cgurl.cpp +++ b/urlparse4/cgurl.cpp @@ -1291,10 +1291,9 @@ static const char __pyx_k_get_attr[] = "_get_attr"; static const char __pyx_k_hostname[] = "hostname"; static const char __pyx_k_password[] = "password"; static const char __pyx_k_qualname[] = "__qualname__"; -static const char __pyx_k_url_join[] = "url_join"; +static const char __pyx_k_urlsplit[] = "urlsplit"; static const char __pyx_k_username[] = "username"; static const char __pyx_k_metaclass[] = "__metaclass__"; -static const char __pyx_k_url_split[] = "url_split"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_urlunsplit[] = "urlunsplit"; static const char __pyx_k_stdlib_urljoin[] = "stdlib_urljoin"; @@ -1348,17 +1347,16 @@ static PyObject *__pyx_n_s_stdlib_urljoin; static PyObject *__pyx_n_s_stdlib_urlunsplit; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_url; -static PyObject *__pyx_n_s_url_join; -static PyObject *__pyx_n_s_url_split; static PyObject *__pyx_n_s_urljoin; static PyObject *__pyx_kp_s_urlparse4_cgurl_pyx; +static PyObject *__pyx_n_s_urlsplit; static PyObject *__pyx_n_s_urlunsplit; static PyObject *__pyx_n_s_username; static PyObject *__pyx_pf_5cgurl_21SplitResultNamedTuple_7__new____get_attr(PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prop); /* proto */ static PyObject *__pyx_pf_5cgurl_21SplitResultNamedTuple___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_url); /* proto */ static PyObject *__pyx_pf_5cgurl_21SplitResultNamedTuple_2geturl(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5cgurl_url_split(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_url); /* proto */ -static PyObject *__pyx_pf_5cgurl_2url_join(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_base, PyObject *__pyx_v_url, PyObject *__pyx_v_allow_fragments); /* proto */ +static PyObject *__pyx_pf_5cgurl_urlsplit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_url); /* proto */ +static PyObject *__pyx_pf_5cgurl_2urljoin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_base, PyObject *__pyx_v_url, PyObject *__pyx_v_allow_fragments); /* proto */ static PyObject *__pyx_tp_new_5cgurl___pyx_scope_struct____new__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_int_65535; static PyObject *__pyx_tuple__2; @@ -2964,26 +2962,26 @@ static PyObject *__pyx_pf_5cgurl_21SplitResultNamedTuple_2geturl(CYTHON_UNUSED P /* "cgurl.pyx":160 * * - * def url_split(url): # <<<<<<<<<<<<<< + * def urlsplit(url): # <<<<<<<<<<<<<< * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * */ /* Python wrapper */ -static PyObject *__pyx_pw_5cgurl_1url_split(PyObject *__pyx_self, PyObject *__pyx_v_url); /*proto*/ -static PyMethodDef __pyx_mdef_5cgurl_1url_split = {"url_split", (PyCFunction)__pyx_pw_5cgurl_1url_split, METH_O, 0}; -static PyObject *__pyx_pw_5cgurl_1url_split(PyObject *__pyx_self, PyObject *__pyx_v_url) { +static PyObject *__pyx_pw_5cgurl_1urlsplit(PyObject *__pyx_self, PyObject *__pyx_v_url); /*proto*/ +static PyMethodDef __pyx_mdef_5cgurl_1urlsplit = {"urlsplit", (PyCFunction)__pyx_pw_5cgurl_1urlsplit, METH_O, 0}; +static PyObject *__pyx_pw_5cgurl_1urlsplit(PyObject *__pyx_self, PyObject *__pyx_v_url) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("url_split (wrapper)", 0); - __pyx_r = __pyx_pf_5cgurl_url_split(__pyx_self, ((PyObject *)__pyx_v_url)); + __Pyx_RefNannySetupContext("urlsplit (wrapper)", 0); + __pyx_r = __pyx_pf_5cgurl_urlsplit(__pyx_self, ((PyObject *)__pyx_v_url)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5cgurl_url_split(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_url) { +static PyObject *__pyx_pf_5cgurl_urlsplit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_url) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2992,14 +2990,14 @@ static PyObject *__pyx_pf_5cgurl_url_split(CYTHON_UNUSED PyObject *__pyx_self, P PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("url_split", 0); + __Pyx_RefNannySetupContext("urlsplit", 0); /* "cgurl.pyx":161 * - * def url_split(url): + * def urlsplit(url): * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) # <<<<<<<<<<<<<< * - * def url_join(bytes base, bytes url, allow_fragments=True): + * def urljoin(bytes base, bytes url, allow_fragments=True): */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_SplitResultNamedTuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error) @@ -3063,7 +3061,7 @@ static PyObject *__pyx_pf_5cgurl_url_split(CYTHON_UNUSED PyObject *__pyx_self, P /* "cgurl.pyx":160 * * - * def url_split(url): # <<<<<<<<<<<<<< + * def urlsplit(url): # <<<<<<<<<<<<<< * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * */ @@ -3075,7 +3073,7 @@ static PyObject *__pyx_pf_5cgurl_url_split(CYTHON_UNUSED PyObject *__pyx_self, P __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("cgurl.url_split", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.urlsplit", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3086,21 +3084,21 @@ static PyObject *__pyx_pf_5cgurl_url_split(CYTHON_UNUSED PyObject *__pyx_self, P /* "cgurl.pyx":163 * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * - * def url_join(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< + * def urljoin(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< * if allow_fragments and base: * return GURL(base).Resolve(url).spec() */ /* Python wrapper */ -static PyObject *__pyx_pw_5cgurl_3url_join(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5cgurl_3url_join = {"url_join", (PyCFunction)__pyx_pw_5cgurl_3url_join, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5cgurl_3url_join(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_5cgurl_3urljoin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_5cgurl_3urljoin = {"urljoin", (PyCFunction)__pyx_pw_5cgurl_3urljoin, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5cgurl_3urljoin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_base = 0; PyObject *__pyx_v_url = 0; PyObject *__pyx_v_allow_fragments = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("url_join (wrapper)", 0); + __Pyx_RefNannySetupContext("urljoin (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_base,&__pyx_n_s_url,&__pyx_n_s_allow_fragments,0}; PyObject* values[3] = {0,0,0}; @@ -3127,7 +3125,7 @@ static PyObject *__pyx_pw_5cgurl_3url_join(PyObject *__pyx_self, PyObject *__pyx case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_url)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("url_join", 0, 2, 3, 1); __PYX_ERR(0, 163, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("urljoin", 0, 2, 3, 1); __PYX_ERR(0, 163, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -3137,7 +3135,7 @@ static PyObject *__pyx_pw_5cgurl_3url_join(PyObject *__pyx_self, PyObject *__pyx } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "url_join") < 0)) __PYX_ERR(0, 163, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "urljoin") < 0)) __PYX_ERR(0, 163, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3155,15 +3153,15 @@ static PyObject *__pyx_pw_5cgurl_3url_join(PyObject *__pyx_self, PyObject *__pyx } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("url_join", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 163, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("urljoin", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 163, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("cgurl.url_join", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.urljoin", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_base), (&PyBytes_Type), 1, "base", 1))) __PYX_ERR(0, 163, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_url), (&PyBytes_Type), 1, "url", 1))) __PYX_ERR(0, 163, __pyx_L1_error) - __pyx_r = __pyx_pf_5cgurl_2url_join(__pyx_self, __pyx_v_base, __pyx_v_url, __pyx_v_allow_fragments); + __pyx_r = __pyx_pf_5cgurl_2urljoin(__pyx_self, __pyx_v_base, __pyx_v_url, __pyx_v_allow_fragments); /* function exit code */ goto __pyx_L0; @@ -3174,7 +3172,7 @@ static PyObject *__pyx_pw_5cgurl_3url_join(PyObject *__pyx_self, PyObject *__pyx return __pyx_r; } -static PyObject *__pyx_pf_5cgurl_2url_join(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_base, PyObject *__pyx_v_url, PyObject *__pyx_v_allow_fragments) { +static PyObject *__pyx_pf_5cgurl_2urljoin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_base, PyObject *__pyx_v_url, PyObject *__pyx_v_allow_fragments) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -3185,11 +3183,11 @@ static PyObject *__pyx_pf_5cgurl_2url_join(CYTHON_UNUSED PyObject *__pyx_self, P PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("url_join", 0); + __Pyx_RefNannySetupContext("urljoin", 0); /* "cgurl.pyx":164 * - * def url_join(bytes base, bytes url, allow_fragments=True): + * def urljoin(bytes base, bytes url, allow_fragments=True): * if allow_fragments and base: # <<<<<<<<<<<<<< * return GURL(base).Resolve(url).spec() * else: @@ -3206,7 +3204,7 @@ static PyObject *__pyx_pf_5cgurl_2url_join(CYTHON_UNUSED PyObject *__pyx_self, P if (__pyx_t_1) { /* "cgurl.pyx":165 - * def url_join(bytes base, bytes url, allow_fragments=True): + * def urljoin(bytes base, bytes url, allow_fragments=True): * if allow_fragments and base: * return GURL(base).Resolve(url).spec() # <<<<<<<<<<<<<< * else: @@ -3223,7 +3221,7 @@ static PyObject *__pyx_pf_5cgurl_2url_join(CYTHON_UNUSED PyObject *__pyx_self, P /* "cgurl.pyx":164 * - * def url_join(bytes base, bytes url, allow_fragments=True): + * def urljoin(bytes base, bytes url, allow_fragments=True): * if allow_fragments and base: # <<<<<<<<<<<<<< * return GURL(base).Resolve(url).spec() * else: @@ -3263,7 +3261,7 @@ static PyObject *__pyx_pf_5cgurl_2url_join(CYTHON_UNUSED PyObject *__pyx_self, P /* "cgurl.pyx":163 * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * - * def url_join(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< + * def urljoin(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< * if allow_fragments and base: * return GURL(base).Resolve(url).spec() */ @@ -3274,7 +3272,7 @@ static PyObject *__pyx_pf_5cgurl_2url_join(CYTHON_UNUSED PyObject *__pyx_self, P __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("cgurl.url_join", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cgurl.urljoin", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3731,10 +3729,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_stdlib_urlunsplit, __pyx_k_stdlib_urlunsplit, sizeof(__pyx_k_stdlib_urlunsplit), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_url, __pyx_k_url, sizeof(__pyx_k_url), 0, 0, 1, 1}, - {&__pyx_n_s_url_join, __pyx_k_url_join, sizeof(__pyx_k_url_join), 0, 0, 1, 1}, - {&__pyx_n_s_url_split, __pyx_k_url_split, sizeof(__pyx_k_url_split), 0, 0, 1, 1}, {&__pyx_n_s_urljoin, __pyx_k_urljoin, sizeof(__pyx_k_urljoin), 0, 0, 1, 1}, {&__pyx_kp_s_urlparse4_cgurl_pyx, __pyx_k_urlparse4_cgurl_pyx, sizeof(__pyx_k_urlparse4_cgurl_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_urlsplit, __pyx_k_urlsplit, sizeof(__pyx_k_urlsplit), 0, 0, 1, 1}, {&__pyx_n_s_urlunsplit, __pyx_k_urlunsplit, sizeof(__pyx_k_urlunsplit), 0, 0, 1, 1}, {&__pyx_n_s_username, __pyx_k_username, sizeof(__pyx_k_username), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} @@ -3789,26 +3786,26 @@ static int __Pyx_InitCachedConstants(void) { /* "cgurl.pyx":160 * * - * def url_split(url): # <<<<<<<<<<<<<< + * def urlsplit(url): # <<<<<<<<<<<<<< * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * */ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_url); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_urlparse4_cgurl_pyx, __pyx_n_s_url_split, 160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_urlparse4_cgurl_pyx, __pyx_n_s_urlsplit, 160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 160, __pyx_L1_error) /* "cgurl.pyx":163 * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * - * def url_join(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< + * def urljoin(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< * if allow_fragments and base: * return GURL(base).Resolve(url).spec() */ __pyx_tuple__10 = PyTuple_Pack(3, __pyx_n_s_base, __pyx_n_s_url, __pyx_n_s_allow_fragments); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_urlparse4_cgurl_pyx, __pyx_n_s_url_join, 163, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 163, __pyx_L1_error) + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_urlparse4_cgurl_pyx, __pyx_n_s_urljoin, 163, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -4183,25 +4180,25 @@ if (!__Pyx_RefNanny) { /* "cgurl.pyx":160 * * - * def url_split(url): # <<<<<<<<<<<<<< + * def urlsplit(url): # <<<<<<<<<<<<<< * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cgurl_1url_split, NULL, __pyx_n_s_cgurl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cgurl_1urlsplit, NULL, __pyx_n_s_cgurl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_url_split, __pyx_t_1) < 0) __PYX_ERR(0, 160, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_urlsplit, __pyx_t_1) < 0) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cgurl.pyx":163 * return SplitResultNamedTuple.__new__(SplitResultNamedTuple, url) * - * def url_join(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< + * def urljoin(bytes base, bytes url, allow_fragments=True): # <<<<<<<<<<<<<< * if allow_fragments and base: * return GURL(base).Resolve(url).spec() */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cgurl_3url_join, NULL, __pyx_n_s_cgurl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cgurl_3urljoin, NULL, __pyx_n_s_cgurl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_url_join, __pyx_t_1) < 0) __PYX_ERR(0, 163, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_urljoin, __pyx_t_1) < 0) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cgurl.pyx":1 From 0712b1104801629a8bedd79a80757ada95aaf860 Mon Sep 17 00:00:00 2001 From: nctl144 Date: Thu, 7 Jun 2018 16:19:44 -0500 Subject: [PATCH 12/13] fix the urllib import --- urlparse4/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/urlparse4/__init__.py b/urlparse4/__init__.py index 1e39e03..dc1c441 100644 --- a/urlparse4/__init__.py +++ b/urlparse4/__init__.py @@ -2,7 +2,10 @@ import six -from six.moves.urllib.parse import urlparse, urlsplit, urljoin +if six.PY2: + from urlparse import * +else: + from urllib.parse import * _original_urlsplit = urlsplit From 30f581ff8f007a949bde63d82f7439a0eb79a383 Mon Sep 17 00:00:00 2001 From: nctl144 Date: Fri, 8 Jun 2018 14:20:51 -0500 Subject: [PATCH 13/13] add travis config file --- .travis.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..33d0266 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,25 @@ +language: python +sudo: false +branches: + only: + - master + - /^\d\.\d+$/ + - /^\d\.\d+\.\d+(rc\d+|\.dev\d+)?$/ +matrix: + include: + - python: 2.7 + env: TOXENV=py27 + - python: 2.7 + env: TOXENV=pypy + - python: 2.7 + env: TOXENV=pypy3 + - python: 3.4 + env: TOXENV=py34 + - python: 3.5 + env: TOXENV=py35 + - python: 3.6 + env: TOXENV=py36 +install: + - pip install -U pip tox +script: + - tox