#1 Backport fix to make eventlet's monkey patching work
Closed 6 years ago by pingou. Opened 6 years ago by pingou.
rpms/ pingou/python-eventlet master  into  master

file added
+45
@@ -0,0 +1,45 @@ 

+ From f5ada68078d2c7af34455b68a8faaf4eb5959f61 Mon Sep 17 00:00:00 2001

+ From: Geoffrey Thomas <geofft@twosigma.com>

+ Date: Fri, 25 Aug 2017 15:09:06 -0400

+ Subject: [PATCH] patcher: Call get_hub() before beginning monkey-patching

+ 

+ In some cases -- notably with Python 2.7.13 and the default hub -- the

+ process of importing the hub involves calling code in a module we

+ monkey-patch. This leads to recursive imports: the first eventlet

+ function will call get_hub(), which will try to import the hub, which

+ will call a monkey-patched module, which will call get_hub() and try to

+ import the hub again.

+ 

+ To avoid this, make sure the hub is fully imported before

+ monkey-patching anything.

+ 

+ Closes #401.

+ ---

+  eventlet/patcher.py | 7 +++++++

+  1 file changed, 7 insertions(+)

+ 

+ diff --git a/eventlet/patcher.py b/eventlet/patcher.py

+ index a929f7f2..d3b4a555 100644

+ --- a/eventlet/patcher.py

+ +++ b/eventlet/patcher.py

+ @@ -1,6 +1,7 @@

+  import imp

+  import sys

+  

+ +import eventlet

+  from eventlet.support import six

+  

+  

+ @@ -222,6 +223,12 @@ def monkey_patch(**on):

+  

+      It's safe to call monkey_patch multiple times.

+      """

+ +

+ +    # Make sure the hub is completely imported before any

+ +    # monkey-patching, or we risk recursion if the process of importing

+ +    # the hub calls into monkey-patched modules.

+ +    eventlet.hubs.get_hub()

+ +

+      accepted_args = set(('os', 'select', 'socket',

+                           'thread', 'time', 'psycopg', 'MySQLdb',

+                           'builtins', 'subprocess'))

file modified
+7 -1
@@ -12,7 +12,7 @@ 

  

  Name:           python-%{pypi_name}

  Version:        0.21.0

- Release:        3%{?dist}

+ Release:        4%{?dist}

  Summary:        Highly concurrent networking library

  License:        MIT

  URL:            http://eventlet.net
@@ -24,6 +24,9 @@ 

  # Compat patch with PyOpenSSL 17.3.0 which deprecates OpenSSL.rand API

  # https://github.com/eventlet/eventlet/commit/5b8f5f595624bdfb5f707707959977bb56864e0d

  Patch002:       0002-Drop-OpenSSL.rand-support.patch

+ # Fix eventlet's monkey patching with CPython 2.7.13+

+ # Source: https://github.com/eventlet/eventlet/pull/434

+ Patch003:       434.patch

  BuildArch:      noarch

  BuildRequires:  git

  
@@ -191,6 +194,9 @@ 

  %endif

  

  %changelog

+ * Wed Nov 29 2017 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.21.0-4

+ - Backport fix to make eventlet patching work with CPython 2.7.13

+ 

  * Tue Oct  3 2017 Haïkel Guémar <hguemar@fedoraproject.org> - 0.21.0-3

  - Fix upstream #401

  - Fix compat with PyOpenSSL 17.3.0

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

Turns out this is already in rawhide, we just need to update F27 for this (I'll take care of it).

Pull-Request has been closed by pingou

6 years ago
Metadata