-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
GH-132554: "Virtual" iterators #132555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-132554: "Virtual" iterators #132555
Changes from 13 commits
7476442
38a429f
2caf56f
588943a
aa62e39
88562ec
025049d
35e389d
e8f4ce6
ed89950
ec8d797
cad1946
428735b
4c83848
f43ccc3
3fd46c3
433282f
e915a05
69a328d
6d1b93e
37ca285
f3b9074
0efab59
a0d814b
5cd55c4
867bd10
d9dc597
d60ef23
9a9d20d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,6 +233,9 @@ extern intptr_t PyStackRef_UntagInt(_PyStackRef ref); | |
|
||
extern _PyStackRef PyStackRef_TagInt(intptr_t i); | ||
|
||
/* Increments a tagged int, but does not check for overflow */ | ||
extern _PyStackRef PyStackRef_IncrementTaggedIntNoOverflow(_PyStackRef ref); | ||
|
||
extern bool | ||
PyStackRef_IsNullOrInt(_PyStackRef ref); | ||
|
||
|
@@ -262,6 +265,14 @@ PyStackRef_UntagInt(_PyStackRef i) | |
} | ||
|
||
|
||
static inline _PyStackRef | ||
PyStackRef_IncrementTaggedIntNoOverflow(_PyStackRef ref) | ||
{ | ||
assert(ref.bits != (uintptr_t)-1); // Deosn't overflow | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand why you use this condition. Should it not be |
||
return (_PyStackRef){ .bits = ref.bits + 4 }; | ||
} | ||
|
||
|
||
#ifdef Py_GIL_DISABLED | ||
|
||
#define Py_TAG_DEFERRED (1) | ||
|
@@ -686,7 +697,13 @@ PyStackRef_XCLOSE(_PyStackRef ref) | |
|
||
#endif // !defined(Py_GIL_DISABLED) && defined(Py_STACKREF_DEBUG) | ||
|
||
#define PyStackRef_TYPE(stackref) Py_TYPE(PyStackRef_AsPyObjectBorrow(stackref)) | ||
static inline PyTypeObject * | ||
PyStackRef_TYPE(_PyStackRef stackref) { | ||
if (PyStackRef_IsTaggedInt(stackref)) { | ||
return &PyLong_Type; | ||
} | ||
return Py_TYPE(PyStackRef_AsPyObjectBorrow(stackref)); | ||
} | ||
|
||
// Converts a PyStackRef back to a PyObject *, converting the | ||
// stackref to a new reference. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.