python / python/cpython

Array.array Type Codes are not platforminvariant.

Open
#96,467 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

The platform-specific type codes interpretations for array.array make it more complex to write python code that contains known type codes and data bytes and will run reliably on all platforms. In particular, the 'l' and 'L' codes are 4 bytes on Windows, but 8 bytes on macOS. The 'i' and 'I' codes seem to be 4 in both cases, but that is a convention, not a requirement. There should be 4-byte and 8-byte integer types that guarantee that size regardless of platform---perhaps '4' and '8' for signed, '5' and '9' for unsigned. (I haven't tested other type codes.) The documentation should be updated in the meantime.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the array.array type-code behavior across platforms and reviewing the related documentation. Determine which type-code guarantees are feasible without breaking existing conventions; done means the supported codes have consistent documented sizes and the documentation explains the platform differences or new guarantees.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.