mypy
[mypyc] Add experimental C extension librt.vecs (part 1/2)
#20653
Merged

[mypyc] Add experimental C extension librt.vecs (part 1/2) #20653

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

Login to write a write a comment.

Login via GitHub

Reviewers
Assignees
No one assigned
Labels
Milestone