Skip to content

Commit

Permalink
Declare a different name for nan_equality.UNEQUAL to prevent Cython w…
Browse files Browse the repository at this point in the history
…arnings. (#12947)

Closes #9462.

```
warning: cudf/_lib/cpp/types.pxd:51:8: 'UNEQUAL' redeclared
```

We've been dealing with warnings like this for as long as I've worked on cudf. I think it'd be good to fix this by renaming the Cython enum. We don't rely on this name very much at the Cython/Python level, so it's a small change. (This has been irking me for a long time and I want to see this warning go away in the build logs.)

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - https://github.com/brandon-b-miller

URL: #12947
  • Loading branch information
bdice authored Mar 17, 2023
1 parent d9e1b90 commit 49e87b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions python/cudf/cudf/_lib/cpp/types.pxd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2022, NVIDIA CORPORATION.
# Copyright (c) 2020-2023, NVIDIA CORPORATION.

from libc.stdint cimport int32_t, uint32_t

Expand Down Expand Up @@ -47,8 +47,10 @@ cdef extern from "cudf/types.hpp" namespace "cudf" nogil:
UNEQUAL "cudf::null_equality::UNEQUAL"

ctypedef enum nan_equality "cudf::nan_equality":
# These names differ from the C++ names due to Cython warnings if
# "UNEQUAL" is declared by both null_equality and nan_equality.
ALL_EQUAL "cudf::nan_equality::ALL_EQUAL"
UNEQUAL "cudf::nan_equality::UNEQUAL"
NANS_UNEQUAL "cudf::nan_equality::UNEQUAL"

ctypedef enum type_id "cudf::type_id":
EMPTY "cudf::type_id::EMPTY"
Expand Down
4 changes: 2 additions & 2 deletions python/cudf/cudf/_lib/lists.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022, NVIDIA CORPORATION.
# Copyright (c) 2021-2023, NVIDIA CORPORATION.

from cudf.core.buffer import acquire_spill_lock

Expand Down Expand Up @@ -84,7 +84,7 @@ def distinct(Column col, bool nulls_equal, bool nans_all_equal):
null_equality.EQUAL if nulls_equal else null_equality.UNEQUAL
)
cdef nan_equality c_nans_equal = (
nan_equality.ALL_EQUAL if nans_all_equal else nan_equality.UNEQUAL
nan_equality.ALL_EQUAL if nans_all_equal else nan_equality.NANS_UNEQUAL
)

cdef unique_ptr[column] c_result
Expand Down

0 comments on commit 49e87b8

Please sign in to comment.