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

bpo-44532: fix _PyStructSequence_InitType_Check#26949

Closed
dexterhahaha wants to merge 1 commit into
python:mainpython/cpython:mainfrom
dexterhahaha:fix/_PyStructSequence_InitType_CheckCopy head branch name to clipboard
Closed

bpo-44532: fix _PyStructSequence_InitType_Check#26949
dexterhahaha wants to merge 1 commit into
python:mainpython/cpython:mainfrom
dexterhahaha:fix/_PyStructSequence_InitType_CheckCopy head branch name to clipboard

Conversation

@dexterhahaha

@dexterhahaha dexterhahaha commented Jun 29, 2021

Copy link
Copy Markdown
Contributor

In _PyStructSequence_InitType, it will check type is initialized.
but when we have multi subinterpreters, type may be initialized in expected.

when type already been initialized, should return 0 rather than throw exception.

/* PyTypeObject has already been initialized */
if (Py_REFCNT(type) != 0) {
    return 0;
}
int
_PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc,
                           unsigned long tp_flags)
{
    PyMemberDef *members;
    Py_ssize_t n_members, n_unnamed_members;

#ifdef Py_TRACE_REFS
    /* if the type object was chained, unchain it first
       before overwriting its storage */
    if (type->ob_base.ob_base._ob_next) {
        _Py_ForgetReference((PyObject *)type);
    }
#endif

    /* PyTypeObject has already been initialized */
    if (Py_REFCNT(type) != 0) {
        PyErr_BadInternalCall();
        return -1;
    }

https://bugs.python.org/issue44532

@dexterhahaha

Copy link
Copy Markdown
Contributor Author

@bedevere-bot skip news

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jul 31, 2021

@MaxwellDupre MaxwellDupre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

407 tests OK.
Looks fine to me.

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.