Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-101819: Remove _testcapi dependencies on specific _io symbols #101918

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 2 commits into from
Feb 15, 2023
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
12 changes: 2 additions & 10 deletions 12 Modules/_io/_iomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,16 +720,8 @@ PyInit__io(void)
// Add types
for (size_t i=0; i < Py_ARRAY_LENGTH(static_types); i++) {
PyTypeObject *type = static_types[i];
// Private type not exposed in the _io module
if (type == &_PyBytesIOBuffer_Type) {
if (PyType_Ready(type) < 0) {
goto fail;
}
}
else {
if (PyModule_AddType(m, type) < 0) {
goto fail;
}
if (PyModule_AddType(m, type) < 0) {
goto fail;
}
}

Expand Down
8 changes: 6 additions & 2 deletions 8 Modules/_testcapimodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1448,12 +1448,10 @@ test_from_contiguous(PyObject* self, PyObject *Py_UNUSED(ignored))
}

#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__GNUC__)
extern PyTypeObject _PyBytesIOBuffer_Type;

static PyObject *
test_pep3118_obsolete_write_locks(PyObject* self, PyObject *Py_UNUSED(ignored))
{
PyTypeObject *type = &_PyBytesIOBuffer_Type;
PyObject *b;
char *dummy[1];
int ret, match;
Expand All @@ -1466,7 +1464,13 @@ test_pep3118_obsolete_write_locks(PyObject* self, PyObject *Py_UNUSED(ignored))
goto error;

/* bytesiobuf_getbuffer() */
PyTypeObject *type = (PyTypeObject *)_PyImport_GetModuleAttrString(
"_io", "_BytesIOBuffer");
if (type == NULL) {
return NULL;
}
b = type->tp_alloc(type, 0);
Py_DECREF(type);
if (b == NULL) {
return NULL;
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.