@@ -600,7 +600,10 @@ end_dynamic_python3(void)
600600py3_runtime_link_init (char * libname , int verbose )
601601{
602602 int i ;
603- void * ucs_from_string , * ucs_decode , * ucs_as_encoded_string ;
603+ PYTHON_PROC * ucs_from_string = (PYTHON_PROC * )& py3_PyUnicode_FromString ;
604+ PYTHON_PROC * ucs_decode = (PYTHON_PROC * )& py3_PyUnicode_Decode ;
605+ PYTHON_PROC * ucs_as_encoded_string =
606+ (PYTHON_PROC * )& py3_PyUnicode_AsEncodedString ;
604607
605608# if !(defined(PY_NO_RTLD_GLOBAL ) && defined(PY3_NO_RTLD_GLOBAL )) && defined(UNIX ) && defined(FEAT_PYTHON )
606609 /* Can't have Python and Python3 loaded at the same time.
@@ -641,33 +644,29 @@ py3_runtime_link_init(char *libname, int verbose)
641644 /* Load unicode functions separately as only the ucs2 or the ucs4 functions
642645 * will be present in the library. */
643646# if PY_VERSION_HEX >= 0x030300f0
644- ucs_from_string = symbol_from_dll (hinstPy3 , "PyUnicode_FromString" );
645- ucs_decode = symbol_from_dll (hinstPy3 , "PyUnicode_Decode" );
646- ucs_as_encoded_string = symbol_from_dll (hinstPy3 ,
647+ * ucs_from_string = symbol_from_dll (hinstPy3 , "PyUnicode_FromString" );
648+ * ucs_decode = symbol_from_dll (hinstPy3 , "PyUnicode_Decode" );
649+ * ucs_as_encoded_string = symbol_from_dll (hinstPy3 ,
647650 "PyUnicode_AsEncodedString" );
648651# else
649- ucs_from_string = symbol_from_dll (hinstPy3 , "PyUnicodeUCS2_FromString" );
650- ucs_decode = symbol_from_dll (hinstPy3 ,
652+ * ucs_from_string = symbol_from_dll (hinstPy3 , "PyUnicodeUCS2_FromString" );
653+ * ucs_decode = symbol_from_dll (hinstPy3 ,
651654 "PyUnicodeUCS2_Decode" );
652- ucs_as_encoded_string = symbol_from_dll (hinstPy3 ,
655+ * ucs_as_encoded_string = symbol_from_dll (hinstPy3 ,
653656 "PyUnicodeUCS2_AsEncodedString" );
654- if (!ucs_from_string || !ucs_decode || !ucs_as_encoded_string )
657+ if (* ucs_from_string == NULL || * ucs_decode == NULL
658+ || * ucs_as_encoded_string == NULL )
655659 {
656- ucs_from_string = symbol_from_dll (hinstPy3 ,
660+ * ucs_from_string = symbol_from_dll (hinstPy3 ,
657661 "PyUnicodeUCS4_FromString" );
658- ucs_decode = symbol_from_dll (hinstPy3 ,
662+ * ucs_decode = symbol_from_dll (hinstPy3 ,
659663 "PyUnicodeUCS4_Decode" );
660- ucs_as_encoded_string = symbol_from_dll (hinstPy3 ,
664+ * ucs_as_encoded_string = symbol_from_dll (hinstPy3 ,
661665 "PyUnicodeUCS4_AsEncodedString" );
662666 }
663667# endif
664- if (ucs_from_string && ucs_decode && ucs_as_encoded_string )
665- {
666- py3_PyUnicode_FromString = ucs_from_string ;
667- py3_PyUnicode_Decode = ucs_decode ;
668- py3_PyUnicode_AsEncodedString = ucs_as_encoded_string ;
669- }
670- else
668+ if (* ucs_from_string == NULL || * ucs_decode == NULL
669+ || * ucs_as_encoded_string == NULL )
671670 {
672671 close_dll (hinstPy3 );
673672 hinstPy3 = 0 ;
0 commit comments