fix buffer (#6447)

This commit is contained in:
Jeong, YunWon authored and GitHub committed 2025-12-16 23:27:21 +09:00
1 parent 65bdfc3d4e
commit aef4de4ab8
2 files changed
+19 -3

No files matched your search

+3
View File
@@ -15,6 +15,7 @@ cellvar
cellvars
cmpop
denom
DICTFLAG
dictoffset
elts
excepthandler
@@ -28,6 +29,7 @@ heaptype
HIGHRES
IMMUTABLETYPE
Itertool
keeped
kwonlyarg
kwonlyargs
lasti
@@ -48,6 +50,7 @@ PYTHREAD_NAME
SA_ONSTACK
SOABI
stackdepth
stginfo
stringlib
structseq
subparams
+16 -3
View File
@@ -238,10 +238,23 @@ impl FormatCode {
_ => 1,
};
// Skip whitespace (Python ignores whitespace in format strings)
while let Some(b' ' | b'\t' | b'\n' | b'\r') = chars.peek() {
chars.next();
}
// determine format char:
let c = chars
.next()
.ok_or_else(|| "repeat count given without format specifier".to_owned())?;
let c = match chars.next() {
Some(c) => c,
None => {
// If we have a repeat count but only whitespace follows, error
if repeat != 1 {
return Err("repeat count given without format specifier".to_owned());
}
// Otherwise, we're done parsing
break;
}
};
// Check for embedded null character
if c == 0 {