Re: [Cython] Segfault in PyThread_release_lock

2011-08-15 Thread Robert Bradshaw
On Mon, Aug 15, 2011 at 2:33 PM, Dag Sverre Seljebotn wrote: > Would it be horribly expensive to generate a better runtime error, or even > initialize the gil on demand? If the gil is not initialized, get the thread > ID of the thread calling the callback and check against the thread entering > at

Re: [Cython] Segfault in PyThread_release_lock

2011-08-15 Thread Dag Sverre Seljebotn
Would it be horribly expensive to generate a better runtime error, or even initialize the gil on demand? If the gil is not initialized, get the thread ID of the thread calling the callback and check against the thread entering at module initialization time...I don't know whether pythread.h has a

Re: [Cython] Segfault in PyThread_release_lock

2011-08-15 Thread Stefan Behnel
Dag Sverre Seljebotn, 15.08.2011 11:54: On 08/15/2011 11:42 AM, mark florisson wrote: @Cython-dev: Do we merely want to update the docs, or do we want to initialize the GIL for either case, or only for the with gil functions? I'm not entirely sure what the overhead is for single-threaded code, b

Re: [Cython] Class scope lookup order

2011-08-15 Thread Vitja Makarov
2011/8/15 Stefan Behnel : > Vitja Makarov, 15.08.2011 19:56: >> >> 2011/8/15 Stefan Behnel: >>> >>> Vitja Makarov, 15.08.2011 19:11: I think I'm done with the issue and if you don't mind I'll push that. https://github.com/vitek/cython/commit/b4a0493efbae68b30d54f0c58311c714

Re: [Cython] Class scope lookup order

2011-08-15 Thread Stefan Behnel
Vitja Makarov, 15.08.2011 19:56: 2011/8/15 Stefan Behnel: Vitja Makarov, 15.08.2011 19:11: I think I'm done with the issue and if you don't mind I'll push that. https://github.com/vitek/cython/commit/b4a0493efbae68b30d54f0c58311c71465d57d43 Could you please use a .py file for the test inste

Re: [Cython] Class scope lookup order

2011-08-15 Thread Vitja Makarov
2011/8/15 Stefan Behnel : > Vitja Makarov, 15.08.2011 19:11: >> >> I think I'm done with the issue and if you don't mind I'll push that. >> >> >> https://github.com/vitek/cython/commit/b4a0493efbae68b30d54f0c58311c71465d57d43 > > Could you please use a .py file for the test instead of a .pyx file?

Re: [Cython] Class scope lookup order

2011-08-15 Thread Stefan Behnel
Vitja Makarov, 15.08.2011 19:11: I think I'm done with the issue and if you don't mind I'll push that. https://github.com/vitek/cython/commit/b4a0493efbae68b30d54f0c58311c71465d57d43 Could you please use a .py file for the test instead of a .pyx file? It's worth comparing the result to CPytho

Re: [Cython] Class scope lookup order

2011-08-15 Thread Vitja Makarov
2011/8/15 Vitja Makarov : > 2011/8/15 Stefan Behnel : >> Vitja Makarov, 15.08.2011 11:55: >>> >>> 2011/8/15 Stefan Behnel: Stefan Behnel, 15.08.2011 11:34: > > at least to me, the most surprising thing is this: > >  >>>  A = 1 >  >>>  def foo(x): >  ...   A = x >>>

Re: [Cython] Class scope lookup order

2011-08-15 Thread Vitja Makarov
2011/8/15 Stefan Behnel : > Vitja Makarov, 15.08.2011 11:55: >> >> 2011/8/15 Stefan Behnel: >>> >>> Stefan Behnel, 15.08.2011 11:34: at least to me, the most surprising thing is this:  >>>  A = 1  >>>  def foo(x):  ...   A = x  ...   class X:  ...     a = A >

Re: [Cython] Class scope lookup order

2011-08-15 Thread Stefan Behnel
Vitja Makarov, 15.08.2011 11:55: 2011/8/15 Stefan Behnel: Stefan Behnel, 15.08.2011 11:34: at least to me, the most surprising thing is this: >>> A = 1 >>> def foo(x): ... A = x ... class X: ... a = A ... return X ... >>> foo(2).a 2 >>> def foo(x): ... A

Re: [Cython] [cython-users] Segfault in PyThread_release_lock

2011-08-15 Thread Dag Sverre Seljebotn
On 08/15/2011 12:35 PM, mark florisson wrote: On Monday, 15 August 2011, Dag Sverre Seljebotn wrote: On 08/15/2011 11:42 AM, mark florisson wrote: On 15 August 2011 02:22, Nikolaus Rathwrote: mark florissonwrites: On 14 August 2011 17:50, Nikolaus Rathwrote: mark florissonw

Re: [Cython] [cython-users] Segfault in PyThread_release_lock

2011-08-15 Thread mark florisson
On Monday, 15 August 2011, Dag Sverre Seljebotn wrote: > On 08/15/2011 11:42 AM, mark florisson wrote: > > On 15 August 2011 02:22, Nikolaus Rath  wrote: > > mark florisson  writes: > > On 14 August 2011 17:50, Nikolaus Rath  wrote: > > mark florisson  writes: > > On 12 August 2011 20:23, Nikolaus

Re: [Cython] Class scope lookup order

2011-08-15 Thread Vitja Makarov
2011/8/15 Stefan Behnel : > Stefan Behnel, 15.08.2011 11:34: >> >> at least to me, the most surprising thing is this: >> >>  >>> A = 1 >>  >>> def foo(x): >>  ...   A = x >>  ...   class X: >>  ...     a = A >>  ...   return X >>  ... >>  >>> foo(2).a >>  2 >>  >>> def foo(x): >>  ...   A = x >>  .

Re: [Cython] [cython-users] Re: Segfault in PyThread_release_lock

2011-08-15 Thread Dag Sverre Seljebotn
On 08/15/2011 11:42 AM, mark florisson wrote: On 15 August 2011 02:22, Nikolaus Rath wrote: mark florisson writes: On 14 August 2011 17:50, Nikolaus Rath wrote: mark florisson writes: On 12 August 2011 20:23, Nikolaus Rath wrote: Hello, The following segfault is completely incomprehens

Re: [Cython] Class scope lookup order

2011-08-15 Thread Stefan Behnel
Stefan Behnel, 15.08.2011 11:34: at least to me, the most surprising thing is this: >>> A = 1 >>> def foo(x): ... A = x ... class X: ... a = A ... return X ... >>> foo(2).a 2 >>> def foo(x): ... A = x ... class X: ... A = A ... return X ... >>> foo(2).A 1 Th

Re: [Cython] [cython-users] Re: Segfault in PyThread_release_lock

2011-08-15 Thread mark florisson
On 15 August 2011 02:22, Nikolaus Rath wrote: > mark florisson writes: >> On 14 August 2011 17:50, Nikolaus Rath wrote: >>> mark florisson writes: On 12 August 2011 20:23, Nikolaus Rath wrote: > Hello, > > The following segfault is completely incomprehensible to me: >

Re: [Cython] Class scope lookup order

2011-08-15 Thread Stefan Behnel
Vitja Makarov, 15.08.2011 07:49: 2011/8/15 Vitja Makarov: When creating python-class dict it seems that CPython first looks at dict then at globals: A = 1 class X: A = A def y(): A = 3 class Y: A = A return Y Y = y() print(X.A, Y.A) Will print: 1, 1 And not: 1, 3 I d