Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mypyc] Implement str-to-float primitive #9685

Merged
merged 5 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
str-to-float primitive
  • Loading branch information
TH3CHARLie committed Nov 1, 2020
commit b663b434de7eaf8cdc1d24f7e212dbb889e2015b
17 changes: 17 additions & 0 deletions mypyc/primitives/float_ops.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Primitive float ops."""

from mypyc.ir.ops import ERR_MAGIC
from mypyc.ir.rtypes import (
str_rprimitive, float_rprimitive
)
from mypyc.primitives.registry import (
c_function_op
)

# float(str)
c_function_op(
name='builtins.float',
arg_types=[str_rprimitive],
return_type=float_rprimitive,
c_function_name='PyFloat_FromString',
error_kind=ERR_MAGIC)
1 change: 1 addition & 0 deletions mypyc/primitives/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,4 @@ def load_address_op(name: str,
import mypyc.primitives.dict_ops # noqa
import mypyc.primitives.tuple_ops # noqa
import mypyc.primitives.misc_ops # noqa
import mypyc.primitives.float_ops # noqa