<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - AttributeError: 'tuple' object has no attribute 'major'"
href="https://bugs.freedesktop.org/show_bug.cgi?id=107566">107566</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>AttributeError: 'tuple' object has no attribute 'major'
</td>
</tr>
<tr>
<th>Product</th>
<td>Mesa
</td>
</tr>
<tr>
<th>Version</th>
<td>git
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86-64 (AMD64)
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Keywords</th>
<td>bisected, regression
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>Mesa core
</td>
</tr>
<tr>
<th>Assignee</th>
<td>mesa-dev@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vlee@freedesktop.org
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>mesa-dev@lists.freedesktop.org
</td>
</tr>
<tr>
<th>CC</th>
<td>baker.dylan.c@gmail.com, bochecha@daitauha.fr
</td>
</tr></table>
<p>
<div>
<pre>Build error with Python 2.6.
Generating build/linux-x86_64-debug/util/xmlpool/options.h ...
Traceback (most recent call last):
File "src/util/xmlpool/gen_xmlpool.py", line 216, in <module>
expandMatches ([matchDESC], translations)
File "src/util/xmlpool/gen_xmlpool.py", line 143, in expandMatches
if sys.version_info.major == 2:
AttributeError: 'tuple' object has no attribute 'major'
commit bd27203f4d808763ac24ac94eb677cacf3e7cb99
Author: Mathieu Bridon <<a href="mailto:bochecha@daitauha.fr">bochecha@daitauha.fr</a>>
Date: Fri Aug 10 23:17:08 2018 +0200
python: Rework bytes/unicode string handling
In both Python 2 and 3, opening a file without specifying the mode will
open it for reading in text mode ('r').
On Python 2, the read() method of a file object opened in mode 'r' will
return byte strings, while on Python 3 it will return unicode strings.
Explicitly specifying the binary mode ('rb') then decoding the byte
string means we always handle unicode strings on both Python 2 and 3.
Which in turns means all re.match(line) will return unicode strings as
well.
If we also make expandCString return unicode strings, we don't need the
call to the unicode() constructor any more.
We were using the ugettext() method because it always returns unicode
strings in Python 2, contrarily to the gettext() one which returns
byte strings. The ugettext() method doesn't exist on Python 3, so we
must use the right method on each version of Python.
The last hurdles are that Python 3 doesn't let us concatenate unicode
and byte strings directly, and that Python 2's stdout wants encoded byte
strings while Python 3's want unicode strings.
With these changes, the script gives the same output on both Python 2
and 3.
Signed-off-by: Mathieu Bridon <<a href="mailto:bochecha@daitauha.fr">bochecha@daitauha.fr</a>>
Reviewed-by: Dylan Baker <<a href="mailto:dylan@pnwbakers.com">dylan@pnwbakers.com</a>></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>