Lexer gives quoted identifiers an `end` that is the token length, not its end offset

Abierto
#380 0 comentarios 0 reacciones 0 asignados Ver en GitHub

@chiliec ya está trabajando en esto.

Desde el 12/10/2026.

  • #382 de @chiliec — abierto
  • #393 de @ApparentlyTejas — abierto

Evaluación

Dificultad
1/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
20/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
python
Área
backend

Línea de trabajo

Read jmespath/lexer.py around line 185 and inspect _consume_quoted_identifier; the issue includes a reproducing expression and the incorrect token fields. Check the existing lexer tests for position assertions, then verify the quoted identifier's end is its end offset in foo."q".

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

While testing an experimental version of Perch, we found the following and figured it was worth a report.

_consume_quoted_identifier sets the token's end to the token's length instead of start + length, so it's wrong whenever the identifier isn't at the start of the expression:

>>> from jmespath.lexer import Lexer
>>> [t for t in Lexer().tokenize('foo."q"') if t['type'] == 'quoted_identifier']
[{'type': 'quoted_identifier', 'value': 'q', 'start': 4, 'end': 2}]

end is 2, which is before start. Every other token type uses start + len(...). Search results aren't affected; only the position information is wrong.

It's at jmespath/lexer.py:185:

return {'type': 'quoted_identifier', 'value': loads(lexeme),
        'start': start, 'end': token_len}

'end': start + token_len would fix it. The lexer rewrite in #362 keeps the same line.

Tested on develop (2812594), Python 3.14.6, macOS 26.2.

Lenguaje dominante
Python
Estrellas
2.5k
Forks
231
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de jmespath/jmespath.py

Todos los issues de jmespath/jmespath.py

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.