@@ -12,7 +12,7 @@ index e2e1f694..870ef417 100644
1212 option(BUILD_DOCS "Build Caffe2 documentation" OFF)
1313 option(BUILD_CUSTOM_PROTOBUF "Build and use Caffe2's own protobuf under third_party" ON)
1414diff --git a/functorch/csrc/dim/dim.cpp b/functorch/csrc/dim/dim.cpp
15- index abdebc24 ..4f235d66 100644
15+ index 9bab33b6 ..4f235d66 100644
1616--- a/functorch/csrc/dim/dim.cpp
1717+++ b/functorch/csrc/dim/dim.cpp
1818@@ -6,7 +6,7 @@
@@ -24,15 +24,6 @@ index abdebc24..4f235d66 100644
2424 #include <utility>
2525 #include <new>
2626 #include <iostream>
27- @@ -1304,7 +1304,7 @@ static py::object __torch_function__(Arena &A, py::handle orig, py::vector_args
28- }
29-
30- py::vector_args as_vector_args(Arena& A, py::handle args, py::handle kwargs) {
31- - auto pos_args = (py::handle*) &PyTuple_GET_ITEM(args.ptr(), 0);
32- + auto pos_args = (py::handle*) PySequence_Fast_ITEMS(args.ptr());
33- auto pos_n = PyTuple_GET_SIZE(args.ptr());
34- if (!kwargs.ptr()) {
35- return py::vector_args(pos_args, pos_n, nullptr);
3627@@ -1421,6 +1421,7 @@ PyTypeObject Tensor::Type = {
3728
3829 // dim() --------------------
@@ -307,10 +298,10 @@ index b847129d..3219d1e1 100644
307298 def clone(self):
308299 return self.__class__(self.mode)
309300diff --git a/torch/csrc/Module.cpp b/torch/csrc/Module.cpp
310- index 8e1ca3b1..b150ac3f 100644
301+ index 3af2e723..df857f31 100644
311302--- a/torch/csrc/Module.cpp
312303+++ b/torch/csrc/Module.cpp
313- @@ -257,50 +257,14 @@ PyObject* THPModule_addDocStr(PyObject* _unused, PyObject* args) {
304+ @@ -257,50 +257,16 @@ PyObject* THPModule_addDocStr(PyObject* _unused, PyObject* args) {
314305 doc_str = all_docs.back().c_str();
315306 }
316307
@@ -320,7 +311,7 @@ index 8e1ca3b1..b150ac3f 100644
320311- return PyErr_Format(
321312- PyExc_RuntimeError,
322313- "function '%s' already has a docstring",
323- - f->m_ml ->ml_name);
314+ - _PyCFunction_GetMethodDef((PyObject*)(f)) ->ml_name);
324315- }
325316- PyObject_SetDoc((PyObject*)(f), doc_str);
326317- } else if (strcmp(Py_TYPE(obj)->tp_name, "method_descriptor") == 0) {
@@ -354,6 +345,7 @@ index 8e1ca3b1..b150ac3f 100644
354345- }
355346- t->tp_doc = doc_str;
356347- } else {
348+ + // GraalPy change
357349+ if (PyObject_GetDoc(obj)) {
358350 return PyErr_Format(
359351- PyExc_TypeError,
@@ -363,6 +355,7 @@ index 8e1ca3b1..b150ac3f 100644
363355+ "object '%100R' already has a docstring",
364356+ obj);
365357+ }
358+ + // GraalPy change
366359+ if (PyObject_SetDoc(obj, doc_str) < 0) {
367360+ return NULL;
368361 }
0 commit comments