Skip to content

Commit

Permalink
defer reactor import in twisted.web.xmlrpc
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Sep 16, 2020
1 parent 1464533 commit 0837c8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/twisted/web/newsfragments/9931.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
defer reactor import in twisted.web.xmlrpc
7 changes: 5 additions & 2 deletions src/twisted/web/xmlrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# Sibling Imports
from twisted.web import resource, server, http
from twisted.internet import defer, protocol, reactor, error
from twisted.internet import defer, protocol, error
from twisted.python import reflect, failure
from twisted.logger import Logger

Expand Down Expand Up @@ -527,7 +527,7 @@ def __init__(
allowNone=False,
useDateTime=False,
connectTimeout=30.0,
reactor=reactor,
reactor=None,
):
"""
@param url: The URL to which to post method calls. Calls will be made
Expand All @@ -537,6 +537,9 @@ def __init__(
@type url: L{bytes}
"""
if reactor is None:
from twisted.internet import reactor

scheme, netloc, path, params, query, fragment = urlparse(url)
netlocParts = netloc.split(b"@")
if len(netlocParts) == 2:
Expand Down

0 comments on commit 0837c8d

Please sign in to comment.