Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Q: How much does it cost to ride the Unibus? A: 2 bits.


comp / comp.lang.python / Re: PyGILState_Ensure() deadlocks, why?

SubjectAuthor
o Re: PyGILState_Ensure() deadlocks, why?Barry

1
Subject: Re: PyGILState_Ensure() deadlocks, why?
From: Barry
Newsgroups: comp.lang.python
Date: Sun, 7 Jul 2024 22:21 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: barry@barrys-emacs.org (Barry)
Newsgroups: comp.lang.python
Subject: Re: PyGILState_Ensure() deadlocks, why?
Date: Sun, 7 Jul 2024 23:21:55 +0100
Lines: 25
Message-ID: <mailman.17.1720392652.2981.python-list@python.org>
References: <DGC1c0YSrMcV0n6rNNeplHySXzBWUfTUwJbBVPgOocO1evufk5MKe8QWWEzO6Zj5-_0VrJJbK3OpB5-vrvMdDRKITiZrvq0RMY69IND05u4=@protonmail.ch>
<BFD66552-780D-4B47-BE26-AA01988E3D07@barrys-emacs.org>
Mime-Version: 1.0 (1.0)
Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de mOdNOWkutIjokxf7+jojAwxBdxQiHAvD2bQpKC9Zr8RA==
Cancel-Lock: sha1:PoyIMOUWDRfMQPgKoOrSWV3aDZg= sha256:JPdgVBa+asvgGhgmyV2eeWYbboNHQTu520i/vSp24/s=
Return-Path: <barry@barrys-emacs.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'jul': 0.04; 'thread':
0.05; 'python.': 0.08; 'cc:addr:python-list': 0.09;
'from:addr:barry': 0.09; 'received:217.70': 0.09;
'received:217.70.178': 0.09; 'received:gandi.net': 0.09;
'received:mail.gandi.net': 0.09; 'subject:skip:P 10': 0.09;
'threads': 0.09; 'cc:no real name:2**0': 0.14; 'barry': 0.16;
'c++': 0.16; 'from:addr:barrys-emacs.org': 0.16; 'init': 0.16;
'message-id:@barrys-emacs.org': 0.16; 'subject:() ': 0.16;
'url:head': 0.16; 'url:tree': 0.16; 'wrote:': 0.16; 'python':
0.16; 'cc:addr:python.org': 0.20; 'creates': 0.22; 'code': 0.23;
'cc:2**0': 0.25; 'project.': 0.27; 'email addr:python.org&gt;':
0.28; 'think': 0.32; 'python-list': 0.32; 'but': 0.32; 'release':
0.34; 'header:In-Reply-To:1': 0.34; 'missing': 0.37; 'use': 0.39;
'wants': 0.40; 'tell': 0.60; 'research': 0.64; 'your': 0.64;
'received:217': 0.67; 'url-ip:104.18/16': 0.67; 'url:net': 0.68;
'you.': 0.71; 'near': 0.76; 'acquire': 0.84; 'email name:&lt
;python-list': 0.84; 'saves': 0.84; 'url:sourceforge': 0.84;
'url:p': 0.88; 'url:source': 0.89
In-Reply-To: <DGC1c0YSrMcV0n6rNNeplHySXzBWUfTUwJbBVPgOocO1evufk5MKe8QWWEzO6Zj5-_0VrJJbK3OpB5-vrvMdDRKITiZrvq0RMY69IND05u4=@protonmail.ch>
X-Mailer: iPad Mail (21F90)
X-GND-Sasl: barry@barrys-emacs.org
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <BFD66552-780D-4B47-BE26-AA01988E3D07@barrys-emacs.org>
X-Mailman-Original-References: <DGC1c0YSrMcV0n6rNNeplHySXzBWUfTUwJbBVPgOocO1evufk5MKe8QWWEzO6Zj5-_0VrJJbK3OpB5-vrvMdDRKITiZrvq0RMY69IND05u4=@protonmail.ch>
View all headers

> On 7 Jul 2024, at 22:09, Tomas Ukkonen via Python-list <python-list@python..org> wrote:
>
> Py_Initialize();

You also need to tell python to init threading.
I think you are missing more python setup code before you can use threads.
Also i think you need to tell python that your thread wants to call into python.
But I an not near my dev system to research this for you.

I have code to use python from C++ in my pysvn project.
See the code starting a line 354 in https://sourceforge.net/p/pysvn/code/HEAD/tree/trunk/pysvn/Extension/Source/pysvn.cpp
That saves the thread state and restores it.

But in my case python creates the threads and I release and acquire the GIL.

Barry

1

rocksolid light 0.9.8
clearnet tor