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-129250: allow pickle instances of generic classes #129446

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

Open
wants to merge 21 commits into
base: main
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
misc tweaks
  • Loading branch information
tom-pytel committed Jan 30, 2025
commit e794467bec5133e538ef7e3b6fbd3b269a672d15
4 changes: 3 additions & 1 deletion 4 Objects/funcobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,9 +928,11 @@ _Py_set_function_type_params(PyThreadState *ts, PyObject *func,
assert(PyTuple_Check(type_params));
PyFunctionObject *f = (PyFunctionObject *)func;
Py_XSETREF(f->func_typeparams, Py_NewRef(type_params));
if (_Py_set_type_params_owner(ts, func) == NULL) {
PyObject *res = _Py_set_type_params_owner(ts, func);
if (res == NULL) {
return NULL;
}
Py_DECREF(res);
return Py_NewRef(func);
}

Expand Down
10 changes: 3 additions & 7 deletions 10 Objects/typevarobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,7 @@ typeparam_reduce_anonymous(PyObject *self, PyObject *owner)
if (module == NULL) {
goto done;
}
PyObject *attrsep = PyUnicode_FromString(".");
if (attrsep == NULL) {
goto done;
}
path = PyUnicode_Split(qualname, attrsep, -1);
Py_DECREF(attrsep);
path = PyUnicode_Split(qualname, _Py_LATIN1_CHR('.'), -1);
if (path == NULL) {
goto done;
}
Expand Down Expand Up @@ -2541,7 +2536,8 @@ _Py_set_type_params_owner(PyThreadState *ts, PyObject *owner)
goto done;
}
if (set_type_params_owner(ts, type_params, owner) == 0) {
ret = Py_None;
Py_INCREF(owner);
ret = owner;
}
done:
Py_XDECREF(type_params);
Expand Down
3 changes: 0 additions & 3 deletions 3 Python/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1594,10 +1594,7 @@ codegen_class(compiler *c, stmt_ty s)
s->v.ClassDef.bases,
&_Py_STR(generic_base),
s->v.ClassDef.keywords));

ADDOP_I(c, loc, COPY, 1);
ADDOP_I_IN_SCOPE(c, loc, CALL_INTRINSIC_1, INTRINSIC_SET_TYPE_PARAMS_OWNER);
ADDOP(c, loc, POP_TOP);

PyCodeObject *co = _PyCompile_OptimizeAndAssemble(c, 0);

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