Skip to content

Commit

Permalink
Backport gh-29392: Use PyObject_TypeCheck in type_call and binary_op1
Browse files Browse the repository at this point in the history
Summary:
Upstream issue: python/cpython#89860
Upstream PR: python/cpython#29392

This also ports D14351113 + D32175230 from 3.8 to 3.10

Test Plan: CI

Reviewers: alexanderm, #cinder

Reviewed By: alexanderm

Differential Revision: https://phabricator.intern.facebook.com/D42229775

Tags: cinder-310-upstream-complete, accept2ship, cinder-310-standalone-upstream-candidate
  • Loading branch information
itamaro committed Dec 27, 2022
1 parent 1ba2419 commit 0bd735a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ type_call(PyTypeObject *type, PyObject *args, PyObject *kwds)

/* If the returned object is not an instance of type,
it won't be initialized. */
if (!PyType_IsSubtype(Py_TYPE(obj), type))
if (!PyObject_TypeCheck(obj, type))
return obj;

type = Py_TYPE(obj);
Expand Down

0 comments on commit 0bd735a

Please sign in to comment.