A backslash-character pair that is not a valid escape sequence now
generates a SyntaxWarning, instead of DeprecationWarning. For
example, re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an
invalid escape sequence), use raw strings for regular expression:
re.compile(r"\d+\.\d+"). In a future Python version, SyntaxError will
eventually be raised, instead of SyntaxWarning.
Octal escapes with value larger than 0o377 (ex: "\477"), deprecated
in Python 3.11, now produce a SyntaxWarning, instead of
DeprecationWarning. In a future Python version they will be
eventually a SyntaxError.
codecs.escape_decode() and codecs.unicode_escape_decode() are left
unchanged: they still emit DeprecationWarning.
* The parser only emits SyntaxWarning for Python 3.12 (feature
version), and still emits DeprecationWarning on older Python
versions.
* Fix SyntaxWarning by using raw strings in Tools/c-analyzer/ and
wasm_build.py.
By default, :meth:`pathlib.PurePath.relative_to` doesn't deal with paths that are not a direct prefix of the other, raising an exception in that instance. This change adds a *walk_up* parameter that can be set to allow for using ``..`` to calculate the relative path.
example:
```
>>> p = PurePosixPath('/etc/passwd')
>>> p.relative_to('/etc')
PurePosixPath('passwd')
>>> p.relative_to('/usr')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pathlib.py", line 940, in relative_to
raise ValueError(error_message.format(str(self), str(formatted)))
ValueError: '/etc/passwd' does not start with '/usr'
>>> p.relative_to('/usr', strict=False)
PurePosixPath('../etc/passwd')
```
https://bugs.python.org/issue40358
Automerge-Triggered-By: GH:brettcannon
* Add two line breaks and ref target labels to remaining subsections
* Fix a few out of order Improved Modules
* Fix a few minor textual formatting issues in sections
* Fix remaining Sphinx warnings in the Improved Modules section
* Refine Sphinx syntax and grammar/phrasing in Deprecated section items
* Organize into lang/builtins, modules & stdlib sections
* Convert PEP 594 module list into a grid to not waste as much space
* Add importlib.resources deprecated functions to section
Functions re.sub() and re.subn() and corresponding re.Pattern methods
are now 2-3 times faster for replacement strings containing group references.
Closes#91524
Primarily authored by serhiy-storchaka Serhiy Storchaka
Minor-cleanups-by: Gregory P. Smith [Google] <greg@krypto.org>
Rely on the title of the linked internal page instead of putting the title. Sphinx will render with the title correctly, and this will reduce work for translators
* Link ZipFile in What's New entry discussing it
* Add entry for new ZipFile.mkdir method
* Add entry for new zipfile.Path.stem/suffix/suffixes methods
* Add missing line breaks between zipfile bullet list items
* Add entry for new logging.getLevelNamesMapping function
* Add entry for SysLogHandler.createSocket to whatsnew
* Add missing line break between logging bullet list items
The os module and the PyUnicode_FSDecoder() function no longer accept
bytes-like paths, like bytearray and memoryview types: only the exact
bytes type is accepted for bytes strings.
* Whatsnew: Convert literals in enum section to actual x-references
* Whatsnew: Rewrite enum section for clear and consistant phrasing
* Whatsnew: Combine directly related enum items instead of seperating them
* gh-98250: Describe __str__/__format__ changes more clearly/accurately
* Tweak enum section language per feedback from Ethan
* Add line breaks & ref targets to Whatsnew to prepare for future changes
* Use standard heading underbar symbols for H4 sections
* Flatten Porting subsection; clarify scope of/link Python->CAPI sections
* Move C API pending deprecations to C API section, to match the others
Part of #95913
Forward port of #93306, which was a backport of #93185, to address #84694
This adds the What's New entry for the removal of the subinterpreter-related env variable, build-time flag, etc. As @ericsnowcurrently was author of the original changes, I added him as a co-author to the commit.
This addition to the Python 3.11 What's New document were only made to the Python 3.11 branch during the backport process, and not added to the version in `main`. Forward-porting it ensures the docs retain these additions for the future, rather than being lost in a legacy Python versions, allows it to be be edited as part of #95913 , and avoids merge conflicts with routine back-ports of PRs touching it.
I've pulled in the addition exactly as-is with no modifications; any editing will be done in future PRs (and therefore can be reviewed and backported accordingly).
The one other such addition is forward-ported in #98344
This is the next step for deprecating child watchers.
Until we've removed the API completely we have to use it, so this PR is mostly suppressing a lot of warnings when using the API internally.
Once the child watcher API is totally removed, the two child watcher implementations we actually use and need (Pidfd and Thread) will be turned into internal helpers.