New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code objects with non-equal co_linetables compare equal
#95150
Comments
|
Simpler reproduction: [k.lower() for k in "a"], [k.lower() for k in [1]]Traceback (most recent call last):
File "...", line 1, in <module>
[k.lower() for k in "a"], [k.lower() for k in [1]]
^^^^^^^^^^^^^^^^^^^^^^^^
File "...", line 1, in <listcomp>
[k.lower() for k in "a"], [k.lower() for k in [1]]
^^^^^^^^^
AttributeError: 'int' object has no attribute 'lower' |
|
Ooh, nice find! The code objects are being "deduplicated" in the compiler, even though they have different column positions. >>> def f():
... (a for b in c), (a for b in d)
...
>>> f.__code__.co_consts
(None, <code object <genexpr> at 0x7fa4fbf92640, file "<stdin>", line 2>)We need to consider the entire positions table when comparing code objects for equality. |
co_linetables compare equal
|
@markshannon: we should add Probably |
…d equality (pythonGH-95509) (cherry picked from commit c7e5bba) Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Bug report
output:
The error should be reported at line 3 and not at line 2, because the integer is passed to
bYour environment
The text was updated successfully, but these errors were encountered: