Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available. #131201

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

plashchynski
Copy link

@plashchynski plashchynski commented Mar 13, 2025

On Linux, compiling without "libffi" causes a misleading warning
"No module named 'msvcrt'" when launching PyREPL.

On Linux, compiling without "libffi" causes a
"No module named 'msvcrt'" warning when launching PyREPL.
@bedevere-app
Copy link

bedevere-app bot commented Mar 13, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot recreate the same setup as you have, can you please share what happens with this change in place?

@plashchynski
Copy link
Author

@sobolevn steps to reproduce on a fresh Ubuntu Server 24.04.2 setup:

sudo apt install build-essential
git clone https://github.com/python/cpython.git
cd cpython
./configure
make

Then:

./python

shows:

Python 3.14.0a5+ (heads/main:c497f83ad85, Mar 14 2025, 09:42:58) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
warning: can't use pyrepl: No module named 'msvcrt'
>>> 

Here's a full log.

with changes in this PR, it shows the following with the same setup:

Python 3.14.0a5+ (heads/fix_msvcrt_warning_on_linux:56364cef29, Mar 14 2025, 09:49:25) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
warning: can't use pyrepl: No module named '_ctypes'
>>> 

Here's a full log.

warning: can't use pyrepl: No module named 'msvcrt'

this warning is misleading, because msvcrt is available only on NT systems.

warning: can't use pyrepl: No module named '_ctypes'

this warning is consistent with the warning make shows for missing necessary bits:

The necessary bits to build these optional modules were not found:
_bz2                      _ctypes                   _ctypes_test           
_curses                   _curses_panel             _dbm                   
_gdbm                     _hashlib                  _lzma                  
_ssl                      _tkinter                  _uuid                  
readline                  zlib                                             
To find the necessary bits, look in configure.ac and config.log.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it is clear now! LGTM. However, I am not the module's maintainer, let's wait for them to make the final decision :)

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants