New submission from Paul Prescod <pres...@gmail.com>:

from importlib import util

mathmodule = util.find_spec("math")
math1 = util.module_from_spec(mathmodule)
print(math1.pi)

=====

$ python3.8 /tmp/foo.py 
3.141592653589793

$ python3.9 /tmp/foo.py 
Traceback (most recent call last):
  File "/tmp/foo.py", line 5, in <module>
    print(math1.pi)
AttributeError: module 'math' has no attribute 'pi'

----------
components: Extension Modules
files: foo.py
messages: 395583
nosy: prescod2
priority: normal
severity: normal
status: open
title: importlib and math.pi interact strangely
versions: Python 3.10, Python 3.11
Added file: https://bugs.python.org/file50101/foo.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44386>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to