1
0

- Add patch use-PyUnicode_DecodeUnicodeEscape.patch:

* Use PyUnicode_DecodeUnicodeEscape directly, rather than wrapping it.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-typed-ast?expand=0&rev=36
This commit is contained in:
2021-11-18 07:30:53 +00:00
committed by Git OBS Bridge
parent 7a0fbb6f17
commit 86cb9a9ffe
3 changed files with 65 additions and 0 deletions
+6
View File
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Nov 18 07:30:17 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch use-PyUnicode_DecodeUnicodeEscape.patch:
* Use PyUnicode_DecodeUnicodeEscape directly, rather than wrapping it.
-------------------------------------------------------------------
Sat Nov 13 20:40:12 UTC 2021 - Dirk Müller <dmueller@suse.com>
+2
View File
@@ -26,6 +26,7 @@ License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/python/typed_ast
Source0: https://files.pythonhosted.org/packages/source/t/typed_ast/typed_ast-%{version}.tar.gz
Patch0: use-PyUnicode_DecodeUnicodeEscape.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
@@ -45,6 +46,7 @@ based on the CPython 2.7 and 3.6 parsers.
%prep
%setup -q -n typed_ast-%{version}
%autopatch -p1
%build
export CFLAGS="%{optflags}"
+57
View File
@@ -0,0 +1,57 @@
From 3ba83b4933dcebc886e67aa40d51c0a1678c93e9 Mon Sep 17 00:00:00 2001
From: Sebastian Rittau <srittau@rittau.biz>
Date: Wed, 10 Nov 2021 19:19:14 +0100
Subject: [PATCH] Use PyUnicode_DecodeUnicodeEscape directly
---
ast3/Python/ast.c | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
diff --git a/ast3/Python/ast.c b/ast3/Python/ast.c
index 60b8fdd..eb7d764 100644
--- a/ast3/Python/ast.c
+++ b/ast3/Python/ast.c
@@ -58,16 +58,6 @@ _PyBytes_DecodeEscape(const char *s,
#endif
-PyObject *
-_PyUnicode_DecodeUnicodeEscape(const char *s,
- Py_ssize_t size,
- const char *errors,
- const char **first_invalid_escape)
-{
- *first_invalid_escape = NULL;
- return PyUnicode_DecodeUnicodeEscape(s, size, errors);
-}
-
static int validate_stmts(asdl_seq *);
static int validate_exprs(asdl_seq *, expr_context_ty, int);
static int validate_nonempty_seq(asdl_seq *, const char *, const char *);
@@ -4461,7 +4451,6 @@ decode_unicode_with_escapes(struct compiling *c, const node *n, const char *s,
char *buf;
char *p;
const char *end;
- const char *first_invalid_escape;
/* check for integer overflow */
if (len > SIZE_MAX / 6)
@@ -4511,17 +4500,8 @@ decode_unicode_with_escapes(struct compiling *c, const node *n, const char *s,
len = p - buf;
s = buf;
- v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
+ v = PyUnicode_DecodeUnicodeEscape(s, len, NULL);
- if (v != NULL && first_invalid_escape != NULL) {
- if (warn_invalid_escape_sequence(c, n, *first_invalid_escape) < 0) {
- /* We have not decref u before because first_invalid_escape points
- inside u. */
- Py_XDECREF(u);
- Py_DECREF(v);
- return NULL;
- }
- }
Py_XDECREF(u);
return v;
}