[mypyc] Add experimental C extension librt.vecs (part 1/2) #20653
Add initial C extension
b685c2ce
Add empty vec class
11188d87
Add dummy append function
37857c97
Can construct empty vec
c49c0192
Implement vec operations (indexing, append, len)
0ee2a949
Support setting vec item
bc61aa6f
Create basic capsule
dbbb66ee
Move some declarations to a header
7d99cb5b
Tweak types
68283398
Fix capsule storage
a771ac0b
Minor refactoring
152e66b7
More refactoring
8bf98759
Move vec[i64] related stuff to a new file
5503a7a8
Switch to vec[t]() for constructing an empty vec
3ab5d01e
Update str() of type obj
e2136978
Update repr of vec[i64]
f62bf16c
[WIP] Beginnings of support for vec[str]
75f8803e
Implement len() for vec[str]
efe565c7
Implement get item and append for vec[t]
95ad1d56
Improvements to vec[t] support
290534d5
Improve runtime type checking
80ea5fa2
Improve runtime error checking
073b0c34
Fix compiler warnings
67d9dd7e
Don't respect __instancecheck__ and allow metaclasses
308a8e80
Share vec item check code
f2190fe2
Support vec[str | None] class proxy objects
1b5cf181
Start implementing real vec[t | None] support
da92666a
Support proxy types with nested vecs
cb7a7ac4
Improvements to optional/nested vecs
37fd0a64
Refactor
afc2dbdd
Refactor
d9733fa7
Add set item op
45d1b1e6
Implement vec[i64](init)
b9bc3ec1
Initialize vec[t] from iterable
91fd2a21
More initialization from iterable
f5cd6606
Implement vec[i64] equality
13c0dd7a
Implement == and != for vec[t]
c8bea048
More __eq__ support
ff5a6a1a
Fix C style
ce0586dd
Implement vec[i64] slicing
4b876126
Small style tweak
ef5b658b
Implement vec[t] slicing
3b3df1a1
Implement remaining vec slicing
b76d9a13
Implement vec[i64].remove(x)
a755479b
Implement vec[t].remove(x)
11e33158
Fix possible issue where vec being compared changes size
ad3bb8f6
Fix refcounting and gc issues
a7102823
Finish up implementation of vec.remove
4e596579
Clean up dealloc code a bit
639617f0
Implement vec[i64].pop
e7246a0f
Implement vec[t].pop
d9a270a9
Finish implementation of pop
4a3ecfdf
Add VecObject struct
9bd0028b
Include vec[t] in capsule
78fbf952
Include vec[t] ext in capsule
745613ae
Minor tweak
f9e55ebb
Add pop(index) to external API
f9b731a1
Add vec[i64] remove to API
61036db7
Add remaining remove variants to external API
67dc4ec5
Add API function for vec slicing
7b30bc89
[WIP] Move to new vec representation for vec[i64]
9264c890
Include boxing op in the capsule (i64 only for now)
86768bd2
Use NULL for empty buffer
dd11f84f
Partial implementation of vec[T] for type objects
3f6d0563
Implement vec[t] remove
9daeac45
Implement vec[t] pop
240a668c
Work towards vec[t | None] support
3164fd40
Fix crash
a50736ca
Update header to use new repr for nested vecs
4c78b0ce
Work towards nested vecs (still not working!)
6c76516c
Implement nested vec subscription + refactor
1656992e
Implement more nested vec features
e2b87aa4
Minor refactoring
9c46dd0a
Add nested vec item unboxing helper
823b868d
Implement nested vec conversion from iterable
0ed34353
Implement low-level append for nested vecs
9e8c5ecc
Implement nested vec assignment
cca673f7
Comment out work-in-progress code (with missing implementations)
457794b3
Implement constructing empty nested vec
eb2c4aeb
Implement append for nested vecs
936117fa
Some fixes
8d192ae8
Implement nested vec equality
3d442264
Support remove with nested vec
0a707d75
Support pop() with nested vecs
7cd1ee92
Add vec[i64] unbox to public API
a615afed
Make remove() a module-level function
29d7060e
Make pop() a module-level function
60fbfef3
Refactoring
f8083d86
Update native pop() implementation to return a tuple
21bebe38
Use tuple return type that is compatible with mypyc
cae209cb
Adjust borrowing/stealing a bit
6f61090d
Use magic constant for i64 etc. special item types in nested vecs
2b23f1bb
Add missing unboxing C API functions (untested)
6495613e
Fix remove
14917299
Fix remove
355326fd
Fix slicing overflow checks
a3b9da49
Fix slicing
1fae06d7
Only the non-vec item type in a nested vec can be optional
c1ebbe98
Allow empty vec[t] to have NULL buf
bdcd956c
Allow specifying capacity when allocating a vec
e310bf8e
Update repr of vec[i64]
f62bf16c
Implement len() for vec[str]
efe565c7
Share vec item check code
f2190fe2
More initialization from iterable
f5cd6606
More __eq__ support
ff5a6a1a
Small style tweak
ef5b658b
Implement vec[i64].pop
e7246a0f
Minor tweak
f9e55ebb
Add pop(index) to external API
f9b731a1
Implement constructing empty nested vec
eb2c4aeb
Refactoring
f8083d86
Support negative vec indexing in set item
fb1879f3
Replace VecT_Ext -> VecVec
f5d96dd2
Refactor
0eaf3d35
Refactor
e2f521b6
Refactor
e91f13ad
Rename file
d3133391
Remove unused function VecVec_ItemCheck
3caac005
Update comments
d97f7e1e
Refactor
40d79cef
WIP start working on vec item type specialization template
7050fa52
Generalize parts of the template
947010bf
Generalize more
bde9dac1
Generalize more
3c2e1ad8
Generalize more
361d947a
Do it properly
f31c0b91
Generalize more
d8197228
Generalize more, including BOX_ITEM
5e25e2d6
Generalize more
1381ae0a
Generalize remaining
a69a7ee3
Generalize more
436c4ed5
Implement vec[float]
5ee4f4db
Refactor
1abadd71
Refactor
772681ae
Refactor
16539f14
Refactor
b0385c44
Implement vec[u8]
f42fb5bc
Support vec[i32] and vec[i16]
adb5b07a
Add item overflow checks
7c5aa3cc
Support vec[bool]
1dc7b4a8
Rename vecs.c to librt_vecs.c
281ea023
Rename vecs.h to librt_vecs.h
d244553c
Add librt.vecs capsule dep
cd826512
Build librt.vecs
31032583
Add librt.vecs stub
6bc280b6
Modernize vecs stub
0575c8ee
Fix build
7e22214f
WIP initial vec[i64] run tests
8d0d770d
Fix tests
bc9da900
Improve some exception error messages
2114b6e4
Rename capsule to librt.vecs._C_API (add librt prefix)
f0030ebb
Update tests
3e2f0b4d
Rename test file
b14345b6
Update test
5bd85983
Fix reference counting and add error checks
27220dec
WIP tests for vec[t]
5db0e92f
Update
e5d11b6e
Fix spacing
065b1448
WIP fixing tests
59fdf8ce
Fix tests
ba069eec
Fix reference counting
bad2b11e
Minor refactoring
12ce9c50
Work around mypy bug
eccef8df
Improve error handling and add comments
66b8ef43
Reference counting fix + update comments
f4f5d496
Fixes to error handling for vec[i64] etc.
953d0add
Improve error handling for vec[t]
432a556d
Remove some TODO comments
e9675468
Improve nested vec error handling
d8b6a7ce
WIP nested vec interpreted tests
e3b156a9
Refactor test cases to not depend on unittest (still not passing)
ca208139
Fix pop ref counting
a4b39156
Fixes to reference counting
5bef5001
Reject Optional[i64] at runtime
30d9c14e
Fix some TODOs
a7bee4de
Improve exception error message
dfdf699d
More tests
2be33ad6
Add tests
abcfdcf5
Test more
ee458dc6
Add test
edf084e2
Minor updates
fa1bb340
Put behind MYPYC_EXPERIMENTAL #define
5f14fd4c
Refactor: VecProxy -> VecGenericAlias
23e31ab8
Remove TODO comment
491ca642
Refactor: rename VecGeneric -> Vec
3bed433d
Add comments
cc9841ac
Update docstrings
a99a1cbe
Refactor
cc0f7930
Refactor: change VecVec prefix in names to VecNested
d007176a
Refactor
17507d1d
Minor tweaks
61d6e146
Rename more
1cca0c66
Rename *Features to *API, also add missing name prefixes
dcd314f9
Add documentation in comments
a92651d0
Lint
8b3f8fff
Update comment
617ff8e5
Remove vec[t] and nested vec support temporarily
c8db19a1
Fix typos in comments
9cbf307f
Fix test on free threading build
a3761af8
Fix compile error on 32-bit windows
ef31b679
Add module docstring
710ecb36
Document macros in vec_template.c
80cefdd0
Fix bad tp_basicsize for buf objects on 32-bit platforms at least
f0a6a54c
Work around failing test on 32-bit platforms
0a920532
Work around issue with test stubs
32e12b26
p-sawicki
approved these changes
on 2026-01-27
JukkaL
merged
eabda0ee
into master 148 days ago
JukkaL
deleted the librt-vecs-extension branch 148 days ago
Assignees
No one assigned
Login to write a write a comment.
Login via GitHub