-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
MAINT: remove unused functions, rearrange headers (from CC=clang) #14534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1428,23 +1428,54 @@ static PyObject * | |
} | ||
/**end repeat**/ | ||
|
||
/**begin repeat | ||
* | ||
* #name = byte, ubyte, short, ushort, int, uint, | ||
* long, ulong, longlong, ulonglong, | ||
* half, float, double, longdouble, | ||
* cfloat, cdouble, clongdouble# | ||
* #Name = Byte, UByte, Short, UShort, Int, UInt, | ||
* Long, ULong, LongLong, ULongLong, | ||
* Half, Float, Double, LongDouble, | ||
* CFloat, CDouble, CLongDouble# | ||
* #cmplx = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1# | ||
* #to_ctype = , , , , , , , , , , npy_half_to_double, , , , , , # | ||
* #which = float*17# | ||
* #func = PyFloat_FromDouble*17# | ||
*/ | ||
static NPY_INLINE PyObject * | ||
@name@_@which@(PyObject *obj) | ||
mattip marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
#if @cmplx@ | ||
if (emit_complexwarning() < 0) { | ||
return NULL; | ||
} | ||
return @func@(@to_ctype@(PyArrayScalar_VAL(obj, @Name@).real)); | ||
#else | ||
return @func@(@to_ctype@(PyArrayScalar_VAL(obj, @Name@))); | ||
#endif | ||
} | ||
/**end repeat**/ | ||
|
||
|
||
#if !defined(NPY_PY3K) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This splits the @name@_@which@ templates into two parts: one for python2 using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to backport this, or shouldn't we just ignore python 2 for such a specific, rarely touched, code chunk? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to backport. NEP 14 is not clear on this, but I think we have not been actively removing python2 code from th 8000 e master branch yet. |
||
/**begin repeat | ||
* | ||
* #name = (byte, ubyte, short, ushort, int, uint, | ||
* long, ulong, longlong, ulonglong, | ||
* half, float, double, longdouble, | ||
* cfloat, cdouble, clongdouble)*2# | ||
* cfloat, cdouble, clongdouble)# | ||
* #Name = (Byte, UByte, Short, UShort, Int, UInt, | ||
* Long, ULong, LongLong, ULongLong, | ||
* Half, Float, Double, LongDouble, | ||
* CFloat, CDouble, CLongDouble)*2# | ||
* #cmplx = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1)*2# | ||
* #to_ctype = (, , , , , , , , , , npy_half_to_double, , , , , , )*2# | ||
* #which = long*17, float*17# | ||
* CFloat, CDouble, CLongDouble)# | ||
* #cmplx = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1)# | ||
* #to_ctype = (, , , , , , , , , , npy_half_to_double, , , , , , )# | ||
* #which = long*17# | ||
mattip marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* #func = (PyLong_FromLongLong, PyLong_FromUnsignedLongLong)*5, | ||
* PyLong_FromDouble*3, npy_longdouble_to_PyLong, | ||
* PyLong_FromDouble*2, npy_longdouble_to_PyLong, | ||
* PyFloat_FromDouble*17# | ||
* PyLong_FromDouble*2, npy_longdouble_to_PyLong# | ||
*/ | ||
static NPY_INLINE PyObject * | ||
@name@_@which@(PyObject *obj) | ||
mattip marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -1460,8 +1491,6 @@ static NPY_INLINE PyObject * | |
} | ||
/**end repeat**/ | ||
|
||
#if !defined(NPY_PY3K) | ||
|
||
/**begin repeat | ||
* | ||
* #name = (byte, ubyte, short, ushort, int, uint, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
#ifndef _RANDOMDGEN__DISTRIBUTIONS_H_ | ||
#define _RANDOMDGEN__DISTRIBUTIONS_H_ | ||
|
||
#pragma once | ||
#include "Python.h" | ||
#include "numpy/npy_common.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change and the others in the random/src files were needed to get rid of a warning. Googling it seems to suggest there is a circular include graph. This reordering solved it and seems harmless.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I keep getting this warning anytime I compile C code that includes <numpy/random/*.h> with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please open a new issue and provide information so we can reproduce: what compiler and platform are you using? What version of NumPy? Some sample code and the actual warning you get would also help. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I will try and see if I can reproduce with an example. The warning is exactly the same as the one you mentioned above:
It pops up anytime I compiled C code with |
||
#include <stddef.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
|
||
#include "Python.h" | ||
#include "numpy/npy_common.h" | ||
#include "numpy/npy_math.h" | ||
#include "numpy/random/bitgen.h" | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.