Skip to content

Commit 6837ce8

Browse files
committed
Address PR review feedback: use unused tp_flags bit and reword test comment
- Change CPy_TPFLAGS_MYPYC_COMPILED from bit 20 (Py_TPFLAGS_IS_ABSTRACT) to bit 21, which is unused across all CPython versions (3.8-3.14) - Reword test comment to not claim direct struct access, since a runtime test cannot prove which code path was taken
1 parent 4b63a80 commit 6837ce8

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

mypyc/lib-rt/mypyc_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ typedef PyObject CPyModule;
149149
// Flag bit set on all mypyc-compiled types. Used to distinguish compiled
150150
// subclasses (safe for direct struct access) from interpreted subclasses
151151
// (need PyObject_GenericGetAttr fallback) in allow_interpreted_subclasses mode.
152-
#define CPy_TPFLAGS_MYPYC_COMPILED (1UL << 20)
152+
#define CPy_TPFLAGS_MYPYC_COMPILED (1UL << 21)
153153

154154
typedef void (*CPyVTableItem)(void);
155155

mypyc/test-data/run-classes.test

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5925,8 +5925,7 @@ assert s.check_flag(), "compiled method doesn't see subclass override"
59255925

59265926
[case testCompiledSubclassAttrAccessWithAllowInterpretedSubclasses]
59275927
# Test that compiled subclasses of a class with allow_interpreted_subclasses=True
5928-
# can correctly access parent instance attributes via direct struct access
5929-
# (not falling back to PyObject_GenericGetAttr).
5928+
# can still correctly access parent instance attributes.
59305929
from mypy_extensions import mypyc_attr
59315930

59325931
@mypyc_attr(allow_interpreted_subclasses=True)

0 commit comments

Comments
 (0)