Re: [Python-Dev] cffi in stdlib

2013-12-18 Thread Gregory P. Smith
On Tue, Dec 17, 2013 at 8:43 AM, Stefan Krah wrote: > Maciej Fijalkowski wrote: > > I would like to discuss on the language summit a potential inclusion > > of cffi[1] into stdlib. This is a project Armin Rigo has been working > > for a while, with some input from other developers. > > I've trie

Re: [Python-Dev] thread issues when embedding Python

2013-12-18 Thread Daniel Pocock
On 18/12/13 16:29, Victor Stinner wrote: > 2013/12/18 Antoine Pitrou : >> You only need to call PyEval_InitThreads() once in the main Python >> thread. > > This is not well documented. For your information, PyGILState_Ensure() > now calls PyEval_InitThreads() in Python 3.4, see: > http://bugs.py

Re: [Python-Dev] Backward-incompatible change to random.randrange in 2.7.6

2013-12-18 Thread Ethan Furman
On 12/18/2013 08:54 AM, Tim Peters wrote: Which reminds me. I used to think there was no such thing as a stupid question. Then I discovered Stack Overflow ;-) +1 QOTW ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman

Re: [Python-Dev] Backward-incompatible change to random.randrange in 2.7.6

2013-12-18 Thread Daniel Holth
On Dec 18, 2013 11:54 AM, "Tim Peters" wrote: > [Daniel Holth] > > But who could forget njzrs' wasp UAV software line 107, using > > int=float? > https://github.com/nzjrs/wasp/blob/master/sw/groundstation/wasp/__init__.py#L107 > > I could forget it ;-) The remarkable thing about the two instance

Re: [Python-Dev] Backward-incompatible change to random.randrange in 2.7.6

2013-12-18 Thread Tim Peters
[Daniel Holth] > But who could forget njzrs' wasp UAV software line 107, using > int=float? > https://github.com/nzjrs/wasp/blob/master/sw/groundstation/wasp/__init__.py#L107 I could forget it ;-) The remarkable thing about the two instances of: random.randrange(0.0,1.0, int=float) in tha

Re: [Python-Dev] Backward-incompatible change to random.randrange in 2.7.6

2013-12-18 Thread Antoine Pitrou
On Wed, 18 Dec 2013 11:31:47 -0500 Daniel Holth wrote: > But who could forget njzrs' wasp UAV software line 107, using > int=float? > https://github.com/nzjrs/wasp/blob/master/sw/groundstation/wasp/__init__.py#L107 > And the purpose is quite Pythonesque: """ Generates a noisy random wal

Re: [Python-Dev] Backward-incompatible change to random.randrange in 2.7.6

2013-12-18 Thread Daniel Holth
But who could forget njzrs' wasp UAV software line 107, using int=float? https://github.com/nzjrs/wasp/blob/master/sw/groundstation/wasp/__init__.py#L107 On Wed, Dec 18, 2013 at 10:49 AM, Guido van Rossum wrote: > BTW, I bet a lavish dinner at PyCon that it is *only* Zope/ZODB that > does this.

Re: [Python-Dev] Backward-incompatible change to random.randrange in 2.7.6

2013-12-18 Thread Guido van Rossum
BTW, I bet a lavish dinner at PyCon that it is *only* Zope/ZODB that does this. In the time we added this bogus dependency on undocumented parameters, the PythonLabs team was at Zope and we didn't always get our boundaries straight. On Wed, Dec 18, 2013 at 2:51 AM, Nick Coghlan wrote: > On 18 Dec

Re: [Python-Dev] thread issues when embedding Python

2013-12-18 Thread Victor Stinner
2013/12/18 Antoine Pitrou : > You only need to call PyEval_InitThreads() once in the main Python > thread. This is not well documented. For your information, PyGILState_Ensure() now calls PyEval_InitThreads() in Python 3.4, see: http://bugs.python.org/issue19576 Victor ___

Re: [Python-Dev] thread issues when embedding Python

2013-12-18 Thread Antoine Pitrou
On Wed, 18 Dec 2013 00:19:23 +0100 Daniel Pocock wrote: > > If a main thread does things like importing a module and obtaining a > reference to a Python method, can those things be used by other C++ > threads or do they have to repeat those lookups? The C++ threads must use the PyGILState API to

Re: [Python-Dev] thread issues when embedding Python

2013-12-18 Thread Daniel Pocock
On 18/12/13 16:02, Chris Angelico wrote: > On Wed, Dec 18, 2013 at 9:26 PM, Daniel Pocock wrote: >> b) when each worker thread starts, call >> PyThreadState_New(mInterpreterState) and save the result in a thread >> local mPyThreadState >> >> c) use the mPyThreadState with PyEval_RestoreThread and

Re: [Python-Dev] thread issues when embedding Python

2013-12-18 Thread Chris Angelico
On Wed, Dec 18, 2013 at 9:26 PM, Daniel Pocock wrote: > b) when each worker thread starts, call > PyThreadState_New(mInterpreterState) and save the result in a thread > local mPyThreadState > > c) use the mPyThreadState with PyEval_RestoreThread and > PyEval_SaveThread before and after calling Py

Re: [Python-Dev] thread issues when embedding Python

2013-12-18 Thread Daniel Pocock
Another link that fills in some gaps and finally helped me make this work: http://www.codevate.com/blog/7-concurrency-with-embedded-python-in-a-multi-threaded-c-application In particular, I found that PyGILState_Ensure/PyGILState_Release as described in the Python docs is not sufficient - as des

Re: [Python-Dev] Backward-incompatible change to random.randrange in 2.7.6

2013-12-18 Thread Nick Coghlan
On 18 December 2013 20:17, Chris Angelico wrote: > On Wed, Dec 18, 2013 at 8:43 PM, Serhiy Storchaka wrote: >> 18.12.13 04:40, Benjamin Peterson написав(ла): >> >>> Mostly yes, but at least you could tell people to upgrade straight to >>> 2.7.7 and skip 2.7.6. >> >> >> It'll make the people to po

Re: [Python-Dev] Backward-incompatible change to random.randrange in 2.7.6

2013-12-18 Thread Chris Angelico
On Wed, Dec 18, 2013 at 8:43 PM, Serhiy Storchaka wrote: > 18.12.13 04:40, Benjamin Peterson написав(ла): > >> Mostly yes, but at least you could tell people to upgrade straight to >> 2.7.7 and skip 2.7.6. > > > It'll make the people to postpone the upgrade to 2.7.6 (which fixes many > security bu

Re: [Python-Dev] Backward-incompatible change to random.randrange in 2.7.6

2013-12-18 Thread Serhiy Storchaka
18.12.13 04:40, Benjamin Peterson написав(ла): Mostly yes, but at least you could tell people to upgrade straight to 2.7.7 and skip 2.7.6. It'll make the people to postpone the upgrade to 2.7.6 (which fixes many security bugs) until 2.7.7 release, instead of correcting their morally-broken p