Hello community,
here is the log from the commit of package python-greenlet for openSUSE:Factory
checked in at 2020-10-29 09:46:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-greenlet (Old)
and /work/SRC/openSUSE:Factory/.python-greenlet.new.3463 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-greenlet"
Thu Oct 29 09:46:00 2020 rev:34 rq:838240 version:0.4.17
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-greenlet/python-greenlet.changes
2020-06-11 14:45:11.721468737 +0200
+++
/work/SRC/openSUSE:Factory/.python-greenlet.new.3463/python-greenlet.changes
2020-10-29 09:46:07.312044819 +0100
@@ -1,0 +2,6 @@
+Mon Sep 28 10:54:19 UTC 2020 - Dirk Mueller <[email protected]>
+
+- update to 0.4.17:
+ - Support for PEP 567 ContextVars
+
+-------------------------------------------------------------------
Old:
----
greenlet-0.4.16.tar.gz
New:
----
greenlet-0.4.17.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-greenlet.spec ++++++
--- /var/tmp/diff_new_pack.iHX9rs/_old 2020-10-29 09:46:07.868045345 +0100
+++ /var/tmp/diff_new_pack.iHX9rs/_new 2020-10-29 09:46:07.868045345 +0100
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-greenlet
-Version: 0.4.16
+Version: 0.4.17
Release: 0
Summary: Lightweight in-process concurrent programming
License: MIT
++++++ greenlet-0.4.16.tar.gz -> greenlet-0.4.17.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/greenlet-0.4.16/.travis.yml
new/greenlet-0.4.17/.travis.yml
--- old/greenlet-0.4.16/.travis.yml 2020-06-05 10:03:11.000000000 +0200
+++ new/greenlet-0.4.17/.travis.yml 2020-09-22 11:01:00.000000000 +0200
@@ -12,6 +12,9 @@
- arch: amd64
python: 2.7
dist: bionic
+ - arch: ppc64le
+ python: 2.7
+ dist: bionic
- arch: amd64
python: 3.2
dist: precise
@@ -24,30 +27,45 @@
- arch: amd64
python: 3.4
dist: xenial
+ - arch: ppc64le
+ python: 3.4
+ dist: xenial
- arch: arm64
python: 3.5
dist: bionic
- arch: amd64
python: 3.5
dist: bionic
+ - arch: ppc64le
+ python: 3.5
+ dist: bionic
- arch: arm64
python: 3.6
dist: bionic
- arch: amd64
python: 3.6
dist: bionic
+ - arch: ppc64le
+ python: 3.6
+ dist: bionic
- arch: arm64
python: 3.7
dist: bionic
- arch: amd64
python: 3.7
dist: bionic
+ - arch: ppc64le
+ python: 3.7
+ dist: bionic
- arch: arm64
python: 3.8
dist: bionic
- arch: amd64
python: 3.8
dist: bionic
+ - arch: ppc64le
+ python: 3.8
+ dist: bionic
install: python setup.py build_ext -i
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/greenlet-0.4.16/AUTHORS new/greenlet-0.4.17/AUTHORS
--- old/greenlet-0.4.16/AUTHORS 2020-04-22 06:41:53.000000000 +0200
+++ new/greenlet-0.4.17/AUTHORS 2020-07-09 23:49:03.000000000 +0200
@@ -28,6 +28,7 @@
* Hye-Shik Chang
* Jared Kuolt
* Jason Madden
+* Josh Snyder
* Kyle Ambroff
* Laszlo Boszormenyi
* Mao Han
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/greenlet-0.4.16/MANIFEST.in
new/greenlet-0.4.17/MANIFEST.in
--- old/greenlet-0.4.16/MANIFEST.in 2020-06-05 10:15:26.000000000 +0200
+++ new/greenlet-0.4.17/MANIFEST.in 2020-09-22 12:53:47.000000000 +0200
@@ -51,6 +51,7 @@
include tests/__init__.py
include tests/_test_extension.c
include tests/_test_extension_cpp.cpp
+include tests/test_contextvars.py
include tests/test_cpp.py
include tests/test_extension_interface.py
include tests/test_gc.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/greenlet-0.4.16/NEWS new/greenlet-0.4.17/NEWS
--- old/greenlet-0.4.16/NEWS 2020-06-05 10:15:26.000000000 +0200
+++ new/greenlet-0.4.17/NEWS 2020-09-22 12:53:47.000000000 +0200
@@ -1,3 +1,7 @@
+0.4.17
+======
+- Support for PEP 567 ContextVars
+
0.4.16
===========
- Support for DEC Alpha architecture
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/greenlet-0.4.16/PKG-INFO new/greenlet-0.4.17/PKG-INFO
--- old/greenlet-0.4.16/PKG-INFO 2020-06-05 10:18:55.818689800 +0200
+++ new/greenlet-0.4.17/PKG-INFO 2020-09-22 13:00:16.431996600 +0200
@@ -1,10 +1,10 @@
Metadata-Version: 1.1
Name: greenlet
-Version: 0.4.16
+Version: 0.4.17
Summary: Lightweight in-process concurrent programming
Home-page: https://github.com/python-greenlet/greenlet
-Author: Alexey Borzenkov
-Author-email: [email protected]
+Author: UNKNOWN
+Author-email: UNKNOWN
License: MIT License
Description: .. image::
https://secure.travis-ci.org/python-greenlet/greenlet.png
:target: http://travis-ci.org/python-greenlet/greenlet
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/greenlet-0.4.16/appveyor.yml
new/greenlet-0.4.17/appveyor.yml
--- old/greenlet-0.4.16/appveyor.yml 2020-04-22 06:52:37.000000000 +0200
+++ new/greenlet-0.4.17/appveyor.yml 2020-09-22 12:53:47.000000000 +0200
@@ -1,4 +1,4 @@
-version: 0.4.16.{build}
+version: 0.4.17.{build}
environment:
global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/greenlet-0.4.16/greenlet.c
new/greenlet-0.4.17/greenlet.c
--- old/greenlet-0.4.16/greenlet.c 2020-06-05 09:33:24.000000000 +0200
+++ new/greenlet-0.4.17/greenlet.c 2020-07-09 23:47:19.000000000 +0200
@@ -491,6 +491,9 @@
PyThreadState* tstate = PyThreadState_GET();
current->recursion_depth = tstate->recursion_depth;
current->top_frame = tstate->frame;
+#if GREENLET_USE_CONTEXT_VARS
+ current->context = tstate->context;
+#endif
#ifdef GREENLET_USE_EXC_INFO
current->exc_info = tstate->exc_info;
current->exc_state = tstate->exc_state;
@@ -522,6 +525,15 @@
tstate->recursion_depth = target->recursion_depth;
tstate->frame = target->top_frame;
target->top_frame = NULL;
+
+#if GREENLET_USE_CONTEXT_VARS
+ tstate->context = target->context;
+ target->context = NULL;
+ /* Incrementing this value invalidates the contextvars cache,
+ which would otherwise remain valid across switches */
+ tstate->context_ver++;
+#endif
+
#ifdef GREENLET_USE_EXC_INFO
tstate->exc_state = target->exc_state;
tstate->exc_info = target->exc_info ? target->exc_info :
&tstate->exc_state;
@@ -963,6 +975,9 @@
- frames are not visited: alive greenlets are not garbage collected
anyway */
Py_VISIT((PyObject*)self->parent);
Py_VISIT(self->run_info);
+#if GREENLET_USE_CONTEXT_VARS
+ Py_VISIT(self->context);
+#endif
#ifdef GREENLET_USE_EXC_INFO
Py_VISIT(self->exc_state.exc_type);
Py_VISIT(self->exc_state.exc_value);
@@ -995,6 +1010,9 @@
so even if it switches we are relatively safe. */
Py_CLEAR(self->parent);
Py_CLEAR(self->run_info);
+#if GREENLET_USE_CONTEXT_VARS
+ Py_CLEAR(self->context);
+#endif
#ifdef GREENLET_USE_EXC_INFO
Py_CLEAR(self->exc_state.exc_type);
Py_CLEAR(self->exc_state.exc_value);
@@ -1073,6 +1091,9 @@
PyObject_ClearWeakRefs((PyObject *) self);
Py_CLEAR(self->parent);
Py_CLEAR(self->run_info);
+#if GREENLET_USE_CONTEXT_VARS
+ Py_CLEAR(self->context);
+#endif
#ifdef GREENLET_USE_EXC_INFO
Py_CLEAR(self->exc_state.exc_type);
Py_CLEAR(self->exc_state.exc_value);
@@ -1739,6 +1760,7 @@
PyModule_AddObject(m, "GreenletExit", PyExc_GreenletExit);
PyModule_AddObject(m, "GREENLET_USE_GC",
PyBool_FromLong(GREENLET_USE_GC));
PyModule_AddObject(m, "GREENLET_USE_TRACING",
PyBool_FromLong(GREENLET_USE_TRACING));
+ PyModule_AddObject(m, "GREENLET_USE_CONTEXT_VARS",
PyBool_FromLong(GREENLET_USE_CONTEXT_VARS));
/* also publish module-level data as attributes of the greentype. */
for (p=copy_on_greentype; *p; p++) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/greenlet-0.4.16/greenlet.h
new/greenlet-0.4.17/greenlet.h
--- old/greenlet-0.4.16/greenlet.h 2020-06-05 10:15:26.000000000 +0200
+++ new/greenlet-0.4.17/greenlet.h 2020-09-22 12:53:47.000000000 +0200
@@ -11,12 +11,20 @@
extern "C" {
#endif
-#define GREENLET_VERSION "0.4.16"
+#define GREENLET_VERSION "0.4.17"
#if PY_VERSION_HEX >= 0x030700A3
# define GREENLET_USE_EXC_INFO
#endif
+#ifndef GREENLET_USE_CONTEXT_VARS
+#ifdef Py_CONTEXT_H
+#define GREENLET_USE_CONTEXT_VARS 1
+#else
+#define GREENLET_USE_CONTEXT_VARS 0
+#endif
+#endif
+
typedef struct _greenlet {
PyObject_HEAD
char* stack_start;
@@ -38,6 +46,9 @@
PyObject* exc_traceback;
#endif
PyObject* dict;
+#if GREENLET_USE_CONTEXT_VARS
+ PyObject* context;
+#endif
} PyGreenlet;
#define PyGreenlet_Check(op) PyObject_TypeCheck(op, &PyGreenlet_Type)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/greenlet-0.4.16/setup.py new/greenlet-0.4.17/setup.py
--- old/greenlet-0.4.16/setup.py 2020-06-05 10:15:26.000000000 +0200
+++ new/greenlet-0.4.17/setup.py 2020-09-22 12:53:47.000000000 +0200
@@ -70,11 +70,9 @@
setup(
name="greenlet",
- version='0.4.16',
+ version='0.4.17',
description='Lightweight in-process concurrent programming',
long_description=readfile("README.rst"),
- maintainer="Alexey Borzenkov",
- maintainer_email="[email protected]",
url="https://github.com/python-greenlet/greenlet",
license="MIT License",
platforms=['any'],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/greenlet-0.4.16/tests/test_contextvars.py
new/greenlet-0.4.17/tests/test_contextvars.py
--- old/greenlet-0.4.16/tests/test_contextvars.py 1970-01-01
01:00:00.000000000 +0100
+++ new/greenlet-0.4.17/tests/test_contextvars.py 2020-07-09
23:47:19.000000000 +0200
@@ -0,0 +1,68 @@
+from functools import partial
+from greenlet import greenlet
+from greenlet import getcurrent
+from greenlet import GREENLET_USE_CONTEXT_VARS
+import unittest
+
+if GREENLET_USE_CONTEXT_VARS:
+ from contextvars import ContextVar
+ from contextvars import copy_context
+
+ class ContextVarsTests(unittest.TestCase):
+ def _new_ctx_run(self, *args, **kwargs):
+ return copy_context().run(*args, **kwargs)
+
+ def _increment(self, greenlet_id, ctx_var, callback, counts, expect):
+ if expect is None:
+ self.assertIsNone(ctx_var.get())
+ else:
+ self.assertEqual(ctx_var.get(), expect)
+ ctx_var.set(greenlet_id)
+ for i in range(2):
+ counts[ctx_var.get()] += 1
+ callback()
+
+ def _test_context(self, propagate):
+ id_var = ContextVar("id", default=None)
+ id_var.set(0)
+
+ callback = getcurrent().switch
+ counts = dict((i, 0) for i in range(5))
+
+ lets = [
+ greenlet(partial(
+ partial(
+ copy_context().run,
+ self._increment
+ ) if propagate else self._increment,
+ greenlet_id=i,
+ ctx_var=id_var,
+ callback=callback,
+ counts=counts,
+ expect=0 if propagate else None,
+ ))
+ for i in range(1, 5)
+ ]
+
+ for i in range(2):
+ counts[id_var.get()] += 1
+ for let in lets:
+ let.switch()
+
+ self.assertEqual(set(counts.values()), set([2]))
+
+ def test_context_propagated(self):
+ self._new_ctx_run(self._test_context, True)
+
+ def test_context_not_propagated(self):
+ self._new_ctx_run(self._test_context, False)
+
+ def test_break_ctxvars(self):
+ let1 = greenlet(copy_context().run)
+ let2 = greenlet(copy_context().run)
+ let1.switch(getcurrent().switch)
+ let2.switch(getcurrent().switch)
+ # Since let2 entered the current context and let1 exits its own,
the
+ # interpreter emits:
+ # RuntimeError: cannot exit context: thread state references a
different context object
+ let1.switch()