mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-41779: Allow defining any __slots__ for a class derived from tuple
This commit is contained in:
parent
3149d64c93
commit
a452fce1f5
8 changed files with 61 additions and 10 deletions
|
|
@ -139,6 +139,7 @@ _PyCode_Quicken(_Py_CODEUNIT *instructions, Py_ssize_t size, int enable_counters
|
|||
#define SPEC_FAIL_ATTR_METACLASS_OVERRIDDEN 34
|
||||
#define SPEC_FAIL_ATTR_SPLIT_DICT 35
|
||||
#define SPEC_FAIL_ATTR_DESCR_NOT_DEFERRED 36
|
||||
#define SPEC_FAIL_ATTR_SLOT_AFTER_ITEMS 37
|
||||
|
||||
/* Binary subscr and store subscr */
|
||||
|
||||
|
|
@ -810,6 +811,10 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
|
|||
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_EXPECTED_ERROR);
|
||||
return -1;
|
||||
}
|
||||
if (dmem->flags & _Py_AFTER_ITEMS) {
|
||||
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_SLOT_AFTER_ITEMS);
|
||||
return -1;
|
||||
}
|
||||
if (dmem->flags & Py_AUDIT_READ) {
|
||||
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_AUDITED_SLOT);
|
||||
return -1;
|
||||
|
|
@ -1004,6 +1009,10 @@ _Py_Specialize_StoreAttr(_PyStackRef owner_st, _Py_CODEUNIT *instr, PyObject *na
|
|||
SPECIALIZATION_FAIL(STORE_ATTR, SPEC_FAIL_EXPECTED_ERROR);
|
||||
goto fail;
|
||||
}
|
||||
if (dmem->flags & _Py_AFTER_ITEMS) {
|
||||
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_SLOT_AFTER_ITEMS);
|
||||
goto fail;
|
||||
}
|
||||
if (dmem->flags & Py_READONLY) {
|
||||
SPECIALIZATION_FAIL(STORE_ATTR, SPEC_FAIL_ATTR_READ_ONLY);
|
||||
goto fail;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue