-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
gh-140025: Fix queue.SimpleQueue.__sizeof__()
#143137
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
Changes from 5 commits
4d03baf
b2b05ea
205fd00
21014aa
de68f62
654673a
de5b4c7
9e67b66
034a9cd
887af43
7ba914f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix ``queue.SimpleQueue.__sizeof__()`` computation. | ||
|
Aniketsy marked this conversation as resolved.
Outdated
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,6 +239,21 @@ simplequeue_traverse(PyObject *op, visitproc visit, void *arg) | |
| return 0; | ||
| } | ||
|
|
||
| /*[clinic input] | ||
| @critical_section | ||
| _queue.SimpleQueue.__sizeof__ -> Py_ssize_t | ||
|
|
||
| Returns size in memory, in bytes. | ||
| [clinic start generated code]*/ | ||
|
|
||
| static Py_ssize_t | ||
| _queue_SimpleQueue___sizeof___impl(simplequeueobject *self) | ||
|
Member
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. Can you put the definition of this method after the definition of
Contributor
Author
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. Sure, I’ll update this. |
||
| /*[clinic end generated code: output=58ce4e3bbc078fd4 input=a3a7f05c9616598f]*/ | ||
| { | ||
| Py_ssize_t res = sizeof(simplequeueobject); | ||
| res += self->buf.items_cap * sizeof(PyObject *); | ||
| return res; | ||
| } | ||
|
Aniketsy marked this conversation as resolved.
Outdated
|
||
| /*[clinic input] | ||
| @classmethod | ||
| _queue.SimpleQueue.__new__ as simplequeue_new | ||
|
|
@@ -534,6 +549,7 @@ static PyMethodDef simplequeue_methods[] = { | |
| _QUEUE_SIMPLEQUEUE_PUT_METHODDEF | ||
| _QUEUE_SIMPLEQUEUE_PUT_NOWAIT_METHODDEF | ||
| _QUEUE_SIMPLEQUEUE_QSIZE_METHODDEF | ||
| _QUEUE_SIMPLEQUEUE___SIZEOF___METHODDEF | ||
| {"__class_getitem__", Py_GenericAlias, | ||
| METH_O|METH_CLASS, PyDoc_STR("See PEP 585")}, | ||
| {NULL, NULL} /* sentinel */ | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move
import sysup betweenimport randomandimport threadingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I missed that. I thought running
pre-commit runwould take care of it.