Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure during the print of select.select output with unblocking sys.stdin #126468

Open
yurivict opened this issue Nov 6, 2024 · 5 comments
Open
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@yurivict
Copy link

yurivict commented Nov 6, 2024

Bug report

Bug description:

This code terminates with error messages after several loop iterations:

import sys
import os
import select

os.set_blocking(sys.stdin.fileno(), False)

while True:
    print('>')
    ready = select.select([sys.stdin, ], [], [], 0.0)[0]
    print(f'< ready={ready}')
$ python3.11 stdin-nonblocking-bug-report.py
<... skip many iterations ...>
< ready=[]
>
< ready=[]
>
< ready=[]
Traceback (most recent call last):
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
Exception ignored in sys.unraisablehook: <built-in function unraisablehook>

$ echo $?
120

The failure occurs in print(f'< ready={ready}').

Python-3.11
FreeBSD 14.1

CPython versions tested on:

3.11

Operating systems tested on:

Other

@yurivict yurivict added the type-bug An unexpected behavior, bug, or error label Nov 6, 2024
@picnixz picnixz added the extension-modules C modules in the Modules dir label Nov 6, 2024
@Zheaoli
Copy link
Contributor

Zheaoli commented Nov 6, 2024

Can not reproduce it on main and 3.13 branch. Would you mind providing more detail?

@yurivict
Copy link
Author

yurivict commented Nov 6, 2024

@Zheaoli
Did you run on FreeBSD ?
What other details can I provide?

@Zheaoli
Copy link
Contributor

Zheaoli commented Nov 6, 2024

Did you run on FreeBSD ?

Yes,

root@freebase-test:~ # fastfetch
```                        `        root@freebase-test
  ` `.....---.......--.```   -/     ------------------
  +o   .--`         /y:`      +.    Host: Standard PC (i440FX + PIIX, 1996) (pc-i440fx-9.0)
   yo`:.            :o      `+-     Kernel: FreeBSD 14.1-RELEASE
    y/               -/`   -o/      Uptime: 19 mins
   .-                  ::/sy+:.     Shell: sh
   /                     `--  /     Terminal: /dev/pts/0
  `:                          :`    CPU: QEMU Virtual version 2.5+ (8) @ 2.50 GHz
  `:                          :`    GPU: Unknown Device 1111 (VGA compatible)
   /                          /     Memory: 4.14 GiB / 47.96 GiB (9%)
   .-                        -.     Swap: 0 B / 1.00 GiB (0%)
    --                      -.      Disk (/): 4.31 GiB / 101.24 GiB (4%) - zfs
     `:`                  `:`       Local IP (eth0): 192.168.12.41/16
       .--             `--.         Locale: en_US.UTF-8
          .---.....----.

@yurivict
Copy link
Author

yurivict commented Nov 6, 2024

I encountered this problem with the python311 package, and you said that you tried 3.13

Can you try with python311?
Maybe it is already fixed in 3.13

@ericvsmith
Copy link
Member

3.11 is no longer receiving bug fixes. Can you try 3.12 or 3.13? See https://devguide.python.org/versions/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants