FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Modules/_testinternalcapi/set.c at main · python/cpython · GitHub
python
/
cpython
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
37.4k
Star
77.5k
Code
Issues
5k+
Pull requests
2.7k
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Modules
/
_testinternalcapi
/
set.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (55 loc) · 1.42 KB
Breadcrumbs
cpython
/
Modules
/
_testinternalcapi
/
set.c
Copy path
File metadata and controls
63 lines (55 loc) · 1.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include
"parts.h"
#include
"../_testcapi/util.h"
// NULLABLE, RETURN_INT
#include
"pycore_critical_section.h"
#include
"pycore_setobject.h"
static
PyObject
*
set_update
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
set
,
*
iterable
;
if
(!
PyArg_ParseTuple
(
args
,
"OO"
,
&
set
,
&
iterable
)) {
return
NULL
;
}
NULLABLE
(
set
);
NULLABLE
(
iterable
);
RETURN_INT
(
_PySet_Update
(
set
,
iterable
));
}
static
PyObject
*
set_next_entry
(
PyObject
*
self
,
PyObject
*
args
)
{
int
rc
;
Py_ssize_t
pos
;
Py_hash_t
hash
=
(
Py_hash_t
)
UNINITIALIZED_SIZE
;
PyObject
*
set
,
*
item
=
UNINITIALIZED_PTR
;
if
(!
PyArg_ParseTuple
(
args
,
"On"
,
&
set
,
&
pos
)) {
return
NULL
;
}
NULLABLE
(
set
);
Py_BEGIN_CRITICAL_SECTION
(
set
);
rc
=
_PySet_NextEntryRef
(
set
,
&
pos
,
&
item
,
&
hash
);
Py_END_CRITICAL_SECTION
();
if
(
rc
==
1
) {
PyObject
*
ret
=
Py_BuildValue
(
"innO"
,
rc
,
pos
,
hash
,
item
);
Py_DECREF
(
item
);
return
ret
;
}
assert
(
item
==
UNINITIALIZED_PTR
);
assert
(
hash
==
(
Py_hash_t
)
UNINITIALIZED_SIZE
);
if
(
rc
==
-1
) {
return
NULL
;
}
assert
(
rc
==
0
);
Py_RETURN_NONE
;
}
static
PyMethodDef
TestMethods
[]
=
{
{
"set_update"
,
set_update
,
METH_VARARGS
},
{
"set_next_entry"
,
set_next_entry
,
METH_VARARGS
},
{
NULL
},
};
int
_PyTestInternalCapi_Init_Set
(
PyObject
*
m
)
{
if
(
PyModule_AddFunctions
(
m
,
TestMethods
)
<
0
) {
return
-1
;
}
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL