Skip to content

Commit b0a25ec

Browse files
committed
Support native member 'nb_power'.
1 parent bd330ab commit b0a25ec

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/NativeMemberNames.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public abstract class NativeMemberNames {
7171
public static final String UNICODE_STATE_READY = "ready";
7272
public static final String MD_DICT = "md_dict";
7373
public static final String BUF_DELEGATE = "buf_delegate";
74+
public static final String NB_ADD = "nb_add";
75+
public static final String NB_INDEX = "nb_index";
76+
public static final String NB_POW = "nb_power";
7477

7578
public static boolean isValid(String key) {
7679
switch (key) {
@@ -105,6 +108,9 @@ public static boolean isValid(String key) {
105108
case UNICODE_STATE_ASCII:
106109
case UNICODE_STATE_READY:
107110
case MD_DICT:
111+
case NB_ADD:
112+
case NB_INDEX:
113+
case NB_POW:
108114
return true;
109115
}
110116
return false;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/PyNumberMethodsWrapperMR.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
*/
3939
package com.oracle.graal.python.builtins.objects.cext;
4040

41+
import static com.oracle.graal.python.builtins.objects.cext.NativeMemberNames.NB_ADD;
42+
import static com.oracle.graal.python.builtins.objects.cext.NativeMemberNames.NB_INDEX;
43+
import static com.oracle.graal.python.builtins.objects.cext.NativeMemberNames.NB_POW;
44+
4145
import com.oracle.graal.python.builtins.objects.cext.CExtNodes.ToSulongNode;
4246
import com.oracle.graal.python.nodes.SpecialMethodNames;
4347
import com.oracle.graal.python.nodes.attributes.LookupAttributeInMRONode;
@@ -65,10 +69,12 @@ public Object access(PyNumberMethodsWrapper object, String key) {
6569

6670
private static String toAttributeName(String numberMethodsMember) {
6771
switch (numberMethodsMember) {
68-
case "nb_add":
72+
case NB_ADD:
6973
return SpecialMethodNames.__ADD__;
70-
case "nb_index":
74+
case NB_INDEX:
7175
return SpecialMethodNames.__INDEX__;
76+
case NB_POW:
77+
return SpecialMethodNames.__POW__;
7278
default:
7379
// TODO extend list
7480
throw UnknownIdentifierException.raise(numberMethodsMember);

0 commit comments

Comments
 (0)