[3.7] bpo-35992: Use PySequence_GetItem only if sq_item is not NULL (GH-11857) by miss-islington · Pull Request #11910 · python/cpython

@ilevkivskyi @miss-islington

…GH-11857)

Not using `__class_getitem__()` fallback if there is a non-subcriptable metaclass was caused by a certain asymmetry between how `PySequenceMethods` and `PyMappingMethods` are used in `PyObject_GetItem`. This PR removes this asymmetry. No tests failed, so I assume it was not intentional.
(cherry picked from commit ac28147)

Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>

ilevkivskyi