Skip to content

Bump meson #57895

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

Closed
wants to merge 17 commits into from
Closed

Bump meson #57895

wants to merge 17 commits into from

Conversation

WillAyd
Copy link
Member

@WillAyd WillAyd commented Mar 18, 2024

Meson 1.4.0 adds first class support for NumPy > 2.0 detection https://mesonbuild.com/Release-notes-for-1-4-0.html#new-numpy-custom-dependency

Not an urgent upgrade but figured worth starting

@WillAyd WillAyd added the Build Library building on various platforms label Mar 18, 2024
void *ptr = realloc(old_ptr, size);
if (ptr != NULL) {
if (old_ptr != ptr) {
Copy link
Member Author

Choose a reason for hiding this comment

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

gcc was complaing about a use-after-free with old_ptr here

@@ -59,7 +59,7 @@ def read_uint32_with_byteswap(bytes data, Py_ssize_t offset, bint byteswap):

def read_uint64_with_byteswap(bytes data, Py_ssize_t offset, bint byteswap):
cdef uint64_t res
assert offset + sizeof(res) < len(data)
Copy link
Member Author

Choose a reason for hiding this comment

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

warning about comparison of operands with different signs (size_t is unsigned, Py_ssize_t is signed)

@@ -137,7 +137,7 @@ except ImportError:

@cython.wraparound(False)
@cython.boundscheck(False)
def memory_usage_of_objects(arr: object[:]) -> int64_t:
def memory_usage_of_objects(arr: ndarray[object]) -> int64_t:
Copy link
Member Author

Choose a reason for hiding this comment

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

This produces:

  pandas/_libs/lib.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/lib.pyx.c:90806:12: warning: '__pyx_memview_set_object' defined but not used [-Wunused-function]
  90806 | static int __pyx_memview_set_object(const char *itemp, PyObject *obj) {
        |            ^~~~~~~~~~~~~~~~~~~~~~~~
  pandas/_libs/lib.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/lib.pyx.c:90801:20: warning: '__pyx_memview_get_object' defined but not used [-Wunused-function]
  90801 |   static PyObject *__pyx_memview_get_object(const char *itemp) {
        |                    ^~~~~~~~~~~~~~~~~~~~~~~~

although I am not sure why it wouldn't let me specify the ndim here.

@lithomas1 lithomas1 self-requested a review March 18, 2024 19:32
@@ -105,7 +111,7 @@ cdef value_count_{{dtype}}(const {{dtype}}_t[:] values, bint dropna, const uint8
cdef:
int64_t[::1] result_counts = np.empty(table.size + na_add, dtype=np.int64)

for i in range(table.size):
for i in range(<Py_ssize_t>table.size): # cast required for 32 bit builds
Copy link
Member Author

Choose a reason for hiding this comment

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

We alternately could change table.size to be of type Py_ssize_t but leaving that to a separate exercise

@@ -43,7 +43,13 @@ cdef value_count_{{dtype}}(const {{dtype}}_t[:] values, bint dropna, const uint8
# Don't use Py_ssize_t, since table.n_buckets is unsigned
khiter_t k

{{c_type}} val
# without explicit initialization the compiler detects that val could
Copy link
Member Author

Choose a reason for hiding this comment

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

This is extremely wonky, but the compiler is right that val would be uninitialized if n==0. I think it would take a decent refactor to make Cython generate something else that the compiler would be comfortable with

@WillAyd
Copy link
Member Author

WillAyd commented Mar 19, 2024

I believe the pypy failure is a Cython issue - see cython/cython#6099

Generally I was surprised that the amount of warnings changed with this PR. But I fixed a few / ignored others (mostly for MSVC). Would be nice to get a lot of the MSVC warnings fixed up but I think that will take a dedicated initiative.

Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Apr 19, 2024
@mroeschke
Copy link
Member

Closing since there hasn't been much activity here, but feel free to reopen if/when you have time to revist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Library building on various platforms Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants