Skip to content

BUG: use internal linkage (static variables) in move.c #24113

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

Merged
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
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,7 @@ Other
- Logical operations ``&, |, ^`` between :class:`Series` and :class:`Index` will no longer raise ``ValueError`` (:issue:`22092`)
- Checking PEP 3141 numbers in :func:`~pandas.api.types.is_scalar` function returns ``True`` (:issue:`22903`)
- Bug in :meth:`DataFrame.combine_first` in which column types were unexpectedly converted to float (:issue:`20699`)
- Bug where C variables were declared with external linkage causing import errors if certain other C libraries were imported before Pandas. (:issue:`24113`)

.. _whatsnew_0.24.0.contributors:

Expand Down
16 changes: 8 additions & 8 deletions pandas/util/move.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif

PyObject *badmove; /* bad move exception class */
static PyObject *badmove; /* bad move exception class */

typedef struct {
PyObject_HEAD
/* the bytes that own the buffer we are mutating */
PyObject *invalid_bytes;
} stolenbufobject;

PyTypeObject stolenbuf_type; /* forward declare type */
static PyTypeObject stolenbuf_type; /* forward declare type */

static void
stolenbuf_dealloc(stolenbufobject *self)
Expand Down Expand Up @@ -71,7 +71,7 @@ stolenbuf_getsegcount(stolenbufobject *self, Py_ssize_t *len)
return 1;
}

PyBufferProcs stolenbuf_as_buffer = {
static PyBufferProcs stolenbuf_as_buffer = {
(readbufferproc) stolenbuf_getreadwritebuf,
(writebufferproc) stolenbuf_getreadwritebuf,
(segcountproc) stolenbuf_getsegcount,
Expand All @@ -81,7 +81,7 @@ PyBufferProcs stolenbuf_as_buffer = {

#else /* Python 3 */

PyBufferProcs stolenbuf_as_buffer = {
static PyBufferProcs stolenbuf_as_buffer = {
(getbufferproc) stolenbuf_getbuffer,
NULL,
};
Expand All @@ -91,7 +91,7 @@ PyBufferProcs stolenbuf_as_buffer = {
PyDoc_STRVAR(stolenbuf_doc,
"A buffer that is wrapping a stolen bytes object's buffer.");

PyTypeObject stolenbuf_type = {
static PyTypeObject stolenbuf_type = {
PyVarObject_HEAD_INIT(NULL, 0)
"pandas.util._move.stolenbuf", /* tp_name */
sizeof(stolenbufobject), /* tp_basicsize */
Expand Down Expand Up @@ -185,7 +185,7 @@ move_into_mutable_buffer(PyObject *self, PyObject *bytes_rvalue)
return (PyObject*) ret;
}

PyMethodDef methods[] = {
static PyMethodDef methods[] = {
{"move_into_mutable_buffer",
(PyCFunction) move_into_mutable_buffer,
METH_O,
Expand All @@ -196,7 +196,7 @@ PyMethodDef methods[] = {
#define MODULE_NAME "pandas.util._move"

#if !COMPILING_IN_PY2
PyModuleDef _move_module = {
static PyModuleDef move_module = {
PyModuleDef_HEAD_INIT,
MODULE_NAME,
NULL,
Expand Down Expand Up @@ -242,7 +242,7 @@ init_move(void)
}

#if !COMPILING_IN_PY2
if (!(m = PyModule_Create(&_move_module)))
if (!(m = PyModule_Create(&move_module)))
#else
if (!(m = Py_InitModule(MODULE_NAME, methods)))
#endif /* !COMPILING_IN_PY2 */
Expand Down