# Bug report ### Bug description: ```python # `metaclass_instance == np.dtype` for NumPy main type("name", metaclass_instance, {}) ``` for metaclasses that have `tp_new == NULL` is well defined: It has to be a Python error just like: ``` >>> type(metaclass_instace)() TypeError: cannot create 'numpy._DTypeMeta' instances ``` (in this case a NumPy metaclass, but you need the main branch of NumPy to test this.) That is, a metaclass that is a valid baseclass in C but has `tp_new == NULL` cannot be instantiated from Python but hits this code branch: https://github.com/python/cpython/blob/94a64bbc6ce89644cf02b82c723d9cc37f6a1870/Objects/typeobject.c#L5029 Which clearly segfaults for `tp_new == NULL`. ### CPython versions tested on: CPython main branch ### Operating systems tested on: _No response_ <!-- gh-linked-prs --> ### Linked PRs * gh-151916 * gh-153705 * gh-153706 * gh-153707 <!-- /gh-linked-prs -->
Bug report
Bug description:
for metaclasses that have
tp_new == NULLis well defined: It has to be a Python error just like:(in this case a NumPy metaclass, but you need the main branch of NumPy to test this.)
That is, a metaclass that is a valid baseclass in C but has
tp_new == NULLcannot be instantiated from Python but hits this code branch:cpython/Objects/typeobject.c
Line 5029 in 94a64bb
Which clearly segfaults for
tp_new == NULL.CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
type()with NULLtp_newmetaclasses #151916type()with NULLtp_newmetaclasses (GH-151916) #153705type()with NULLtp_newmetaclasses (GH-151916) #153706type()with NULLtp_newmetaclasses (GH-151916) #153707