Boolean list elements are encoded as True/False instead of true/false
Los mantenedores suelen responder en 1 día
@inchang-ing ya está trabajando en esto.
Desde el 20/10/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza en stripe/_encode.py, en _api_encode(), y compara la rama de listas/tuplas con el tratamiento de Boolean para valores independientes y valores de diccionarios anidados. Después, ejecuta las pruebas de codificación que cubren _api_encode() y añade un caso para elementos Boolean en una lista. La tarea está terminada cuando los valores del array codificado son true y false en minúsculas, de forma coherente con las demás posiciones.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
Description
stripe._encode._api_encode() serializes Boolean values inconsistently depending on their position in the request parameters.
Top-level and nested-dictionary Booleans become lowercase true / false, but Booleans directly inside lists remain Python True / False when URL-encoded.
Minimal reproduction
from urllib.parse import urlencode
from stripe._encode import _api_encode
cases = {
"standalone": {"enabled": True},
"array": {"enabled": [True, False]},
"nested": {"enabled": {"flag": True}},
}
for name, params in cases.items():
print(name, urlencode(list(_api_encode(params))))
Actual behavior
standalone enabled=true
array enabled%5B0%5D=True&enabled%5B1%5D=False
nested enabled%5Bflag%5D=true
Expected behavior
Boolean array elements should be serialized consistently as lowercase true and false.
Root cause
The list/tuple branch of _api_encode() yields scalar array elements directly without applying the Boolean conversion used elsewhere.
Source:
https://github.com/stripe/stripe-python/blob/master/stripe/_encode.py
Existing tests cover top-level Boolean values and lists separately, but not Booleans directly inside lists.
Verification
Reproduced locally using the current upstream _api_encode() implementation in an isolated Python harness.
No live Stripe API request was made, and the full installed SDK test suite was not executed. The potential impact on specific API endpoints has not yet been established.
To Reproduce
- Use the current "stripe-python" "_api_encode()" implementation.
- Run the Python example provided in the Minimal reproduction section above. No Stripe API key or network access is required.
- Compare the URL-encoded output for standalone, nested, and array Boolean values.
- Observe that standalone and nested Booleans become lowercase "true" / "false", while array elements become uppercase "True" / "False".
- Expected: All Boolean values should use consistent lowercase encoding regardless of nesting.
Expected behavior
Boolean values should be consistently serialized as lowercase "true" and "false", regardless of whether they appear as standalone values, nested dictionary fields, or array elements.
For example:
enabled%5B0%5D=true&enabled%5B1%5D=false
Instead of:
enabled%5B0%5D=True&enabled%5B1%5D=False
The encoded representation should not depend on the nesting structure.
Code snippets
OS
ubuntu
Language version
Python 3.13
Library version
Development branch (master); isolated source reproduction, no installed SDK
API version
N/A — no Stripe API request performed
Additional context
No response
- Lenguaje dominante
- Python
- Estrellas
- 2.1k
- Forks
- 539
- Merge medio
- 3 d 5 h
- PR fusionados (30 d)
- 17
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de stripe/stripe-python
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
stripe/stripe-python#1948 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
stripe/stripe-python#1936 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
feature-request future
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
stripe/stripe-python#1941 · 6 comentarios ·
Los mantenedores suelen responder en 1 día
-
Add support for HTTPX2Abiertofeature-request future
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
stripe/stripe-python#1886 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
feature-request
Dificultad 2/5 1-3 horas Aptitud para principiantes 54/100
stripe/stripe-python#1841 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de stripe/stripe-python
Issues similares
-
Validate non-divisible effective batch sizes in the Unsloth LoRA backendPosiblemente ocupada @debesh-biswas la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
`rx.Model` event arguments emit `PydanticDeprecatedSince20` once per payload keyPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
reflex-dev/reflex#7634 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
documentation
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
topoteretes/cognee#6239 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
ranaroussi/yfinance#3009 ·
Los mantenedores suelen responder en 1 día
-
Test discovery aborts on GPU builds without cuStateVec: check_cuStateVec expects a failed result but set_config() now raises RuntimeErrorPosiblemente ocupada @dmeliksetian la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Qiskit/qiskit-aer#2495 ·
Los mantenedores suelen responder en 1 día