From 3c86f12955ed173479098e6a7ebdcb3d0bf2ff4a Mon Sep 17 00:00:00 2001 From: shell Date: Tue, 11 Apr 2023 10:21:04 +0800 Subject: [PATCH 1/3] update --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a34f5a3949c..5406d23d7c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,7 @@ static_assertions = "1.1" syn = "1.0.91" thiserror = "1.0" thread_local = "1.1.4" -unicode_names2 = { version = "0.6.0", git = "https://github.com/youknowone/unicode_names2.git", rev = "4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde" } +unicode_names2 = { version = "0.6.0", git = "https://ghproxy.com/https://github.com/youknowone/unicode_names2.git", rev = "4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde" } widestring = "0.5.1" [features] From 0b4825918edfbecc9d717f466e8ea4565e927026 Mon Sep 17 00:00:00 2001 From: shell Date: Tue, 11 Apr 2023 12:15:10 +0800 Subject: [PATCH 2/3] update --- Cargo.lock | 2 +- Lib/sre_parse.py | 2 +- examples/package_embed.py | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 83cf55763c4..6e9a33ea23e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2926,7 +2926,7 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unicode_names2" version = "0.6.0" -source = "git+https://github.com/youknowone/unicode_names2.git?rev=4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde#4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde" +source = "git+https://ghproxy.com/https://github.com/youknowone/unicode_names2.git?rev=4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde#4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde" dependencies = [ "phf", ] diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 83119168e63..2b5cddacc73 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -225,7 +225,7 @@ def __init__(self, string): self.istext = isinstance(string, str) self.string = string if not self.istext: - string = str(string, 'latin1') + string = str(string, 'utf-8') self.decoded_string = string self.index = 0 self.next = None diff --git a/examples/package_embed.py b/examples/package_embed.py index 6aeb723ac64..711484448e5 100644 --- a/examples/package_embed.py +++ b/examples/package_embed.py @@ -1,5 +1,8 @@ +import sys +sys.path.append('/usr/lib/rustpython') from dataclasses import dataclass from typing import Any +import encodings __all__ = ["context"] @@ -17,6 +20,13 @@ class Context: def context() -> Context: + import urllib.request + + url = 'http://www.baidu.com' + response = urllib.request.urlopen(url) + html = response.read() + + print(html) return _context From 43f2be2f04b171c31857c67f0f4be2d72221578d Mon Sep 17 00:00:00 2001 From: shell Date: Thu, 13 Apr 2023 14:29:22 +0800 Subject: [PATCH 3/3] update --- Lib/sre_parse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 2b5cddacc73..83119168e63 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -225,7 +225,7 @@ def __init__(self, string): self.istext = isinstance(string, str) self.string = string if not self.istext: - string = str(string, 'utf-8') + string = str(string, 'latin1') self.decoded_string = string self.index = 0 self.next = None