@@ -1831,15 +1831,27 @@ abstract static class UpcallCextLNode extends PythonBuiltinNode {
1831
1831
@ Child private CExtNodes .AsLong asLongNode = CExtNodes .AsLong .create ();
1832
1832
1833
1833
@ Specialization
1834
- long upcall (VirtualFrame frame , PythonModule cextModule , String name , Object [] args ,
1834
+ Object upcall (VirtualFrame frame , PythonModule cextModule , String name , Object [] args ,
1835
+ @ Cached ("createBinaryProfile()" ) ConditionProfile isVoidPtr ,
1835
1836
@ Cached ("create()" ) CExtNodes .CextUpcallNode upcallNode ) {
1836
- return asLongNode .execute (upcallNode .execute (frame , cextModule , name , args ));
1837
+ Object result = upcallNode .execute (frame , cextModule , name , args );
1838
+ if (isVoidPtr .profile (result instanceof PythonNativeVoidPtr )) {
1839
+ return ((PythonNativeVoidPtr ) result ).object ;
1840
+ } else {
1841
+ return asLongNode .execute (result );
1842
+ }
1837
1843
}
1838
1844
1839
1845
@ Specialization (guards = "!isString(callable)" )
1840
- long doDirect (VirtualFrame frame , @ SuppressWarnings ("unused" ) PythonModule cextModule , Object callable , Object [] args ,
1846
+ Object doDirect (VirtualFrame frame , @ SuppressWarnings ("unused" ) PythonModule cextModule , Object callable , Object [] args ,
1847
+ @ Cached ("createBinaryProfile()" ) ConditionProfile isVoidPtr ,
1841
1848
@ Cached ("create()" ) CExtNodes .DirectUpcallNode upcallNode ) {
1842
- return asLongNode .execute (upcallNode .execute (frame , callable , args ));
1849
+ Object result = upcallNode .execute (frame , callable , args );
1850
+ if (isVoidPtr .profile (result instanceof PythonNativeVoidPtr )) {
1851
+ return ((PythonNativeVoidPtr ) result ).object ;
1852
+ } else {
1853
+ return asLongNode .execute (result );
1854
+ }
1843
1855
}
1844
1856
}
1845
1857
0 commit comments