Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
GH-94382: port multiprocessing static types to heap types#94336
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
10 commits Select commit Hold shift + click to select a range
ff5673f port multiprocssing types to heap types
kumaraditya303 100ad99 fix allocation
kumaraditya303 08c501d remove mod state
kumaraditya303 31d44d9 decref
kumaraditya303 4e71aac Apply suggestions from code review
kumaraditya303 ccab6e6 code review from Victor
kumaraditya303 3e5cb84 📜🤖 Added by blurb_it.
blurb-it[bot] 1251e74 Merge branch 'main' of https://github.com/python/cpython into multipr…
kumaraditya303 ef7ce6c Merge branch 'multiprocessing' of https://github.com/kumaraditya303/c…
kumaraditya303 919bbe0 edit news
kumaraditya303 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions 1 Misc/NEWS.d/next/Library/2022-07-03-16-41-03.gh-issue-94382.zuVZeM.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Port static types of ``_multiprocessing`` module to heap types. Patch by Kumar Aditya. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -568,10 +568,13 @@ _multiprocessing_SemLock__rebuild_impl(PyTypeObject *type, SEM_HANDLE handle, | ||
| static void | ||
| semlock_dealloc(SemLockObject* self) | ||
| { | ||
| PyTypeObject *tp = Py_TYPE(self); | ||
| PyObject_GC_UnTrack(self); | ||
| if (self->handle != SEM_FAILED) | ||
| SEM_CLOSE(self->handle); | ||
| PyMem_Free(self->name); | ||
| Py_TYPE(self)->tp_free((PyObject*)self); | ||
| tp->tp_free(self); | ||
| Py_DECREF(tp); | ||
| } | ||
| /*[clinic input] | ||
| @@ -701,6 +704,13 @@ _multiprocessing_SemLock___exit___impl(SemLockObject *self, | ||
| return _multiprocessing_SemLock_release_impl(self); | ||
| } | ||
| static int | ||
| semlock_traverse(SemLockObject *s, visitproc visit, void *arg) | ||
| { | ||
| Py_VISIT(Py_TYPE(s)); | ||
| return 0; | ||
| } | ||
| /* | ||
| * Semaphore methods | ||
| */ | ||
| @@ -739,45 +749,26 @@ static PyMemberDef semlock_members[] ={ | ||
| * Semaphore type | ||
| */ | ||
| PyTypeObject _PyMp_SemLockType ={ | ||
| PyVarObject_HEAD_INIT(NULL, 0) | ||
| /* tp_name */ "_multiprocessing.SemLock", | ||
| /* tp_basicsize */ sizeof(SemLockObject), | ||
| /* tp_itemsize */ 0, | ||
| /* tp_dealloc */ (destructor)semlock_dealloc, | ||
| /* tp_vectorcall_offset */ 0, | ||
| /* tp_getattr */ 0, | ||
| /* tp_setattr */ 0, | ||
| /* tp_as_async */ 0, | ||
| /* tp_repr */ 0, | ||
| /* tp_as_number */ 0, | ||
| /* tp_as_sequence */ 0, | ||
| /* tp_as_mapping */ 0, | ||
| /* tp_hash */ 0, | ||
| /* tp_call */ 0, | ||
| /* tp_str */ 0, | ||
| /* tp_getattro */ 0, | ||
| /* tp_setattro */ 0, | ||
| /* tp_as_buffer */ 0, | ||
| /* tp_flags */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, | ||
| /* tp_doc */ "Semaphore/Mutex type", | ||
| /* tp_traverse */ 0, | ||
| /* tp_clear */ 0, | ||
| /* tp_richcompare */ 0, | ||
| /* tp_weaklistoffset */ 0, | ||
| /* tp_iter */ 0, | ||
| /* tp_iternext */ 0, | ||
| /* tp_methods */ semlock_methods, | ||
| /* tp_members */ semlock_members, | ||
| /* tp_getset */ 0, | ||
| /* tp_base */ 0, | ||
| /* tp_dict */ 0, | ||
| /* tp_descr_get */ 0, | ||
| /* tp_descr_set */ 0, | ||
| /* tp_dictoffset */ 0, | ||
| /* tp_init */ 0, | ||
| /* tp_alloc */ 0, | ||
| /* tp_new */ _multiprocessing_SemLock, | ||
| static PyType_Slot _PyMp_SemLockType_slots[] ={ | ||
| {Py_tp_dealloc, semlock_dealloc}, | ||
| {Py_tp_getattro, PyObject_GenericGetAttr}, | ||
| {Py_tp_setattro, PyObject_GenericSetAttr}, | ||
| {Py_tp_methods, semlock_methods}, | ||
| {Py_tp_members, semlock_members}, | ||
| {Py_tp_alloc, PyType_GenericAlloc}, | ||
| {Py_tp_new, _multiprocessing_SemLock}, | ||
| {Py_tp_traverse, semlock_traverse}, | ||
| {Py_tp_free, PyObject_GC_Del}, | ||
erlend-aasland marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| {Py_tp_doc, (void *)PyDoc_STR("Semaphore/Mutex type")}, | ||
| {0, 0}, | ||
| }; | ||
| PyType_Spec _PyMp_SemLockType_spec ={ | ||
| .name = "_multiprocessing.SemLock", | ||
| .basicsize = sizeof(SemLockObject), | ||
| .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | | ||
| Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE), | ||
| .slots = _PyMp_SemLockType_slots, | ||
| }; | ||
| /* | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.