Your message dated Thu, 5 Dec 2024 14:57:52 -0400
with message-id
<5jbanaz3mq3ct32pu3zx6w5yr6c4a3ubczvrqlhzeobdtmgm5u@dizqowsweaw3>
and subject line Re: Bug#1087681: python3.12: bug in
`argparse.ArgumentParser().parse_known_intermixed_args()`
has caused the Debian Bug report #1087681,
regarding python3.12: bug in
`argparse.ArgumentParser().parse_known_intermixed_args()`
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
1087681: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1087681
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python3.12
Version: 3.12.7-3
Severity: normal
X-Debbugs-Cc: [email protected]
Dear Maintainer,
I'm observing a bug in
`argparse.ArgumentParser().parse_known_intermixed_args()` in Debian Testing's
version of Python 3.12.7. However if I instead install Python 3.12.7 by
compiling from the official Python source the bug goes away so it seems this
bug is may be specific to Debian Testing's version of Python 3.12.7.
To reproduce the bug:
1. Start Debian Testing in Docker with `docker run --rm -ti debian:testing`
2. Within docker container install `python3.12` with `apt-get update && apt-get
install -y python3.12`
3. Start the python shell using the command `python3.12` and run the following
python code:
```python
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("--foo")
parser.add_argument("cmd")
parser.add_argument("rest", nargs="*", type=int)
args = ["doit", "1", "--foo", "bar", "2", "3", "-n", "4"]
a_r = parser.parse_known_intermixed_args(args)
print(a_r)
```
I observe the following incorrect output:
```python
(Namespace(foo='bar', cmd='doit', rest=[1, 2, 3, 4]), ['-n'])
```
However the expected output is instead:
```python
(Namespace(foo='bar', cmd='doit', rest=[1, 2, 3]), ['-n', '4'])
```
Notice the different location for the `4`.
To install Python 3.12 from the official source in the Debian Testing container
I use the following bash commands:
```bash
apt-get update && apt-get install -y gcc make wget xz-utils
wget https://www.python.org/ftp/python/3.12.7/Python-3.12.7.tar.xz
tar xf Python-3.12.7.tar.xz
cd Python-3.12.7
./configure
make
```
Then after I start this compiled-from-official-source version of Python 3.12
with `./python` and run the previous python commands I get the expected output:
```python
(Namespace(foo='bar', cmd='doit', rest=[1, 2, 3]), ['-n', '4'])
```
Thanks,
Trevor
-- System Information:
Debian Release: bookworm/sid
APT prefers jammy-updates
APT policy: (500, 'jammy-updates'), (500, 'jammy-security'), (500, 'jammy'),
(100, 'jammy-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.9.3-76060903-generic (SMP w/20 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
--- End Message ---
--- Begin Message ---
Version: 3.12.8-1
The fix for this should have been included in 3.12.8:
https://github.com/python/cpython/pull/125839
Stefano
--- End Message ---