Skip to content

Commit ead5048

Browse files
committed
shift binary graalpy version string into printable char range
1 parent e9b913b commit ead5048

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

graalpython/com.oracle.graal.python.resources/src/com/oracle/graal/python/resources/PythonResource.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public final class PythonResource implements InternalResource {
6464

6565
static {
6666
try (InputStream is = PythonResource.class.getResourceAsStream("/graalpy_versions")) {
67-
PYTHON_MAJOR = is.read();
68-
PYTHON_MINOR = is.read();
67+
PYTHON_MAJOR = is.read() - ' ';
68+
PYTHON_MINOR = is.read() - ' ';
6969
is.read(); // skip python micro version
70-
GRAALVM_MAJOR = is.read();
71-
GRAALVM_MINOR = is.read();
70+
GRAALVM_MAJOR = is.read() - ' ';
71+
GRAALVM_MINOR = is.read() - ' ';
7272
} catch (IOException e) {
7373
throw new RuntimeException(e);
7474
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,19 +217,19 @@ private static Class<PythonResource> getPythonResourceClass() {
217217
PYTHON_RESOURCE_CLASS = getPythonResourceClass();
218218
try (InputStream is = PythonLanguage.class.getResourceAsStream("/graalpy_versions")) {
219219
int ch;
220-
if (MAJOR != (ch = is.read())) {
220+
if (MAJOR != (ch = is.read() - ' ')) {
221221
throw new RuntimeException("suite.py version info does not match PythonLanguage#MAJOR: " + ch);
222222
}
223-
if (MINOR != (ch = is.read())) {
223+
if (MINOR != (ch = is.read() - ' ')) {
224224
throw new RuntimeException("suite.py version info does not match PythonLanguage#MINOR: " + ch);
225225
}
226-
if (MICRO != (ch = is.read())) {
226+
if (MICRO != (ch = is.read() - ' ')) {
227227
throw new RuntimeException("suite.py version info does not match PythonLanguage#MICRO: " + ch);
228228
}
229-
if (GRAALVM_MAJOR != (ch = is.read())) {
229+
if (GRAALVM_MAJOR != (ch = is.read() - ' ')) {
230230
throw new RuntimeException("suite.py version info does not match PythonLanguage#GRAALVM_MAJOR: " + ch);
231231
}
232-
if (GRAALVM_MINOR != (ch = is.read())) {
232+
if (GRAALVM_MINOR != (ch = is.read() - ' ')) {
233233
throw new RuntimeException("suite.py version info does not match PythonLanguage#GRAALVM_MINOR: " + ch);
234234
}
235235
} catch (IOException e) {

mx.graalpython/mx_graalpython.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ def py_version_short(variant=None, **kwargs):
17481748
if variant == 'major_minor_nodot':
17491749
return PYTHON_VERSION_MAJ_MIN.replace(".", "")
17501750
elif variant == 'binary':
1751-
return "".join([chr(int(p)) for p in PYTHON_VERSION.split(".")])
1751+
return "".join([chr(int(p) + ord(' ')) for p in PYTHON_VERSION.split(".")])
17521752
else:
17531753
return PYTHON_VERSION_MAJ_MIN
17541754

@@ -1757,7 +1757,7 @@ def graal_version_short(variant=None, **kwargs):
17571757
if variant == 'major_minor_nodot':
17581758
return GRAAL_VERSION_MAJ_MIN.replace(".", "")
17591759
elif variant == 'binary':
1760-
return "".join([chr(int(p)) for p in GRAAL_VERSION.split(".")])
1760+
return "".join([chr(int(p) + ord(' ')) for p in GRAAL_VERSION.split(".")])
17611761
else:
17621762
return GRAAL_VERSION_MAJ_MIN
17631763

0 commit comments

Comments
 (0)