Get all builtin types dynamiclly (#8095)

This commit is contained in:
Shahar Naveh authored and GitHub committed 2026-06-15 11:11:32 +09:00
1 parent 5c1803e019
commit c3e1f0fa37
2 files changed
+11 -26

No files matched your search

+10 -9
View File
@@ -1,10 +1,13 @@
Lib/** linguist-vendored
Cargo.lock linguist-generated
*.snap linguist-generated -merge
vm/src/stdlib/ast/gen.rs linguist-generated -merge
Lib/*.py text working-tree-encoding=UTF-8 eol=LF
**/*.rs text working-tree-encoding=UTF-8 eol=LF
crates/rustpython_doc_db/src/*.inc.rs linguist-generated=true
crates/vm/src/stdlib/ast/gen.rs linguist-generated -merge
crates/doc/src/data.inc.rs generated
crates/compiler-core/src/bytecode/opcode_metadata.rs generated
.github/workflows/*.lock.yml linguist-generated=true merge=ours
# Binary data types
*.aif binary
@@ -45,10 +48,11 @@ Lib/venv/scripts/posix/* text eol=lf
# Language aware diff headers
# https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more
# https://gist.github.com/tekin/12500956bd56784728e490d8cef9cb81
*.css diff=css
*.html diff=html
*.py diff=python
*.md diff=markdown
*.css diff=css
*.html diff=html
*.py diff=python
*.md diff=markdown
*.inc.rs diff=rust
# Generated files
# https://github.com/github/linguist/blob/master/docs/overrides.md
@@ -66,6 +70,3 @@ Lib/test/certdata/*.0 generated
Lib/test/levenshtein_examples.json generated
Lib/test/test_stable_abi_ctypes.py generated
Lib/token.py generated
crates/compiler-core/src/bytecode/opcode_metadata.rs generated
.github/workflows/*.lock.yml linguist-generated=true merge=ours
+1 -17
View File
@@ -185,23 +185,7 @@ def find_doc_entries() -> "Iterable[DocEntry]":
)
yield from (doc_entry for doc_entry in traverse(__builtins__, __builtins__))
builtin_types = [
type(None),
type(bytearray().__iter__()),
type(bytes().__iter__()),
type(dict().__iter__()),
type(dict().items()),
type(dict().items().__iter__()),
type(dict().values()),
type(dict().values().__iter__()),
type(lambda: ...),
type(list().__iter__()),
type(memoryview(b"").__iter__()),
type(range(0).__iter__()),
type(set().__iter__()),
type(str().__iter__()),
type(tuple().__iter__()),
]
builtin_types = object.__subclasses__()
# Add types from the types module (e.g., ModuleType, FunctionType, etc.)
for name in dir(types):