aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2024-11-02 10:02:47 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2024-11-02 10:14:50 +0300
commit54eda9ada2080a577e1ab0800c8725d34cea0a4b (patch)
tree4815803a17742c885ee3bead9dc8ac1cab489ac5 /contrib
parent8ecc203e1fb0bb7a83c2b4b20a6fb778efa3a59c (diff)
downloadydb-54eda9ada2080a577e1ab0800c8725d34cea0a4b.tar.gz
Update contrib/python/MarkupSafe/py3 to 3.0.2
commit_hash:885751ae8f5f3eff72c88798b636a67ffcf86aa1
Diffstat (limited to 'contrib')
-rw-r--r--contrib/python/MarkupSafe/py3/.dist-info/METADATA2
-rw-r--r--contrib/python/MarkupSafe/py3/markupsafe/_speedups.c2
-rw-r--r--contrib/python/MarkupSafe/py3/tests/test_escape.py36
-rw-r--r--contrib/python/MarkupSafe/py3/ya.make2
4 files changed, 39 insertions, 3 deletions
diff --git a/contrib/python/MarkupSafe/py3/.dist-info/METADATA b/contrib/python/MarkupSafe/py3/.dist-info/METADATA
index cbf0cfef4f..82261f2a46 100644
--- a/contrib/python/MarkupSafe/py3/.dist-info/METADATA
+++ b/contrib/python/MarkupSafe/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: MarkupSafe
-Version: 3.0.1
+Version: 3.0.2
Summary: Safely add untrusted strings to HTML/XML markup.
Maintainer-email: Pallets <contact@palletsprojects.com>
License: Copyright 2010 Pallets
diff --git a/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c b/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c
index 73c2955827..09dd57caa8 100644
--- a/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c
+++ b/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c
@@ -151,7 +151,7 @@ escape_unicode_kind4(PyUnicodeObject *in)
static PyObject*
escape_unicode(PyObject *self, PyObject *s)
{
- if (!PyUnicode_CheckExact(s))
+ if (!PyUnicode_Check(s))
return NULL;
// This check is no longer needed in Python 3.12.
diff --git a/contrib/python/MarkupSafe/py3/tests/test_escape.py b/contrib/python/MarkupSafe/py3/tests/test_escape.py
index 03e0b64892..07698ec2dc 100644
--- a/contrib/python/MarkupSafe/py3/tests/test_escape.py
+++ b/contrib/python/MarkupSafe/py3/tests/test_escape.py
@@ -1,5 +1,7 @@
from __future__ import annotations
+import typing as t
+
import pytest
from markupsafe import escape
@@ -30,3 +32,37 @@ from markupsafe import Markup
)
def test_escape(value: str, expect: str) -> None:
assert escape(value) == Markup(expect)
+
+
+class Proxy:
+ def __init__(self, value: t.Any) -> None:
+ self.__value = value
+
+ @property # type: ignore[misc]
+ def __class__(self) -> type[t.Any]:
+ # Make o.__class__ and isinstance(o, str) see the proxied object.
+ return self.__value.__class__ # type: ignore[no-any-return]
+
+ def __str__(self) -> str:
+ return str(self.__value)
+
+
+def test_proxy() -> None:
+ """Handle a proxy object that pretends its __class__ is str."""
+ p = Proxy("test")
+ assert p.__class__ is str
+ assert isinstance(p, str)
+ assert escape(p) == Markup("test")
+
+
+class ReferenceStr(str):
+ def __str__(self) -> str:
+ # This should return a str, but it returns the subclass instead.
+ return self
+
+
+def test_subclass() -> None:
+ """Handle if str(o) does not return a plain str."""
+ s = ReferenceStr("test")
+ assert isinstance(s, str)
+ assert escape(s) == Markup("test")
diff --git a/contrib/python/MarkupSafe/py3/ya.make b/contrib/python/MarkupSafe/py3/ya.make
index 7b942e706a..cb76ce9b31 100644
--- a/contrib/python/MarkupSafe/py3/ya.make
+++ b/contrib/python/MarkupSafe/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(3.0.1)
+VERSION(3.0.2)
LICENSE(BSD-3-Clause)