Assertion failure at Python/instruction_sequence.c:121: `int _PyInstructionSequence_Addop(instr_sequence *, int, int, location): Assertion 'OPCODE_HAS_ARG(opcode) || HAS_TARGET(opcode) || oparg == 0' failed`
Aberta
Ninguém assumiu esta issue ainda.
interpreter-core
tests
type-crash
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
Crash report
What happened?
import unittest
from test.support.bytecode_helper import CodegenTestCase
class IsolatedCodeGenTests(CodegenTestCase):
def assertInstructionsMatch_recursive(self, insts, expected_insts):
self.assertInstructionsMatch(insts, expected_insts)
def codegen_test(self, snippet, expected_insts):
import ast
a = ast.parse(snippet, 'my_file.py', 'exec')
insts = self.generate_code(a)
self.assertInstructionsMatch_recursive(insts, expected_insts)
def test_if_expression(self):
snippet = '42 if True else 24'
expected = [('RESUME', 0, 0), ('ANNOTATIONS_PLACEHOLDER', None), ('LOAD_CONST', 0, 1), ('TO_BOOL', 256, 1), ('POP_JUMP_IF_FALSE', (false_lbl := 1), 1), ('LOAD_CONST', 1, 1), ('\x00', (exit_lbl := self.Label())), false_lbl, ('', 255, 1), exit_lbl, ('POP_TOP', None), ('LOAD_CONST', 1), ('RETURN_VALUE', None)]
self.codegen_test(snippet, expected)
if __name__ == "__main__":
unittest.main(verbosity=0)
python: ../Python/instruction_sequence.c:121: int _PyInstructionSequence_Addop(instr_sequence *, int, int, location): Assertion `OPCODE_HAS_ARG(opcode) || HAS_TARGET(opcode) || oparg == 0' failed.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
No response
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece pela assertion em Python/instruction_sequence.c:121 e reproduza-a usando o snippet fornecido de IsolatedCodeGenTests por meio de CodegenTestCase.generate_code(). Rastreie as instruções geradas para a expressão condicional e determine por que a assertion é atingida com o opcode e o argumento reportados. O trabalho estará concluído quando o reproducer não abortar mais e um teste de regressão cobrir o caso.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- compilers
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 30/100