GeezerVison is showing github.com — [WIP] Add SemLock implementation to RustPython by Copilot · Pull Request #6506 · RustPython/RustPython
Conversation
Copilot
AI
commented
Dec 25, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
- Establish baseline by running targeted existing tests to observe current failures
- Implement
_multiprocessing.SemLock and sem_unlink functionality (Unix-focused, preserving Windows behavior)
- Add or adapt focused tests to cover basic SemLock creation and acquire/release
- Run targeted tests for
_multiprocessing/multiprocessing synchronization and verify behavior
- Final review, code cleanup, and security checks
Original prompt
This section details on the original issue you should resolve
<issue_title>_multiprocessing_SemLock</issue_title>
<issue_description>This is missing in RustPython.</issue_description>
<agent_instructions>Checkout SemLock in CPython and implement one for RustPython</agent_instructions>
Comments on the Issue (you are @copilot in this section)
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Important
Review skipped
Bot user detected.
To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Comment @coderabbitai help to get the list of available commands and usage tips.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
@copilot try again
Implemented Unix _multiprocessing.SemLock (with constants and sem_unlink) and ran rustpython-stdlib tests in ec25df2.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@copilot fix CI failure
error[E0425]: cannot find function `sem_getvalue` in crate `libc`
--> crates/stdlib/src/multiprocessing.rs:308:38
|
308 | let res = unsafe { libc::sem_getvalue(self.handle.as_ptr(), &mut value) };
| ^^^^^^^^^^^^ not found in `libc`
error[E0425]: cannot find function `sem_timedwait` in crate `libc`
--> crates/stdlib/src/multiprocessing.rs:387:42
|
387 | let res = unsafe { libc::sem_timedwait(self.handle.as_ptr(), &ts) };
| ^^^^^^^^^^^^^ help: a function with a similar name exists: `sem_trywait`
|
::: /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.178/src/unix/mod.rs:1550:5
|
1550 | pub fn sem_trywait(sem: *mut sem_t) -> c_int;
| --------------------------------------------- similarly named function `sem_trywait` defined here
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
@copilot fix CI failure
...
Added explicit extern bindings for sem_getvalue/sem_timedwait so CI builds succeed across libc targets; rustpython-stdlib tests now pass (aa11f3e).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@copilot Something wrong. Carefully review the CI result and fix the problem.
e.g.
Run target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v test__colorize test_array test_asyncgen test_binop test_bisect test_bool test_bytes test_call test_class test_cmath test_collections test_complex test_contains test_copy test_dataclasses test_decimal test_decorators test_defaultdict test_deque test_dict test_dictcomps test_dictviews test_dis test_enumerate test_exception_variations test_float test_format test_fractions test_genericalias test_genericclass test_grammar test_range test_index test_int test_int_literal test_isinstance test_iter test_iterlen test_itertools test_json test_keyword test_keywordonlyarg test_list test_long test_longexp test_math test_operator test_ordered_dict test_pow test_raise test_richcmp test_scope test_set test_slice test_sort test_string test_string_literals test_strtod test_structseq test_subclassinit test_super test_syntax test_tuple test_types test_unary test_unpack test_weakref test_yield_from
thread 'main' (4106) panicked at crates/stdlib/src/multiprocessing.rs:343:22:
intern RECURSIVE_MUTEX
stack backtrace:
0: 0x55b58e7f3253 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h718e2d17a1928e63
1: 0x55b58d63ea2f - core::fmt::write::h1d2246b072ea91eb
2: 0x55b58e7c6ea3 - std::io::Write::write_fmt::haf55272405c09d9b
3: 0x55b58e7cf6d2 - std::sys::backtrace::BacktraceLock::print::h61c3bd81a9458a03
4: 0x55b58e7d27ae - std::panicking::default_hook::{{closure}}::haf1ffb5d1e33a97f
5: 0x55b58e7d22ef - std::panicking::default_hook::hc32245deb6eaa988
6: 0x55b58e7d2b95 - std::panicking::panic_with_hook::h43adc00fd0e494cb
7: 0x55b58e7d299a - std::panicking::panic_handler::{{closure}}::h44391079756da3e7
8: 0x55b58e7cf819 - std::sys::backtrace::__rust_end_short_backtrace::h934e1568393e5b8f
9: 0x55b58e7ba36d - __rustc[d9b87f19e823c0ef]::rust_begin_unwind
10: 0x55b58d649020 - core::panicking::panic_fmt::h62031895f6e012da
11: 0x55b58d647ebb - core::option::expect_failed::h40dde8b63ee0f843
12: 0x55b58dfbc382 - <rustpython_stdlib::multiprocessing::_multiprocessing::SemLock as rustpython_vm::class::PyClassImpl>::impl_extend_class::h82ef0c5c139008a2
13: 0x55b58dfbf3d4 - rustpython_vm::class::PyClassImpl::extend_class::h06a341b4833469e9
14: 0x55b58df6e5f8 - once_cell::imp::OnceCell<T>::initialize::{{closure}}::h14eb56b716e2e7f9
15: 0x55b58db718cc - once_cell::imp::initialize_or_wait::h34fa2e290e5e2ed3
16: 0x55b58df6bd82 - once_cell::imp::OnceCell<T>::initialize::h11c02bfa74ceb193
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
@copilot Something wrong. Carefully review the CI result and fix the problem.
e.g.
...
Switched SemLock constants to use ctx.intern_str to avoid missing intern entries (panic fixed) and reran cargo test -p rustpython-stdlib --lib -- --nocapture successfully (c91612c).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
youknowone
Awaiting requested review from youknowone
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
_multiprocessing_SemLock
Uh oh!
There was an error while loading. Please reload this page.
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.
|