1. 15 Nov, 2019 1 commit
  2. 14 Nov, 2019 17 commits
    • libgolang: Fix double C++ defer · 14a249cb
      If defer was used multiple times in one function it was failing to
      compile. For example added test is failing like this:
          In file included from golang/runtime/libgolang_test.cpp:22:
          golang/runtime/libgolang_test.cpp: In function ‘void __test_defer(int*)’:
          ./golang/libgolang.h:457:59: error: redeclaration of ‘golang::_deferred _defer___COUNTER__’
           #define defer(f) golang::_deferred _defer_ ## __COUNTER__ (f)
          golang/runtime/libgolang_test.cpp:473:5: note: in expansion of macro ‘defer’
               defer([&]() {
          ./golang/libgolang.h:457:36: note: ‘golang::_deferred _defer___COUNTER__’ previously declared here
           #define defer(f) golang::_deferred _defer_ ## __COUNTER__ (f)
          golang/runtime/libgolang_test.cpp:470:5: note: in expansion of macro ‘defer’
               defer([&]() {
      It turns out the __COUNTER__ was not expanded and they say you have to
      use 3 level of macro calls. Oh well...
      Kirill Smelkov committed
    • libgolang: Provide func as alias for std::function · de269272
      std::function is frequently too long to type while func is more native to Go.
      Kirill Smelkov committed
    • context: Export PyContext for cimport · a6c1c984
      For example wendelin.core wants to accept Python-level context,
      transform it into C-level context and pass to pyx/nogil code.
      Kirill Smelkov committed
    • context: Move/Port context package to C++/Pyx nogil · 2a359791
      Provide context-related functionality that can be used directly from C++
      and Pyx/nogil codes. Python-level classes and functions become small
      wrappers around pyx/nogil ones.
      Like with timers (b073f6df "time: Move/Port timers to C++/Pyx nogil")
      and interfaces (5a99b769 "libgolang: Start providing interfaces")
      memory for objects dynamically allocated on heap is managed
      Kirill Smelkov committed
    • cxx: New package · 9785f2d3
      Start new package that provides C++ amendments to be used by libgolang
      and its users. Current functionality: dict and set that wrap
      std::unordered_map and std::unordered_set into ergonomic interface.
      The code originates from wendelin.core:
      Pyx/nogil only.
      Kirill Smelkov committed
    • errors: New package · a245ab56
      With just one function - errors.New() - to create new error with given
      This will be soon used in Pyx/nogil context package to create context.canceled
      and context.deadlineExceeded errors.
      Pyx/nogil only for now.
      Kirill Smelkov committed
    • libgolang: Start providing interfaces · 5a99b769
      - interface is analog of interface{} in Go.
      - error is analog of error in Go.
      For now the interfaces are implemented via classic C++ scheme via
      inheritance and additional vtable field in pointed object.
      In the future we might want to consider reworking that to Go-style
      interfaces without predeclaring which interfaces a class implements.
      Top-level documentation is TODO.
      Interfaces will be soon needed to describe Context interface in C
      context package.
      Kirill Smelkov committed
    • golang.pxd: Expose missing memory-management bits · 274afa3f
      - refptr==refptr  (e.g. to compare whether returned error object is
        something particular)
      - adoptref() and newref()
      - object (exposed as gobject not to be confused with builtin pyx
        "object" referring to python object)
      All this will be soon used in C version of context package.
      Kirill Smelkov committed
    • context: Provide package documentation · 9216e2db
      Briefly describe provided functionality instead of only referring to
      https://golang.org/pkg/context and https://blog.golang.org/context.
      Kirill Smelkov committed
    • libgolang: Rename refobj -> object · b2253abf
      Thinking a bit more after e82b4fab (libgolang: Objects refcounting
      (initial draft)) and working on interfaces as part of context pyx -> C
      move, I've came to conclusion that the better name for on-heap objects
      managed by libgolang is just "object" without "ref" prefix.
      -> Rename refobj -> object and amend its documentation correspondingly.
      Kirill Smelkov committed
    • libgolang: Provide std::hash<refptr> · af4a8d80
      So that refptr<T> could be used as keys in e.g. dict (unordered_map) or
      set (unordered_set). set<refptr> will soon be used by C version of
      context package.
      Kirill Smelkov committed
    • libgolang: Provide select(vector<_selcase>) · 66e1e756
      We already provide select for array and std::initializer_list. However
      when cases are constructed at runtime dynamically both array and
      initializer_list are not convenient to use.
      -> Provide select() overload that accepts vector<_selcase>.
      This functionality will soon be used in C version of context package.
      Kirill Smelkov committed
    • sync: Fixup package documentation · 85df1e40
      - indicated that WorkGroup is not provided in Go version (amends
        40f3b90c "sync: Provide package documentation").
      - fix typo in sync.pxd subject (amends 34b7a1f4 "golang: Expose Sema and
        Mutex as public Python and Cython/nogil API")
      Kirill Smelkov committed
    • golang: tests: Silence inspect deprecation warning · 45f4df9e
      Every time tests are run under Python3 the following warnings are printed:
          .../golang/golang_test.py:990: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
            assert inspect.formatargspec(*inspect.getargspec(MyClass.zzz)) == '(self, v, x=2, **kkkkwww)'
          .../golang/golang_test.py:990: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
            assert inspect.formatargspec(*inspect.getargspec(MyClass.zzz)) == '(self, v, x=2, **kkkkwww)'
      However since we are not going to drop Python2 support soon, and there is no
      reffered "use-instead" functionality on Python2, let's simply silence the
      warning for now.
      Kirill Smelkov committed
    • context: Switch to comparing value keys by identity instead of equality · 281defb2
      It will be some extra work to define general equality when moving
      context code into C. However that is unnecessary as usually a key is
      specific to one particular package, and value associated with that key
      is struct, or some other aggregate, that is holding all package-specific
      context values.
      Switching to compare keys by identity preserves that use-case while
      making transition to C easier.
      Kirill Smelkov committed
    • context: Don't use dict in _ValueCtx · f76c11f3
      We always store just one key in there.
      This will simplify transition to C.
      Kirill Smelkov committed
    • context: tests: Don't compare .done() by "is" · 20761c55
      This continues 2c8063f4 (*: Channels must be compared by ==, not by "is"
      even for nilchan) and changes comparision of .done() for different
      contexts from "is" to ==.
      The reason is that soon we are going to move contexts into C, and this
      way in context tree there potentially can be PyCtx -> CCtx -> PyCtx
      chains, and while all those contexts could have the same C-level channel,
      it would be difficult to propagate the knowledge that Python-level
      pychan wrapper should be also exactly the same.
      We already treat channel objects as pointers and require to compare them
      by ==, so there should be no loss here. However to keep performance of
      we continue to require that .done() for a particular python context
      object returns exactly the same channel object every time.
      Kirill Smelkov committed
  3. 13 Nov, 2019 1 commit
  4. 11 Nov, 2019 2 commits
  5. 07 Nov, 2019 10 commits
  6. 06 Nov, 2019 3 commits
  7. 04 Nov, 2019 6 commits