[RELEASE] Python 3.12.0 beta 1 released.

Robin Becker robin at reportlab.com
Thu May 25 07:23:15 EDT 2023


On 22/05/2023 22:04, Thomas Wouters wrote:
 > I'm pleased to announce the release of Python 3.12 beta 1 (and feature
 > freeze for Python 3.12).
 >
.......
I see a major difference between 3.12.0a7 and 3.12.0b1

Basically in preppy an importer is defined to handle imports of '.prep' files.

This worked as expected in the a7 version and fails in the b1. I put in some prints in the code and I see these calls 
for the a7 run> $ ~/LOCAL/3.12.0a7/bin/python3 test_import.py
 > sys.meta_path.insert(<preppy.installImporter.<locals>.PreppyImporter object at 0x7fa870b84080>) --> 
[<preppy.installImporter.<locals>.PreppyImporter object at 0x7fa870b84080>, <_distutils_hack.DistutilsMetaFinder object 
at 0x7fa871290fb0>, <class '_frozen_importlib.BuiltinImporter'>, <class '_frozen_importlib.FrozenImporter'>, <class 
'_frozen_importlib_external.PathFinder'>]
 > PreppyImporter.find_module('sample001',None)
 > PreppyImporter.load_module('sample001')
 > 4
 > .
 > ----------------------------------------------------------------------
 > Ran 1 test in 0.004s
 >
 > OK

In 3.12.0b1 although the importer is inserted into sys.meta_path the find_module/load_module methods are never called.
and the import fails.

So is this an expected change in the way importers behave or a bug?

 > $ ~/LOCAL/3.12.0b1/bin/python3 test_import.py
 > sys.meta_path.insert(<preppy.installImporter.<locals>.PreppyImporter object at 0x7fc866ecb110>) --> 
[<preppy.installImporter.<locals>.PreppyImporter object at 0x7fc866ecb110>, <class '_frozen_importlib.BuiltinImporter'>, 
<class '_frozen_importlib.FrozenImporter'>, <class '_frozen_importlib_external.PathFinder'>]
 > E
 > ======================================================================
 > ERROR: testImport1 (__main__.ImportTestCase.testImport1)
 > ----------------------------------------------------------------------
 > Traceback (most recent call last):
 >   File "/home/robin/devel/reportlab/REPOS/preppy/tmp/test_import.py", line 13, in testImport1
 >     import sample001
 > ModuleNotFoundError: No module named 'sample001'
 >
 > ----------------------------------------------------------------------
 > Ran 1 test in 0.001s
 >
 > FAILED (errors=1)

..........
 > Your release team,
 > Thomas Wouters
 > Ned Deily
 > Steve Dower




More information about the Python-list mailing list