10000 Clarify that refcount ops do not mess with exceptions. · markshannon/New-C-API-for-Python@aba6f90 · GitHub
[go: up one dir, main page]

Skip to content

Commit aba6f90

Browse files
committed
Clarify that refcount ops do not mess with exceptions.
1 parent 82849a3 commit aba6f90

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

DesignRules.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ API functions must obey the following rules:
6666
Note that if an API function does not produce a result, the result of calling `PyApi_GetLatestException()`
6767
is undefined. It will be a legal, safe to use value; it will just be meaningless.
6868

69+
6970
### Functions that return references
7071

7172
Many functions return a result, but may also raise an exception.
@@ -110,6 +111,13 @@ int PyApi_List_Append(PyContext ctx, PyListRef list, PyRef item);
110111
```
111112
Success is indicated by returning a negative value, usually -1.
112113

114+
### Cleanup after an error
115+
116+
In order to allow the cleanup of references after an error,
117+
`PyRef_Dup`, `PyRef_Close` and `PyRef_Free` will not change the
118+
result of `PyApi_GetLatestException()`.
119+
120+
113121
## Naming
114122

115123
All API function and struct names should adhere to simple rules.

0 commit comments

Comments
 (0)
0