[New-bugs-announce] [issue44386] importlib and math.pi interact strangely

Paul Prescod report at bugs.python.org
Thu Jun 10 18:45:59 EDT 2021


New submission from Paul Prescod <prescod at 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 <report at bugs.python.org>
<https://bugs.python.org/issue44386>
_______________________________________


More information about the New-bugs-announce mailing list