-
Notifications
You must be signed in to change notification settings - Fork 135
Closed
Description
The pycountry
package exposes a list of all countries as an pycountry.ExistingCountries
which implements __iter__
and __len__
. The following TruffleSqueak screenshot demonstrates that pycountry.countries
appears correctly as an array-like object. However, it is not possible to access its values through the interop API. Either, iterables should not be exposed like this, or InteropLibrary#readArrayElement
is not allowed to fail.
TruffleSqueak screenshot
Python workspace
import pycountry
pycountry.countries => ForeignObject[arraySize=249,memberSize=41]
str(type(pycountry.countries)) => '<class ''pycountry.ExistingCountries''>'
pycountry.countries[1] => `Error: TypeError: 'ExistingCountries' object is not subscriptable` (this is expected)
list(pycountry.countries)[1] => ForeignObject[memberSize=26]
Smalltalk workspace
(Polyglot eval: 'python' string: 'pycountry.countries') => ForeignObject[arraySize=249,memberSize=41]
(Polyglot eval: 'python' string: 'pycountry.countries') at: 1
/cc @timfel
Metadata
Metadata
Assignees
Labels
No labels