Skip to content

Conversation

@tomasr8
Copy link
Member

@tomasr8 tomasr8 commented Apr 14, 2025

I linked to the ctypes types table and added this sentence:

In addition, the c typecode is an alias for :class:ctypes.c_char.

The rest of the diff is just wrapping.


📚 Documentation preview 📚: https://cpython-previews--132504.org.readthedocs.build/

Copy link
Member

@gpshead gpshead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also mention that the w typecode of array is not supported? (glancing at the code, it is missing from Lib/multiprocessing/sharedctypes.py)

@tomasr8
Copy link
Member Author

tomasr8 commented Apr 14, 2025

Could you also mention that the w typecode of array is not supported? (glancing at the code, it is missing from Lib/multiprocessing/sharedctypes.py)

Will do. Do you think it's worth to improve the error message for invalid typecodes as well? TypeError: this type has no size is a bit cryptic imo. Compare with the array.array error:

>>> array('x')
...
ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, q, Q, f or d)

(And I just noticed that the error message doesn't include 'w' 😆 )

@gpshead
Copy link
Member

gpshead commented Apr 14, 2025

Yeah, improving the error message and/or even adding 'w' support are all also viable options. I expect this part of the code was inherited from the original upstream project multiprocessing came from and likely hasn't been meaningfully touched since? It's a dark corner.

@tomasr8
Copy link
Member Author

tomasr8 commented Apr 14, 2025

Updated to mention that 'w' is not supported.

improving the error message and/or even adding 'w' support are all also viable options.

I'll send a patch to improve the error message and align it with that of array.array. I'm not that familiar with this module so I'm not sure how useful it'd be to add support for 'w'. I'll check how many changes that would require.

@tomasr8
Copy link
Member Author

tomasr8 commented Dec 27, 2025

I'm planning to merge this docs fix, we can think about supporting 'w' in a separate issue :)

@gpshead gpshead added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Dec 27, 2025
@tomasr8 tomasr8 merged commit 136f6d8 into python:main Jan 2, 2026
32 checks passed
@tomasr8 tomasr8 deleted the multiprocessing-array-docs branch January 2, 2026 19:18
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Jan 2, 2026
@miss-islington-app
Copy link

Thanks @tomasr8 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 2, 2026
pythonGH-132504)

* Document the `c` typecode for `multiprocessing.Array`.

* Add quotes

* Mention that 'w' is not supported
(cherry picked from commit 136f6d8)

Co-authored-by: Tomas R. <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jan 2, 2026

GH-143369 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jan 2, 2026
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 2, 2026
pythonGH-132504)

* Document the `c` typecode for `multiprocessing.Array`.

* Add quotes

* Mention that 'w' is not supported
(cherry picked from commit 136f6d8)

Co-authored-by: Tomas R. <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jan 2, 2026

GH-143370 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 2, 2026
tomasr8 added a commit that referenced this pull request Jan 2, 2026
…`. (GH-132504) (#143369)

gh-76187: Document the `c` typecode for `multiprocessing.Array`. (GH-132504)

* Document the `c` typecode for `multiprocessing.Array`.

* Add quotes

* Mention that 'w' is not supported
(cherry picked from commit 136f6d8)

Co-authored-by: Tomas R <[email protected]>
tomasr8 added a commit that referenced this pull request Jan 2, 2026
…`. (GH-132504) (#143370)

gh-76187: Document the `c` typecode for `multiprocessing.Array`. (GH-132504)

* Document the `c` typecode for `multiprocessing.Array`.

* Add quotes

* Mention that 'w' is not supported
(cherry picked from commit 136f6d8)

Co-authored-by: Tomas R <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants