|
48 | 48 |
|
49 | 49 | %fragment("NumPy_Backward_Compatibility", "header") |
50 | 50 | { |
51 | | -%#if NPY_API_VERSION < 0x00000007 |
| 51 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
52 | 52 | %#define NPY_ARRAY_DEFAULT NPY_DEFAULT |
53 | 53 | %#define NPY_ARRAY_FARRAY NPY_FARRAY |
54 | 54 | %#define NPY_FORTRANORDER NPY_FORTRAN |
|
69 | 69 | { |
70 | 70 | /* Macros to extract array attributes. |
71 | 71 | */ |
72 | | -%#if NPY_API_VERSION < 0x00000007 |
| 72 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
73 | 73 | %#define is_array(a) ((a) && PyArray_Check((PyArrayObject*)a)) |
74 | 74 | %#define array_type(a) (int)(PyArray_TYPE((PyArrayObject*)a)) |
75 | 75 | %#define array_numdims(a) (((PyArrayObject*)a)->nd) |
|
165 | 165 | return PyArray_EquivTypenums(actual_type, desired_type); |
166 | 166 | } |
167 | 167 |
|
168 | | -%#ifdef SWIGPY_USE_CAPSULE |
169 | | - void free_cap(PyObject * cap) |
| 168 | +void free_cap(PyObject * cap) |
170 | 169 | { |
171 | 170 | void* array = (void*) PyCapsule_GetPointer(cap,SWIGPY_CAPSULE_NAME); |
172 | 171 | if (array != NULL) free(array); |
173 | 172 | } |
174 | | -%#endif |
175 | 173 |
|
176 | 174 |
|
177 | 175 | } |
|
293 | 291 | Py_INCREF(array_descr(ary)); |
294 | 292 | result = (PyArrayObject*) PyArray_FromArray(ary, |
295 | 293 | array_descr(ary), |
296 | | -%#if NPY_API_VERSION < 0x00000007 |
| 294 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
297 | 295 | NPY_FORTRANORDER); |
298 | 296 | %#else |
299 | 297 | NPY_ARRAY_F_CONTIGUOUS); |
|
2459 | 2457 |
|
2460 | 2458 | if (!array) SWIG_fail; |
2461 | 2459 |
|
2462 | | -%#ifdef SWIGPY_USE_CAPSULE |
2463 | | - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2464 | | -%#else |
2465 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); |
2466 | | -%#endif |
| 2460 | +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2467 | 2461 |
|
2468 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2462 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2469 | 2463 | PyArray_BASE(array) = cap; |
2470 | 2464 | %#else |
2471 | 2465 | PyArray_SetBaseObject(array,cap); |
|
2493 | 2487 |
|
2494 | 2488 | if (!array) SWIG_fail; |
2495 | 2489 |
|
2496 | | -%#ifdef SWIGPY_USE_CAPSULE |
2497 | | - PyObject* cap = PyCapsule_New((void*)(*$2), SWIGPY_CAPSULE_NAME, free_cap); |
2498 | | -%#else |
2499 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$2), free); |
2500 | | -%#endif |
| 2490 | +PyObject* cap = PyCapsule_New((void*)(*$2), SWIGPY_CAPSULE_NAME, free_cap); |
2501 | 2491 |
|
2502 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2492 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2503 | 2493 | PyArray_BASE(array) = cap; |
2504 | 2494 | %#else |
2505 | 2495 | PyArray_SetBaseObject(array,cap); |
|
2528 | 2518 |
|
2529 | 2519 | if (!array) SWIG_fail; |
2530 | 2520 |
|
2531 | | -%#ifdef SWIGPY_USE_CAPSULE |
2532 | | - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2533 | | -%#else |
2534 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); |
2535 | | -%#endif |
| 2521 | +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2536 | 2522 |
|
2537 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2523 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2538 | 2524 | PyArray_BASE(array) = cap; |
2539 | 2525 | %#else |
2540 | 2526 | PyArray_SetBaseObject(array,cap); |
|
2563 | 2549 |
|
2564 | 2550 | if (!array) SWIG_fail; |
2565 | 2551 |
|
2566 | | -%#ifdef SWIGPY_USE_CAPSULE |
2567 | | - PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap); |
2568 | | -%#else |
2569 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$3), free); |
2570 | | -%#endif |
| 2552 | +PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap); |
2571 | 2553 |
|
2572 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2554 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2573 | 2555 | PyArray_BASE(array) = cap; |
2574 | 2556 | %#else |
2575 | 2557 | PyArray_SetBaseObject(array,cap); |
|
2598 | 2580 |
|
2599 | 2581 | if (!array || !require_fortran(array)) SWIG_fail; |
2600 | 2582 |
|
2601 | | -%#ifdef SWIGPY_USE_CAPSULE |
2602 | | - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2603 | | -%#else |
2604 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); |
2605 | | -%#endif |
| 2583 | +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2606 | 2584 |
|
2607 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2585 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2608 | 2586 | PyArray_BASE(array) = cap; |
2609 | 2587 | %#else |
2610 | 2588 | PyArray_SetBaseObject(array,cap); |
|
2633 | 2611 |
|
2634 | 2612 | if (!array || !require_fortran(array)) SWIG_fail; |
2635 | 2613 |
|
2636 | | -%#ifdef SWIGPY_USE_CAPSULE |
2637 | | - PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap); |
2638 | | -%#else |
2639 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$3), free); |
2640 | | -%#endif |
| 2614 | +PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap); |
2641 | 2615 |
|
2642 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2616 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2643 | 2617 | PyArray_BASE(array) = cap; |
2644 | 2618 | %#else |
2645 | 2619 | PyArray_SetBaseObject(array,cap); |
|
2670 | 2644 |
|
2671 | 2645 | if (!array) SWIG_fail; |
2672 | 2646 |
|
2673 | | -%#ifdef SWIGPY_USE_CAPSULE |
2674 | | - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2675 | | -%#else |
2676 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); |
2677 | | -%#endif |
| 2647 | +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2678 | 2648 |
|
2679 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2649 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2680 | 2650 | PyArray_BASE(array) = cap; |
2681 | 2651 | %#else |
2682 | 2652 | PyArray_SetBaseObject(array,cap); |
|
2707 | 2677 |
|
2708 | 2678 | if (!array) SWIG_fail; |
2709 | 2679 |
|
2710 | | -%#ifdef SWIGPY_USE_CAPSULE |
2711 | | - PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap); |
2712 | | -%#else |
2713 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$4), free); |
2714 | | -%#endif |
| 2680 | +PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap); |
2715 | 2681 |
|
2716 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2682 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2717 | 2683 | PyArray_BASE(array) = cap; |
2718 | 2684 | %#else |
2719 | 2685 | PyArray_SetBaseObject(array,cap); |
|
2744 | 2710 |
|
2745 | 2711 | if (!array || !require_fortran(array)) SWIG_fail; |
2746 | 2712 |
|
2747 | | -%#ifdef SWIGPY_USE_CAPSULE |
2748 | | - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2749 | | -%#else |
2750 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); |
2751 | | -%#endif |
| 2713 | +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2752 | 2714 |
|
2753 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2715 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2754 | 2716 | PyArray_BASE(array) = cap; |
2755 | 2717 | %#else |
2756 | 2718 | PyArray_SetBaseObject(array,cap); |
|
2781 | 2743 |
|
2782 | 2744 | if (!array || !require_fortran(array)) SWIG_fail; |
2783 | 2745 |
|
2784 | | -%#ifdef SWIGPY_USE_CAPSULE |
2785 | | - PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap); |
2786 | | -%#else |
2787 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$4), free); |
2788 | | -%#endif |
| 2746 | +PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap); |
2789 | 2747 |
|
2790 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2748 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2791 | 2749 | PyArray_BASE(array) = cap; |
2792 | 2750 | %#else |
2793 | 2751 | PyArray_SetBaseObject(array,cap); |
|
2819 | 2777 |
|
2820 | 2778 | if (!array) SWIG_fail; |
2821 | 2779 |
|
2822 | | -%#ifdef SWIGPY_USE_CAPSULE |
2823 | | - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2824 | | -%#else |
2825 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); |
2826 | | -%#endif |
| 2780 | +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2827 | 2781 |
|
2828 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2782 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2829 | 2783 | PyArray_BASE(array) = cap; |
2830 | 2784 | %#else |
2831 | 2785 | PyArray_SetBaseObject(array,cap); |
|
2857 | 2811 |
|
2858 | 2812 | if (!array) SWIG_fail; |
2859 | 2813 |
|
2860 | | -%#ifdef SWIGPY_USE_CAPSULE |
2861 | | - PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap); |
2862 | | -%#else |
2863 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$5), free); |
2864 | | -%#endif |
| 2814 | +PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap); |
2865 | 2815 |
|
2866 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2816 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2867 | 2817 | PyArray_BASE(array) = cap; |
2868 | 2818 | %#else |
2869 | 2819 | PyArray_SetBaseObject(array,cap); |
|
2895 | 2845 |
|
2896 | 2846 | if (!array || !require_fortran(array)) SWIG_fail; |
2897 | 2847 |
|
2898 | | -%#ifdef SWIGPY_USE_CAPSULE |
2899 | | - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2900 | | -%#else |
2901 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); |
2902 | | -%#endif |
| 2848 | +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); |
2903 | 2849 |
|
2904 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2850 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2905 | 2851 | PyArray_BASE(array) = cap; |
2906 | 2852 | %#else |
2907 | 2853 | PyArray_SetBaseObject(array,cap); |
|
2933 | 2879 |
|
2934 | 2880 | if (!array || !require_fortran(array)) SWIG_fail; |
2935 | 2881 |
|
2936 | | -%#ifdef SWIGPY_USE_CAPSULE |
2937 | | - PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap); |
2938 | | -%#else |
2939 | | - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$5), free); |
2940 | | -%#endif |
| 2882 | +PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap); |
2941 | 2883 |
|
2942 | | -%#if NPY_API_VERSION < 0x00000007 |
| 2884 | +%#if NPY_API_VERSION < NPY_1_7_API_VERSION |
2943 | 2885 | PyArray_BASE(array) = cap; |
2944 | 2886 | %#else |
2945 | 2887 | PyArray_SetBaseObject(array,cap); |
|
0 commit comments