@@ -506,16 +506,16 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa
506
506
return SysModuleBuiltinsFactory .getFactories ();
507
507
}
508
508
509
- private static PSimpleNamespace makeImplementation (PythonLanguage language , PTuple versionInfo , TruffleString gmultiarch ) {
509
+ private static PSimpleNamespace makeImplementation (PythonLanguage language , PTuple graalpyVersionInfo , TruffleString gmultiarch ) {
510
510
final PSimpleNamespace ns = PFactory .createSimpleNamespace (language );
511
511
ns .setAttribute (tsLiteral ("name" ), T_GRAALPYTHON_ID );
512
512
/*- 'cache_tag' must match the format of mx.graalpython/mx_graalpython.py:graalpy_ext */
513
513
ns .setAttribute (T_CACHE_TAG , toTruffleStringUncached (J_GRAALPYTHON_ID +
514
514
PythonLanguage .GRAALVM_MAJOR + PythonLanguage .GRAALVM_MINOR + PythonLanguage .DEV_TAG +
515
515
"-" + PythonLanguage .MAJOR + PythonLanguage .MINOR ));
516
- ns .setAttribute (T_VERSION , versionInfo );
516
+ ns .setAttribute (T_VERSION , graalpyVersionInfo );
517
517
ns .setAttribute (T__MULTIARCH , gmultiarch );
518
- ns .setAttribute (tsLiteral ("hexversion" ), PythonLanguage .VERSION_HEX );
518
+ ns .setAttribute (tsLiteral ("hexversion" ), PythonLanguage .GRAALVM_MAJOR << 16 | PythonLanguage . GRAALVM_MINOR << 8 | PythonLanguage . GRAALVM_MICRO );
519
519
return ns ;
520
520
}
521
521
@@ -588,7 +588,10 @@ public void initialize(Python3Core core) {
588
588
addBuiltinConstant (T_STDOUT , PNone .NONE );
589
589
addBuiltinConstant (T_STDERR , PNone .NONE );
590
590
591
- addBuiltinConstant ("implementation" , makeImplementation (language , versionInfo , gmultiarch ));
591
+ PTuple graalpyVersion = PFactory .createStructSeq (language , VERSION_INFO_DESC , PythonLanguage .GRAALVM_MAJOR , PythonLanguage .GRAALVM_MINOR , PythonLanguage .GRAALVM_MICRO ,
592
+ PythonLanguage .RELEASE_LEVEL_STRING , PythonLanguage .RELEASE_SERIAL );
593
+ addBuiltinConstant ("graalpy_version_info" , graalpyVersion );
594
+ addBuiltinConstant ("implementation" , makeImplementation (language , graalpyVersion , gmultiarch ));
592
595
addBuiltinConstant ("hexversion" , PythonLanguage .VERSION_HEX );
593
596
594
597
if (os == PLATFORM_WIN32 ) {
0 commit comments