Skip to content

gh-76785: Clean Up the Channels Module #110568

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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix function names related to channel end types.
  • Loading branch information
ericsnowcurrently committed Oct 17, 2023
commit 7b2a190e2a6e8ed2a3d3cb239986386a56bee6e0
23 changes: 12 additions & 11 deletions Modules/_xxinterpchannelsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2317,12 +2317,12 @@ channelid_richcompare(PyObject *self, PyObject *other, int op)
return res;
}

static PyTypeObject * _get_current_channel_end_type(int end);
static PyTypeObject * _get_current_channelend_type(int end);

static PyObject *
_channel_from_cid(PyObject *cid, int end)
{
PyObject *cls = (PyObject *)_get_current_channel_end_type(end);
PyObject *cls = (PyObject *)_get_current_channelend_type(end);
if (cls == NULL) {
return NULL;
}
Expand Down Expand Up @@ -2483,7 +2483,7 @@ static PyType_Spec ChannelIDType_spec = {
// XXX Use a new __xid__ protocol instead?

static PyTypeObject *
_get_current_channel_end_type(int end)
_get_current_channelend_type(int end)
{
module_state *state = _get_current_module_state();
if (state == NULL) {
Expand Down Expand Up @@ -2519,13 +2519,13 @@ _get_current_channel_end_type(int end)
}

static PyObject *
_channel_end_from_xid(_PyCrossInterpreterData *data)
_channelend_from_xid(_PyCrossInterpreterData *data)
{
channelid *cid = (channelid *)_channelid_from_xid(data);
if (cid == NULL) {
return NULL;
}
PyTypeObject *cls = _get_current_channel_end_type(cid->end);
PyTypeObject *cls = _get_current_channelend_type(cid->end);
if (cls == NULL) {
Py_DECREF(cid);
return NULL;
Expand All @@ -2536,7 +2536,7 @@ _channel_end_from_xid(_PyCrossInterpreterData *data)
}

static int
_channel_end_shared(PyThreadState *tstate, PyObject *obj,
_channelend_shared(PyThreadState *tstate, PyObject *obj,
_PyCrossInterpreterData *data)
{
PyObject *cidobj = PyObject_GetAttrString(obj, "_id");
Expand All @@ -2548,12 +2548,12 @@ _channel_end_shared(PyThreadState *tstate, PyObject *obj,
if (res < 0) {
return -1;
}
data->new_object = _channel_end_from_xid;
data->new_object = _channelend_from_xid;
return 0;
}

static int
set_channel_end_types(PyObject *mod, PyTypeObject *send, PyTypeObject *recv)
set_channelend_types(PyObject *mod, PyTypeObject *send, PyTypeObject *recv)
{
module_state *state = get_module_state(mod);
if (state == NULL) {
Expand All @@ -2570,16 +2570,17 @@ set_channel_end_types(PyObject *mod, PyTypeObject *send, PyTypeObject *recv)
state->send_channel_type = (PyTypeObject *)Py_NewRef(send);
state->recv_channel_type = (PyTypeObject *)Py_NewRef(recv);

if (register_xid_class(send, _channel_end_shared, xid_classes)) {
if (register_xid_class(send, _channelend_shared, xid_classes)) {
return -1;
}
if (register_xid_class(recv, _channel_end_shared, xid_classes)) {
if (register_xid_class(recv, _channelend_shared, xid_classes)) {
return -1;
}

return 0;
}


/* module level code ********************************************************/

/* globals is the process-global state for the module. It holds all
Expand Down Expand Up @@ -3079,7 +3080,7 @@ channelsmod__register_end_types(PyObject *self, PyObject *args, PyObject *kwds)
PyTypeObject *cls_send = (PyTypeObject *)send;
PyTypeObject *cls_recv = (PyTypeObject *)recv;

if (set_channel_end_types(self, cls_send, cls_recv) < 0) {
if (set_channelend_types(self, cls_send, cls_recv) < 0) {
return NULL;
}

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy