← index #4923Issue #3886
Related · high · value 1.233
QUERY · ISSUE

BUG: sys.modules['sys'] not pointing __import__('sys')

openby pmp-popened 2019-07-16updated 2019-07-16

Probably the same reason as :
https://github.com/micropython/micropython/issues/4427

CANDIDATE · ISSUE

python3 compat: modules don't support hashing as dict keys

closedby pmp-popened 2018-06-21updated 2018-06-21

hi, expecting :

Python 3.7.0rc1 (default, Jun 18 2018, 19:28:58) 
[GCC 4.8.5] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> m='os'
>>> m = sys.modules[m] = __import__(m)
>>> m
<module 'os' from '/usr/local/lib/python3.7/os.py'>

got:

MicroPython v1.9.4-114-g309fe39-dirty on 2018-06-20; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import sys
>>> m='os'
>>> m = sys.modules[m] = __import__(m)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported type for __hash__: 'module'

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied