No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
2395 | 2395 | self); |
|
2396 | 2396 | return -1; |
|
2397 | 2397 | } |
|
2398 | + | if ((flags & PyBUF_WRITEABLE) == PyBUF_WRITEABLE) { |
|
2399 | + | PyErr_SetString(PyExc_BufferError, "scalar buffer is readonly"); |
|
2400 | + | return -1; |
|
2401 | + | } |
|
2398 | 2402 | PyArray_Descr *descr = PyArray_DescrFromScalar(self); |
|
2399 | 2403 | if (descr == NULL) { |
|
2400 | 2404 | return -1; |
2413 | 2417 | view->shape = NULL; |
|
2414 | 2418 | view->strides = NULL; |
|
2415 | 2419 | view->suboffsets = NULL; |
|
2420 | + | view->readonly = 1; /* assume general (user) scalars are readonly. */ |
|
2416 | 2421 | Py_INCREF(self); |
|
2417 | 2422 | view->obj = self; |
|
2418 | 2423 | view->buf = scalar_value(self, descr); |
2444 | 2449 | @name@_getbuffer(PyObject *self, Py_buffer *view, int flags) |
|
2445 | 2450 | { |
|
2446 | 2451 | if ((flags & PyBUF_WRITEABLE) == PyBUF_WRITEABLE) { |
|
2452 | + | PyErr_SetString(PyExc_BufferError, "scalar buffer is readonly"); |
|
2447 | 2453 | return -1; |
|
2448 | 2454 | } |
|
2449 | 2455 | Py@Name@ScalarObject *scalar = (Py@Name@ScalarObject *)self; |
2456 | 2462 | view->shape = NULL; |
|
2457 | 2463 | view->strides = NULL; |
|
2458 | 2464 | view->suboffsets = NULL; |
|
2465 | + | view->readonly = 1; |
|
2459 | 2466 | Py_INCREF(self); |
|
2460 | 2467 | view->obj = self; |
|
2461 | 2468 | view->buf = &(scalar->obval); |
2482 | 2489 | unicode_getbuffer(PyObject *self, Py_buffer *view, int flags) |
|
2483 | 2490 | { |
|
2484 | 2491 | if ((flags & PyBUF_WRITEABLE) == PyBUF_WRITEABLE) { |
|
2492 | + | PyErr_SetString(PyExc_BufferError, "scalar buffer is readonly"); |
|
2485 | 2493 | return -1; |
|
2486 | 2494 | } |
|
2487 | 2495 | PyUnicodeScalarObject *scalar = (PyUnicodeScalarObject *)self; |
2493 | 2501 | view->shape = NULL; |
|
2494 | 2502 | view->strides = NULL; |
|
2495 | 2503 | view->suboffsets = NULL; |
|
2504 | + | view->readonly = 1; |
|
2496 | 2505 | Py_INCREF(self); |
|
2497 | 2506 | view->obj = self; |
|
2498 | 2507 |
2522 | 2531 | view->format = scalar->buffer_fmt; |
|
2523 | 2532 | } |
|
2524 | 2533 | else { |
|
2525 | - | scalar->buffer_fmt = PyObject_Malloc(22); |
|
2534 | + | scalar->buffer_fmt = PyMem_Malloc(22); |
|
2526 | 2535 | if (scalar->buffer_fmt == NULL) { |
|
2527 | 2536 | Py_SETREF(view->obj, NULL); |
|
2528 | 2537 | return -1; |
2549 | 2558 | @name@_getbuffer(PyObject *self, Py_buffer *view, int flags) |
|
2550 | 2559 | { |
|
2551 | 2560 | if ((flags & PyBUF_WRITEABLE) == PyBUF_WRITEABLE) { |
|
2561 | + | PyErr_SetString(PyExc_BufferError, "scalar buffer is readonly"); |
|
2552 | 2562 | return -1; |
|
2553 | 2563 | } |
|
2554 | 2564 | Py@Name@ScalarObject *scalar = (Py@Name@ScalarObject *)self; |
2560 | 2570 | view->shape = &length; |
|
2561 | 2571 | view->strides = NULL; |
|
2562 | 2572 | view->suboffsets = NULL; |
|
2573 | + | view->readonly = 1; |
|
2563 | 2574 | Py_INCREF(self); |
|
2564 | 2575 | view->obj = self; |
|
2565 | 2576 |
2651 | 2662 | { |
|
2652 | 2663 | /* note: may be null if it was never requested */ |
|
2653 | 2664 | PyMem_Free(PyArrayScalar_VAL(v, Unicode)); |
|
2665 | + | PyMem_Free(((PyUnicodeScalarObject *)v)->buffer_fmt); |
|
2654 | 2666 | /* delegate to the base class */ |
|
2655 | 2667 | PyUnicode_Type.tp_dealloc(v); |
|
2656 | 2668 | } |
576 | 576 | return NULL; |
|
577 | 577 | } |
|
578 | 578 | ||
579 | + | if (PyArray_FailUnlessWriteable(self, "putmask: output array") < 0) { |
|
580 | + | return NULL; |
|
581 | + | } |
|
582 | + | ||
579 | 583 | mask = (PyArrayObject *)PyArray_FROM_OTF(mask0, NPY_BOOL, |
|
580 | 584 | NPY_ARRAY_CARRAY | NPY_ARRAY_FORCECAST); |
|
581 | 585 | if (mask == NULL) { |
3194 | 3194 | } |
|
3195 | 3195 | ||
3196 | 3196 | PyObject *shape2 = convert_shape_to_string(mit->nd, mit->dimensions, ""); |
|
3197 | - | if (shape2 == NULL) |
|
3197 | + | if (shape2 == NULL) { |
|
3198 | 3198 | Py_DECREF(shape1); |
|
3199 | 3199 | goto finish; |
|
3200 | + | } |
|
3200 | 3201 | ||
3201 | 3202 | PyErr_Format(PyExc_ValueError, |
|
3202 | 3203 | "shape mismatch: value array of shape %S could not be broadcast " |
677 | 677 | "invalid error argument to test function."); |
|
678 | 678 | } |
|
679 | 679 | if (PyArray_RegisterDataType(dtype) < 0) { |
|
680 | - | /* Fix original type in the error_path == 2 case. */ |
|
680 | + | /* Fix original type in the error_path == 2 case and delete it */ |
|
681 | 681 | Py_SET_TYPE(dtype, original_type); |
|
682 | + | Py_DECREF(dtype); |
|
682 | 683 | return NULL; |
|
683 | 684 | } |
|
684 | - | Py_INCREF(dtype); |
|
685 | + | Py_INCREF(dtype); /* hold on to the original (leaks a reference) */ |
|
685 | 686 | return (PyObject *)dtype; |
|
686 | 687 | } |
|
687 | 688 |
Learn more Showing 14 files with coverage changes found.
numpy/core/src/multiarray/mapping.c
numpy/core/src/umath/ufunc_object.c
numpy/core/src/multiarray/_multiarray_tests.c.src
numpy/core/src/multiarray/buffer.c
numpy/core/src/umath/loops.c.src
numpy/core/src/common/npy_cpu_features.c.src
numpy/core/src/umath/simd.inc.src
numpy/core/src/_simd/_simd_vector.inc
numpy/core/src/common/simd/avx512/misc.h
numpy/core/src/common/simd/avx512/memory.h
numpy/core/src/common/simd/avx512/math.h
numpy/core/src/common/simd/avx512/reorder.h
numpy/core/src/common/simd/avx512/arithmetic.h
numpy/core/src/common/simd/avx512/operators.h
Files | Coverage |
---|---|
numpy | +1.12% 83.75% |
Project Totals (157 files) | 83.75% |
#17873
1652a17
46d219d
2de93df
#17873
2fe36cd
d3cffdc
2061a7b
ada9441
7432908
c924809
a846494
4234327
33da69f
#17873
9f17656
#17873
67b21e6
76930e7