Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.
This repository has been archived by the owner on May 31, 2020. It is now read-only.

import statement throws internal java.lang.ClassCastException #906

Open
@patiences

Description

from math import sqrt

sqrt(4)

throws this error:

java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at python.testdaemon.TestDaemon.main(TestDaemon.java:65)
Caused by: java.lang.ClassCastException: org.python.java.Module cannot be cast to org.python.Callable
	at python.test.module$import(test.py:3)
	at python.test.main(test.py)
	... 5 more

FAIL

You don't get this error if the program was instead:

from math import * 

sqrt(4)

Then you get a NameError.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions