RESOLVED FIXED249564
KeyError: '__spec__' in apipkg.py with Python v3.11
https://bugs.webkit.org/show_bug.cgi?id=249564
Summary KeyError: '__spec__' in apipkg.py with Python v3.11
Fujii Hironori
Reported 2022-12-18 17:07:13 PST
WinCairo-64-bit-Debug-Tests is reporting test-webkitpy failure. https://build.webkit.org/#/builders/727/builds/59 This is reproduce on my PC with Python v3.11. Downloading py-1.5.2... Installing py-1.5.2... Installed py-1.5.2! Checking imports ...Traceback (most recent call last): File "C:\home\webkit\gc\Tools\Scripts\libraries\autoinstalled\python-3-AMD64\py\_vendored_packages\apipkg.py", line 141, in __makeattr modpath, attrname = self.__map__[name] ~~~~~~~~~~~~^^^^^^ KeyError: '__spec__' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\home\webkit\gc\Tools\Scripts\webkitpy\test\main.py", line 366, in <module> sys.exit(main()) ^^^^^^ File "C:\home\webkit\gc\Tools\Scripts\webkitpy\test\main.py", line 115, in main return not tester.run() ^^^^^^^^^^^^ File "C:\home\webkit\gc\Tools\Scripts\webkitpy\test\main.py", line 188, in run return self._run_tests(names) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\home\webkit\gc\Tools\Scripts\webkitpy\test\main.py", line 217, in _run_tests if not self._check_imports(names): ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\home\webkit\gc\Tools\Scripts\webkitpy\test\main.py", line 300, in _check_imports __import__(name) File "C:\home\webkit\gc\Tools\Scripts\webkitpy\common\config\committers_unittest.py", line 31, in <module> from webkitpy.test.markers import xfail File "C:\home\webkit\gc\Tools\Scripts\webkitpy\test\markers.py", line 26, in <module> import pytest File "C:\home\webkit\gc\Tools\Scripts\libraries\autoinstalled\python-3-AMD64\pytest\__init__.py", line 5, in <module> from _pytest.assertion import register_assert_rewrite File "C:\home\webkit\gc\Tools\Scripts\libraries\autoinstalled\python-3-AMD64\_pytest\assertion\__init__.py", line 9, in <module> from _pytest.assertion import rewrite File "C:\home\webkit\gc\Tools\Scripts\libraries\autoinstalled\python-3-AMD64\_pytest\assertion\rewrite.py", line 34, in <module> from _pytest.assertion import util File "C:\home\webkit\gc\Tools\Scripts\libraries\autoinstalled\python-3-AMD64\_pytest\assertion\util.py", line 13, in <module> import _pytest._code File "C:\home\webkit\gc\Tools\Scripts\libraries\autoinstalled\python-3-AMD64\_pytest\_code\__init__.py", line 2, in <module> from .code import Code File "C:\home\webkit\gc\Tools\Scripts\libraries\autoinstalled\python-3-AMD64\_pytest\_code\code.py", line 54, in <module> class Code: File "C:\home\webkit\gc\Tools\Scripts\libraries\autoinstalled\python-3-AMD64\_pytest\_code\code.py", line 81, in Code def path(self) -> Union[py.path.local, str]: ^^^^^^^^^^^^^ File "C:\home\webkit\gc\Tools\Scripts\libraries\autoinstalled\python-3-AMD64\py\_vendored_packages\apipkg.py", line 148, in __makeattr result = importobj(modpath, attrname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\home\webkit\gc\Tools\Scripts\libraries\autoinstalled\python-3-AMD64\py\_vendored_packages\apipkg.py", line 69, in importobj module = __import__(modpath, None, None, ['__doc__']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1178, in _find_and_load File "<frozen importlib._bootstrap>", line 1138, in _find_and_load_unlocked File "C:\home\webkit\gc\Tools\Scripts\libraries\autoinstalled\python-3-AMD64\py\_vendored_packages\apipkg.py", line 146, in __makeattr raise AttributeError(name) AttributeError: __spec__
Attachments
Patch (2.44 KB, patch)
2022-12-19 12:38 PST, Fujii Hironori
no flags
Patch (2.73 KB, patch)
2022-12-19 13:00 PST, Fujii Hironori
no flags
Fujii Hironori
Comment 1 2022-12-18 17:34:57 PST
This problem was fixed by upstream. AttributeError __spec__ on Python 3.11 · Issue #273 · pytest-dev/py https://github.com/pytest-dev/py/issues/273 I tryed py 1.11.0. https://pypi.org/project/py/1.11.0/ diff --git a/Tools/Scripts/webkitpy/__init__.py b/Tools/Scripts/webkitpy/__init__.py index 7cc6593c1ef8..babfc798fdac 100644 --- a/Tools/Scripts/webkitpy/__init__.py +++ b/Tools/Scripts/webkitpy/__init__.py @@ -69,7 +69,7 @@ AutoInstall.register(Package('mozprocess', Version(1, 3, 0))) AutoInstall.register(Package('mozlog', Version(7, 1, 0), wheel=True)) AutoInstall.register(Package('mozterm', Version(1, 0, 0))) AutoInstall.register(Package('pluggy', Version(0, 13, 1))) -AutoInstall.register(Package('py', Version(1, 5, 2))) +AutoInstall.register(Package('py', Version(1, 11, 0))) AutoInstall.register(Package('pycodestyle', Version(2, 5, 0))) AutoInstall.register(Package('pyfakefs', Version(3, 7, 2))) AutoInstall.register(Package('scandir', Version(1, 10, 0))) Then, all tests failed: > [727/1813] webkitpy.layout_tests.run_webkit_tests_integrationtest.RunTest.test_output_diffs.test_output_diffs erred: > AttributeError: 'function' object has no attribute 'test_output_diffs' > > [728/1813] webkitpy.layout_tests.run_webkit_tests_integrationtest.RunTest.test_pixel_test_directories.test_pixel_test_directories erred: > AttributeError: 'function' object has no attribute 'test_pixel_test_directories'
Fujii Hironori
Comment 2 2022-12-18 21:12:01 PST
(In reply to Fujii Hironori from comment #1) > Then, all tests failed: Created another bug: Bug 249568 – Use unittest.TestCase.id() to get the test name instead of regexp matching
Fujii Hironori
Comment 3 2022-12-19 12:38:54 PST
Fujii Hironori
Comment 4 2022-12-19 13:00:03 PST
Fujii Hironori
Comment 5 2022-12-20 14:01:26 PST
Comment on attachment 464107 [details] Patch Thank you for the review.
EWS
Comment 6 2022-12-20 15:10:56 PST
Committed 258166@main (7177e82d539f): <https://commits.webkit.org/258166@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 464107 [details].
Radar WebKit Bug Importer
Comment 7 2022-12-20 15:11:19 PST
Note You need to log in before you can comment on or make changes to this bug.