← index #18837Issue #17541
Related · high · value 1.903
QUERY · ISSUE

Enabling DUPTERM on Unix kills output to stderr

openby smurfixopened 2026-02-18updated 2026-03-14
bugport-unix

Port, board and/or hardware

Unix

MicroPython version

current master, v1.27.0-175-ga8b71559cf-dirty

Reproduction

Adding

#define MICROPY_PY_OS_DUPTERM (2)

to ports/unix/mpconfigport.h disables writing to standard error. Output is sent to stdout instead.

Expected behaviour

$ ports/unix/build-standard/micropython -c "import sys;print('XXX',file=sys.stderr)" >/dev/null
XXX
$ 

Observed behaviour

$ ports/unix/build-standard/micropython -c "import sys;print('XXX',file=sys.stderr)" >/dev/null
[ no output ]
$ 

Additional Information

>>> import sys
>>> sys.stdout
<io.TextIOWrapper 1>
>>> sys.stderr
<io.TextIOWrapper 2>

but print or write don't seem to care.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

Compiling unix build with dupterm support fails on ubuntu

openby thatbudakguyopened 2025-06-21updated 2026-02-14
bug

Port, board and/or hardware

unix

MicroPython version

Micropython v1.24.1-dirty (from v1.24-release branch)

Reproduction

git clone -b v1.24-release --depth=1 --single-branch https://github.com/micropython/micropython.git
cd micropython
git submodule update --init
CFLAGS_EXTRA="-DMICROPY_PY_OS_DUPTERM=2" make -C ports/unix

This is executed on a GitHub actions runner (ubuntu-latest).

Expected behaviour

Finish compiling with a working os.dupterm.

Observed behaviour

This exception appears during compilation:

In file included from ../py/runtime.h:29,
                 from ../py/bc.h:30,
                 from ../py/emitglue.h:30,
                 from ../py/compile.h:31,
                 from ../py/runtime.c:35:
../py/runtime.c: In function ‘mp_init’:
../py/mpstate.h:312:40: error: ‘mp_state_vm_t’ {aka ‘struct _mp_state_vm_t’} has no member named ‘dupterm_objs’
  312 | #define MP_STATE_VM(x) (mp_state_ctx.vm.x)
      |                                        ^
../py/runtime.c:128:9: note: in expansion of macro ‘MP_STATE_VM’
  128 |         MP_STATE_VM(dupterm_objs[i]) = MP_OBJ_NULL;
      |         ^~~~~~~~~~~
-e See https://github.com/micropython/micropython/wiki/Build-Troubleshooting
make[1]: *** [../py/mkrules.mk:90: build/py/runtime.o] Error 1
make[1]: Leaving directory '/home/runner/work/mqterm/mqterm/micropython/mpy-cross'
make: *** [../../py/mkrules.mk:179: ../../mpy-cross/build/mpy-cross] Error 2
make: Leaving directory '/home/runner/work/mqterm/mqterm/micropython/ports/unix'

Additional Information

When compiling locally on my machine (M3 MacBook Pro), setting -DMICROPY_PY_OS_DUPTERM=2 correctly enables os.dupterm support.

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied