CINXE.COM

What’s new in gevent 1.1 - gevent 24.11.2.dev0 documentation

<!doctype html> <html class="no-js" lang="en" data-content_root="./"> <head><meta charset="utf-8"/> <meta name="viewport" content="width=device-width,initial-scale=1"/> <meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="index" title="Index" href="genindex.html" /><link rel="search" title="Search" href="search.html" /><link rel="next" title="What’s new in gevent 1.0" href="whatsnew_1_0.html" /><link rel="prev" title="What’s new in gevent 1.2" href="whatsnew_1_2.html" /> <!-- Generated with Sphinx 8.1.3 and Furo 2024.08.06 --> <title>What’s new in gevent 1.1 - gevent 24.11.2.dev0 documentation</title> <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=a3258c64" /> <link rel="stylesheet" type="text/css" href="_static/styles/furo.css?v=354aac6f" /> <link rel="stylesheet" type="text/css" href="_static/styles/furo-extensions.css?v=302659d7" /> <link rel="stylesheet" type="text/css" href="_static/custom.css?v=e405f49d" /> <style> body { --color-code-background: #eeeedd; --color-code-foreground: black; --color-brand-primary: #7c9a5e; --color-brand-content: #7c9a5e; --color-foreground-border: #b7d897; --font-stack: "SF Pro",-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"; --font-stack--monospace: "JetBrainsMono", "JetBrains Mono", "JetBrains Mono Regular", "JetBrainsMono-Regular", ui-monospace, profont, monospace; } @media not print { body[data-theme="dark"] { --color-code-background: #202020; --color-code-foreground: #d0d0d0; } @media (prefers-color-scheme: dark) { body:not([data-theme="light"]) { --color-code-background: #202020; --color-code-foreground: #d0d0d0; } } } </style><script async type="text/javascript" src="/_/static/javascript/readthedocs-addons.js"></script><meta name="readthedocs-project-slug" content="python-gevent" /><meta name="readthedocs-version-slug" content="latest" /><meta name="readthedocs-resolver-filename" content="/whatsnew_1_1.html" /><meta name="readthedocs-http-status" content="200" /></head> <body> <script> document.body.dataset.theme = localStorage.getItem("theme") || "auto"; </script> <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> <symbol id="svg-toc" viewBox="0 0 24 24"> <title>Contents</title> <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> </svg> </symbol> <symbol id="svg-menu" viewBox="0 0 24 24"> <title>Menu</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> <line x1="3" y1="12" x2="21" y2="12"></line> <line x1="3" y1="6" x2="21" y2="6"></line> <line x1="3" y1="18" x2="21" y2="18"></line> </svg> </symbol> <symbol id="svg-arrow-right" viewBox="0 0 24 24"> <title>Expand</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> <polyline points="9 18 15 12 9 6"></polyline> </svg> </symbol> <symbol id="svg-sun" viewBox="0 0 24 24"> <title>Light mode</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> <circle cx="12" cy="12" r="5"></circle> <line x1="12" y1="1" x2="12" y2="3"></line> <line x1="12" y1="21" x2="12" y2="23"></line> <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> <line x1="1" y1="12" x2="3" y2="12"></line> <line x1="21" y1="12" x2="23" y2="12"></line> <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> </svg> </symbol> <symbol id="svg-moon" viewBox="0 0 24 24"> <title>Dark mode</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> </svg> </symbol> <symbol id="svg-sun-with-moon" viewBox="0 0 24 24"> <title>Auto light/dark, in light mode</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-custom-derived-from-feather-sun-and-tabler-moon"> <path style="opacity: 50%" d="M 5.411 14.504 C 5.471 14.504 5.532 14.504 5.591 14.504 C 3.639 16.319 4.383 19.569 6.931 20.352 C 7.693 20.586 8.512 20.551 9.25 20.252 C 8.023 23.207 4.056 23.725 2.11 21.184 C 0.166 18.642 1.702 14.949 4.874 14.536 C 5.051 14.512 5.231 14.5 5.411 14.5 L 5.411 14.504 Z"/> <line x1="14.5" y1="3.25" x2="14.5" y2="1.25"/> <line x1="14.5" y1="15.85" x2="14.5" y2="17.85"/> <line x1="10.044" y1="5.094" x2="8.63" y2="3.68"/> <line x1="19" y1="14.05" x2="20.414" y2="15.464"/> <line x1="8.2" y1="9.55" x2="6.2" y2="9.55"/> <line x1="20.8" y1="9.55" x2="22.8" y2="9.55"/> <line x1="10.044" y1="14.006" x2="8.63" y2="15.42"/> <line x1="19" y1="5.05" x2="20.414" y2="3.636"/> <circle cx="14.5" cy="9.55" r="3.6"/> </svg> </symbol> <symbol id="svg-moon-with-sun" viewBox="0 0 24 24"> <title>Auto light/dark, in dark mode</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-custom-derived-from-feather-sun-and-tabler-moon"> <path d="M 8.282 7.007 C 8.385 7.007 8.494 7.007 8.595 7.007 C 5.18 10.184 6.481 15.869 10.942 17.24 C 12.275 17.648 13.706 17.589 15 17.066 C 12.851 22.236 5.91 23.143 2.505 18.696 C -0.897 14.249 1.791 7.786 7.342 7.063 C 7.652 7.021 7.965 7 8.282 7 L 8.282 7.007 Z"/> <line style="opacity: 50%" x1="18" y1="3.705" x2="18" y2="2.5"/> <line style="opacity: 50%" x1="18" y1="11.295" x2="18" y2="12.5"/> <line style="opacity: 50%" x1="15.316" y1="4.816" x2="14.464" y2="3.964"/> <line style="opacity: 50%" x1="20.711" y1="10.212" x2="21.563" y2="11.063"/> <line style="opacity: 50%" x1="14.205" y1="7.5" x2="13.001" y2="7.5"/> <line style="opacity: 50%" x1="21.795" y1="7.5" x2="23" y2="7.5"/> <line style="opacity: 50%" x1="15.316" y1="10.184" x2="14.464" y2="11.036"/> <line style="opacity: 50%" x1="20.711" y1="4.789" x2="21.563" y2="3.937"/> <circle style="opacity: 50%" cx="18" cy="7.5" r="2.169"/> </svg> </symbol> <symbol id="svg-pencil" viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-pencil-code"> <path d="M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" /> <path d="M13.5 6.5l4 4" /> <path d="M20 21l2 -2l-2 -2" /> <path d="M17 17l-2 2l2 2" /> </svg> </symbol> <symbol id="svg-eye" viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-eye-code"> <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" /> <path d="M11.11 17.958c-3.209 -.307 -5.91 -2.293 -8.11 -5.958c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6c-.21 .352 -.427 .688 -.647 1.008" /> <path d="M20 21l2 -2l-2 -2" /> <path d="M17 17l-2 2l2 2" /> </svg> </symbol> </svg> <input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> <input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> <label class="overlay sidebar-overlay" for="__navigation"> <div class="visually-hidden">Hide navigation sidebar</div> </label> <label class="overlay toc-overlay" for="__toc"> <div class="visually-hidden">Hide table of contents sidebar</div> </label> <a class="skip-to-content muted-link" href="#furo-main-content">Skip to content</a> <div class="page"> <header class="mobile-header"> <div class="header-left"> <label class="nav-overlay-icon" for="__navigation"> <div class="visually-hidden">Toggle site navigation sidebar</div> <i class="icon"><svg><use href="#svg-menu"></use></svg></i> </label> </div> <div class="header-center"> <a href="contents.html"><div class="brand">gevent 24.11.2.dev0 documentation</div></a> </div> <div class="header-right"> <div class="theme-toggle-container theme-toggle-header"> <button class="theme-toggle"> <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg> <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg> <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> </button> </div> <label class="toc-overlay-icon toc-header-icon" for="__toc"> <div class="visually-hidden">Toggle table of contents sidebar</div> <i class="icon"><svg><use href="#svg-toc"></use></svg></i> </label> </div> </header> <aside class="sidebar-drawer"> <div class="sidebar-container"> <div class="sidebar-sticky"><a class="sidebar-brand" href="contents.html"> <div class="sidebar-logo-container"> <img class="sidebar-logo" src="_static/5564530.png" alt="Logo"/> </div> </a><form class="sidebar-search-container" method="get" action="search.html" role="search"> <input class="sidebar-search" placeholder="Search" name="q" aria-label="Search"> <input type="hidden" name="check_keywords" value="yes"> <input type="hidden" name="area" value="default"> </form> <div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> <ul> <li class="toctree-l1"><a class="reference internal" href="install.html">Installation and Requirements</a></li> <li class="toctree-l1 has-children"><a class="reference internal" href="changelog.html">Changelog</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle navigation of Changelog</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l2"><a class="reference internal" href="changelog_1_5.html">Changes for 1.5</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_4.html">Changes for 1.4</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_3.html">Changes for 1.3</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_2.html">Changes for 1.2</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html">Changes for 1.1</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_0.html">Changes for 1.0</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_pre.html">Changes before gevent 1.0</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction</a></li> <li class="toctree-l1"><a class="reference internal" href="api/gevent.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent</span></code> – common functions</a></li> <li class="toctree-l1"><a class="reference internal" href="api/gevent.greenlet.html">Greenlet Objects</a></li> <li class="toctree-l1"><a class="reference internal" href="servers.html">Implementing servers</a></li> <li class="toctree-l1 has-children"><a class="reference internal" href="dns.html">Name Resolution (DNS)</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle navigation of Name Resolution (DNS)</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l2"><a class="reference internal" href="api/gevent.resolver.thread.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.resolver.thread</span></code> – thread based hostname resolver</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.resolver.ares.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.resolver.ares</span></code> – c-ares based hostname resolver</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.resolver.dnspython.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.resolver.dnspython</span></code> – Pure Python hostname resolver</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.resolver.blocking.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.resolver.blocking</span></code> – Non-cooperative resolver</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="monitoring.html">Monitoring and Debugging gevent Applications</a></li> <li class="toctree-l1"><a class="reference internal" href="loop_impls.html">Event Loop Implementations: libuv and libev</a></li> <li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuring gevent</a></li> </ul> <ul> <li class="toctree-l1 has-children"><a class="reference internal" href="api/index.html">API reference</a><input class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" role="switch" type="checkbox"/><label for="toctree-checkbox-3"><div class="visually-hidden">Toggle navigation of API reference</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l2"><a class="reference internal" href="api/gevent.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent</span></code> – common functions</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.timeout.html">Cooperative Timeouts Using <code class="docutils literal notranslate"><span class="pre">gevent.Timeout</span></code></a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.greenlet.html">Greenlet Objects</a></li> <li class="toctree-l2 has-children"><a class="reference internal" href="api/gevent.socket.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.socket</span></code> – Cooperative low-level networking interface</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" role="switch" type="checkbox"/><label for="toctree-checkbox-4"><div class="visually-hidden">Toggle navigation of gevent.socket – Cooperative low-level networking interface</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="api/gevent._socket3.html">Python 3 interface</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.ssl.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.ssl</span></code> – Secure Sockets Layer (SSL/TLS) module</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.select.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.select</span></code> – Waiting for I/O completion</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.selectors.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.selectors</span></code> – High-level IO Multiplexing</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.event.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.event</span></code> – Notifications of multiple listeners</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.queue.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.queue</span></code> – Synchronized queues</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.local.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.local</span></code> – Greenlet-local objects</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.lock.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.lock</span></code> – Locking primitives</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.hub.html"><code class="docutils literal notranslate"><span class="pre">gevent.hub</span></code> - The Event Loop and the Hub</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.core.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.core</span></code> - (deprecated) event loop abstraction</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent</span></code> – common functions</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.backdoor.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.backdoor</span></code> – Interactive greenlet-based network console that can be used in any process</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.baseserver.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.baseserver</span></code> – Base class for implementing servers</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.builtins.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.builtins</span></code> – gevent friendly implementations of builtin functions</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.contextvars.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.contextvars</span></code> – Cooperative <code class="docutils literal notranslate"><span class="pre">contextvars</span></code></a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.core.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.core</span></code> - (deprecated) event loop abstraction</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.event.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.event</span></code> – Notifications of multiple listeners</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.events.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.events</span></code> – Publish/subscribe event infrastructure</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.exceptions.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.exceptions</span></code> – Exceptions</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.fileobject.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.fileobject</span></code> – Wrappers to make file-like objects cooperative</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.hub.html"><code class="docutils literal notranslate"><span class="pre">gevent.hub</span></code> - The Event Loop and the Hub</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.local.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.local</span></code> – Greenlet-local objects</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.lock.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.lock</span></code> – Locking primitives</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.monkey.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.monkey</span></code> – Make the standard library cooperative</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.os.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.os</span></code> – Low-level operating system functions from <code class="xref py py-mod docutils literal notranslate"><span class="pre">os</span></code></a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.pool.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.pool</span></code> – Managing greenlets in a group</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.pywsgi.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.pywsgi</span></code> – A pure-Python, gevent-friendly WSGI server</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.queue.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.queue</span></code> – Synchronized queues</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.resolver.ares.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.resolver.ares</span></code> – c-ares based hostname resolver</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.resolver.blocking.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.resolver.blocking</span></code> – Non-cooperative resolver</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.resolver.dnspython.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.resolver.dnspython</span></code> – Pure Python hostname resolver</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.resolver.thread.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.resolver.thread</span></code> – thread based hostname resolver</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.select.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.select</span></code> – Waiting for I/O completion</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.selectors.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.selectors</span></code> – High-level IO Multiplexing</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.server.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.server</span></code> – TCP/SSL server</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.signal.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.signal</span></code> – Cooperative implementation of special cases of <code class="xref py py-func docutils literal notranslate"><span class="pre">signal.signal()</span></code></a></li> <li class="toctree-l2 has-children"><a class="reference internal" href="api/gevent.socket.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.socket</span></code> – Cooperative low-level networking interface</a><input class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" role="switch" type="checkbox"/><label for="toctree-checkbox-5"><div class="visually-hidden">Toggle navigation of gevent.socket – Cooperative low-level networking interface</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="api/gevent._socket3.html">Python 3 interface</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.ssl.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.ssl</span></code> – Secure Sockets Layer (SSL/TLS) module</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.subprocess.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.subprocess</span></code> – Cooperative <code class="docutils literal notranslate"><span class="pre">subprocess</span></code> module</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.thread.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.thread</span></code> – Implementation of the standard <code class="xref py py-mod docutils literal notranslate"><span class="pre">thread</span></code> module that spawns greenlets</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.threading.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.threading</span></code> – Implementation of the standard <code class="xref py py-mod docutils literal notranslate"><span class="pre">threading</span></code> using greenlets</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.threadpool.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.threadpool</span></code> - A pool of native threads</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.time.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.time</span></code> – Makes <em>sleep</em> gevent aware</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.util.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.util</span></code> – Low-level utilities</a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.ares.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.ares</span></code> – Backwards compatibility alias for <code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.resolver.cares</span></code></a></li> <li class="toctree-l2"><a class="reference internal" href="api/gevent.wsgi.html"><code class="docutils literal notranslate"><span class="pre">gevent.wsgi</span></code> – Historical note only; does not exist</a></li> <li class="toctree-l2 has-children"><a class="reference internal" href="examples/index.html">Examples</a><input class="toctree-checkbox" id="toctree-checkbox-6" name="toctree-checkbox-6" role="switch" type="checkbox"/><label for="toctree-checkbox-6"><div class="visually-hidden">Toggle navigation of Examples</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="examples/concurrent_download.html">Example concurrent_download.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/dns_mass_resolve.html">Example dns_mass_resolve.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/echoserver.html">Example echoserver.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/geventsendfile.html">Example geventsendfile.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/portforwarder.html">Example portforwarder.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/processes.html">Example processes.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/psycopg2_pool.html">Example psycopg2_pool.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/threadpool.html">Example threadpool.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/udp_client.html">Example udp_client.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/udp_server.html">Example udp_server.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/unixsocket_client.html">Example unixsocket_client.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/unixsocket_server.html">Example unixsocket_server.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/webproxy.html">Example webproxy.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/webpy.html">Example webpy.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/wsgiserver.html">Example wsgiserver.py</a></li> <li class="toctree-l3"><a class="reference internal" href="examples/wsgiserver_ssl.html">Example wsgiserver_ssl.py</a></li> </ul> </li> </ul> </li> </ul> <ul> <li class="toctree-l1 has-children"><a class="reference internal" href="development/index.html">Development</a><input class="toctree-checkbox" id="toctree-checkbox-7" name="toctree-checkbox-7" role="switch" type="checkbox"/><label for="toctree-checkbox-7"><div class="visually-hidden">Toggle navigation of Development</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l2"><a class="reference internal" href="development/getting_started.html">Getting Started</a></li> <li class="toctree-l2"><a class="reference internal" href="development/installing_from_source.html">Installing From Source</a></li> <li class="toctree-l2"><a class="reference internal" href="development/running_tests.html">Running Tests</a></li> <li class="toctree-l2"><a class="reference internal" href="development/ci.html">Continuous integration</a></li> <li class="toctree-l2"><a class="reference internal" href="development/release_process.html">Release Process</a></li> </ul> </li> </ul> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="success.html">Success stories</a></li> <li class="toctree-l1"><a class="reference internal" href="community.html">Community</a></li> <li class="toctree-l1 current has-children"><a class="reference internal" href="older_releases.html">Information About Older Releases</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-8" name="toctree-checkbox-8" role="switch" type="checkbox"/><label for="toctree-checkbox-8"><div class="visually-hidden">Toggle navigation of Information About Older Releases</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> <li class="toctree-l2 has-children"><a class="reference internal" href="whatsnew_1_5.html">What’s new in gevent 1.5</a><input class="toctree-checkbox" id="toctree-checkbox-9" name="toctree-checkbox-9" role="switch" type="checkbox"/><label for="toctree-checkbox-9"><div class="visually-hidden">Toggle navigation of What’s new in gevent 1.5</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="changelog_1_5.html">Changes for 1.5</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="whatsnew_1_4.html">What’s new in gevent 1.4</a><input class="toctree-checkbox" id="toctree-checkbox-10" name="toctree-checkbox-10" role="switch" type="checkbox"/><label for="toctree-checkbox-10"><div class="visually-hidden">Toggle navigation of What’s new in gevent 1.4</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="changelog_1_4.html">Changes for 1.4</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="whatsnew_1_3.html">What’s new in gevent 1.3</a><input class="toctree-checkbox" id="toctree-checkbox-11" name="toctree-checkbox-11" role="switch" type="checkbox"/><label for="toctree-checkbox-11"><div class="visually-hidden">Toggle navigation of What’s new in gevent 1.3</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="changelog_1_3.html">Changes for 1.3</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="whatsnew_1_2.html">What’s new in gevent 1.2</a><input class="toctree-checkbox" id="toctree-checkbox-12" name="toctree-checkbox-12" role="switch" type="checkbox"/><label for="toctree-checkbox-12"><div class="visually-hidden">Toggle navigation of What’s new in gevent 1.2</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="changelog_1_2.html">Changes for 1.2</a></li> </ul> </li> <li class="toctree-l2 current has-children current-page"><a class="current reference internal" href="#">What’s new in gevent 1.1</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-13" name="toctree-checkbox-13" role="switch" type="checkbox"/><label for="toctree-checkbox-13"><div class="visually-hidden">Toggle navigation of What’s new in gevent 1.1</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="changelog_1_1.html">Changes for 1.1</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="whatsnew_1_0.html">What’s new in gevent 1.0</a><input class="toctree-checkbox" id="toctree-checkbox-14" name="toctree-checkbox-14" role="switch" type="checkbox"/><label for="toctree-checkbox-14"><div class="visually-hidden">Toggle navigation of What’s new in gevent 1.0</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="changelog_1_0.html">Changes for 1.0</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_5.html">Changes for 1.5</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_4.html">Changes for 1.4</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_3.html">Changes for 1.3</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_2.html">Changes for 1.2</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html">Changes for 1.1</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_0.html">Changes for 1.0</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_pre.html">Changes before gevent 1.0</a></li> </ul> </li> </ul> </div> </div> </div> </div> </aside> <div class="main"> <div class="content"> <div class="article-container"> <a href="#" class="back-to-top muted-link"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> </svg> <span>Back to top</span> </a> <div class="content-icon-container"> <div class="theme-toggle-container theme-toggle-content"> <button class="theme-toggle"> <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg> <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg> <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> </button> </div> <label class="toc-overlay-icon toc-content-icon" for="__toc"> <div class="visually-hidden">Toggle table of contents sidebar</div> <i class="icon"><svg><use href="#svg-toc"></use></svg></i> </label> </div> <article role="main" id="furo-main-content"> <section id="what-s-new-in-gevent-1-1"> <h1>What’s new in gevent 1.1<a class="headerlink" href="#what-s-new-in-gevent-1-1" title="Link to this heading">¶</a></h1> <div class="toctree-wrapper compound"> <ul> <li class="toctree-l1"><a class="reference internal" href="changelog_1_1.html">Changes for 1.1</a><ul> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#jul-21-2016">1.1.2 (Jul 21, 2016)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#apr-4-2016">1.1.1 (Apr 4, 2016)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#mar-5-2016">1.1.0 (Mar 5, 2016)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#rc5-feb-24-2016">1.1rc5 (Feb 24, 2016)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#rc4-feb-16-2016">1.1rc4 (Feb 16, 2016)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#rc3-jan-04-2016">1.1rc3 (Jan 04, 2016)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#rc2-dec-11-2015">1.1rc2 (Dec 11, 2015)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#rc1-nov-14-2015">1.1rc1 (Nov 14, 2015)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#b6-oct-17-2015">1.1b6 (Oct 17, 2015)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#b5-sep-18-2015">1.1b5 (Sep 18, 2015)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#b4-sep-4-2015">1.1b4 (Sep 4, 2015)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#b3-aug-16-2015">1.1b3 (Aug 16, 2015)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#b2-aug-5-2015">1.1b2 (Aug 5, 2015)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#b1-jul-17-2015">1.1b1 (Jul 17, 2015)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#a2-jul-8-2015">1.1a2 (Jul 8, 2015)</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog_1_1.html#a1-jun-29-2015">1.1a1 (Jun 29, 2015)</a></li> </ul> </li> </ul> </div> <p>Detailed information an what has changed is available in <a class="reference internal" href="changelog_1_1.html"><span class="doc">Changes for 1.1</span></a>. This document summarizes the most important changes since <a class="reference internal" href="whatsnew_1_0.html"><span class="doc">gevent 1.0.2</span></a>.</p> <section id="broader-platform-support"> <h2>Broader Platform Support<a class="headerlink" href="#broader-platform-support" title="Link to this heading">¶</a></h2> <p>gevent 1.1 supports Python 2.6, 2.7, 3.3, and 3.4 on the CPython (<a class="reference external" href="http://www.python.org/downloads/">python.org</a>) interpreter. It also supports <a class="reference external" href="http://pypy.org">PyPy</a> 2.6.1 and above (PyPy 4.0.1 or higher is recommended); PyPy3 is not supported.</p> <p>Support for Python 2.5 was removed when support for Python 3 was added. Any further releases in the 1.0.x line will maintain support for Python 2.5.</p> <div class="admonition note"> <p class="admonition-title">Note</p> <p>Version 1.1.x will be the last series of gevent releases to support Python 2.6. The next major release will only support Python 2.7 and above.</p> </div> <p>Python 3.5 has preliminary support, which means that gevent is expected to generally run and function with the same level of support as on Python 3.4, but new features and APIs introduced in 3.5 may not be properly supported (e.g., <a class="reference external" href="https://docs.python.org/3.5/whatsnew/3.5.html#selectors">DevpollSelector</a>) and due to the recent arrival of Python 3.5, the level of testing it has received is lower.</p> <p>For ease of installation on Windows and OS X, gevent 1.1 is distributed as pre-compiled binary wheels, in addition to source code.</p> <section id="pypy-notes"> <h3>PyPy Notes<a class="headerlink" href="#pypy-notes" title="Link to this heading">¶</a></h3> <p>PyPy has been tested on OS X and 64-bit Linux from version 2.6.1 through 4.0.0 and 4.0.1, and on 32-bit ARM on Raspbian with version 4.0.1.</p> <div class="admonition note"> <p class="admonition-title">Note</p> <p>PyPy is not supported on Windows. (gevent’s CFFI backend is not available on Windows.)</p> </div> <ul class="simple"> <li><p>Version 4.0.1 or above is <strong>highly recommended</strong> due to its extensive bug fixes relative to earlier versions.</p></li> <li><p>Version 2.6.1 or above is <strong>required</strong> for proper signal handling. Prior to 2.6.1 and its inclusion of <a class="reference external" href="https://bitbucket.org/cffi/cffi/src/ad3140a30a7b0ca912185ef500546a9fb5525ece/doc/source/whatsnew.rst?at=default">cffi 1.3.0</a>, signals could be delivered incorrectly or fail to be delivered during a blocking operation. (PyPy 2.5.0 includes CFFI 0.8.6 while 2.6.0 has 1.1.0; the necessary feature was added in <a class="reference external" href="https://cffi.readthedocs.io/en/latest/whatsnew.html#v1-2-0">1.2.0</a> which is not itself directly present in any PyPy release.) CFFI 1.3.0 also allows using the CFFI backend on CPython.</p></li> <li><p>Overall performance seems to be quite acceptable with newer versions of PyPy. The benchmarks distributed with gevent typically perform as well or better on PyPy than on CPython at least on some platforms. Things that are known or expected to be (relatively) slower under PyPy include the <code class="xref py py-mod docutils literal notranslate"><span class="pre">c-ares</span> <span class="pre">resolver</span></code> and <a class="reference internal" href="api/gevent.lock.html#gevent.lock.Semaphore" title="gevent.lock.Semaphore"><code class="xref py py-class docutils literal notranslate"><span class="pre">Semaphore</span></code></a>. Whether or not these matter will depend on the workload of each application (<a class="extlink-pr reference external" href="https://github.com/gevent/gevent/pull/708">pull request #708</a> mentions some specific benchmarks for <code class="docutils literal notranslate"><span class="pre">Semaphore</span></code>).</p></li> </ul> <div class="admonition caution"> <p class="admonition-title">Caution</p> <p>The <code class="docutils literal notranslate"><span class="pre">c-ares</span></code> resolver is considered highly experimental under PyPy and is not recommended for production use. Released versions of PyPy through at least 4.0.1 have <a class="reference external" href="https://bitbucket.org/pypy/pypy/issues/2149/memory-leak-for-python-subclass-of-cpyext">a bug</a> that can cause a memory leak when subclassing objects that are implemented in Cython, as is the c-ares resolver. In addition, thanks to reports like <a class="extlink-issue reference external" href="https://github.com/gevent/gevent/issues/704">issue #704</a>, we know that the PyPy garbage collector can interact badly with Cython-compiled code, leading to crashes. While the intended use of the ares resolver has been loosely audited for these issues, no guarantees are made.</p> </div> <div class="admonition note"> <p class="admonition-title">Note</p> <p>PyPy 4.0.x on Linux is known to <em>rarely</em> (once per 24 hours) encounter crashes when running heavily loaded, heavily networked gevent programs (even without <code class="docutils literal notranslate"><span class="pre">c-ares</span></code>). The exact cause is unknown and is being tracked in <a class="extlink-issue reference external" href="https://github.com/gevent/gevent/issues/677">issue #677</a>.</p> </div> </section> <section id="operating-systems"> <span id="operating-systems-label"></span><h3>Operating Systems<a class="headerlink" href="#operating-systems" title="Link to this heading">¶</a></h3> <p>gevent is regularly built and tested on Mac OS X, Ubuntu Linux, and Windows, in both 32- and 64-bit configurations. All three platforms are primarily tested on the x86/amd64 architecture, while Linux is also occasionally tested on Raspian on ARM.</p> <p>In general, gevent should work on any platform that both Python and <a class="reference external" href="http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#PORTABILITY_NOTES">libev support</a>. However, some less commonly used platforms may require tweaks to the gevent source code or user environment to compile (e.g., <a class="reference external" href="https://github.com/gevent/gevent/pull/711">SmartOS</a>). Also, due to differences in things such as timing, some platforms may not be able to fully pass gevent’s extensive test suite (e.g., <a class="reference external" href="https://github.com/gevent/gevent/issues/737">OpenBSD</a>).</p> </section> </section> <section id="bug-fixes"> <h2>Bug Fixes<a class="headerlink" href="#bug-fixes" title="Link to this heading">¶</a></h2> <p>Since 1.0.2, gevent 1.1 contains over 600 commits from nearly two dozen contributors. Over 200 issues were closed, and over 50 pull requests were merged.</p> </section> <section id="improved-subprocess-support"> <h2>Improved subprocess support<a class="headerlink" href="#improved-subprocess-support" title="Link to this heading">¶</a></h2> <p>In gevent 1.0, support and monkey patching for the <a class="reference external" href="https://docs.python.org/3/library/subprocess.html#module-subprocess" title="(in Python v3.13)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">subprocess</span></code></a> module was added. Monkey patching this module was off by default.</p> <p>In 1.1, monkey patching <code class="docutils literal notranslate"><span class="pre">subprocess</span></code> is on by default due to improvements in handling child processes and requirements by downstream libraries, notably <a class="reference external" href="http://gunicorn.org">gunicorn</a>.</p> <ul class="simple"> <li><p><a class="reference internal" href="api/gevent.os.html#gevent.os.fork" title="gevent.os.fork"><code class="xref py py-func docutils literal notranslate"><span class="pre">gevent.os.fork()</span></code></a>, which is monkey patched by default (and should be used to fork a gevent-aware process that expects to use gevent in the child process) has been improved and cooperates with <a class="reference internal" href="api/gevent.os.html#gevent.os.waitpid" title="gevent.os.waitpid"><code class="xref py py-func docutils literal notranslate"><span class="pre">gevent.os.waitpid()</span></code></a> (again monkey patched by default) and <a class="reference internal" href="api/gevent.signal.html#gevent.signal.signal" title="gevent.signal.signal"><code class="xref py py-func docutils literal notranslate"><span class="pre">gevent.signal.signal()</span></code></a> (which is monkey patched only for the <a class="reference external" href="https://docs.python.org/3/library/signal.html#signal.SIGCHLD" title="(in Python v3.13)"><code class="xref py py-data docutils literal notranslate"><span class="pre">signal.SIGCHLD</span></code></a> case). The latter two patches are new in 1.1.</p></li> <li><p>In gevent 1.0, use of libev child watchers (which are used internally by <code class="docutils literal notranslate"><span class="pre">gevent.subprocess</span></code>) had race conditions with user-provided <code class="docutils literal notranslate"><span class="pre">SIGCHLD</span></code> handlers, causing many types of unpredictable breakage. The two new APIs described above are intended to rectify this.</p></li> <li><p>Fork-watchers will be called, even in multi-threaded programs (except on Windows).</p></li> <li><p>The default threadpool and threaded resolver work in child processes.</p></li> <li><p>File descriptors are no longer leaked if <a class="reference internal" href="api/gevent.subprocess.html#gevent.subprocess.Popen" title="gevent.subprocess.Popen"><code class="xref py py-class docutils literal notranslate"><span class="pre">gevent.subprocess.Popen</span></code></a> fails to start the child.</p></li> </ul> <p>In addition, simple use of <a class="reference external" href="https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Process" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">multiprocessing.Process</span></code></a> is now possible in a monkey patched system, at least on POSIX platforms.</p> <div class="admonition caution"> <p class="admonition-title">Caution</p> <p>Use of <a class="reference external" href="https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Queue" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">multiprocessing.Queue</span></code></a> when <code class="xref py py-mod docutils literal notranslate"><span class="pre">thread</span></code> has been monkey-patched will lead to a hang due to <code class="docutils literal notranslate"><span class="pre">Queue</span></code>’s internal use of a blocking pipe and threads. For the same reason, <a class="reference external" href="https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">concurrent.futures.ProcessPoolExecutor</span></code></a>, which internally uses a <code class="docutils literal notranslate"><span class="pre">Queue</span></code>, will hang.</p> </div> <div class="admonition caution"> <p class="admonition-title">Caution</p> <p>It is not possible to use <a class="reference internal" href="api/gevent.subprocess.html#module-gevent.subprocess" title="gevent.subprocess"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.subprocess</span></code></a> from native threads. See <a class="reference internal" href="api/gevent.subprocess.html#module-gevent.subprocess" title="gevent.subprocess"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.subprocess</span></code></a> for details.</p> </div> <div class="admonition note"> <p class="admonition-title">Note</p> <p>If the <code class="docutils literal notranslate"><span class="pre">SIGCHLD</span></code> signal is to be handled, it is important to monkey patch (or directly use) both <a class="reference external" href="https://docs.python.org/3/library/os.html#module-os" title="(in Python v3.13)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">os</span></code></a> and <a class="reference external" href="https://docs.python.org/3/library/signal.html#module-signal" title="(in Python v3.13)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">signal</span></code></a>; this is the default for <a class="reference internal" href="api/gevent.monkey.html#gevent.monkey.patch_all" title="gevent.monkey.patch_all"><code class="xref py py-func docutils literal notranslate"><span class="pre">patch_all()</span></code></a>. Failure to do so can result in the <code class="docutils literal notranslate"><span class="pre">SIGCHLD</span></code> signal being lost.</p> </div> <div class="admonition tip"> <p class="admonition-title">Tip</p> <p>All of the above entail forking a child process. Forking a child process that uses gevent, greenlets, and libev can have some unexpected consequences if the child doesn’t immediately <code class="docutils literal notranslate"><span class="pre">exec</span></code> a new binary. Be sure you understand these consequences before using this functionality, especially late in a program’s lifecycle. For a more robust solution to certain uses of child process, consider <a class="reference external" href="https://gehrcke.de/gipc/">gipc</a>.</p> </div> </section> <section id="monkey-patching"> <h2>Monkey patching<a class="headerlink" href="#monkey-patching" title="Link to this heading">¶</a></h2> <p>Monkey patching is more robust, especially if the standard library <a class="reference external" href="https://docs.python.org/3/library/threading.html#module-threading" title="(in Python v3.13)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">threading</span></code></a> or <a class="reference external" href="https://docs.python.org/3/library/logging.html#module-logging" title="(in Python v3.13)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">logging</span></code></a> modules had been imported before applying the patch. In addition, there are now supported ways to determine if something has been monkey patched.</p> </section> <section id="api-additions"> <h2>API Additions<a class="headerlink" href="#api-additions" title="Link to this heading">¶</a></h2> <p>Numerous APIs offer slightly expanded functionality in this version. Look for “changed in version 1.1” or “added in version 1.1” throughout the documentation for specifics. Highlights include:</p> <ul class="simple"> <li><p>A gevent-friendly version of <a class="reference external" href="https://docs.python.org/3/library/select.html#select.poll" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">select.poll</span></code></a> (on platforms that implement it).</p></li> <li><p><a class="reference internal" href="api/gevent.fileobject.html#gevent.fileobject.FileObjectPosix" title="gevent.fileobject.FileObjectPosix"><code class="xref py py-class docutils literal notranslate"><span class="pre">FileObjectPosix</span></code></a> uses the <a class="reference external" href="https://docs.python.org/3/library/io.html#module-io" title="(in Python v3.13)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">io</span></code></a> package on both Python 2 and Python 3, increasing its functionality, correctness, and performance. (Previously, the Python 2 implementation used the undocumented class <code class="xref py py-class docutils literal notranslate"><span class="pre">socket._fileobject</span></code>.)</p></li> <li><p>Locks raise the same error as standard library locks if they are over-released. Likewise, SSL sockets raise the same errors as their bundled counterparts if they are read or written after being closed.</p></li> <li><p><a class="reference internal" href="api/gevent.threadpool.html#id0" title="gevent.threadpool.ThreadPool.apply"><code class="xref py py-meth docutils literal notranslate"><span class="pre">ThreadPool.apply</span></code></a> can now be used recursively.</p></li> <li><p>The various pool objects (<a class="reference internal" href="api/gevent.pool.html#gevent.pool.Group" title="gevent.pool.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>, <a class="reference internal" href="api/gevent.pool.html#gevent.pool.Pool" title="gevent.pool.Pool"><code class="xref py py-class docutils literal notranslate"><span class="pre">Pool</span></code></a>, <a class="reference internal" href="api/gevent.threadpool.html#gevent.threadpool.ThreadPool" title="gevent.threadpool.ThreadPool"><code class="xref py py-class docutils literal notranslate"><span class="pre">ThreadPool</span></code></a>) support the same improved APIs: <a class="reference internal" href="api/gevent.pool.html#gevent.pool.Group.imap" title="gevent.pool.Group.imap"><code class="xref py py-meth docutils literal notranslate"><span class="pre">imap</span></code></a> and <a class="reference internal" href="api/gevent.pool.html#gevent.pool.Group.imap_unordered" title="gevent.pool.Group.imap_unordered"><code class="xref py py-meth docutils literal notranslate"><span class="pre">imap_unordered</span></code></a> accept multiple iterables, <a class="reference internal" href="api/gevent.pool.html#gevent.pool.Group.apply" title="gevent.pool.Group.apply"><code class="xref py py-meth docutils literal notranslate"><span class="pre">apply</span></code></a> raises any exception raised by the target callable, etc.</p></li> <li><p>Killing a greenlet (with <a class="reference internal" href="api/gevent.html#gevent.kill" title="gevent.kill"><code class="xref py py-func docutils literal notranslate"><span class="pre">gevent.kill()</span></code></a> or <a class="reference internal" href="api/gevent.greenlet.html#gevent.Greenlet.kill" title="gevent.Greenlet.kill"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Greenlet.kill</span></code></a>) before it is actually started and switched to now prevents the greenlet from ever running, instead of raising an exception when it is later switched to. Attempting to spawn a greenlet with an invalid target now immediately produces a useful <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.13)"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a>, instead of spawning a greenlet that would (usually) immediately die the first time it was switched to.</p></li> <li><p>Almost anywhere that gevent raises an exception from one greenlet to another (e.g., <a class="reference internal" href="api/gevent.greenlet.html#gevent.Greenlet.get" title="gevent.Greenlet.get"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Greenlet.get</span></code></a>), the original traceback is preserved and raised.</p></li> <li><p>Various logging/debugging outputs have been cleaned up.</p></li> <li><p>The WSGI server found in <a class="reference internal" href="api/gevent.pywsgi.html#module-gevent.pywsgi" title="gevent.pywsgi"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gevent.pywsgi</span></code></a> is more robust against errors in either the client or the WSGI application, fixing several hangs or HTTP protocol violations. It also supports new functionality such as configurable error handling and logging.</p></li> <li><p>Documentation has been expanded and clarified.</p></li> </ul> </section> <section id="library-updates"> <span id="library-updates-label"></span><h2>Library Updates<a class="headerlink" href="#library-updates" title="Link to this heading">¶</a></h2> <p>The two C libraries that are bundled with gevent have been updated. libev has been updated from 4.19 to 4.20 (<a class="reference external" href="https://github.com/gevent/gevent/blob/master/libev/Changes#L17">libev release notes</a>) and c-ares has been updated from 1.9.1 to 1.10.0 (<a class="reference external" href="https://raw.githubusercontent.com/bagder/c-ares/cares-1_10_0/RELEASE-NOTES">c-ares release notes</a>).</p> <div class="admonition caution"> <p class="admonition-title">Caution</p> <p>The c-ares <code class="docutils literal notranslate"><span class="pre">configure</span></code> script is now <em>much</em> stricter about the contents of compilation environment variables such as <code class="docutils literal notranslate"><span class="pre">$CFLAGS</span></code> and <code class="docutils literal notranslate"><span class="pre">$LDFLAGS</span></code>. For example, <code class="docutils literal notranslate"><span class="pre">$CFLAGS</span></code> is no longer allowed to contain <code class="docutils literal notranslate"><span class="pre">-I</span></code> directives; instead, these must be placed in <code class="docutils literal notranslate"><span class="pre">$CPPFLAGS</span></code>. That’s one common cause of an error like the following when compiling from scratch on a POSIX platform:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Running</span> <span class="s1">&#39;(cd &quot;/tmp/easy_install-NT921u/gevent-1.1b2/c-ares&quot; &amp;&amp; if [ -e ares_build.h ]; then cp ares_build.h ares_build.h.orig; fi &amp;&amp; /bin/sh ./configure CONFIG_COMMANDS= CONFIG_FILES= &amp;&amp; cp ares_config.h ares_build.h &quot;$OLDPWD&quot; &amp;&amp; mv ares_build.h.orig ares_build.h) &gt; configure-output.txt&#39;</span> <span class="ow">in</span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">easy_install</span><span class="o">-</span><span class="n">NT921u</span><span class="o">/</span><span class="n">gevent</span><span class="o">-</span><span class="mf">1.1</span><span class="n">b2</span><span class="o">/</span><span class="n">build</span><span class="o">/</span><span class="n">temp</span><span class="o">.</span><span class="n">linux</span><span class="o">-</span><span class="n">x86_64</span><span class="o">-</span><span class="mf">2.7</span><span class="o">/</span><span class="n">c</span><span class="o">-</span><span class="n">ares</span> <span class="n">configure</span><span class="p">:</span> <span class="n">error</span><span class="p">:</span> <span class="n">Can</span> <span class="ow">not</span> <span class="k">continue</span><span class="o">.</span> <span class="n">Fix</span> <span class="n">errors</span> <span class="n">mentioned</span> <span class="n">immediately</span> <span class="n">above</span> <span class="n">this</span> <span class="n">line</span><span class="o">.</span> </pre></div> </div> </div> </section> <section id="compatibility"> <h2>Compatibility<a class="headerlink" href="#compatibility" title="Link to this heading">¶</a></h2> <p>This release is intended to be compatible with 1.0.x with minimal or no changes to client source code. However, there are a few changes to be aware of that might affect some applications. Most of these changes are due to the increased platform support of Python 3 and PyPy and reduce the cases of undocumented or non-standard behaviour.</p> <ul> <li><p><a class="reference internal" href="api/gevent.baseserver.html#gevent.baseserver.BaseServer" title="gevent.baseserver.BaseServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">gevent.baseserver.BaseServer</span></code></a> deterministically <a class="reference external" href="https://github.com/gevent/gevent/issues/248#issuecomment-82467350">closes its sockets</a>.</p> <p>As soon as a request completes (the request handler returns), the <code class="docutils literal notranslate"><span class="pre">BaseServer</span></code> and its subclasses including <a class="reference internal" href="api/gevent.server.html#gevent.server.StreamServer" title="gevent.server.StreamServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">gevent.server.StreamServer</span></code></a> and <a class="reference internal" href="api/gevent.pywsgi.html#gevent.pywsgi.WSGIServer" title="gevent.pywsgi.WSGIServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">gevent.pywsgi.WSGIServer</span></code></a> close the client socket.</p> <p>In gevent 1.0, the client socket was left to the mercies of the garbage collector (this was undocumented). In the typical case, the socket would still be closed as soon as the request handler returned due to CPython’s reference-counting garbage collector. But this meant that a reference cycle could leave a socket dangling open for an indeterminate amount of time, and a reference leak would result in it never being closed. It also meant that Python 3 would produce ResourceWarnings, and PyPy (which, unlike CPython, <a class="reference external" href="http://doc.pypy.org/en/latest/cpython_differences.html#differences-related-to-garbage-collection-strategies">does not use a reference-counted GC</a>) would only close (and flush!) the socket at an arbitrary time in the future.</p> <p>If your application relied on the socket not being closed when the request handler returned (e.g., you spawned a greenlet that continued to use the socket) you will need to keep the request handler from returning (e.g., <code class="docutils literal notranslate"><span class="pre">join</span></code> the greenlet). If for some reason that isn’t possible, you may subclass the server to prevent it from closing the socket, at which point the responsibility for closing and flushing the socket is now yours; <em>but</em> the former approach is strongly preferred, and subclassing the server for this reason may not be supported in the future.</p> </li> </ul> <ul> <li><p><a class="reference internal" href="api/gevent.pywsgi.html#gevent.pywsgi.WSGIServer" title="gevent.pywsgi.WSGIServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">gevent.pywsgi.WSGIServer</span></code></a> ensures that headers (names and values) and the status line set by the application can be encoded in the ISO-8859-1 (Latin-1) charset and are of the <em>native string type</em>.</p> <p>Under gevent 1.0, non-<code class="docutils literal notranslate"><span class="pre">bytes</span></code> headers (that is, <code class="docutils literal notranslate"><span class="pre">unicode</span></code>, since gevent 1.0 only ran on Python 2, although objects like <code class="docutils literal notranslate"><span class="pre">int</span></code> were also allowed) were encoded according to the current default Python encoding. In some cases, this could allow non-Latin-1 characters to be sent in the headers, but this violated the HTTP specification, and their interpretation by the recipient is unknown. In other cases, gevent could send malformed partial HTTP responses. Now, a <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#UnicodeError" title="(in Python v3.13)"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UnicodeError</span></code></a> will be raised proactively.</p> <p>Most applications that adhered to the WSGI PEP, <span class="target" id="index-0"></span><a class="pep reference external" href="https://peps.python.org/pep-3333/"><strong>PEP 3333</strong></a>, will not need to make any changes. See <a class="extlink-issue reference external" href="https://github.com/gevent/gevent/issues/614">issue #614</a> for more discussion.</p> </li> <li><p>Under Python 2, the previously undocumented <code class="docutils literal notranslate"><span class="pre">timeout</span></code> parameter to <a class="reference internal" href="api/gevent.subprocess.html#gevent.subprocess.Popen.wait" title="gevent.subprocess.Popen.wait"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Popen.wait</span></code></a> (a gevent extension ) now throws an exception, just like the documented parameter to the same stdlib method in Python 3.</p></li> <li><p>Under Python 3, several standard library methods added <code class="docutils literal notranslate"><span class="pre">timeout</span></code> parameters. These often default to -1 to mean “no timeout”, whereas gevent uses a default of <code class="docutils literal notranslate"><span class="pre">None</span></code> to mean the same thing, potentially leading to great confusion and bugs in portable code. In gevent, using a negative value has always been ill-defined and hard to reason about. Because of those two things, as of this release, negative <code class="docutils literal notranslate"><span class="pre">timeout</span></code> values should be considered deprecated (unless otherwise documented). The current ill-defined behaviour is maintained, but future releases may choose to treat it the same as <code class="docutils literal notranslate"><span class="pre">None</span></code> or raise an error. No runtime warnings are issued for this change for performance reasons.</p></li> <li><p>The previously undocumented class <code class="docutils literal notranslate"><span class="pre">gevent.fileobject.SocketAdapter</span></code> has been removed, as have the internal <code class="docutils literal notranslate"><span class="pre">gevent._util</span></code> module and some internal implementation modules found in early pre-releases of 1.1.</p></li> </ul> </section> </section> </article> </div> <footer> <div class="related-pages"> <a class="next-page" href="whatsnew_1_0.html"> <div class="page-info"> <div class="context"> <span>Next</span> </div> <div class="title">What’s new in gevent 1.0</div> </div> <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg> </a> <a class="prev-page" href="whatsnew_1_2.html"> <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg> <div class="page-info"> <div class="context"> <span>Previous</span> </div> <div class="title">What’s new in gevent 1.2</div> </div> </a> </div> <div class="bottom-of-page"> <div class="left-details"> <div class="copyright"> Copyright &#169; 2009-2023, gevent contributors </div> Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s <a href="https://github.com/pradyunsg/furo">Furo</a> </div> <div class="right-details"> </div> </div> </footer> </div> <aside class="toc-drawer"> <div class="toc-sticky toc-scroll"> <div class="toc-title-container"> <span class="toc-title"> On this page </span> </div> <div class="toc-tree-container"> <div class="toc-tree"> <ul> <li><a class="reference internal" href="#">What’s new in gevent 1.1</a><ul> <li><a class="reference internal" href="#broader-platform-support">Broader Platform Support</a><ul> <li><a class="reference internal" href="#pypy-notes">PyPy Notes</a></li> <li><a class="reference internal" href="#operating-systems">Operating Systems</a></li> </ul> </li> <li><a class="reference internal" href="#bug-fixes">Bug Fixes</a></li> <li><a class="reference internal" href="#improved-subprocess-support">Improved subprocess support</a></li> <li><a class="reference internal" href="#monkey-patching">Monkey patching</a></li> <li><a class="reference internal" href="#api-additions">API Additions</a></li> <li><a class="reference internal" href="#library-updates">Library Updates</a></li> <li><a class="reference internal" href="#compatibility">Compatibility</a></li> </ul> </li> </ul> </div> </div> </div> </aside> </div> </div><script src="_static/documentation_options.js?v=32fdf4fc"></script> <script src="_static/doctools.js?v=9bcbadda"></script> <script src="_static/sphinx_highlight.js?v=dc90522c"></script> <script src="_static/scripts/furo.js?v=5fa4622c"></script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10