New GitHub issue #119413 from DylanZA:<br>

<hr>

<pre>
# Crash report

### What happened?

It seems that the below code will serialize the pointer to the lock handle over to the child process, and then rebuild the raw pointer in https://github.com/python/cpython/blob/main/Modules/_multiprocessing/clinic/semaphore.c.h#L331

this then segfaults the child process - which seems to cause new children to spin up.


```python
import multiprocessing
import os

def _init(l):
 print(os.getpid())
    print(l)

def main():
    ctx = multiprocessing.get_context(method="forkserver")
    lock = multiprocessing.Lock()
    with ctx.Pool(1, initializer=_init, initargs=(lock,)) as pool:
        ret = pool.map(print, [1])

if __name__ == "__main__":
    main()
```


### CPython versions tested on:

3.10, 3.11

### Operating systems tested on:

Linux

### Output from running 'python -VV' on the command line:

_No response_
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/119413">View on GitHub</a>
<p>Labels: type-crash</p>
<p>Assignee: </p>