Boolean list elements are encoded as True/False instead of true/false
I maintainer di solito rispondono entro 1 giorno
@inchang-ing ci sta già lavorando.
Dal 20/10/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia in stripe/_encode.py, in _api_encode(), e confronta il ramo di liste/tuple con la gestione dei valori Boolean autonomi e dei valori contenuti in dizionari annidati. Poi esegui i test di codifica che coprono _api_encode() e aggiungi un caso per gli elementi Boolean in una lista. Il lavoro è concluso quando i valori dell’array codificato sono true e false in minuscolo, coerentemente con le altre posizioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 2.1k
- Fork
- 543
- Merge medio
- 3g 21h
- PR unite (30g)
- 17
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di stripe/stripe-python
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 90/100
stripe/stripe-python#1953 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
stripe/stripe-python#1948 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
stripe/stripe-python#1936 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
stripe/stripe-python#1954 ·
I maintainer di solito rispondono entro 1 giorno
-
feature-request future
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
stripe/stripe-python#1941 · 8 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di stripe/stripe-python
Issue simili
-
Project submission:Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
slavakurilyak/awesome-ai-agents#845 ·
I maintainer di solito rispondono entro 1 giorno
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertadifficulty:2 enhancement good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
MakazhanAlpamys/Soup#2178 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
scverse/rapids-singlecell#854 ·
I maintainer di solito rispondono entro 1 giorno
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLForse già presa @ninglinLiu l’ha presa oggi. Apertaarea:frontend backend:slang bug direction:input
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 13 giorni