Use cpython declaration of _PyWeakref_ClearRef (#136300)

To avoid the DLL inconsistency warning by MSVC:
```
torch/csrc/utils/python_compat.h(38): warning C4273: '_PyWeakref_ClearRef': inconsistent dll linkage
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/136300
Approved by: https://github.com/Skylion007
This commit is contained in:
cyy 2024-09-20 18:58:56 +00:00 committed by PyTorch MergeBot
parent 7f9c06462f
commit d2455b99fb

View File

@ -35,7 +35,11 @@ PyCode_GetNFreevars(PyCodeObject* code) {
} }
// Provided by CPython but getting the header for them is very hard // Provided by CPython but getting the header for them is very hard
#if IS_PYTHON_3_11_PLUS
PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference* self);
#else
extern void _PyWeakref_ClearRef(PyWeakReference* self); extern void _PyWeakref_ClearRef(PyWeakReference* self);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }