◐ Shell
clean mode source ↗

Align psuedo ops to CPython 3.14.2 by youknowone · Pull Request #6846 · RustPython/RustPython

🧩 Analysis chain

🏁 Script executed:

cat -n crates/stdlib/src/_opcode.rs | sed -n '310,330p'

Repository: RustPython/RustPython

Length of output: 754


🏁 Script executed:

cd crates/stdlib && cargo clippy --all-targets 2>&1 | head -100

Repository: RustPython/RustPython

Length of output: 174


🏁 Script executed:

rg "get_special_method_names\|__enter__\|__exit__" crates/stdlib/src/_opcode.rs -A 2 -B 2

Repository: RustPython/RustPython

Length of output: 47


🏁 Script executed:

rg "get_intrinsic1_descs|get_intrinsic2_descs" crates/stdlib/src/_opcode.rs -A 6

Repository: RustPython/RustPython

Length of output: 639


🏁 Script executed:

rg "class.*Manager|__enter__|__exit__|__aenter__|__aexit__" --type rs | head -30

Repository: RustPython/RustPython

Length of output: 91


🏁 Script executed:

cat -n crates/stdlib/src/_opcode.rs | sed -n '1,50p'

Repository: RustPython/RustPython

Length of output: 1893


🏁 Script executed:

rg "get_special_method_names" crates/stdlib/

Repository: RustPython/RustPython

Length of output: 168


🏁 Script executed:

rg "__enter__|__exit__|__aenter__|__aexit__" crates/stdlib/src/_opcode.rs

Repository: RustPython/RustPython

Length of output: 125


🏁 Script executed:

git log --oneline -10 crates/stdlib/src/_opcode.rs

Repository: RustPython/RustPython

Length of output: 99


🏁 Script executed:

find crates -name "*test*" -type f | xargs grep -l "special_method\|__enter__\|__exit__" 2>/dev/null | head -5

Repository: RustPython/RustPython

Length of output: 159


🏁 Script executed:

rg "def get_special_method_names|special_method" crates/stdlib/src/_opcode.rs -B 5 -A 10

Repository: RustPython/RustPython

Length of output: 446


🏁 Script executed:

cat -n crates/stdlib/src/_opcode.rs | sed -n '320,350p'

Repository: RustPython/RustPython

Length of output: 776


🌐 Web query:

CPython _opcode module get_special_method_names function

💡 Result:

In CPython, _opcode.get_special_method_names() is a CPython-internal helper that returns a Python list of the interpreter’s “special method” (dunder) names.

Implementation (CPython 3.14): it allocates a list of length SPECIAL_MAX + 1 and fills it with _Py_SpecialMethods[i].name for i = 0..SPECIAL_MAX. The returned list index corresponds to CPython’s internal “special method” id. [1]

API docstring in the generated clinic header: “Return a list of special method names.” [2]

Use:

import _opcode
names = _opcode.get_special_method_names()

Sources: [1] [2]


🏁 Script executed:

rg "ASYNC_WITH|WITH_CLEANUP|context.*manager" crates/ --type-list | head -10

Repository: RustPython/RustPython

Length of output: 454


🏁 Script executed:

cat -n crates/stdlib/src/_opcode.rs | sed -n '280,330p'

Repository: RustPython/RustPython

Length of output: 2069


Incomplete implementation: Returns only context manager special methods, not all special methods.

The function syntactically follows the established pattern (array → .into_iter().map().collect()), but does not match CPython's get_special_method_names(). CPython's implementation returns a comprehensive list of all special method names (indexed from an internal _Py_SpecialMethods array), while this implementation returns only the four context manager methods: __enter__, __exit__, __aenter__, __aexit__. This implementation is incomplete relative to CPython and may cause compatibility issues if callers expect the full set of special method names.