Skip to content

Commit 9f2d60a

Browse files
jbrockmendelpeterpanmj
authored andcommitted
Fix c build warnings pandas-dev#17634; remove several unused funcs (pandas-dev#17932)
1 parent 6f8f684 commit 9f2d60a

File tree

5 files changed

+9
-44
lines changed

5 files changed

+9
-44
lines changed

pandas/_libs/parsers.pyx

+4-10
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ from cpython cimport (PyObject, PyBytes_FromString,
1212
PyBytes_AsString, PyBytes_Check,
1313
PyUnicode_Check, PyUnicode_AsUTF8String,
1414
PyErr_Occurred, PyErr_Fetch)
15-
from cpython.ref cimport PyObject, Py_XDECREF
15+
from cpython.ref cimport Py_XDECREF
1616
from pandas.errors import (ParserError, DtypeWarning,
1717
EmptyDataError, ParserWarning)
1818

@@ -43,12 +43,10 @@ from pandas.core.dtypes.common import (
4343
is_categorical_dtype, CategoricalDtype,
4444
is_integer_dtype, is_float_dtype,
4545
is_bool_dtype, is_object_dtype,
46-
is_string_dtype, is_datetime64_dtype,
46+
is_datetime64_dtype,
4747
pandas_dtype)
48-
from pandas.core.categorical import Categorical, _recode_for_categories
49-
from pandas.core.algorithms import take_1d
48+
from pandas.core.categorical import Categorical
5049
from pandas.core.dtypes.concat import union_categoricals
51-
from pandas import Index
5250

5351
import pandas.io.common as com
5452

@@ -165,7 +163,7 @@ cdef extern from "parser/tokenizer.h":
165163
int quoting # style of quoting to write */
166164

167165
# hmm =/
168-
# int numeric_field
166+
# int numeric_field
169167

170168
char commentchar
171169
int allow_embedded_newline
@@ -253,11 +251,7 @@ cdef extern from "parser/tokenizer.h":
253251
double round_trip(const char *p, char **q, char decimal, char sci,
254252
char tsep, int skip_trailing) nogil
255253

256-
# inline int to_complex(char *item, double *p_real,
257-
# double *p_imag, char sci, char decimal)
258254
int to_longlong(char *item, long long *p_value) nogil
259-
# inline int to_longlong_thousands(char *item, long long *p_value,
260-
# char tsep)
261255
int to_boolean(const char *item, uint8_t *val) nogil
262256

263257

pandas/_libs/src/datetime.pxd

-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ from cpython cimport PyObject
55
from cpython cimport PyUnicode_Check, PyUnicode_AsASCIIString
66

77

8-
cdef extern from "headers/stdint.h":
9-
enum: INT64_MIN
10-
enum: INT32_MIN
11-
12-
13-
148
cdef extern from "datetime.h":
159

1610
ctypedef class datetime.date [object PyDateTime_Date]:

pandas/_libs/src/numpy_helper.h

-23
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,6 @@ The full license is in the LICENSE file, distributed with this software.
1515
#include "numpy/arrayobject.h"
1616
#include "numpy/arrayscalars.h"
1717

18-
#define PANDAS_FLOAT 0
19-
#define PANDAS_INT 1
20-
#define PANDAS_BOOL 2
21-
#define PANDAS_STRING 3
22-
#define PANDAS_OBJECT 4
23-
#define PANDAS_DATETIME 5
24-
25-
PANDAS_INLINE int infer_type(PyObject* obj) {
26-
if (PyBool_Check(obj)) {
27-
return PANDAS_BOOL;
28-
} else if (PyArray_IsIntegerScalar(obj)) {
29-
return PANDAS_INT;
30-
} else if (PyArray_IsScalar(obj, Datetime)) {
31-
return PANDAS_DATETIME;
32-
} else if (PyFloat_Check(obj) || PyArray_IsScalar(obj, Floating)) {
33-
return PANDAS_FLOAT;
34-
} else if (PyString_Check(obj) || PyUnicode_Check(obj)) {
35-
return PANDAS_STRING;
36-
} else {
37-
return PANDAS_OBJECT;
38-
}
39-
}
4018

4119
PANDAS_INLINE npy_int64 get_nat(void) { return NPY_MIN_INT64; }
4220

@@ -135,7 +113,6 @@ void transfer_object_column(char* dst, char* src, size_t stride,
135113
}
136114
}
137115

138-
void set_array_owndata(PyArrayObject* ao) { ao->flags |= NPY_OWNDATA; }
139116

140117
void set_array_not_contiguous(PyArrayObject* ao) {
141118
ao->flags &= ~(NPY_C_CONTIGUOUS | NPY_F_CONTIGUOUS);

pandas/_libs/src/parser/tokenizer.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static int make_stream_space(parser_t *self, size_t nbytes) {
262262
("\n\nmake_stream_space: nbytes = %zu. grow_buffer(self->stream...)\n",
263263
nbytes))
264264
self->stream = (char *)grow_buffer((void *)self->stream, self->stream_len,
265-
&self->stream_cap, nbytes * 2,
265+
(size_t*)&self->stream_cap, nbytes * 2,
266266
sizeof(char), &status);
267267
TRACE(
268268
("make_stream_space: self->stream=%p, self->stream_len = %zu, "
@@ -289,7 +289,8 @@ static int make_stream_space(parser_t *self, size_t nbytes) {
289289
cap = self->words_cap;
290290
self->words =
291291
(char **)grow_buffer((void *)self->words, self->words_len,
292-
&self->words_cap, nbytes, sizeof(char *), &status);
292+
(size_t*)&self->words_cap, nbytes,
293+
sizeof(char *), &status);
293294
TRACE(
294295
("make_stream_space: grow_buffer(self->self->words, %zu, %zu, %zu, "
295296
"%d)\n",
@@ -319,7 +320,8 @@ static int make_stream_space(parser_t *self, size_t nbytes) {
319320
cap = self->lines_cap;
320321
self->line_start =
321322
(int64_t *)grow_buffer((void *)self->line_start, self->lines + 1,
322-
&self->lines_cap, nbytes, sizeof(int64_t), &status);
323+
(size_t*)&self->lines_cap, nbytes,
324+
sizeof(int64_t), &status);
323325
TRACE((
324326
"make_stream_space: grow_buffer(self->line_start, %zu, %zu, %zu, %d)\n",
325327
self->lines + 1, self->lines_cap, nbytes, status))

pandas/_libs/src/util.pxd

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ cimport numpy as cnp
33
cimport cpython
44

55
cdef extern from "numpy_helper.h":
6-
void set_array_owndata(ndarray ao)
76
void set_array_not_contiguous(ndarray ao)
87

98
int is_integer_object(object)
@@ -16,7 +15,6 @@ cdef extern from "numpy_helper.h":
1615
int assign_value_1d(ndarray, Py_ssize_t, object) except -1
1716
cnp.int64_t get_nat()
1817
object get_value_1d(ndarray, Py_ssize_t)
19-
int floatify(object, double*) except -1
2018
char *get_c_string(object) except NULL
2119
object char_to_string(char*)
2220
void transfer_object_column(char *dst, char *src, size_t stride,

0 commit comments

Comments
 (0)