-
-
Notifications
You must be signed in to change notification settings - Fork 66
Fixes for compatibility with Python 3.13 #1321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
f27d9ea
bcd883a
eb2232e
f73364b
48070e9
29706ae
b5b8857
275a3b8
d446ead
df448b1
cb97bd4
70d245b
377ca28
a663d11
1d8d2fc
13e4e4f
cf7eca0
7f6f7be
74c8559
fe31042
4d29659
80b4bcb
6739cc4
13975f6
2472e56
e2d2461
77ca343
aa326a4
c720e12
fa44dfd
8e999f1
8874890
0809fcf
ea44d3b
9fd4deb
7108d16
09c88dc
0d2b4f9
de9227c
b973956
4f2a910
2ae7b1e
5349006
46521af
33fd261
28a130b
ba90dfa
ec5dd08
8829514
69d8b1f
bdc3cb7
1eb8cfc
ccb933c
367e5f0
513c5e8
5c6e46a
d641864
fea63df
634dcbe
4643026
6edcf54
47e82c7
58457c3
414161b
e8b6e76
b2c018a
b3a7663
30d5759
9a2c3e2
8485c2f
d936d73
5bc5311
2d48746
867f623
87f24f1
0c1e8c1
620049d
253e925
454610e
39acb51
ae82c9f
2fba7db
b74fbde
721a644
5e21311
b74ac00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1060,16 +1060,16 @@ class RegisterImport(Builtin): | |
| >> FilePrint["ExampleData/ExampleData.txt"] | ||
| | Example File Format | ||
| | Created by Angus | ||
| | 0.629452 0.586355 | ||
| | 0.711009 0.687453 | ||
| | 0.246540 0.433973 | ||
| | 0.926871 0.887255 | ||
| | 0.825141 0.940900 | ||
| | 0.847035 0.127464 | ||
| | 0.054348 0.296494 | ||
| | 0.838545 0.247025 | ||
| | 0.838697 0.436220 | ||
| | 0.309496 0.833591 | ||
| | 0.629452 0.586355 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In docstrings, use 4 spaces instead of a tab character. |
||
| | 0.711009 0.687453 | ||
| | 0.246540 0.433973 | ||
| | 0.926871 0.887255 | ||
| | 0.825141 0.940900 | ||
| | 0.847035 0.127464 | ||
| | 0.054348 0.296494 | ||
| | 0.838545 0.247025 | ||
| | 0.838697 0.436220 | ||
| | 0.309496 0.833591 | ||
|
|
||
| >> Import["ExampleData/ExampleData.txt", {"ExampleFormat1", "Elements"}] | ||
| = {Data, Header} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -468,6 +468,8 @@ def get_functions(self, prefix="eval", is_pymodule=False): | |
| for name in dir(self): | ||
| if name.startswith(prefix): | ||
| function = getattr(self, name) | ||
| if not hasattr(function, "__call__"): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now, |
||
| continue | ||
| pattern = function.__doc__ | ||
| if pattern is None: # Fixes PyPy bug | ||
| continue | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,7 +93,7 @@ | |
| r"""(?mx)^ # re.MULTILINE (multi-line match) | ||
| # and re.VERBOSE (readable regular expressions | ||
| ((?:.|\n)*?) | ||
| ^\s+([>#SX])>[ ](.*) # test-code indicator | ||
| ^\s*([>#SX])>[ ](.*) # test-code indicator | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Python 3.13, doctrings are trimmed of "margin" spaces. |
||
| ((?:\n\s*(?:[:|=.][ ]|\.).*)*) # test-code results""" | ||
| ) | ||
| TESTCASE_OUT_RE = re.compile(r"^\s*([:|=])(.*)$") | ||
|
|
@@ -216,10 +216,7 @@ def parse_docstring_to_DocumentationEntry_items( | |
| logging.warning("``key_part`` is deprecated. Its value is discarded.") | ||
|
|
||
| # Remove commented lines. | ||
| doc = filter_comments(doc).strip(r"\s") | ||
|
|
||
| # Remove leading <dl>...</dl> | ||
| # doc = DL_RE.sub("", doc) | ||
| doc = filter_comments(doc) # .strip("\s") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not remember the reason of the r"\s" strip, but it breaks some tests now. |
||
|
|
||
| # pre-substitute Python code because it might contain tests | ||
| doc, post_substitutions = pre_sub( | ||
|
|
@@ -394,11 +391,16 @@ def compare_out(self, outs: tuple = tuple()) -> bool: | |
| # Mismatched number of output lines, and we don't have "..." | ||
| return False | ||
|
|
||
| # Python 3.13 replaces tabs by a single space in docstrings. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Python 3.13 converts tab characters in docstrings to simple spaces. This "hack" helps to keep the doctests compatible with this change. |
||
| # In doctests we replace tabs by sequences of four spaces. | ||
| def tabs_to_spaces(val): | ||
| return val.text.replace("\t", 4 * " ") | ||
|
|
||
| # Need to check all output line by line | ||
| for got, wanted in zip(outs, wanted_outs): | ||
| if wanted.text == "...": | ||
| return True | ||
| if not got == wanted: | ||
| if not tabs_to_spaces(got) == tabs_to_spaces(wanted): | ||
| return False | ||
|
|
||
| return True | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should keep 3.8? Maybe 3.8, 3.10, 3.12 and 3.13 would be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am for dropping 3.8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so ['3.13', '3.12', '3.11', '3.10', '3.9'] in all the workflows?