X-Received: by 2002:a05:622a:54c:: with SMTP id m12mr2375406qtx.300.1643988571455; Fri, 04 Feb 2022 07:29:31 -0800 (PST) X-Received: by 2002:a81:1153:: with SMTP id 80mr3326201ywr.327.1643988571268; Fri, 04 Feb 2022 07:29:31 -0800 (PST) Path: ...!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: fr.comp.lang.python Date: Fri, 4 Feb 2022 07:29:30 -0800 (PST) Injection-Info: google-groups.googlegroups.com; posting-host=185.24.186.214; posting-account=dcD-vwoAAAADRTmn7k3Lt-A6Fc1w3JmV NNTP-Posting-Host: 185.24.186.214 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: =?UTF-8?Q?probl=C3=A8me_avec_struct=2Ecalcsize_qui_retourne_la_m=C3=AAme?= =?UTF-8?Q?_valeur_alors_qu=27un_entier_non_sign=C3=A9_a_=C3=A9t=C3=A9_ajout=C3=A9_au_for?= =?UTF-8?Q?matage?= From: "pata...@gmail.com" Injection-Date: Fri, 04 Feb 2022 15:29:31 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Bytes: 1805 Lines: 27 bonjour, je rencontre un comportement =C3=A9trange de la part de la fonction calcsiz= e du module struct. voici le probl=C3=A8me : # 8<----------- cd /tmp/ python --version Python 3.10.1 python -m venv struct.test source struct.test/bin/activate python -c 'import struct; print(struct.calcsize("4sIQ4I2Q"), 4+4+8+(4*4)+(2= *8))' 48 48 python -c 'import struct; print(struct.calcsize("4sIQ5I2Q"), 4+4+8+(5*4)+(2= *8))' 56 52 python -c 'import struct; print(struct.calcsize("4sIQ6I2Q"), 4+4+8+(6*4)+(2= *8))' 56 56 # 8<----------- struct.calcsize("4sIQ5I2Q") ne retourne pas 52 comme attendu... une explication ? cordialement, lacsaP.