mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
* Leave Rust-only name decoration out of a generated signature A leading underscore marks an argument Rust sees as unused and `r#` escapes a Rust keyword. Neither describes the parameter a Python caller passes, and `r#` is not valid Python, so `inspect.signature()` rejects any signature carrying one. Reporting the bare name fixes _sre.template, select.epoll.__exit__ and bytearray.__reduce_ex__ without touching them, and lets a method name a parameter after a Rust keyword. A parameter CPython itself names with a leading underscore, such as compile's `_feature_version`, reaches Python through a FromArgs field, which this never sees. Assisted-by: Claude Code:claude-opus-5 * Name builtin type parameters the way CPython names them A generated __text_signature__ reports the Rust parameter name, so a name chosen for Rust reaches anyone reading help() or inspect. Rename the ones CPython describes differently: list.pop's `i` becomes `index`, list.count's `needle` becomes `value`, __format__'s `spec` becomes `format_spec`, bytes.strip's `chars` becomes `bytes`, and object.__reduce_ex__'s `proto` becomes `protocol`. Left alone are the parameters CPython reports as `object` or `unused`. Those are synthesised from the METH_* flags rather than named: CPython reports slice.indices as ($self, object, /) while its own docstring calls the argument len. Assisted-by: Claude Code:claude-opus-5 * Name os parameters the way CPython names them os.read's `n` becomes `length`, os.lseek's `how` becomes `whence`, os.kill's `sig` becomes `signal`, os.stat's `file` becomes `path`, and os.putenv's `key` becomes `name`, among others. os.chmod is left alone. It reports (path, dir_fd, mode, follow_symlinks) while the call binds mode second and takes follow_symlinks by keyword, so the order and the kind are wrong rather than the names, which a rename cannot fix. os.fstatvfs is left alone too: it shares one Rust function with statvfs, which CPython names `path`, so the two aliases cannot report different names. Assisted-by: Claude Code:claude-opus-5 * Name sys parameters the way CPython names them sys.excepthook's (exc_type, exc_val, exc_tb) become (exctype, value, traceback), sys._getframe's `offset` becomes `depth`, sys.intern's `s` becomes `string`, and sys.settrace's `tracefunc` becomes `function`. sys._clear_type_descriptors takes the name CPython gives it, which Rust spells r#type. Assisted-by: Claude Code:claude-opus-5 * Name vm stdlib parameters the way CPython names them deque.rotate's `mid` becomes `n`, deque.extend's `iter` becomes `iterable`, _sre.ascii_tolower's `ch` becomes `character`, _operator.neg's `pos` becomes `a`, signal.alarm's `time` becomes `seconds`, and codecs.register_error's `name` becomes `errors`. gc.collect and charmap_build keep theirs. Their argument is a FromArgs struct or a PosArgs bundle, so the reported name is the binding rather than a parameter, and renaming the binding would only disguise that. Assisted-by: Claude Code:claude-opus-5 * Name stdlib crate parameters the way CPython names them unicodedata.category's `character` becomes `chr`, math.isqrt's `x` becomes `n`, cmath.polar's `x` becomes `z`, struct.calcsize's `fmt` becomes `format`, binascii.crc32's `init` becomes `crc`, zlib.adler32's `begin_state` becomes `value`, and array.append's `x` becomes `v`. array.fromunicode's parameter is `ustr`, which cspell has to be told about. array.__deepcopy__ keeps `_memo`, which the generator now reports as `memo`; CPython calls it `unused`, a name synthesised from METH_O rather than chosen. Assisted-by: Claude Code:claude-opus-5 * Name BaseExceptionGroup.split's parameter the way CPython names it CPython calls the argument of split and subgroup `matcher_value`. Assisted-by: Claude Code:claude-opus-5 * Strip a generated parameter name with unraw and one prefix check syn already removes r# through IdentExt::unraw, the way from_args.rs does for a field name. The empty-name guard never ran: a bare `_` is Pat::Wild, which func_sig has already refused. Assisted-by: Claude Code:claude-fable-5-1 * Take object and unused from CPython's Clinic signatures CPython also falls back to these names for METH_O, but list.append and insert, set.add, discard and remove, _weakref.getweakrefcount and getweakrefs, sys.displayhook and getrefcount, and array.__deepcopy__ get them from an Argument Clinic signature. The earlier commit that kept array.__deepcopy__'s `_memo` was wrong to call `unused` synthesised. test_pydoc's set.add summary-line tests now pass. Assisted-by: Claude Code:claude-opus-5
150 lines
3.1 KiB
JSON
150 lines
3.1 KiB
JSON
// See: https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell
|
|
{
|
|
"version": "0.2",
|
|
"import": [
|
|
"@cspell/dict-en_us/cspell-ext.json",
|
|
// "@cspell/dict-cpp/cspell-ext.json",
|
|
"@cspell/dict-python/cspell-ext.json",
|
|
"@cspell/dict-rust/cspell-ext.json",
|
|
"@cspell/dict-win32/cspell-ext.json",
|
|
"@cspell/dict-shell/cspell-ext.json",
|
|
],
|
|
"allowCompoundWords": true,
|
|
// language - current active spelling language
|
|
"language": "en",
|
|
// dictionaries - list of the names of the dictionaries to use
|
|
"dictionaries": [
|
|
"cpython", // Sometimes keeping same terms with cpython is easy
|
|
"python-more", // Python API terms not listed in python
|
|
"rust-more", // Rust API terms not listed in rust
|
|
"rustpython", // RustPython derive macros and internal terms
|
|
"en_US",
|
|
"softwareTerms",
|
|
"c",
|
|
"cpp",
|
|
"python",
|
|
"rust",
|
|
"shell",
|
|
"win32"
|
|
],
|
|
// dictionaryDefinitions - this list defines any custom dictionaries to use
|
|
"dictionaryDefinitions": [
|
|
{
|
|
"name": "cpython",
|
|
"path": "./.cspell.dict/cpython.txt"
|
|
},
|
|
{
|
|
"name": "python-more",
|
|
"path": "./.cspell.dict/python-more.txt"
|
|
},
|
|
{
|
|
"name": "rust-more",
|
|
"path": "./.cspell.dict/rust-more.txt"
|
|
},
|
|
{
|
|
"name": "rustpython",
|
|
"path": "./.cspell.dict/rustpython.txt"
|
|
}
|
|
],
|
|
"ignorePaths": [
|
|
"**/__pycache__/**",
|
|
"target/**",
|
|
"Lib/**",
|
|
"crates/host_env/**"
|
|
],
|
|
"overrides": [
|
|
{
|
|
"filename": "crates/common/src/encodings/cjk/**",
|
|
"words": [
|
|
"CHOSEONG",
|
|
"EUCKR",
|
|
"famille",
|
|
"GBCOMMON",
|
|
"jong",
|
|
"JONGSEONG",
|
|
"JUNGSEONG",
|
|
"PHINT",
|
|
"Xabc"
|
|
]
|
|
}
|
|
],
|
|
// words - list of words to be always considered correct
|
|
// (compound words like pyarg, baseclass, microbenchmark are handled by allowCompoundWords)
|
|
"words": [
|
|
"AESGCM",
|
|
"aiterable",
|
|
"alnum",
|
|
"COMPLEMENTOFALL",
|
|
"COMPLEMENTOFDEFAULT",
|
|
"csock",
|
|
"coro",
|
|
"contig",
|
|
"Crnl",
|
|
"dedentations",
|
|
"dedents",
|
|
"deduped",
|
|
"deoptimized",
|
|
"deoptimize",
|
|
"EECDH",
|
|
"emscripten",
|
|
"excs",
|
|
"fdigits",
|
|
"feff",
|
|
"flufl",
|
|
"fnfe",
|
|
"fsdefault",
|
|
"ifexp",
|
|
"implicits",
|
|
"inity",
|
|
"interps",
|
|
"jitted",
|
|
"jitting",
|
|
"kwonly",
|
|
"lossily",
|
|
"mcache",
|
|
"MLKEM",
|
|
"oparg",
|
|
"opargs",
|
|
"pointee",
|
|
"pyc",
|
|
"qmark",
|
|
"reborrow",
|
|
"reborrows",
|
|
"reparenting",
|
|
"reraises",
|
|
"reraising",
|
|
"significand",
|
|
"SUITEB",
|
|
"summands",
|
|
"TESTFN",
|
|
"TZPATH",
|
|
"unraisable",
|
|
"ustr",
|
|
"wasi",
|
|
"weaked",
|
|
// unix
|
|
"posixshmem",
|
|
"shm",
|
|
"CLOEXEC",
|
|
"endgrent",
|
|
"gethrvtime",
|
|
"getrusage",
|
|
"sigaction",
|
|
"WRLCK",
|
|
// win32
|
|
"IFEXEC"
|
|
],
|
|
// flagWords - list of words to be always considered incorrect
|
|
"flagWords": [
|
|
],
|
|
"ignoreRegExpList": [
|
|
],
|
|
// languageSettings - allow for per programming language configuration settings.
|
|
"languageSettings": [
|
|
{
|
|
"languageId": "python",
|
|
"locale": "en"
|
|
}
|
|
]
|
|
}
|