@@ -12,7 +12,7 @@ index e2e1f694..870ef417 100644
12
12
option(BUILD_DOCS "Build Caffe2 documentation" OFF)
13
13
option(BUILD_CUSTOM_PROTOBUF "Build and use Caffe2's own protobuf under third_party" ON)
14
14
diff --git a/functorch/csrc/dim/dim.cpp b/functorch/csrc/dim/dim.cpp
15
- index abdebc24 ..4f235d66 100644
15
+ index 9bab33b6 ..4f235d66 100644
16
16
--- a/functorch/csrc/dim/dim.cpp
17
17
+++ b/functorch/csrc/dim/dim.cpp
18
18
@@ -6,7 +6,7 @@
@@ -24,15 +24,6 @@ index abdebc24..4f235d66 100644
24
24
#include <utility>
25
25
#include <new>
26
26
#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);
36
27
@@ -1421,6 +1421,7 @@ PyTypeObject Tensor::Type = {
37
28
38
29
// dim() --------------------
@@ -307,10 +298,10 @@ index b847129d..3219d1e1 100644
307
298
def clone(self):
308
299
return self.__class__(self.mode)
309
300
diff --git a/torch/csrc/Module.cpp b/torch/csrc/Module.cpp
310
- index 8e1ca3b1..b150ac3f 100644
301
+ index 3af2e723..df857f31 100644
311
302
--- a/torch/csrc/Module.cpp
312
303
+++ 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) {
314
305
doc_str = all_docs.back().c_str();
315
306
}
316
307
@@ -320,7 +311,7 @@ index 8e1ca3b1..b150ac3f 100644
320
311
- return PyErr_Format(
321
312
- PyExc_RuntimeError,
322
313
- "function '%s' already has a docstring",
323
- - f->m_ml ->ml_name);
314
+ - _PyCFunction_GetMethodDef((PyObject*)(f)) ->ml_name);
324
315
- }
325
316
- PyObject_SetDoc((PyObject*)(f), doc_str);
326
317
- } else if (strcmp(Py_TYPE(obj)->tp_name, "method_descriptor") == 0) {
@@ -354,6 +345,7 @@ index 8e1ca3b1..b150ac3f 100644
354
345
- }
355
346
- t->tp_doc = doc_str;
356
347
- } else {
348
+ + // GraalPy change
357
349
+ if (PyObject_GetDoc(obj)) {
358
350
return PyErr_Format(
359
351
- PyExc_TypeError,
@@ -363,6 +355,7 @@ index 8e1ca3b1..b150ac3f 100644
363
355
+ "object '%100R' already has a docstring",
364
356
+ obj);
365
357
+ }
358
+ + // GraalPy change
366
359
+ if (PyObject_SetDoc(obj, doc_str) < 0) {
367
360
+ return NULL;
368
361
}
0 commit comments