Repository navigation
Closed
Labels
C-compatA discrepancy between RustPython and CPython
Description
Description
Two of the fields in struct lconv are swapped in RustPython when compared to the glibc counterpart.
RustPython
int_n_cs_precedes should come directly after int_p_sep_by_spaces, not before (see C struct below).
#[cfg(windows)]
#[repr(C)]
struct lconv {
decimal_point: *mut libc::c_char,
thousands_sep: *mut libc::c_char,
grouping: *mut libc::c_char,
int_curr_symbol: *mut libc::c_char,
currency_symbol: *mut libc::c_char,
mon_decimal_point: *mut libc::c_char,
mon_thousands_sep: *mut libc::c_char,
mon_grouping: *mut libc::c_char,
positive_sign: *mut libc::c_char,
negative_sign: *mut libc::c_char,
int_frac_digits: libc::c_char,
frac_digits: libc::c_char,
p_cs_precedes: libc::c_char,
p_sep_by_space: libc::c_char,
n_cs_precedes: libc::c_char,
n_sep_by_space: libc::c_char,
p_sign_posn: libc::c_char,
n_sign_posn: libc::c_char,
int_p_cs_precedes: libc::c_char,
int_n_cs_precedes: libc::c_char, // Swap these
int_p_sep_by_space: libc::c_char, // Swap these
int_n_sep_by_space: libc::c_char,
int_p_sign_posn: libc::c_char,
int_n_sign_posn: libc::c_char,
}glibc
(Comments removed in following)
struct lconv
{
char *decimal_point;
char *thousands_sep;
char *grouping;
char *int_curr_symbol;
char *currency_symbol;
char *mon_decimal_point;
char *mon_thousands_sep;
char *mon_grouping;
char *positive_sign;
char *negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
char p_sep_by_space;
char n_cs_precedes;
char n_sep_by_space;
char p_sign_posn;
char n_sign_posn;
#ifdef __USE_ISOC99
char int_p_cs_precedes;
char int_p_sep_by_space;
char int_n_cs_precedes;
char int_n_sep_by_space;
char int_p_sign_posn;
char int_n_sign_posn;
#else
char __int_p_cs_precedes;
char __int_p_sep_by_space; // These were out of order
char __int_n_cs_precedes; // These were out of order
char __int_n_sep_by_space;
char __int_p_sign_posn;
char __int_n_sign_posn;
#endif
};Metadata
Metadata
Assignees
Labels
C-compatA discrepancy between RustPython and CPython
Activity
jackoconnordev commentedon Aug 5, 2025
I'll open a PR later, Github status page mentions a problem with PRs now