Bump cherrypy from 18.8.0 to 18.9.0 (#2266)

* Bump cherrypy from 18.8.0 to 18.9.0

Bumps [cherrypy](https://github.com/cherrypy/cherrypy) from 18.8.0 to 18.9.0.
- [Changelog](https://github.com/cherrypy/cherrypy/blob/main/CHANGES.rst)
- [Commits](https://github.com/cherrypy/cherrypy/compare/v18.8.0...v18.9.0)

---
updated-dependencies:
- dependency-name: cherrypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update cherrypy==18.9.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

[skip ci]
This commit is contained in:
dependabot[bot] 2024-03-24 15:25:44 -07:00 committed by GitHub
commit faef9a94c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
673 changed files with 159850 additions and 11583 deletions

View file

@ -0,0 +1,17 @@
def Function(i):
Test.Echo(i)
print(dir())
a=1
b=a
c=b # And here is a comment
d="A string"
print(a)
Test.echo("Hello from Python")
for i in range(2):
Function(i)
a = """\
A multi-line string!
"""

View file

@ -0,0 +1,7 @@
a=1
b=a
Test.Echo "Hello from VBScript"
' Here is a comment
for i = 1 to 10
next

View file

@ -0,0 +1,188 @@
import sys
import pythoncom
import win32com.server.policy
from win32com.axscript import axscript
from win32com.axscript.server import axsite
from win32com.axscript.server.error import Exception
from win32com.server import connect, util
class MySite(axsite.AXSite):
def OnScriptError(self, error):
exc = error.GetExceptionInfo()
context, line, char = error.GetSourcePosition()
print(" >Exception:", exc[1])
try:
st = error.GetSourceLineText()
except pythoncom.com_error:
st = None
if st is None:
st = ""
text = st + "\n" + (" " * (char - 1)) + "^" + "\n" + exc[2]
for line in text.splitlines():
print(" >" + line)
class MyCollection(util.Collection):
def _NewEnum(self):
print("Making new Enumerator")
return util.Collection._NewEnum(self)
class Test:
_public_methods_ = ["echo"]
_public_attrs_ = ["collection", "verbose"]
def __init__(self):
self.verbose = 0
self.collection = util.wrap(MyCollection([1, "Two", 3]))
self.last = ""
# self._connect_server_ = TestConnectServer(self)
def echo(self, *args):
self.last = "".join(map(str, args))
if self.verbose:
for arg in args:
print(arg, end=" ")
print()
# self._connect_server_.Broadcast(last)
#### Connections currently wont work, as there is no way for the engine to
#### know what events we support. We need typeinfo support.
IID_ITestEvents = pythoncom.MakeIID("{8EB72F90-0D44-11d1-9C4B-00AA00125A98}")
class TestConnectServer(connect.ConnectableServer):
_connect_interfaces_ = [IID_ITestEvents]
# The single public method that the client can call on us
# (ie, as a normal COM server, this exposes just this single method.
def __init__(self, object):
self.object = object
def Broadcast(self, arg):
# Simply broadcast a notification.
self._BroadcastNotify(self.NotifyDoneIt, (arg,))
def NotifyDoneIt(self, interface, arg):
interface.Invoke(1000, 0, pythoncom.DISPATCH_METHOD, 1, arg)
VBScript = """\
prop = "Property Value"
sub hello(arg1)
test.echo arg1
end sub
sub testcollection
test.verbose = 1
for each item in test.collection
test.echo "Collection item is", item
next
end sub
"""
if sys.version_info < (3,):
PyScript = """print "PyScript is being parsed..."\n"""
else:
PyScript = """print("PyScript is being parsed...")\n"""
PyScript += """\
prop = "Property Value"
def hello(arg1):
test.echo(arg1)
pass
def testcollection():
test.verbose = 1
# test.collection[1] = "New one"
for item in test.collection:
test.echo("Collection item is", item)
pass
"""
ErrScript = """\
bad code for everyone!
"""
def TestEngine(engineName, code, bShouldWork=1):
echoer = Test()
model = {
"test": util.wrap(echoer),
}
site = MySite(model)
engine = site._AddEngine(engineName)
engine.AddCode(code, axscript.SCRIPTTEXT_ISPERSISTENT)
try:
engine.Start()
finally:
if not bShouldWork:
engine.Close()
return
doTestEngine(engine, echoer)
# re-transition the engine back to the UNINITIALIZED state, a-la ASP.
engine.eScript.SetScriptState(axscript.SCRIPTSTATE_UNINITIALIZED)
engine.eScript.SetScriptSite(util.wrap(site))
print("restarting")
engine.Start()
# all done!
engine.Close()
def doTestEngine(engine, echoer):
# Now call into the scripts IDispatch
from win32com.client.dynamic import Dispatch
ob = Dispatch(engine.GetScriptDispatch())
try:
ob.hello("Goober")
except pythoncom.com_error as exc:
print("***** Calling 'hello' failed", exc)
return
if echoer.last != "Goober":
print("***** Function call didnt set value correctly", repr(echoer.last))
if str(ob.prop) != "Property Value":
print("***** Property Value not correct - ", repr(ob.prop))
ob.testcollection()
# Now make sure my engines can evaluate stuff.
result = engine.eParse.ParseScriptText(
"1+1", None, None, None, 0, 0, axscript.SCRIPTTEXT_ISEXPRESSION
)
if result != 2:
print("Engine could not evaluate '1+1' - said the result was", result)
def dotestall():
for i in range(10):
TestEngine("Python", PyScript)
print(sys.gettotalrefcount())
## print "Testing Exceptions"
## try:
## TestEngine("Python", ErrScript, 0)
## except pythoncom.com_error:
## pass
def testall():
dotestall()
pythoncom.CoUninitialize()
print(
"AXScript Host worked correctly - %d/%d COM objects left alive."
% (pythoncom._GetInterfaceCount(), pythoncom._GetGatewayCount())
)
if __name__ == "__main__":
testall()

View file

@ -0,0 +1,257 @@
import sys
import unittest
import pythoncom
import win32com.server.policy
import win32com.test.util
from win32com.axscript import axscript
from win32com.axscript.server import axsite
from win32com.axscript.server.error import Exception
from win32com.client.dynamic import Dispatch
from win32com.server import connect, util
from win32com.server.exception import COMException
verbose = "-v" in sys.argv
class MySite(axsite.AXSite):
def __init__(self, *args):
self.exception_seen = None
axsite.AXSite.__init__(self, *args)
def OnScriptError(self, error):
self.exception_seen = exc = error.GetExceptionInfo()
context, line, char = error.GetSourcePosition()
if not verbose:
return
print(" >Exception:", exc[1])
try:
st = error.GetSourceLineText()
except pythoncom.com_error:
st = None
if st is None:
st = ""
text = st + "\n" + (" " * (char - 1)) + "^" + "\n" + exc[2]
for line in text.splitlines():
print(" >" + line)
class MyCollection(util.Collection):
def _NewEnum(self):
return util.Collection._NewEnum(self)
class Test:
_public_methods_ = ["echo", "fail"]
_public_attrs_ = ["collection"]
def __init__(self):
self.verbose = verbose
self.collection = util.wrap(MyCollection([1, "Two", 3]))
self.last = ""
self.fail_called = 0
# self._connect_server_ = TestConnectServer(self)
def echo(self, *args):
self.last = "".join([str(s) for s in args])
if self.verbose:
for arg in args:
print(arg, end=" ")
print()
def fail(self, *args):
print("**** fail() called ***")
for arg in args:
print(arg, end=" ")
print()
self.fail_called = 1
# self._connect_server_.Broadcast(last)
#### Connections currently wont work, as there is no way for the engine to
#### know what events we support. We need typeinfo support.
IID_ITestEvents = pythoncom.MakeIID("{8EB72F90-0D44-11d1-9C4B-00AA00125A98}")
class TestConnectServer(connect.ConnectableServer):
_connect_interfaces_ = [IID_ITestEvents]
# The single public method that the client can call on us
# (ie, as a normal COM server, this exposes just this single method.
def __init__(self, object):
self.object = object
def Broadcast(self, arg):
# Simply broadcast a notification.
self._BroadcastNotify(self.NotifyDoneIt, (arg,))
def NotifyDoneIt(self, interface, arg):
interface.Invoke(1000, 0, pythoncom.DISPATCH_METHOD, 1, arg)
VBScript = """\
prop = "Property Value"
sub hello(arg1)
test.echo arg1
end sub
sub testcollection
if test.collection.Item(0) <> 1 then
test.fail("Index 0 was wrong")
end if
if test.collection.Item(1) <> "Two" then
test.fail("Index 1 was wrong")
end if
if test.collection.Item(2) <> 3 then
test.fail("Index 2 was wrong")
end if
num = 0
for each item in test.collection
num = num + 1
next
if num <> 3 then
test.fail("Collection didn't have 3 items")
end if
end sub
"""
PyScript = """\
# A unicode \xa9omment.
prop = "Property Value"
def hello(arg1):
test.echo(arg1)
def testcollection():
# test.collection[1] = "New one"
got = []
for item in test.collection:
got.append(item)
if got != [1, "Two", 3]:
test.fail("Didn't get the collection")
pass
"""
# XXX - needs py3k work! Throwing a bytes string with an extended char
# doesn't make much sense, but py2x allows it. What it gets upset with
# is a real unicode arg - which is the only thing py3k allows!
PyScript_Exc = """\
def hello(arg1):
raise RuntimeError("exc with extended \xa9har")
"""
ErrScript = """\
bad code for everyone!
"""
state_map = {
axscript.SCRIPTSTATE_UNINITIALIZED: "SCRIPTSTATE_UNINITIALIZED",
axscript.SCRIPTSTATE_INITIALIZED: "SCRIPTSTATE_INITIALIZED",
axscript.SCRIPTSTATE_STARTED: "SCRIPTSTATE_STARTED",
axscript.SCRIPTSTATE_CONNECTED: "SCRIPTSTATE_CONNECTED",
axscript.SCRIPTSTATE_DISCONNECTED: "SCRIPTSTATE_DISCONNECTED",
axscript.SCRIPTSTATE_CLOSED: "SCRIPTSTATE_CLOSED",
}
def _CheckEngineState(engine, name, state):
got = engine.engine.eScript.GetScriptState()
if got != state:
got_name = state_map.get(got, str(got))
state_name = state_map.get(state, str(state))
raise RuntimeError(
"Warning - engine %s has state %s, but expected %s"
% (name, got_name, state_name)
)
class EngineTester(win32com.test.util.TestCase):
def _TestEngine(self, engineName, code, expected_exc=None):
echoer = Test()
model = {
"test": util.wrap(echoer),
}
site = MySite(model)
engine = site._AddEngine(engineName)
try:
_CheckEngineState(site, engineName, axscript.SCRIPTSTATE_INITIALIZED)
engine.AddCode(code)
engine.Start()
_CheckEngineState(site, engineName, axscript.SCRIPTSTATE_STARTED)
self.assertTrue(not echoer.fail_called, "Fail should not have been called")
# Now call into the scripts IDispatch
ob = Dispatch(engine.GetScriptDispatch())
try:
ob.hello("Goober")
self.assertTrue(
expected_exc is None,
"Expected %r, but no exception seen" % (expected_exc,),
)
except pythoncom.com_error:
if expected_exc is None:
self.fail(
"Unexpected failure from script code: %s"
% (site.exception_seen,)
)
if expected_exc not in site.exception_seen[2]:
self.fail(
"Could not find %r in %r"
% (expected_exc, site.exception_seen[2])
)
return
self.assertEqual(echoer.last, "Goober")
self.assertEqual(str(ob.prop), "Property Value")
ob.testcollection()
self.assertTrue(not echoer.fail_called, "Fail should not have been called")
# Now make sure my engines can evaluate stuff.
result = engine.eParse.ParseScriptText(
"1+1", None, None, None, 0, 0, axscript.SCRIPTTEXT_ISEXPRESSION
)
self.assertEqual(result, 2)
# re-initialize to make sure it transitions back to initialized again.
engine.SetScriptState(axscript.SCRIPTSTATE_INITIALIZED)
_CheckEngineState(site, engineName, axscript.SCRIPTSTATE_INITIALIZED)
engine.Start()
_CheckEngineState(site, engineName, axscript.SCRIPTSTATE_STARTED)
# Transition back to initialized, then through connected too.
engine.SetScriptState(axscript.SCRIPTSTATE_INITIALIZED)
_CheckEngineState(site, engineName, axscript.SCRIPTSTATE_INITIALIZED)
engine.SetScriptState(axscript.SCRIPTSTATE_CONNECTED)
_CheckEngineState(site, engineName, axscript.SCRIPTSTATE_CONNECTED)
engine.SetScriptState(axscript.SCRIPTSTATE_INITIALIZED)
_CheckEngineState(site, engineName, axscript.SCRIPTSTATE_INITIALIZED)
engine.SetScriptState(axscript.SCRIPTSTATE_CONNECTED)
_CheckEngineState(site, engineName, axscript.SCRIPTSTATE_CONNECTED)
engine.SetScriptState(axscript.SCRIPTSTATE_DISCONNECTED)
_CheckEngineState(site, engineName, axscript.SCRIPTSTATE_DISCONNECTED)
finally:
engine.Close()
engine = None
site = None
def testVB(self):
self._TestEngine("VBScript", VBScript)
def testPython(self):
self._TestEngine("Python", PyScript)
def testPythonUnicodeError(self):
self._TestEngine("Python", PyScript)
def testVBExceptions(self):
self.assertRaises(pythoncom.com_error, self._TestEngine, "VBScript", ErrScript)
def testPythonExceptions(self):
expected = "RuntimeError: exc with extended \xa9har"
self._TestEngine("Python", PyScript_Exc, expected)
if __name__ == "__main__":
unittest.main()

View file

@ -0,0 +1,88 @@
import os
import sys
import traceback
import pythoncom
import win32ui
from win32com.axscript import axscript
from win32com.axscript.server import axsite
from win32com.axscript.server.error import Exception
from win32com.server import util
version = "0.0.1"
class MySite(axsite.AXSite):
def OnScriptError(self, error):
print("An error occurred in the Script Code")
exc = error.GetExceptionInfo()
try:
text = error.GetSourceLineText()
except:
text = "<unknown>"
context, line, char = error.GetSourcePosition()
print(
"Exception: %s (line %d)\n%s\n%s^\n%s"
% (exc[1], line, text, " " * (char - 1), exc[2])
)
class ObjectModel:
_public_methods_ = ["echo", "msgbox"]
def echo(self, *args):
print("".join(map(str, args)))
def msgbox(self, *args):
msg = "".join(map(str, args))
win32ui.MessageBox(msg)
def TestEngine():
model = {"Test": util.wrap(ObjectModel())}
scriptDir = "."
site = MySite(model)
pyEngine = site._AddEngine("Python")
# pyEngine2 = site._AddEngine("Python")
vbEngine = site._AddEngine("VBScript")
# forthEngine = site._AddEngine("ForthScript")
try:
# code = open(os.path.join(scriptDir, "debugTest.4ths"),"rb").read()
# forthEngine.AddCode(code)
code = open(os.path.join(scriptDir, "debugTest.pys"), "rb").read()
pyEngine.AddCode(code)
code = open(os.path.join(scriptDir, "debugTest.vbs"), "rb").read()
vbEngine.AddCode(code)
# code = open(os.path.join(scriptDir, "debugTestFail.pys"),"rb").read()
# pyEngine2.AddCode(code)
# from win32com.axdebug import axdebug
# sessionProvider=pythoncom.CoCreateInstance(axdebug.CLSID_DefaultDebugSessionProvider,None,pythoncom.CLSCTX_ALL, axdebug.IID_IDebugSessionProvider)
# sessionProvider.StartDebugSession(None)
input("Press enter to continue")
# forthEngine.Start()
pyEngine.Start() # Actually run the Python code
vbEngine.Start() # Actually run the VB code
except pythoncom.com_error as details:
print("Script failed: %s (0x%x)" % (details[1], details[0]))
# Now run the code expected to fail!
# try:
# pyEngine2.Start() # Actually run the Python code that fails!
# print "Script code worked when it should have failed."
# except pythoncom.com_error:
# pass
site._Close()
if __name__ == "__main__":
import win32com.axdebug.util
try:
TestEngine()
except:
traceback.print_exc()
win32com.axdebug.util._dump_wrapped()
sys.exc_type = sys.exc_value = sys.exc_traceback = None
print(pythoncom._GetInterfaceCount(), "com objects still alive")