Skip to content

Commit acd6c60

Browse files
committed
[GR-21590] [GR-36886] [GR-29094] Update Python imports
PullRequest: graalpython/2131
2 parents 453d042 + edfcd2c commit acd6c60

File tree

17 files changed

+131
-226
lines changed

17 files changed

+131
-226
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "overlay": "1872fad0df9fa14b17f7188a9df4cec31102e5b6" }
1+
{ "overlay": "955765a94e2eaed92fef6480886516843fb127f6" }

graalpython/com.oracle.graal.python.cext/modules/_mmap.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2019, 2021, Oracle and/or its affiliates.
1+
/* Copyright (c) 2019, 2022, Oracle and/or its affiliates.
22
* Copyright (C) 1996-2017 Python Software Foundation
33
*
44
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
@@ -51,9 +51,14 @@ int mmap_getbuffer(PyObject *self, Py_buffer *view, int flags) {
5151

5252
static PyObject* mmap_init_bufferprotocol(PyObject* self, PyObject* mmap_type) {
5353
assert(PyType_Check(mmap_type));
54-
initialize_type_structure(&mmap_object_type, (PyTypeObject*)mmap_type, polyglot_mmap_object_typeid());
5554

56-
polyglot_invoke(PY_TRUFFLE_CEXT, "PyTruffle_SetBufferProcs", native_to_java(mmap_type), (getbufferproc) mmap_getbuffer, (releasebufferproc) NULL);
55+
initialize_type_structure(&mmap_object_type, (PyTypeObject*)mmap_type, polyglot_mmap_object_typeid());
56+
static PyBufferProcs mmap_as_buffer = {
57+
(getbufferproc)mmap_getbuffer,
58+
(releasebufferproc)NULL,
59+
};
60+
mmap_object_type.tp_as_buffer = &mmap_as_buffer;
61+
5762
return Py_None;
5863
}
5964

graalpython/com.oracle.graal.python.cext/src/capi.c

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ void initialize_type_structure(PyTypeObject* structure, PyTypeObject* ptype, pol
115115
destructor dealloc_fun = structure->tp_dealloc;
116116
freefunc free_fun = structure->tp_free;
117117
Py_ssize_t vectorcall_offset = structure->tp_vectorcall_offset;
118+
PyBufferProcs* as_buffer = structure->tp_as_buffer;
118119
PyTypeObject* type_handle = truffle_assign_managed(structure, ptype);
119120
// write flags as specified in the dummy to the PythonClass object
120121
type_handle->tp_flags = original_flags | Py_TPFLAGS_READY;
@@ -135,6 +136,9 @@ void initialize_type_structure(PyTypeObject* structure, PyTypeObject* ptype, pol
135136
if (vectorcall_offset) {
136137
type_handle->tp_vectorcall_offset = vectorcall_offset;
137138
}
139+
if (as_buffer) {
140+
type_handle->tp_as_buffer = as_buffer;
141+
}
138142
}
139143

140144
static void initialize_builtin_type(PyTypeObject* structure, const char* typname, polyglot_typeid tid) {
@@ -314,10 +318,29 @@ static void initialize_globals() {
314318
}
315319

316320
static void initialize_bufferprocs() {
317-
polyglot_invoke(PY_TRUFFLE_CEXT, "PyTruffle_SetBufferProcs", native_to_java((PyObject*)&PyBytes_Type), (getbufferproc)bytes_buffer_getbuffer, (releasebufferproc)NULL);
318-
polyglot_invoke(PY_TRUFFLE_CEXT, "PyTruffle_SetBufferProcs", native_to_java((PyObject*)&PyByteArray_Type), (getbufferproc)bytearray_getbuffer, (releasebufferproc)bytearray_releasebuffer);
319-
polyglot_invoke(PY_TRUFFLE_CEXT, "PyTruffle_SetBufferProcs", native_to_java((PyObject*)&PyBuffer_Type), (getbufferproc)bufferdecorator_getbuffer, (releasebufferproc)NULL);
320-
polyglot_invoke(PY_TRUFFLE_CEXT, "PyTruffle_SetBufferProcs", native_to_java((PyObject*)&PyMemoryView_Type), (getbufferproc)memoryview_getbuffer, (releasebufferproc)memoryview_releasebuffer);
321+
static PyBufferProcs bytes_as_buffer = {
322+
(getbufferproc)bytes_buffer_getbuffer, /* bf_getbuffer */
323+
(releasebufferproc)NULL, /* bf_releasebuffer */
324+
};
325+
PyBytes_Type.tp_as_buffer = &bytes_as_buffer;
326+
327+
static PyBufferProcs bytearray_as_buffer = {
328+
(getbufferproc)bytearray_getbuffer, /* bf_getbuffer */
329+
(releasebufferproc)bytearray_releasebuffer, /* bf_releasebuffer */
330+
};
331+
PyByteArray_Type.tp_as_buffer = &bytearray_as_buffer;
332+
333+
static PyBufferProcs buffer_as_buffer = {
334+
(getbufferproc)bufferdecorator_getbuffer, /* bf_getbuffer */
335+
(releasebufferproc)NULL, /* bf_releasebuffer */
336+
};
337+
PyBuffer_Type.tp_as_buffer = &buffer_as_buffer;
338+
339+
static PyBufferProcs memory_as_buffer = {
340+
(getbufferproc)memoryview_getbuffer, /* bf_getbuffer */
341+
(releasebufferproc)memoryview_releasebuffer, /* bf_releasebuffer */
342+
};
343+
PyMemoryView_Type.tp_as_buffer = &memory_as_buffer;
321344
}
322345

323346
static void initialize_filesystemencoding() {

graalpython/com.oracle.graal.python.cext/src/typeobject.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,14 @@ static void inherit_slots(PyTypeObject *type, PyTypeObject *base) {
316316
#define COPYMAP(SLOT) COPYSLOT(tp_as_mapping->SLOT)
317317
#define COPYBUF(SLOT) COPYSLOT(tp_as_buffer->SLOT)
318318

319+
if (type->tp_as_buffer != NULL && base->tp_as_buffer != NULL) {
320+
basebase = base->tp_base;
321+
if (basebase->tp_as_buffer == NULL)
322+
basebase = NULL;
323+
COPYBUF(bf_getbuffer);
324+
COPYBUF(bf_releasebuffer);
325+
}
326+
319327
basebase = base->tp_base;
320328

321329
COPYSLOT(tp_dealloc);
@@ -727,6 +735,21 @@ int PyType_Ready(PyTypeObject* cls) {
727735
}
728736
}
729737

738+
/* Some more special stuff */
739+
base = cls->tp_base;
740+
if (base != NULL) {
741+
// if (cls->tp_as_async == NULL)
742+
// cls->tp_as_async = base->tp_as_async;
743+
// if (cls->tp_as_number == NULL)
744+
// cls->tp_as_number = base->tp_as_number;
745+
// if (cls->tp_as_sequence == NULL)
746+
// cls->tp_as_sequence = base->tp_as_sequence;
747+
// if (cls->tp_as_mapping == NULL)
748+
// cls->tp_as_mapping = base->tp_as_mapping;
749+
if (cls->tp_as_buffer == NULL)
750+
cls->tp_as_buffer = base->tp_as_buffer;
751+
}
752+
730753
/* Link into each base class's list of subclasses */
731754
bases = cls->tp_bases;
732755
n = PyTuple_GET_SIZE(bases);

graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/GraalPythonMain.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,10 @@ private String[] getExecutableList() {
476476
for (String arg : ManagementFactory.getRuntimeMXBean().getInputArguments()) {
477477
if (arg.matches("(-Xrunjdwp:|-agentlib:jdwp=).*suspend=y.*")) {
478478
arg = arg.replace("suspend=y", "suspend=n");
479-
}
480-
if ((javaOptions != null && javaOptions.contains(arg)) || (javaToolOptions != null && javaToolOptions.contains(arg))) {
479+
} else if (arg.matches(".*ThreadPriorityPolicy.*")) {
480+
// skip this one, it may cause warnings
481+
continue;
482+
} else if ((javaOptions != null && javaOptions.contains(arg)) || (javaToolOptions != null && javaToolOptions.contains(arg))) {
481483
// both _JAVA_OPTIONS and JAVA_TOOL_OPTIONS are adeed during
482484
// JVM startup automatically. We do not want to repeat these
483485
// for subprocesses, because they should also pick up those

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_dataclasses.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
*graalpython.lib-python.3.test.test_dataclasses.TestSlots.test_derived_added_field
158158
*graalpython.lib-python.3.test.test_dataclasses.TestSlots.test_simple
159159
*graalpython.lib-python.3.test.test_dataclasses.TestStringAnnotations.test_classvar
160+
*graalpython.lib-python.3.test.test_dataclasses.TestStringAnnotations.test_classvar_module_level_import
160161
*graalpython.lib-python.3.test.test_dataclasses.TestStringAnnotations.test_initvar
161162
*graalpython.lib-python.3.test.test_dataclasses.TestStringAnnotations.test_isnt_classvar
162163
*graalpython.lib-python.3.test.test_dataclasses.TestStringAnnotations.test_isnt_initvar

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_exceptions.txt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,50 @@
33
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testChainingDescriptors
44
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testExceptionCleanupNames
55
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testExceptionCleanupState
6+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testInfiniteRecursion
7+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testInvalidAttrs
8+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testInvalidTraceback
9+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testKeywordArgs
10+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testNoneClearsTracebackAttr
11+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testRaising
12+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testSettingException
13+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testSyntaxErrorMessage
14+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testSyntaxErrorMissingParens
15+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.testWithTraceback
16+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_3114
17+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_MemoryError
18+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_WindowsError
19+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_badisinstance
20+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_errno_ENOTDIR
21+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_exception_target_in_nested_scope
22+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_exception_with_doc
23+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_close_cleanup_exc_state
24+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_del_cleanup_exc_state
25+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_doesnt_retain_old_exc
26+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_doesnt_retain_old_exc2
27+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_finalizing_and_exc_info
28+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_leaking
29+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_leaking2
30+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_leaking3
31+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_leaking4
32+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_next_cleanup_exc_state
33+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_send_cleanup_exc_state
34+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_generator_throw_cleanup_exc_state
35+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_memory_error_cleanup
36+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_memory_error_in_PyErr_PrintEx
37+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_raise_in_generator
38+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_recursion_error_cleanup
39+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_recursion_normalizing_exception
40+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_recursion_normalizing_infinite_exception
41+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_recursion_normalizing_with_no_memory
42+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_str
43+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_unhandled
44+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_unicode_change_attributes
45+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_unicode_errors_no_object
46+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_unraisable
47+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_windows_message
48+
*graalpython.lib-python.3.test.test_exceptions.ExceptionTests.test_yield_in_nested_try_excepts
49+
*graalpython.lib-python.3.test.test_exceptions.ImportErrorTests.test_attributes
50+
*graalpython.lib-python.3.test.test_exceptions.ImportErrorTests.test_copy_pickle
51+
*graalpython.lib-python.3.test.test_exceptions.ImportErrorTests.test_non_str_argument
52+
*graalpython.lib-python.3.test.test_exceptions.ImportErrorTests.test_reset_attributes

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_re.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
*graalpython.lib-python.3.test.test_re.ReTests.test_match_repr
8080
*graalpython.lib-python.3.test.test_re.ReTests.test_misc_errors
8181
*graalpython.lib-python.3.test.test_re.ReTests.test_multiple_repeat
82+
*graalpython.lib-python.3.test.test_re.ReTests.test_named_unicode_escapes
8283
*graalpython.lib-python.3.test.test_re.ReTests.test_not_literal
8384
*graalpython.lib-python.3.test.test_re.ReTests.test_nothing_to_repeat
8485
*graalpython.lib-python.3.test.test_re.ReTests.test_other_escapes

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_smtplib.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*graalpython.lib-python.3.test.test_smtplib.BadHELOServerTests.testFailingHELO
22
*graalpython.lib-python.3.test.test_smtplib.DebuggingServerTests.testBasic
3+
*graalpython.lib-python.3.test.test_smtplib.DebuggingServerTests.testELHO
34
*graalpython.lib-python.3.test.test_smtplib.DebuggingServerTests.testEXPNNotImplemented
45
*graalpython.lib-python.3.test.test_smtplib.DebuggingServerTests.testHELP
56
*graalpython.lib-python.3.test.test_smtplib.DebuggingServerTests.testNOOP

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_threading.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
*graalpython.lib-python.3.test.test_threading.ExceptHookTests.test_excepthook
7272
*graalpython.lib-python.3.test.test_threading.ExceptHookTests.test_excepthook_thread_None
7373
*graalpython.lib-python.3.test.test_threading.ExceptHookTests.test_system_exit
74+
*graalpython.lib-python.3.test.test_threading.InterruptMainTests.test_interrupt_main_noerror
7475
*graalpython.lib-python.3.test.test_threading.LockTests.test_acquire_contended
7576
*graalpython.lib-python.3.test.test_threading.LockTests.test_acquire_destroy
7677
*graalpython.lib-python.3.test.test_threading.LockTests.test_acquire_release
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*graalpython.lib-python.3.test.test_threadsignals.ThreadSignals.test_lock_acquire_retries_on_intr
2+
*graalpython.lib-python.3.test.test_threadsignals.ThreadSignals.test_rlock_acquire_retries_on_intr

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextBuiltins.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,23 +1146,6 @@ static Object doPythonObject(PythonClassNativeWrapper klass, Object ptr,
11461146
}
11471147
}
11481148

1149-
@Builtin(name = "PyTruffle_SetBufferProcs", minNumOfPositionalArgs = 3)
1150-
@GenerateNodeFactory
1151-
abstract static class PyTruffleSetBufferProcs extends PythonTernaryBuiltinNode {
1152-
1153-
@Specialization
1154-
static Object doNativeWrapper(PythonClassNativeWrapper nativeWrapper, Object getBufferProc, Object releaseBufferProc) {
1155-
nativeWrapper.setGetBufferProc(getBufferProc);
1156-
nativeWrapper.setReleaseBufferProc(releaseBufferProc);
1157-
return PNone.NO_VALUE;
1158-
}
1159-
1160-
@Specialization
1161-
static Object doPythonObject(PythonManagedClass obj, Object getBufferProc, Object releaseBufferProc) {
1162-
return doNativeWrapper(obj.getClassNativeWrapper(), getBufferProc, releaseBufferProc);
1163-
}
1164-
}
1165-
11661149
@Builtin(name = "PyMemoryView_FromObject", minNumOfPositionalArgs = 1)
11671150
@GenerateNodeFactory
11681151
abstract static class PyTruffleMemoryViewFromObject extends NativeBuiltin {

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

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import static com.oracle.graal.python.builtins.objects.cext.capi.NativeMember.OB_REFCNT;
5353
import static com.oracle.graal.python.builtins.objects.cext.capi.NativeMember.OB_TYPE;
5454
import static com.oracle.graal.python.builtins.objects.cext.capi.NativeMember.TP_ALLOC;
55+
import static com.oracle.graal.python.builtins.objects.cext.capi.NativeMember.TP_AS_BUFFER;
5556
import static com.oracle.graal.python.builtins.objects.cext.capi.NativeMember.TP_BASICSIZE;
5657
import static com.oracle.graal.python.builtins.objects.cext.capi.NativeMember.TP_DEALLOC;
5758
import static com.oracle.graal.python.builtins.objects.cext.capi.NativeMember.TP_DEL;
@@ -84,7 +85,6 @@
8485
import java.util.logging.Level;
8586

8687
import com.oracle.graal.python.PythonLanguage;
87-
import com.oracle.graal.python.builtins.Python3Core;
8888
import com.oracle.graal.python.builtins.PythonBuiltinClassType;
8989
import com.oracle.graal.python.builtins.modules.cext.PythonCextBuiltins;
9090
import com.oracle.graal.python.builtins.modules.ctypes.StgDictObject;
@@ -472,45 +472,9 @@ static Object doTpAsNumber(PythonManagedClass object, @SuppressWarnings("unused"
472472

473473
@Specialization(guards = "eq(TP_AS_BUFFER, key)")
474474
static Object doTpAsBuffer(PythonManagedClass object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key,
475-
@Cached IsSubtypeNode isSubtype,
476-
@Cached BranchProfile notBytes,
477-
@Cached BranchProfile notBytearray,
478-
@Cached BranchProfile notMemoryview,
479-
@Cached BranchProfile notBuffer,
480-
@Cached BranchProfile notMmap,
481475
@Cached LookupNativeMemberInMRONode lookupTpAsBufferNode,
482476
@Shared("nullToSulongNode") @Cached ToSulongNode toSulongNode) {
483-
Python3Core core = PythonContext.get(toSulongNode);
484-
PythonBuiltinClass pBytes = core.lookupType(PythonBuiltinClassType.PBytes);
485-
if (isSubtype.execute(object, pBytes)) {
486-
return new PyBufferProcsWrapper(pBytes);
487-
}
488-
notBytes.enter();
489-
PythonBuiltinClass pBytearray = core.lookupType(PythonBuiltinClassType.PByteArray);
490-
if (isSubtype.execute(object, pBytearray)) {
491-
return new PyBufferProcsWrapper(pBytearray);
492-
}
493-
notBytearray.enter();
494-
PythonBuiltinClass pMemoryview = core.lookupType(PythonBuiltinClassType.PMemoryView);
495-
if (isSubtype.execute(object, pMemoryview)) {
496-
return new PyBufferProcsWrapper(pMemoryview);
497-
}
498-
notMemoryview.enter();
499-
PythonBuiltinClass pBuffer = core.lookupType(PythonBuiltinClassType.PBuffer);
500-
if (isSubtype.execute(object, pBuffer)) {
501-
return new PyBufferProcsWrapper(pBuffer);
502-
}
503-
notBuffer.enter();
504-
PythonBuiltinClass pMmap = core.lookupType(PythonBuiltinClassType.PMMap);
505-
if (isSubtype.execute(object, pMmap)) {
506-
return new PyBufferProcsWrapper(pMmap);
507-
}
508-
notMmap.enter();
509-
/*
510-
* Managed classes don't store PyBufferProcs objects and so there is no attribute. This
511-
* is why we use managedMemberName == "".
512-
*/
513-
Object result = lookupTpAsBufferNode.execute(object, NativeMember.TP_AS_BUFFER, "");
477+
Object result = lookupTpAsBufferNode.execute(object, NativeMember.TP_AS_BUFFER, TypeBuiltins.TYPE_AS_BUFFER);
514478
if (result == PNone.NO_VALUE) {
515479
// NULL pointer
516480
return toSulongNode.execute(PythonContext.get(toSulongNode).getNativeNull());
@@ -1457,6 +1421,13 @@ static void doTpFree(Object object, @SuppressWarnings("unused") PythonNativeWrap
14571421
writeAttrNode.execute(object, TypeBuiltins.TYPE_FREE, asPythonObjectNode.execute(freeFunc));
14581422
}
14591423

1424+
@Specialization(guards = {"isPythonClass(object)", "eq(TP_AS_BUFFER, key)"})
1425+
static void doTpAsBuffer(Object object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key, Object bufferProcs,
1426+
@Cached WriteAttributeToObjectNode writeAttrNode,
1427+
@Cached WrapVoidPtrNode asPythonObjectNode) {
1428+
writeAttrNode.execute(object, TypeBuiltins.TYPE_AS_BUFFER, asPythonObjectNode.execute(bufferProcs));
1429+
}
1430+
14601431
@GenerateUncached
14611432
static final class EachSubclassAdd extends HashingStorageLibrary.ForEachNode<SubclassAddState> {
14621433

@@ -1633,6 +1604,7 @@ protected boolean isMemberModifiable(String member) {
16331604
MD_STATE.getMemberName().equals(member) ||
16341605
TP_DICT.getMemberName().equals(member) ||
16351606
TP_DICTOFFSET.getMemberName().equals(member) ||
1607+
TP_AS_BUFFER.getMemberName().equals(member) ||
16361608
MEMORYVIEW_EXPORTS.getMemberName().equals(member);
16371609
}
16381610

0 commit comments

Comments
 (0)