Skip to content

"TypeError: an integer is required" when calling function returning double #26

Closed

Description

@belm0

seen as of cinder 5bd8c57 (and it occurs prior to that commit)

from __static__ import double

def test() -> double:
    return double(.5)

test()
$ python -m compiler --static foo.py
TypeError: an integer is required

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.8/compiler/__main__.py", line 111, in <module>
    exec(codeobj)
  File "/.../foo.py", line 6, in __main__
    test()
SystemError: PyEval_EvalFrameEx returned a result with an error set

(Same error even when test() is not called from module scope.)

Activity

  1. added
    sp-correctness
    staticpython
    on Jun 9, 2021
  2. czardoz commented on Jun 9, 2021

    @czardoz
    Contributor

    Ah right, returning primitive doubles is not yet supported. I'll make this a compiler reported error, so we don't crash.

  3. belm0 commented on Jun 9, 2021

    @belm0
    ContributorAuthor

    Our application is heavily numeric, so returning primitive doubles will be key to getting performance out of static modules 🙏

  4. czardoz commented on Aug 2, 2021

    @czardoz
    Contributor

    @belm0 This should be fixed since f244f2c

    Can you try it out and let me know if you still see an issue? :)

  5. czardoz commented on Aug 2, 2021

    @czardoz
    Contributor

    Closing for now, will re-open if necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    sp-correctnessstaticpython

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions