This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ANNOUNCEMENT] python3 3.6.1-2 (x86 only)


Hello,

On Fri, 24 Mar 2017 13:22:56 -0500 Yaakov Selkowitz wrote:
> This release fixes thread allocation issues reported with WoW64 on some 
> versions of Windows.  As this only affects 32-bit Cygwin, the 64-bit build
> has not been updated.

Thanks for quick fix. I have confirmed the issue has been fixed.

However, I have found another prombem related this issue.

Python API PyThread_create_key() in the latest release of 64-bit version
returns an invalid key value, which is truncated into int size.

To confirm this, execute following script:
--- from here ---
from ctypes import pythonapi
key = pythonapi.PyThread_create_key()
res1 = pythonapi.PyThread_set_key_value(key, 5555)
res2 = pythonapi.PyThread_get_key_value(key)
res3 = pythonapi.PyThread_delete_key(key)
print(key,res1,res2,res3)
--- to here ---

Expected result is:
1 0 5555 0

'1' in the first column can be any other value, but the remaining columns
must be '0 5555 0'.

However, result of 64-bit version is:
1145600 -1 0 22

This means PyThread_set_key_value(), PyThread_get_key_value() and
PyThread_delete_key() fail to access key 1145600. This is because the key value is invalid. It seems that the 64 bit key value is truncated into
32-bit value.

To fix this issue as well as the issue on WOW, I have made two patches
attached, based on two different ideas.

pthread-cygwin-1.patch:
The higher part of key value is saved, and only lower part is handed
to python API. The key value is recombined with higher part when it
handed to cygwin pthread functions.
Smaller memory and little bit faster.

pthread-cygwin-2.patch:
The key value returned by cygwin pthread_key_create() is saved in
table, and index of the table is handed to python API as a key.
The key value is converted via the table when it handed to cygwin
pthread functions.
Larger memory but steady operation.

I prefer pthread-cygwin-2.patch. What do you think?

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

Attachment: pthread-cygwin-1.patch
Description: Binary data

Attachment: pthread-cygwin-2.patch
Description: Binary data

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]