E TypeError: code expected at least 16 arguments, got 14
Categories
(Firefox Build System :: General, defect)
Tracking
(firefox-esr115 fixed, firefox116 fixed)
People
(Reporter: glandium, Assigned: glandium)
References
Details
Attachments
(2 files)
Running python/mozbuild/mozbuild/test/configure/test_lint.py locally fails with python 3.11 with e.g.:
0:01.17 ________________________ TestLint.test_default_disable _________________________
0:01.17 python/mozbuild/mozbuild/test/configure/test_lint.py:346: in test_default_disable
0:01.17 self.lint_test()
0:01.17 python/mozbuild/mozbuild/test/configure/test_lint.py:26: in lint_test
0:01.17 sandbox.run(mozpath.join(test_data_path, "moz.configure"))
0:01.17 python/mozbuild/mozbuild/configure/lint.py:44: in run
0:01.17 self.include_file(path)
0:01.17 python/mozbuild/mozbuild/configure/__init__.py:495: in include_file
0:01.17 exec_(code, self)
0:01.17 python/mozbuild/mozbuild/util.py:56: in exec_
0:01.17 exec(object, globals, locals)
0:01.17 python/mozbuild/mozbuild/test/configure/data/moz.configure:2: in <module>
0:01.17 ???
0:01.17 python/mozbuild/mozbuild/configure/lint.py:214: in option_impl
0:01.17 self._check_option(result, *args, **kwargs)
0:01.17 python/mozbuild/mozbuild/configure/lint.py:224: in _check_option
0:01.17 self._check_prefix_for_bool_option(*args, **kwargs)
0:01.17 python/mozbuild/mozbuild/configure/lint.py:259: in _check_prefix_for_bool_option
0:01.17 self._raise_from(e, frame.f_back if frame else None)
0:01.17 python/mozbuild/mozbuild/configure/lint.py:113: in _raise_from
0:01.17 code = types.CodeType(*codetype_args)
0:01.17 E TypeError: code expected at least 16 arguments, got 14
Assignee | ||
Comment 1•2 years ago
|
||
Past that error, we also hit:
0:02.32 During handling of the above exception, another exception occurred:
0:02.32 python/mozbuild/mozbuild/test/configure/test_lint.py:340: in test_default_disable
0:02.32 with self.assertRaisesFromLine(ConfigureError, 2) as e:
0:02.32 /usr/lib/python3.11/contextlib.py:155: in __exit__
0:02.32 self.gen.throw(typ, value, traceback)
0:02.32 python/mozbuild/mozbuild/test/configure/test_lint.py:40: in assertRaisesFromLine
0:02.32 traceback.extract_tb(tb)[-1][:2],
0:02.32 E IndexError: list index out of range
Assignee | ||
Comment 2•2 years ago
|
||
Python 3.10 added some more arguments to the CodeTypes constructor. It
also changed co_lnotab to co_linetables.
We were using co_lnotab to simulate a function with a def at a specific
line and a raise at a specific other line. I'm not sure how I ended up
with this particular requirement (this may have been related to python 2
still being used back then), but as of now, it doesn't seem we need the
def to be at a specific location, so we can avoid needing to generate
a co_linetables/co_lnotab, relying instead on the raise expression being
on the co_firstlineno+1 in the thrower function.
As for the extra arguments, it turns out python 3.8 also introduced a
CodeType.replace method that can be used to derive a CodeType object
from another, which is certainly simpler than calling its construtor
with the right set of arguments.
Assignee | ||
Comment 3•2 years ago
|
||
In python 3.11 (maybe also 3.10, I haven't tested that version ; 3.9 was
definitely different), by the time the context manager comes back in our
assertRaisesFromLine, the traceback is not available anymore (or yet,
I'm not entirely sure which way it does) to inspect and check the line
numbers we want to check.
And while assertRaises exposes the thrown exception in its exception
attribute, it also resets the traceback associated with it, so we can't
find it there either.
So instead, we implement our own context manager for
assertRaisesFromLine such that we can access that traceback.
Comment 5•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ff226d67527a
https://hg.mozilla.org/mozilla-central/rev/9ca24dcf06d7
Updated•1 year ago
|
Comment hidden (Intermittent Failures Robot) |
Description
•