This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author snwokenk
Recipients snwokenk, steven.daprano, yselivanov
Date 2017-11-11.05:16:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1510377364.49.0.213398074469.issue32003@psf.upfronthosting.co.za>
In-reply-to
Content
I completely wrote the wrong code: 

So I'll copy and paste:

--------------------
Scenario 1
import multiprocessing

br = multiprocessing.Array('c', 1)

br[0] = 's'

print(br[:])

Scenario 1 result = "TypeError: one character bytes, bytearray or integer expected"

-------------------------

Scenario 2
import multiprocessing

br = multiprocessing.Array('b', 1)

br[0] = 's'.encode()

print(br[:])

Scenario 2 results = "TypeError: an integer is required (got type bytes)"

-----------------------------------

I believe my confusion is that I am thinking more of the python data type byte, which takes b'', than C language data type byte (which takes numbers from -127 to 128. This confusion is compounded when I do something like scenario 3:
-------------------------------

import multiprocessing

br = multiprocessing.Array('c', 1)

br[0] = 's'.encode()

print(br[:])

scenario 3 results: b's'
------------------

In the first scenario passing 's' i get an error, even though by definition 's' is a c char data type.
History
Date User Action Args
2017-11-11 05:16:04snwokenksetrecipients: + snwokenk, steven.daprano, yselivanov
2017-11-11 05:16:04snwokenksetmessageid: <1510377364.49.0.213398074469.issue32003@psf.upfronthosting.co.za>
2017-11-11 05:16:04snwokenklinkissue32003 messages
2017-11-11 05:16:03snwokenkcreate