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

Fix compiler warnings on Py_SET_REFCNT() #3236

Merged
merged 1 commit into from
Feb 8, 2022
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
6 changes: 3 additions & 3 deletions src/core/buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ class Mmap_BufferImpl : public BufferImpl, MemoryMapWorker {
for (size_t i = 0; i < n; ++i) {
data[i] = Py_None;
}
Py_SET_REFCNT(Py_None, Py_REFCNT(Py_None) + n);
Py_SET_REFCNT(Py_None, Py_REFCNT(Py_None) + static_cast<Py_ssize_t>(n));
}
impl_->contains_pyobjects_ = true;
return *this;
Expand All @@ -955,7 +955,7 @@ class Mmap_BufferImpl : public BufferImpl, MemoryMapWorker {
if (n_new > n_old) {
PyObject** data = static_cast<PyObject**>(xptr());
for (size_t i = n_old; i < n_new; ++i) data[i] = Py_None;
Py_SET_REFCNT(Py_None, Py_REFCNT(Py_None) + n_new - n_old);
Py_SET_REFCNT(Py_None, Py_REFCNT(Py_None) + static_cast<Py_ssize_t>(n_new - n_old));
}
} else {
impl_->resize(newsize);
Expand Down Expand Up @@ -1019,7 +1019,7 @@ class Mmap_BufferImpl : public BufferImpl, MemoryMapWorker {
size_t i = 0;
for (; i < n_copy; ++i) Py_INCREF(newdata[i]);
for (; i < n_new; ++i) newdata[i] = Py_None;
Py_SET_REFCNT(Py_None, Py_REFCNT(Py_None) + n_new - n_copy);
Py_SET_REFCNT(Py_None, Py_REFCNT(Py_None) + static_cast<Py_ssize_t>(n_new - n_copy));
}
impl_->release(); // noexcept
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/column/const_na.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static Column _fw_col(size_t nrows, SType stype) {
});

if (std::is_same<T, PyObject*>::value) {
Py_SET_REFCNT(Py_None, Py_REFCNT(Py_None) + nrows);
Py_SET_REFCNT(Py_None, Py_REFCNT(Py_None) + static_cast<Py_ssize_t>(nrows));
buf.set_pyobjects(/* clear_data= */ false);
}
return Column(new ColClass(nrows, stype, std::move(buf)));
Expand All @@ -102,7 +102,7 @@ static Column _special_col(size_t nrows) {
});

if (std::is_same<T, PyObject*>::value) {
Py_SET_REFCNT(Py_None, Py_REFCNT(Py_None) + nrows);
Py_SET_REFCNT(Py_None, Py_REFCNT(Py_None) + static_cast<Py_ssize_t>(nrows));
buf.set_pyobjects(/* clear_data= */ false);
}
return Column(new ColClass(nrows, std::move(buf)));
Expand Down