diff --git a/scrapely/_htmlpage.c b/scrapely/_htmlpage.c index 74a469e..6a39110 100644 --- a/scrapely/_htmlpage.c +++ b/scrapely/_htmlpage.c @@ -325,13 +325,8 @@ END: Cython Metadata */ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX < 0x030800A4 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#endif #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES diff --git a/scrapely/extraction/_similarity.c b/scrapely/extraction/_similarity.c index ef56178..d6eca25 100644 --- a/scrapely/extraction/_similarity.c +++ b/scrapely/extraction/_similarity.c @@ -329,13 +329,8 @@ END: Cython Metadata */ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX < 0x030800A4 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#endif #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES @@ -616,6 +611,23 @@ static CYTHON_INLINE float __PYX_NAN() { #include #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" + +#if defined(NPY_2_0_API_VERSION) && (NPY_API_VERSION >= NPY_2_0_API_VERSION) + +#define SUBARRAY(p_array_d) (PyDataType_SUBARRAY(p_array_d)) +#define NAMES(p_array_d) (PyDataType_NAMES(p_array_d)) +#define FIELDS(p_array_d) (PyDataType_FIELDS(p_array_d)) +#define ELSIZE(p_array_d) (PyDataType_ELSIZE(p_array_d)) + +#else + +#define SUBARRAY(p_array_d) (p_array_d->subarray) +#define NAMES(p_array_d) (p_array_d->names) +#define FIELDS(p_array_d) (p_array_d->fields) +#define ELSIZE(p_array_d) (p_array_d->elsize) + +#endif + #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -5613,8 +5625,8 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ * return () */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); - __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); + __Pyx_INCREF(SUBARRAY(__pyx_v_d)->shape); + __pyx_r = SUBARRAY(__pyx_v_d)->shape; goto __pyx_L0; /* "../../.virtualenvs/scraping/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":837 @@ -5709,11 +5721,12 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * fields = descr.fields[childname] * child, new_offset = fields */ - if (unlikely(__pyx_v_descr->names == Py_None)) { + + if (unlikely(NAMES(__pyx_v_descr) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(1, 851, __pyx_L1_error) } - __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_1 = NAMES(__pyx_v_descr); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS @@ -5732,11 +5745,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields * */ - if (unlikely(__pyx_v_descr->fields == Py_None)) { + if (unlikely(FIELDS(__pyx_v_descr) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 852, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_GetItem(FIELDS(__pyx_v_descr), __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); @@ -5937,7 +5950,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * if not PyDataType_HASFIELDS(child): */ __pyx_t_8 = 0; - (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); + (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + ELSIZE(__pyx_v_child)); /* "../../.virtualenvs/scraping/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":877 * offset[0] += child.itemsize diff --git a/setup.py b/setup.py index a1a5b8c..f500420 100755 --- a/setup.py +++ b/setup.py @@ -16,10 +16,16 @@ extensions = [ Extension("scrapely._htmlpage", ["scrapely/_htmlpage%s" % ext], - include_dirs=include_dirs), + include_dirs=include_dirs, + extra_compile_args=[ + '-Wno-deprecated-declarations', + '-Wno-int-conversion']), Extension("scrapely.extraction._similarity", ["scrapely/extraction/_similarity%s" % ext], - include_dirs=include_dirs), + include_dirs=include_dirs, + extra_compile_args=[ + '-Wno-deprecated-declarations', + '-Wno-int-conversion']), ] if USE_CYTHON and not IS_PYPY: from Cython.Build import cythonize @@ -44,11 +50,11 @@ 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Text Processing :: Markup :: HTML', ],