Skip to content

[mypyc] Add codegen support and compiled run tests for vecs#20737

Merged
JukkaL merged 13 commits intomasterfrom
mypyc-vec-3
Feb 5, 2026
Merged

[mypyc] Add codegen support and compiled run tests for vecs#20737
JukkaL merged 13 commits intomasterfrom
mypyc-vec-3

Conversation

@JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Feb 4, 2026

Now vecs work efficiently in compiled code (when experimental features are enabled).

This is the last big PR from my old vec branch. The following PRs will be more incremental.

Follow-up to #20732.

Related issue: mypyc/mypyc#840

if any(LIBRT_TIME in mod.dependencies for mod in self.modules.values()):
ext_declarations.emit_line("#include <time/librt_time.h>")
if any(LIBRT_VECS in mod.dependencies for mod in self.modules.values()):
ext_declarations.emit_line('#include "vecs/librt_vecs.h"')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ext_declarations.emit_line('#include "vecs/librt_vecs.h"')
ext_declarations.emit_line('#include <vecs/librt_vecs.h>')

for consistency

Comment on lines +170 to +177
if int() + 1:
assert x is not None
assert len(x) == 1
assert x[0] == 5
if int() + 2:
assert isinstance(x, vec)
assert len(x) == 1
assert x[0] == 5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the if statements seem strange, what's the reason?

Comment on lines 229 to 232
vv, x = pop(v)
assert vv == vec[vec[float]]()
assert x == vec[float]([1.5])
v[0] = vec[float]([-2.5])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't v[0] out of bounds?

assert v2 == vec[str](["5"])

o3: Any = vec[str]()
# TODO: Use str | None instead union
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outdated?

@JukkaL JukkaL merged commit 87f98db into master Feb 5, 2026
16 checks passed
@JukkaL JukkaL deleted the mypyc-vec-3 branch February 5, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants