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

distutils.sysconfig.customize_compiler() produces TypeError #4984

Open
xiaxinmeng opened this issue May 20, 2023 · 1 comment
Open

distutils.sysconfig.customize_compiler() produces TypeError #4984

xiaxinmeng opened this issue May 20, 2023 · 1 comment
Labels
C-bug Something isn't working

Comments

@xiaxinmeng
Copy link

Summary

In Python, distutils.ccompiler provides an interface for compiling and linking C/C++ code.

import distutils.ccompiler

c = distutils.ccompiler.new_compiler()
print(c.compiler)

distutils.sysconfig.customize_compiler(c)
print(c.compiler)

Expected

Output on CPython3.9:

['cc']
['gcc', '-pthread', '-Wno-unused-result', '-Wsign-compare', '-DNDEBUG', '-g', '-fwrapv', '-O3', '-Wall']

Actual

RustPython reports a TypeError:

['cc']
<distutils.unixccompiler.UnixCCompiler object at 0x55f4f18fb7c0>
Traceback (most recent call last):
  File "/home/xxm/Desktop/RustPython/example.py", line 197, in <module>
    distutils.sysconfig.customize_compiler(c)
  File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/59df92d/pylib/Lib/distutils/sysconfig.py", line 217, in customize_compiler
    cpp = cc + " -E"           # not always
TypeError: '+' not supported between instances of 'NoneType' and 'str'

Environment

RustPython: v0.2.0 (https://github.com/RustPython/RustPython#59df92d7)
CPython: 3.9.0
Ubuntu 18.04

@xiaxinmeng xiaxinmeng added the C-bug Something isn't working label May 20, 2023
@DimitrisJim
Copy link
Member

DimitrisJim commented May 20, 2023

First stab at this would be updating distutils to the most recent Python version, can't find out quickly which version it is currently on. Reference #4564

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants