Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
b685c2c
Add initial C extension
JukkaL Apr 5, 2021
11188d8
Add empty vec class
JukkaL Apr 5, 2021
37857c9
Add dummy append function
JukkaL Apr 5, 2021
c49c019
Can construct empty vec
JukkaL Apr 5, 2021
0ee2a94
Implement vec operations (indexing, append, len)
JukkaL Apr 5, 2021
bc61aa6
Support setting vec item
JukkaL Apr 5, 2021
dbbb66e
Create basic capsule
JukkaL Apr 11, 2021
7d99cb5
Move some declarations to a header
JukkaL Apr 11, 2021
6828339
Tweak types
JukkaL Apr 11, 2021
a771ac0
Fix capsule storage
JukkaL Apr 11, 2021
152e66b
Minor refactoring
JukkaL Nov 15, 2021
8bf9875
More refactoring
JukkaL Nov 15, 2021
5503a7a
Move vec[i64] related stuff to a new file
JukkaL Nov 15, 2021
3ab5d01
Switch to vec[t]() for constructing an empty vec
JukkaL Nov 15, 2021
e213697
Update str() of type obj
JukkaL Nov 15, 2021
f62bf16
Update repr of vec[i64]
JukkaL Nov 15, 2021
75f8803
[WIP] Beginnings of support for vec[str]
JukkaL Nov 15, 2021
efe565c
Implement len() for vec[str]
JukkaL Nov 15, 2021
95ad1d5
Implement get item and append for vec[t]
JukkaL Nov 15, 2021
290534d
Improvements to vec[t] support
JukkaL Nov 15, 2021
80ea5fa
Improve runtime type checking
JukkaL Nov 17, 2021
073b0c3
Improve runtime error checking
JukkaL Nov 17, 2021
67d9dd7
Fix compiler warnings
JukkaL Nov 20, 2021
308a8e8
Don't respect __instancecheck__ and allow metaclasses
JukkaL Nov 20, 2021
f2190fe
Share vec item check code
JukkaL Nov 20, 2021
1b5cf18
Support vec[str | None] class proxy objects
JukkaL Nov 20, 2021
da92666
Start implementing real vec[t | None] support
JukkaL Nov 20, 2021
cb7a7ac
Support proxy types with nested vecs
JukkaL Nov 20, 2021
37fd0a6
Improvements to optional/nested vecs
JukkaL Nov 20, 2021
afc2dbd
Refactor
JukkaL Nov 20, 2021
d9733fa
Refactor
JukkaL Nov 20, 2021
45d1b1e
Add set item op
JukkaL Nov 20, 2021
b9bc3ec
Implement vec[i64](init)
JukkaL Nov 21, 2021
91fd2a2
Initialize vec[t] from iterable
JukkaL Nov 21, 2021
f5cd660
More initialization from iterable
JukkaL Nov 21, 2021
13c0dd7
Implement vec[i64] equality
JukkaL Nov 22, 2021
c8bea04
Implement == and != for vec[t]
JukkaL Nov 27, 2021
ff5a6a1
More __eq__ support
JukkaL Nov 27, 2021
ce0586d
Fix C style
JukkaL Nov 27, 2021
4b87612
Implement vec[i64] slicing
JukkaL Nov 27, 2021
ef5b658
Small style tweak
JukkaL Nov 27, 2021
3b3df1a
Implement vec[t] slicing
JukkaL Nov 27, 2021
b76d9a1
Implement remaining vec slicing
JukkaL Nov 27, 2021
a755479
Implement vec[i64].remove(x)
JukkaL Nov 27, 2021
11e3315
Implement vec[t].remove(x)
JukkaL Nov 27, 2021
ad3bb8f
Fix possible issue where vec being compared changes size
JukkaL Nov 27, 2021
a710282
Fix refcounting and gc issues
JukkaL Nov 27, 2021
4e59657
Finish up implementation of vec.remove
JukkaL Nov 27, 2021
639617f
Clean up dealloc code a bit
JukkaL Nov 27, 2021
e7246a0
Implement vec[i64].pop
JukkaL Nov 28, 2021
d9a270a
Implement vec[t].pop
JukkaL Nov 28, 2021
4a3ecfd
Finish implementation of pop
JukkaL Nov 28, 2021
9bd0028
Add VecObject struct
JukkaL Nov 28, 2021
78fbf95
Include vec[t] in capsule
JukkaL Nov 28, 2021
745613a
Include vec[t] ext in capsule
JukkaL Nov 28, 2021
f9e55eb
Minor tweak
JukkaL Dec 4, 2021
f9b731a
Add pop(index) to external API
JukkaL Dec 11, 2021
61036db
Add vec[i64] remove to API
JukkaL Dec 11, 2021
67dc4ec
Add remaining remove variants to external API
JukkaL Dec 11, 2021
7b30bc8
Add API function for vec slicing
JukkaL Dec 28, 2021
9264c89
[WIP] Move to new vec representation for vec[i64]
JukkaL Apr 10, 2023
86768bd
Include boxing op in the capsule (i64 only for now)
JukkaL Apr 10, 2023
dd11f84
Use NULL for empty buffer
JukkaL Apr 10, 2023
3f6d056
Partial implementation of vec[T] for type objects
JukkaL Apr 15, 2023
9daeac4
Implement vec[t] remove
JukkaL Apr 15, 2023
240a668
Implement vec[t] pop
JukkaL Apr 15, 2023
3164fd4
Work towards vec[t | None] support
JukkaL Apr 15, 2023
a50736c
Fix crash
JukkaL Apr 15, 2023
4c78b0c
Update header to use new repr for nested vecs
JukkaL Apr 15, 2023
6c76516
Work towards nested vecs (still not working!)
JukkaL Apr 15, 2023
1656992
Implement nested vec subscription + refactor
JukkaL Apr 16, 2023
e2b87aa
Implement more nested vec features
JukkaL Apr 16, 2023
9c46dd0
Minor refactoring
JukkaL Apr 16, 2023
823b868
Add nested vec item unboxing helper
JukkaL Apr 16, 2023
0ed3435
Implement nested vec conversion from iterable
JukkaL Apr 16, 2023
9e8c5ec
Implement low-level append for nested vecs
JukkaL Apr 16, 2023
cca673f
Implement nested vec assignment
JukkaL Apr 16, 2023
457794b
Comment out work-in-progress code (with missing implementations)
JukkaL Apr 16, 2023
eb2c4ae
Implement constructing empty nested vec
JukkaL Apr 16, 2023
936117f
Implement append for nested vecs
JukkaL Apr 16, 2023
8d192ae
Some fixes
JukkaL Apr 16, 2023
3d44226
Implement nested vec equality
JukkaL Apr 29, 2023
0a707d7
Support remove with nested vec
JukkaL Apr 29, 2023
7cd1ee9
Support pop() with nested vecs
JukkaL Apr 29, 2023
a615afe
Add vec[i64] unbox to public API
JukkaL May 1, 2023
29d7060
Make remove() a module-level function
JukkaL May 8, 2023
60fbfef
Make pop() a module-level function
JukkaL May 8, 2023
f8083d8
Refactoring
JukkaL May 8, 2023
21bebe3
Update native pop() implementation to return a tuple
JukkaL May 29, 2023
cae209c
Use tuple return type that is compatible with mypyc
JukkaL May 29, 2023
6f61090
Adjust borrowing/stealing a bit
JukkaL Jun 10, 2023
2b23f1b
Use magic constant for i64 etc. special item types in nested vecs
JukkaL Jun 10, 2023
6495613
Add missing unboxing C API functions (untested)
JukkaL Jun 11, 2023
1491729
Fix remove
JukkaL Jun 17, 2023
355326f
Fix remove
JukkaL Jun 17, 2023
a3b9da4
Fix slicing overflow checks
JukkaL Jul 8, 2023
1fae06d
Fix slicing
JukkaL Jul 8, 2023
c1ebbe9
Only the non-vec item type in a nested vec can be optional
JukkaL Aug 19, 2023
bdcd956
Allow empty vec[t] to have NULL buf
JukkaL Aug 19, 2023
e310bf8
Allow specifying capacity when allocating a vec
JukkaL Aug 19, 2023
49d06af
Fix segfault
JukkaL Aug 27, 2023
626aa6b
Change return type of nested vec pop
JukkaL Aug 28, 2023
727d6ce
Add conversion functions from VecbufTExtItem
JukkaL Aug 28, 2023
285823c
Fix segfault
JukkaL Sep 3, 2023
83b236e
Support negative vec indexing
JukkaL Sep 3, 2023
fb1879f
Support negative vec indexing in set item
JukkaL Sep 3, 2023
c3d39a2
Replace Vec_T -> VecT
JukkaL Dec 27, 2023
f5d96dd
Replace VecT_Ext -> VecVec
JukkaL Dec 27, 2023
bcba2da
Replace Vec_I64 -> VecI64
JukkaL Dec 27, 2023
5b4344b
More refactoring
JukkaL Dec 27, 2023
1b5f815
More renaming
JukkaL Dec 27, 2023
b01756c
More refactoring
JukkaL Dec 27, 2023
95c7b3a
More refactoring
JukkaL Dec 27, 2023
44b9afd
More refactoring
JukkaL Dec 27, 2023
228bcde
Refactor
JukkaL Dec 27, 2023
d83ca05
Refactor
JukkaL Dec 27, 2023
0eaf3d3
Refactor
JukkaL Dec 27, 2023
e2f521b
Refactor
JukkaL Dec 27, 2023
e91f13a
Refactor
JukkaL Dec 27, 2023
d313339
Rename file
JukkaL Dec 27, 2023
3caac00
Remove unused function VecVec_ItemCheck
JukkaL Dec 27, 2023
d97f7e1
Update comments
JukkaL Dec 27, 2023
40d79ce
Refactor
JukkaL Dec 27, 2023
7050fa5
WIP start working on vec item type specialization template
JukkaL Jan 1, 2024
947010b
Generalize parts of the template
JukkaL Jan 1, 2024
bde9dac
Generalize more
JukkaL Jan 1, 2024
3c2e1ad
Generalize more
JukkaL Jan 1, 2024
361d947
Generalize more
JukkaL Jan 1, 2024
f31c0b9
Do it properly
JukkaL Jan 1, 2024
d819722
Generalize more
JukkaL Jan 1, 2024
5e25e2d
Generalize more, including BOX_ITEM
JukkaL Jan 1, 2024
1381ae0
Generalize more
JukkaL Jan 1, 2024
a69a7ee
Generalize remaining
JukkaL Jan 1, 2024
436c4ed
Generalize more
JukkaL Jan 1, 2024
5ee4f4d
Implement vec[float]
JukkaL Jan 1, 2024
1abadd7
Refactor
JukkaL Jan 1, 2024
772681a
Refactor
JukkaL Jan 1, 2024
16539f1
Refactor
JukkaL Jan 1, 2024
b0385c4
Refactor
JukkaL Jan 1, 2024
f42fb5b
Implement vec[u8]
JukkaL Jan 1, 2024
adb5b07
Support vec[i32] and vec[i16]
JukkaL Jan 27, 2024
7c5aa3c
Add item overflow checks
JukkaL Jan 27, 2024
1dc7b4a
Support vec[bool]
JukkaL Jan 27, 2024
281ea02
Rename vecs.c to librt_vecs.c
JukkaL Jan 21, 2026
d244553
Rename vecs.h to librt_vecs.h
JukkaL Jan 21, 2026
cd82651
Add librt.vecs capsule dep
JukkaL Jan 21, 2026
3103258
Build librt.vecs
JukkaL Jan 21, 2026
6bc280b
Add librt.vecs stub
JukkaL Jan 21, 2026
0575c8e
Modernize vecs stub
JukkaL Jan 21, 2026
7e22214
Fix build
JukkaL Jan 21, 2026
8d0d770
WIP initial vec[i64] run tests
JukkaL Jan 21, 2026
bc9da90
Fix tests
JukkaL Jan 21, 2026
2114b6e
Improve some exception error messages
JukkaL Jan 21, 2026
f0030eb
Rename capsule to librt.vecs._C_API (add librt prefix)
JukkaL Jan 22, 2026
3e2f0b4
Update tests
JukkaL Jan 22, 2026
b14345b
Rename test file
JukkaL Jan 22, 2026
5bd8598
Update test
JukkaL Jan 22, 2026
27220de
Fix reference counting and add error checks
JukkaL Jan 22, 2026
5db0e92
WIP tests for vec[t]
JukkaL Jan 22, 2026
e5d11b6
Update
JukkaL Jan 22, 2026
065b144
Fix spacing
JukkaL Jan 22, 2026
59fdf8c
WIP fixing tests
JukkaL Jan 22, 2026
ba069ee
Fix tests
JukkaL Jan 22, 2026
bad2b11
Fix reference counting
JukkaL Jan 22, 2026
12ce9c5
Minor refactoring
JukkaL Jan 22, 2026
eccef8d
Work around mypy bug
JukkaL Jan 22, 2026
66b8ef4
Improve error handling and add comments
JukkaL Jan 22, 2026
f4f5d49
Reference counting fix + update comments
JukkaL Jan 23, 2026
953d0ad
Fixes to error handling for vec[i64] etc.
JukkaL Jan 23, 2026
432a556
Improve error handling for vec[t]
JukkaL Jan 23, 2026
e967546
Remove some TODO comments
JukkaL Jan 23, 2026
d8b6a7c
Improve nested vec error handling
JukkaL Jan 23, 2026
e3b156a
WIP nested vec interpreted tests
JukkaL Jan 23, 2026
ca20813
Refactor test cases to not depend on unittest (still not passing)
JukkaL Jan 23, 2026
a4b3915
Fix pop ref counting
JukkaL Jan 23, 2026
5bef500
Fixes to reference counting
JukkaL Jan 23, 2026
30d9c14
Reject Optional[i64] at runtime
JukkaL Jan 23, 2026
a7bee4d
Fix some TODOs
JukkaL Jan 23, 2026
dfdf699
Improve exception error message
JukkaL Jan 23, 2026
2be33ad
More tests
JukkaL Jan 23, 2026
abcfdcf
Add tests
JukkaL Jan 23, 2026
ee458dc
Test more
JukkaL Jan 23, 2026
edf084e
Add test
JukkaL Jan 23, 2026
fa1bb34
Minor updates
JukkaL Jan 23, 2026
5f14fd4
Put behind MYPYC_EXPERIMENTAL #define
JukkaL Jan 23, 2026
23e31ab
Refactor: VecProxy -> VecGenericAlias
JukkaL Jan 26, 2026
491ca64
Remove TODO comment
JukkaL Jan 26, 2026
3bed433
Refactor: rename VecGeneric -> Vec
JukkaL Jan 26, 2026
cc9841a
Add comments
JukkaL Jan 26, 2026
a99a1cb
Update docstrings
JukkaL Jan 26, 2026
cc0f793
Refactor
JukkaL Jan 26, 2026
d007176
Refactor: change VecVec prefix in names to VecNested
JukkaL Jan 26, 2026
17507d1
Refactor
JukkaL Jan 26, 2026
61d6e14
Minor tweaks
JukkaL Jan 26, 2026
1cca0c6
Rename more
JukkaL Jan 26, 2026
dcd314f
Rename *Features to *API, also add missing name prefixes
JukkaL Jan 26, 2026
a92651d
Add documentation in comments
JukkaL Jan 26, 2026
8b3f8ff
Lint
JukkaL Jan 27, 2026
617ff8e
Update comment
JukkaL Jan 27, 2026
c8db19a
Remove vec[t] and nested vec support temporarily
JukkaL Jan 27, 2026
9cbf307
Fix typos in comments
JukkaL Jan 27, 2026
a3761af
Fix test on free threading build
JukkaL Jan 27, 2026
ef31b67
Fix compile error on 32-bit windows
JukkaL Jan 27, 2026
710ecb3
Add module docstring
JukkaL Jan 27, 2026
80cefdd
Document macros in vec_template.c
JukkaL Jan 27, 2026
f0a6a54
Fix bad tp_basicsize for buf objects on 32-bit platforms at least
JukkaL Jan 27, 2026
0a92053
Work around failing test on 32-bit platforms
JukkaL Jan 27, 2026
32e12b2
Work around issue with test stubs
JukkaL Jan 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions mypy/typeshed/stubs/librt/librt/vecs.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from typing import TypeVar, Generic, Iterable, Iterator, overload
from mypy_extensions import i64

T = TypeVar("T")

class vec(Generic[T]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, items: Iterable[T], /) -> None: ...
def __len__(self) -> i64: ...
@overload
def __getitem__(self, i: i64, /) -> T: ...
@overload
def __getitem__(self, i: slice, /) -> vec[T]: ...
def __setitem__(self, i: i64, o: T, /) -> None: ...
def __iter__(self) -> Iterator[T]: ...

def append(v: vec[T], o: T, /) -> vec[T]: ...
def remove(v: vec[T], o: T, /) -> vec[T]: ...
def pop(v: vec[T], i: i64 = -1, /) -> tuple[vec[T], T]: ...
14 changes: 14 additions & 0 deletions mypyc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,20 @@ class ModDesc(NamedTuple):
],
["base64"],
),
ModDesc(
"librt.vecs",
[
"vecs/librt_vecs.c",
"vecs/vec_i64.c",
"vecs/vec_i32.c",
"vecs/vec_i16.c",
"vecs/vec_u8.c",
"vecs/vec_float.c",
"vecs/vec_bool.c",
],
["vecs/librt_vecs.h", "vecs/vec_template.c"],
["vecs"],
),
]

try:
Expand Down
1 change: 1 addition & 0 deletions mypyc/ir/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def get_header(self) -> str:

LIBRT_STRINGS: Final = Capsule("librt.strings")
LIBRT_BASE64: Final = Capsule("librt.base64")
LIBRT_VECS: Final = Capsule("librt.vecs")

BYTES_EXTRA_OPS: Final = SourceDep("bytes_extra_ops.c")
BYTES_WRITER_EXTRA_OPS: Final = SourceDep("byteswriter_extra_ops.c")
Expand Down
14 changes: 14 additions & 0 deletions mypyc/lib-rt/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,19 @@ def run(self) -> None:
include_dirs=[".", "base64"],
extra_compile_args=cflags,
),
Extension(
"librt.vecs",
[
"vecs/librt_vecs.c",
"vecs/vec_i64.c",
"vecs/vec_i32.c",
"vecs/vec_i16.c",
"vecs/vec_u8.c",
"vecs/vec_float.c",
"vecs/vec_bool.c",
],
include_dirs=[".", "vecs"],
extra_compile_args=cflags,
),
]
)
Loading