1. 14 Nov, 2019 1 commit
  2. 11 Nov, 2019 1 commit
  3. 04 Nov, 2019 1 commit
    • Kirill Smelkov's avatar
      context: Move code to pyx · cc7069e0
      Kirill Smelkov authored
      In preparation to start migrating, at least partially, context
      functionality to nogil mode, first, similarly to package time (see
      32f34607 "time: Move code to pyx"), move the code from context.py to
      _context.pyx.
      
      This is straight code movement + associated  setup.py & co adjusts.
      
      We don't move just to context.pyx (note no _ prefix), since we will need
      to continue distinguishing pyx/nogil from py objects/functions.
      cc7069e0
  4. 14 Oct, 2019 2 commits
    • Kirill Smelkov's avatar
      context: Switch done channel from chan() to -> chan(dtype='C.structZ') · 149ae661
      Kirill Smelkov authored
      C.structZ is empty structure and chan[C.structZ] can be used in
      pyx/nogil world. This way context tree initially created from Python can
      be extended in pyx/nogil and e.g. root context can be canceled from
      Python, which will correctly transfer the cancelation signal to pyx/nogil
      world too.
      149ae661
    • Kirill Smelkov's avatar
      *: Channels must be compared by ==, not by "is" even for nilchan · 2c8063f4
      Kirill Smelkov authored
      In a followup commit we are going to add channel types (e.g. chan of
      double, chan of int, etc) and accordingly there will be several nil
      channel objects, e.g. nil(dtype=int), nil(dtype=double) etc, which will
      be separate python objects. Even without data types, another planned
      change is to add directional channels, e.g. a channel instance that can
      only send, but not receive and vice versa(*).
      
      This way for the same underlying channel object, there can be several
      pychan objects that point to it - even for nil channel - e.g. nilchan
      and `niltx = nilchan.txonly()` that creates another pychan object
      pointing to the same underlying nil.
      
      Since we want all channels (of the same type) that point to the same
      underlying channel to compare as same, we cannot use "is" for comparison
      and have to use ==. In other words channels, both at C and Python level,
      should be perceived as pointers, of which there can be multiple ones
      pointing to the same location, and thus == has to be used to compare
      them.
      
      (*) see https://golang.org/ref/spec#Channel_types for details.
      2c8063f4
  5. 04 Oct, 2019 1 commit
    • Kirill Smelkov's avatar
      *: threading.Lock -> sync.Mutex · 548f2df1
      Kirill Smelkov authored
      Similarly to 78d85cdc (sync: threading.Event -> chan) replace everywhere
      threaing.Lock usage with sync.Mutex . This brings 2 goods:
      
      - sync.Mutex becomes more well tested;
      - we untie ourselves from threading python module (threading.Lock was
        the last user).
      548f2df1
  6. 16 May, 2019 3 commits
  7. 14 May, 2019 1 commit
    • Kirill Smelkov's avatar
      *: __future__ += absolute_imports; Use unified __future__ everywhere · 81dfefa0
      Kirill Smelkov authored
      - we are going to introduce golang.time, and from inside there without
        `from __future__ import absolute_imports` it won't be possible to import
        needed stdlib's time.
      
      - we were already doing `from __future__ import print_function`, but
        only in some files.
      
      -> It makes sense to apply updated __future__ usage uniformly.
      81dfefa0
  8. 03 May, 2019 1 commit