This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skip.montanaro
Recipients skip.montanaro
Date 2020-11-11.13:57:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605103067.76.0.762518596297.issue42325@roundup.psfhosted.org>
In-reply-to
Content
I recently replaced Ubuntu 20.04 with Manjaro 20.2. In the process my Python builds broke in the sharedmods target of the Makefile. The tail end of the traceback is:

  File "/home/skip/src/python/cpython/./setup.py", line 246, in grep_headers_for
    if function in f.read():
  File "/home/skip/src/python/cpython/Lib/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb4 in position 1600: invalid start byte

The grep_headers_for() function in setup.py appeared to be the culprit, so I added a print statement to its loop:

def grep_headers_for(function, headers):
    for header in headers:
        print("***", header, file=sys.stderr)
        with open(header, 'r') as f:
            if function in f.read():
                return True
    return False

which printed these lines:

*** /usr/include/umfpack_report_perm.h
*** /usr/include/dbstl_dbc.h
*** /usr/include/itclTclIntStubsFcn.h
*** /usr/include/dbstl_vector.h
*** /usr/include/cholmod_blas.h
*** /usr/include/amd.h
*** /usr/include/m17n-X.h

Sure enough, that m17n-X.h file (attached) doesn't contain utf-8 (my environment's encoding). According to the Emacs coding cookie at the end, the file is euc-japan encoded. Would simply catching the exception in grep_headers_for() be the correct way to deal with this?
History
Date User Action Args
2020-11-11 13:57:47skip.montanarosetrecipients: + skip.montanaro
2020-11-11 13:57:47skip.montanarosetmessageid: <1605103067.76.0.762518596297.issue42325@roundup.psfhosted.org>
2020-11-11 13:57:47skip.montanarolinkissue42325 messages
2020-11-11 13:57:47skip.montanarocreate