Skip to content
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

Reenabled no-unused-function in setup.py #29767

Merged
merged 1 commit into from
Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions pandas/_libs/parsers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1406,59 +1406,6 @@ cdef inline StringPath _string_path(char *encoding):
# Type conversions / inference support code


cdef _string_box_factorize(parser_t *parser, int64_t col,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is completely unused?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea this is the only thing that appears in a grep of _libs

$ grep -nr "_string_box_factorize" pandas/_libs
pandas/_libs/parsers.pyx:1409:cdef _string_box_factorize(parser_t *parser, int64_t col,

cdef as well so can't be called from outside of there

int64_t line_start, int64_t line_end,
bint na_filter, kh_str_starts_t *na_hashset):
cdef:
int error, na_count = 0
Py_ssize_t i, lines
coliter_t it
const char *word = NULL
ndarray[object] result

int ret = 0
kh_strbox_t *table

object pyval

object NA = na_values[np.object_]
khiter_t k

table = kh_init_strbox()
lines = line_end - line_start
result = np.empty(lines, dtype=np.object_)
coliter_setup(&it, parser, col, line_start)

for i in range(lines):
COLITER_NEXT(it, word)

if na_filter:
if kh_get_str_starts_item(na_hashset, word):
# in the hash table
na_count += 1
result[i] = NA
continue

k = kh_get_strbox(table, word)

# in the hash table
if k != table.n_buckets:
# this increments the refcount, but need to test
pyval = <object>table.vals[k]
else:
# box it. new ref?
pyval = PyBytes_FromString(word)

k = kh_put_strbox(table, word, &ret)
table.vals[k] = <PyObject*>pyval

result[i] = pyval

kh_destroy_strbox(table)

return result, na_count


cdef _string_box_utf8(parser_t *parser, int64_t col,
int64_t line_start, int64_t line_end,
bint na_filter, kh_str_starts_t *na_hashset):
Expand Down
16 changes: 0 additions & 16 deletions pandas/_libs/src/ujson/python/objToJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,22 +399,6 @@ static void *CLong(JSOBJ obj, JSONTypeContext *tc, void *outValue,
return NULL;
}

#ifdef _LP64
static void *PyIntToINT64(JSOBJ _obj, JSONTypeContext *tc, void *outValue,
size_t *_outLen) {
PyObject *obj = (PyObject *)_obj;
*((JSINT64 *)outValue) = PyLong_AsLong(obj);
return NULL;
}
#else
static void *PyIntToINT32(JSOBJ _obj, JSONTypeContext *tc, void *outValue,
size_t *_outLen) {
PyObject *obj = (PyObject *)_obj;
*((JSINT32 *)outValue) = PyLong_AsLong(obj);
return NULL;
}
#endif

static void *PyLongToINT64(JSOBJ _obj, JSONTypeContext *tc, void *outValue,
size_t *_outLen) {
*((JSINT64 *)outValue) = GET_TC(tc)->longValue;
Expand Down
4 changes: 0 additions & 4 deletions pandas/_libs/tslibs/nattype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ cdef class _NaT(datetime):
# higher than np.ndarray and np.matrix
__array_priority__ = 100

def __hash__(_NaT self):
# py3k needs this defined here
return hash(self.value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure this can be removed? (do you know why?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two __hash__ definitions for this class so I suppose the second one takes priority

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's a good reason to remove it ;)


def __richcmp__(_NaT self, object other, int op):
cdef:
int ndim = getattr(other, 'ndim', -1)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def run(self):
extra_link_args.append("/DEBUG")
else:
# args to ignore warnings
extra_compile_args = ["-Wno-unused-function"]
extra_compile_args = []
extra_link_args = []
if debugging_symbols_requested:
extra_compile_args.append("-g")
Expand Down